Environments¶
EnvironmentInfo¶
- class nnabla_rl.environments.environment_info.EnvironmentInfo(observation_space, action_space, max_episode_steps, unwrapped_env, reward_function: Callable[[Any, Any, Dict], int] | None = None)[source]¶
Environment Information class.
This class contains the basic information of the target training environment.
- property action_dim¶
The dimension of action assuming that the action is flatten.
- property action_high¶
The upper limit of action space.
- property action_low¶
The lower limit of action space.
- property action_shape¶
The shape of action space.
- static from_env(env)[source]¶
Create env_info from environment.
- Parameters:
env (gym.Env) – the environment
- Returns:
EnvironmentInfo (
EnvironmentInfo
)
Example
>>> import gym >>> from nnabla_rl.environments.environment_info import EnvironmentInfo >>> env = gym.make("CartPole-v0") >>> env_info = EnvironmentInfo.from_env(env) >>> env_info.state_shape (4,)
- is_continuous_action_env()[source]¶
Check whether the action to execute in the environment is continuous or not.
- Returns:
- True if the action to execute in the environment is continuous. Otherwise False.
Note that if the action is gym.spaces.Tuple and all of the element are continuous, it returns True.
- Return type:
bool
- is_continuous_state_env()[source]¶
Check whether the state of the environment is continuous or not.
- Returns:
- True if the state of the environment is continuous. Otherwise False.
Note that if the state is gym.spaces.Tuple and all of the element are continuous, it returns True.
- Return type:
bool
- is_discrete_action_env()[source]¶
Check whether the action to execute in the environment is discrete or not.
- Returns:
- True if the action to execute in the environment is discrete. Otherwise False.
Note that if the action is gym.spaces.Tuple and all of the element are discrete, it returns True.
- Return type:
bool
- is_discrete_state_env()[source]¶
Check whether the state of the environment is discrete or not.
- Returns:
- True if the state of the environment is discrete. Otherwise False.
Note that if the state is gym.spaces.Tuple and all of the element are discrete, it returns True.
- Return type:
bool
- is_goal_conditioned_env()[source]¶
Check whether the environment is gym.GoalEnv or not.
- Returns:
True if the environment is GoalEnv. Otherwise False.
- Return type:
bool
- is_mixed_action_env()[source]¶
Check whether the action of the environment consists of either continuous or discrete action.
- Returns:
- True if the action of the environment is either continuous or discrete. Otherwise False.
Note that if the action is not a gym.spaces.Tuple, then returns False.
- Return type:
bool
- is_mixed_state_env()[source]¶
Check whether the state of the environment consists of either continuous or discrete state.
- Returns:
- True if the state of the environment is either continuous or discrete. Otherwise False.
Note that if the state is not a gym.spaces.Tuple, then returns False.
- Return type:
bool
- is_tuple_action_env()[source]¶
Check whether the action of the environment is tuple or not.
- Returns:
True if the action of the environment is tuple. Otherwise False.
- Return type:
bool
- is_tuple_state_env()[source]¶
Check whether the state of the environment is tuple or not.
- Returns:
True if the state of the environment is tuple. Otherwise False.
- Return type:
bool
- property state_dim¶
The dimension of state assuming that the state is flatten.
- property state_high¶
The upper limit of observation space.
- property state_low¶
The lower limit of observation space.
- property state_shape¶
The shape of observation space.