garage.sampler.vec_env_executor module

Environment wrapper that runs multiple environments.

class VecEnvExecutor(envs, max_path_length)[source]

Bases: object

Environment wrapper that runs multiple environments.

Parameters:
  • envs (list[gym.Env]) – List of environments to batch together.
  • max_path_length (int) – Maximum length of any path.
action_space

Read the action space.

Returns:The action space.
Return type:gym.Space
close()[source]

Close all environments.

num_envs

Read the number of environments.

Returns:Number of environments
Return type:int
observation_space

Read the observation space.

Returns:The observation space.
Return type:gym.Space
reset()[source]

Reset all environments.

Returns:Observations of shape \((K, O*)\)
Return type:np.ndarray
step(action_n)[source]

Step all environments using the provided actions.

Inserts an environment infor ‘vec_env_executor.complete’ containing the episode end signal (time limit reached or done signal from environment).

Parameters:action_n (np.ndarray) – Array of actions.
Returns:
Tuple containing:
  • observations (np.ndarray)
  • rewards (np.ndarray)
  • dones (np.ndarray): The done signal from the environment.
  • env_infos (dict[str, np.ndarray])
  • completes (np.ndarray): whether or not the path is complete.
    A path is complete at some time-step N if the done signal has been received at that or before N, or if max_path_length N >= max_path_length.
Return type:tuple