hive.envs.pettingzoo.pettingzoo module

class hive.envs.pettingzoo.pettingzoo.PettingZooEnv(env_name, env_family, num_players, **kwargs)[source]

Bases: BaseEnv

PettingZoo environment from https://github.com/PettingZoo-Team/PettingZoo

For now, we only support environments from PettingZoo with discrete actions.

Parameters
  • env_name (str) – Name of the environment

  • env_family (str) – Family of the environment such as “Atari”,

  • "Classic"

  • "SISL"

  • "Butterfly"

  • "MAgent"

  • "MPE". (and) –

  • num_players (int) – Number of learning agents

create_env(env_name, num_players, **kwargs)[source]
create_env_spec(env_name, **kwargs)[source]

Each family of environments have their own type of observations and actions. You can add support for more families here by modifying obs_dim and act_dim.

reset()[source]

Resets the state of the environment.

Returns

The initial observation of the new episode. turn (int): The index of the agent which should take turn.

Return type

observation

step(action)[source]

Run one time-step of the environment using the input action.

Parameters

action – An element of environment’s action space.

Returns

Indicates the next state that is an element of environment’s observation space. reward: A reward achieved from the transition. done (bool): Indicates whether the episode has ended. turn (int): Indicates which agent should take turn. info (dict): Additional custom information.

Return type

observation

render(mode='rgb_array')[source]

Displays a rendered frame from the environment.

seed(seed=None)[source]

Reseeds the environment.

Parameters

seed (int) – Seed to use for environment.

close()[source]

Additional clean up operations