-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdoublecheckenv.py
More file actions
24 lines (21 loc) · 817 Bytes
/
doublecheckenv.py
File metadata and controls
24 lines (21 loc) · 817 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/python3
from CloudDefrag.Misc.misc import *
def doublecheckenv():
episodes = 10
max_hops_for_connectivity = 2
# Test Env
env = VNFEnv(max_hops_for_connectivity=max_hops_for_connectivity)
for episode in range(episodes):
done = False
obs = env.reset()
step = 0
total_reward = 0
while not done: # not done:
random_action = env.action_space.sample()
obs, reward, done, info = env.step(random_action)
print(f"Episode: {episode + 1}, Step: {step + 1} Action: {random_action}, Reward: {reward}")
total_reward += reward
step += 1
print(f"Episode: {episode + 1}, Total Reward: {total_reward}, Score: {info['score']}")
if __name__ == '__main__':
doublecheckenv()