0

我想制作一段从 MountainCar 多次到达目标(标志位置>.5)的视频。我正在使用 openai 的 MountainCar-v0(步骤和奖励限制有所变化),但达到目标需要很多时间。我正在使用以下代码:

import numpy as np
import gym

from gym import wrappers    
gym.envs.register(
    id='MountainCarMyVersion-v0',
    entry_point='gym.envs.classic_control:MountainCarEnv',
    max_episode_steps=200000,      # MountainCar-v0 uses 200
    reward_threshold=-1000.0,
)
env = gym.make('MountainCarMyVersion-v0')

env = wrappers.Monitor(env, '/home/video', force=True)
game_terminator = 0
for i_episode in range(2000):
    time.sleep(2)
    for t in range(1000000):
        if game_terminator:
            break
        env.render()
        action = env.action_space.sample()
        observation, reward, done, info = env.step(action)
        if done:
            print("Episode finished after {} timesteps".format(t + 1))
            observation = env.reset()
            if t < 200000 - 1 and reward > -1:
                print('the flag point is reched at step:', t)
                game_terminator = 1
                break

如何更改此设置以帮助代理更快地达到目标?谢谢

4

0 回答 0