Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于环境初始化的一点提示 #73

Open
Summer907 opened this issue Mar 14, 2024 · 0 comments
Open

关于环境初始化的一点提示 #73

Summer907 opened this issue Mar 14, 2024 · 0 comments

Comments

@Summer907
Copy link

0.26.0以上版本的gym对一些函数做出了改动,这一点在 #50 有被提到过,并给出了修改方法:

  1. # env.seed(0)改为env.reset(seed=0)
  2. state = env.reset()下一行添加一行state = state[0]
  3. next_state, reward, done, _ = env.step(action)等号左边添加一个, _,即新版函数增加了一个输出

Originally posted by @wulidede in #50 (comment)

注意到env.reset()除了在定义环境的时候使用过,在训练过程中也有所涉及,因此第7、8、9章代码的训练部分,以及rl_utils.py中的对应部分也要改为env.reset(seed=0)。修改后,在CartPole-v0环境中的训练结果更好,且结果固定。如图:
output1
output

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant