作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在 OpenAI Gym 中制作自定义环境,但真的不明白,action_space 是做什么用的?我应该在里面放什么?准确地说,我不知道 action_space 是什么,我没有在任何代码中使用它。而且我在互联网上没有找到任何东西,什么可以正常回答我的问题。
最佳答案
action_space
在健身房环境中使用,用于定义环境 Action 空间的特征。有了这个,人们可以说明 Action 空间是连续的还是离散的,定义 Action 的最小值和最大值等。
对于连续 Action 空间,可以使用 Box类(class)。
import gym
from gym import spaces
class MyEnv(gym.Env):
def __init__(self):
# set 2 dimensional continuous action space as continuous
# [-1,2] for first dimension and [-2,4] for second dimension
self.action_space = spaces.Box(np.array([-1,-2]),np.array([2,4]),dtype=np.float32)
import gym
from gym import spaces
class MyEnv(gym.Env):
def __init__(self):
# set 2 dimensional action space as discrete {0,1}
self.action_space = spaces.Discrete(2)
action_space
的例子。和
observation_space
.
The main OpenAI Gym class. It encapsulates an environment with
arbitrary behind-the-scenes dynamics. An environment can be
partially or fully observed.
The main API methods that users of this class need to know are:
step
reset
render
close
seed
And set the following attributes:
action_space: The Space object corresponding to valid actions
observation_space: The Space object corresponding to valid observations
reward_range: A tuple corresponding to the min and max possible rewards
Note: a default reward range set to [-inf,+inf] already exists. Set it if you want a narrower range.
The methods are accessed publicly as "step", "reset", etc.. The
non-underscored versions are wrapper methods to which we may add
functionality over time.
关于openai-gym - action_space 有什么用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56633955/
我正在 OpenAI Gym 中制作自定义环境,但真的不明白,action_space 是做什么用的?我应该在里面放什么?准确地说,我不知道 action_space 是什么,我没有在任何代码中使用它
我想在 OpenAI 上设置一个 RL 代理 CarRacing-v0环境,但在此之前我想了解 Action 空间。在 the code on github第 119 行说: self.action_
我是一名优秀的程序员,十分优秀!