-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtrain5.py
28 lines (22 loc) · 807 Bytes
/
train5.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
from stable_baselines3 import PPO, A2C, DQN
from stable_baselines3.common.env_util import make_vec_env
from uav import UavTrajectory
# deleted on 07.31 for Version 4 - 2
#env = UavTrajectory()
# added on 07.31 for Version 4 - 2
env = make_vec_env(UavTrajectory, n_envs=1)
model = PPO("MlpPolicy", env, gamma=0.90, verbose=1, tensorboard_log = '/home/baseline/output/gamma90batch512', batch_size=512)
# edited on 08.15 for Version 8 - 1
model.learn(total_timesteps=200000, log_interval=1)
model.save('/home/baseline/output/gamma90batch512/model')
# deleted on 08.02 for Version 5 - 1
'''
# added on 07.31 for Version 4 - 2
obs = env.reset()
while True:
action, _states = model.predict(obs)
obs, rewards, dones, info = env.step(action)
env.render("console")
if dones:
break
'''