-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
29 lines (19 loc) · 747 Bytes
/
main.py
File metadata and controls
29 lines (19 loc) · 747 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
25
26
27
28
29
import gym
import tensorflow as tf
import matplotlib.pyplot as plt
import beta_policy as beta
def main(args):
env = gym.envs.make("MountainCarContinuous-v0")
env.observation_space.sample()
global_step = tf.Variable(0, name="global_step", trainable=False)
tf_config = tf.ConfigProto()
tf_config.gpu_options.allow_growth = True
sess = tf.Session(config=tf_config)
actor = beta.Actor(learning_rate=0.001)
critic = beta.Critic(learning_rate=0.1)
sess.run(tf.global_variables_initializer())
episode_rewards = beta.run_model(sess, env, actor, critic, 100, discount_factor=0.995)
plt.plot(list(range(len(episode_rewards))), episode_rewards)
plt.show()
if __name__ == '__main__':
tf.app.run()