-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlander.py
More file actions
26 lines (19 loc) · 775 Bytes
/
lander.py
File metadata and controls
26 lines (19 loc) · 775 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
import gym
from gym.envs.box2d import LunarLanderContinuous
from stable_baselines3 import SAC
from stable_baselines3.common.monitor import Monitor
from stable_baselines3.common.vec_env import DummyVecEnv, VecFrameStack
class LunarLanderContinuousDifficult(LunarLanderContinuous):
def step(self, action):
ob, reward, done, info = super().step(action)
ob[2:3] = 0
return ob, reward, done, info
env = LunarLanderContinuousDifficult()
# env = LunarLanderContinuous()
env = Monitor(env)
env = DummyVecEnv([lambda:env])
# env = VecFrameStack(env, n_stack=3)
name = "LunarLanderDifficult"
model = SAC('MlpPolicy', env, verbose=1, tensorboard_log="./logs/all/")
model.learn(total_timesteps=200_000, tb_log_name=name)
model.save(f"Lunar_{name}.zip")