Shortcuts

openrl.selfplay.wrappers package

Submodules

openrl.selfplay.wrappers.base_multiplayer_wrapper module

class openrl.selfplay.wrappers.base_multiplayer_wrapper.BaseMultiPlayerWrapper(env, cfg=None, reward_class=None)[source]

Bases: gymnasium.core.Env[gymnasium.core.WrapperObsType, gymnasium.core.WrapperActType], Generic[gymnasium.core.WrapperObsType, gymnasium.core.WrapperActType, gymnasium.core.ObsType, gymnasium.core.ActType]

Base class for multi-player wrappers.

property action_space: Union[gymnasium.spaces.space.Space[gymnasium.core.ActType], gymnasium.spaces.space.Space[gymnasium.core.WrapperActType]]

Return the Env action_space unless overwritten then the wrapper action_space is used.

close()[source]

Closes the wrapper and env.

abstract get_opponent_action(player_name: str, observation, reward, termination, truncation, info)[source]
property np_random: numpy.random._generator.Generator

Returns the environment’s internal _np_random that if not set will initialise with a random seed.

Returns:

Instances of np.random.Generator

property observation_space: Union[gymnasium.spaces.space.Space[gymnasium.core.ObsType], gymnasium.spaces.space.Space[gymnasium.core.WrapperObsType]]

Return the Env observation_space unless overwritten then the wrapper observation_space is used.

on_episode_end(player_name, observation, reward, termination, truncation, info)[source]
reset(*, seed: Optional[int] = None, **kwargs)[source]

Uses the reset() of the env that can be overwritten to change the returned data.

self_player: Optional[str] = None
step(action)[source]

Uses the step() of the env that can be overwritten to change the returned data.

openrl.selfplay.wrappers.human_opponent_wrapper module

class openrl.selfplay.wrappers.human_opponent_wrapper.HumanOpponentWrapper(env, cfg=None, reward_class=None)[source]

Bases: gymnasium.core.Env[gymnasium.core.WrapperObsType, gymnasium.core.WrapperActType], Generic[gymnasium.core.WrapperObsType, gymnasium.core.WrapperActType, gymnasium.core.ObsType, gymnasium.core.ActType]

get_opponent_action(player_name, observation, reward, termination, truncation, info)[source]

openrl.selfplay.wrappers.opponent_pool_wrapper module

class openrl.selfplay.wrappers.opponent_pool_wrapper.OpponentPoolWrapper(env, cfg, reward_class=None)[source]

Bases: gymnasium.core.Env[gymnasium.core.WrapperObsType, gymnasium.core.WrapperActType], Generic[gymnasium.core.WrapperObsType, gymnasium.core.WrapperActType, gymnasium.core.ObsType, gymnasium.core.ActType]

get_opponent(opponent_players: List[str])[source]
get_opponent_action(player_name, observation, reward, termination, truncation, info)[source]
on_episode_end(player_name, observation, reward, termination, truncation, info)[source]
reset(*, seed: Optional[int] = None, **kwargs)[source]

Uses the reset() of the env that can be overwritten to change the returned data.

openrl.selfplay.wrappers.random_opponent_wrapper module

class openrl.selfplay.wrappers.random_opponent_wrapper.RandomOpponentWrapper(env, cfg=None, reward_class=None)[source]

Bases: gymnasium.core.Env[gymnasium.core.WrapperObsType, gymnasium.core.WrapperActType], Generic[gymnasium.core.WrapperObsType, gymnasium.core.WrapperActType, gymnasium.core.ObsType, gymnasium.core.ActType]

get_opponent_action(player_name, observation, reward, termination, truncation, info)[source]

Module contents