环境
- class lzero.envs.wrappers.lightzero_env_wrapper.LightZeroEnvWrapper(env: Env, cfg: EasyDict)[源代码]
基类:
Wrapper- 概述:
将 classic_control 和 box2d 环境打包为 LightZero 所需的格式。将 obs 包装为一个字典,包含键:obs、action_mask 和 to_play。
- 接口:
__init__、reset、step- 属性:
env (
gym.Env): the environment to wrap.
- __init__(env: Env, cfg: EasyDict) None[源代码]
- 概述:
初始化
self.查看help(type(self))以获取准确的签名;根据运行均值和标准差设置属性。
- 参数:
env (-) – 要包装的环境。
- _is_protocol = False
- property _np_random
- property action_space: Space[ActType]
返回环境的动作空间。
- classmethod class_name()
返回包装器的类名。
- close()
关闭环境。
- property metadata: dict
返回环境元数据。
- property np_random: RandomNumberGenerator
返回环境 np_random。
- property observation_space: Space
返回环境的观察空间。
- render(*args: Tuple[Any], **kwargs: Dict[str, Any]) RenderFrame | List[RenderFrame] | None
- property render_mode: str | None
返回环境渲染模式。
- reset(**kwargs)[源代码]
- 概述:
重置环境的状态和重置属性。
- 参数:
kwargs (-) – 使用此键参数重置
- 返回:
重置后的新观察
- 返回类型:
observation (
Any)
- property reward_range: Tuple[SupportsFloat, SupportsFloat]
返回环境的奖励范围。
- seed(seed=None)
初始化环境。
- property spec
返回环境规范。
- step(action)[源代码]
- 概述:
使用给定的动作来操作环境。重复动作,累加奖励,并更新
data_count,同时在整合输入action后更新self.rms属性一次。
- 参数:
action (-) – 给定的动作来逐步执行。
- 返回:
normalized observation after the input action and updated
self.rms- reward (Any) : amount of reward returned after previous action - done (Bool) : whether the episode has ended, in which case further step() calls will return undefined results - info (Dict) : contains auxiliary diagnostic information (helpful for debugging, and sometimes learning)- 返回类型:
self.observation(observation)
- property unwrapped: Env
返回包装器的基环境。
- class lzero.envs.wrappers.action_discretization_env_wrapper.ActionDiscretizationEnvWrapper(env: Env, cfg: EasyDict)[源代码]
基类:
Wrapper- 概述:
经过修改的环境,手动离散化的动作空间。对于每个维度,将原始连续动作等分为
each_dim_disc_size个区间,并使用它们的笛卡尔积来获得手工制作的离散动作。- 接口:
__init__、reset、step- 属性:
env (
gym.Env): the environment to wrap.
- __init__(env: Env, cfg: EasyDict) None[源代码]
- 概述:
初始化
self.查看help(type(self))以获取准确的签名;根据运行均值和标准差设置属性。
- 参数:
env (-) – 要包装的环境。
- _is_protocol = False
- property _np_random
- property action_space: Space[ActType]
返回环境的动作空间。
- classmethod class_name()
返回包装器的类名。
- close()
关闭环境。
- property metadata: dict
返回环境元数据。
- property np_random: RandomNumberGenerator
返回环境 np_random。
- property observation_space: Space
返回环境的观察空间。
- render(*args: Tuple[Any], **kwargs: Dict[str, Any]) RenderFrame | List[RenderFrame] | None
- property render_mode: str | None
返回环境渲染模式。
- reset(**kwargs)[源代码]
- 概述:
重置环境的状态和重置属性。
- 参数:
kwargs (-) – 使用此键参数重置
- 返回:
重置后的新观察
- 返回类型:
observation (
Any)
- property reward_range: Tuple[SupportsFloat, SupportsFloat]
返回环境的奖励范围。
- seed(seed=None)
初始化环境。
- property spec
返回环境规范。
- step(action)[源代码]
- 概述:
使用给定的动作来操作环境。重复动作,累加奖励,并更新
data_count,同时在整合输入action后更新self.rms属性一次。
- 参数:
action (-) – 给定的动作来逐步执行。
- 返回:
normalized observation after the input action and updated
self.rms- reward (Any) : amount of reward returned after previous action - done (Bool) : whether the episode has ended, in which case further step() calls will return undefined results - info (Dict) : contains auxiliary diagnostic information (helpful for debugging, and sometimes learning)- 返回类型:
self.observation(observation)
- property unwrapped: Env
返回包装器的基环境。