-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
28 lines (24 loc) · 777 Bytes
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import gym
from collections import deque
#import matplotlib.pyplot as plt
from agent import Agent
if __name__ == '__main__':
checkpoint_file = './models/model.pkl'
env = gym.make("LunarLander-v2")
agent = Agent.load(checkpoint_file)
values = deque(maxlen=1000)
for _ in range(1000):
observation = env.reset()
action = agent.act(observation)
done = False
total_reward = 0
while not done:
env.render()
observation, reward, done, info = env.step(action)
value = agent.value(observation)
values.append(value)
action = agent.act(observation)
total_reward += reward
#plt.plot(values)
#plt.clf()
print(total_reward)