Concatenated Multi-robot Environment#

class enki_env.concat_env.ConcatEnv(env: ParallelEnkiEnv)#

Bases: Env[dict[str, ndarray[tuple[Any, …], dtype[float64]]], ndarray[tuple[Any, …], dtype[float64]]]

Wraps a multi-robot environment as a single agent environment, concatenating observations and information dictionaries and aggregating rewards, terminations and truncations.

Parameters:

env – The parallel environment

__init__(env: ParallelEnkiEnv) None#
display_in_notebook() None#

Displays the environment in a notebook using a an interactive pyenki.buffer.EnkiRemoteFrameBuffer.

Requires render_mode="human" and a notebook.

make_world(policy: Predictor | None = None, seed: int = 0, deterministic: bool = True, cutoff: float = 0) pyenki.World#

Generates a world using the scenario and assign a centralized policy to the world controller.

Parameters:
  • policy – The centralized policy to apply; if not provided, it will randomly generate actions.

  • seed – The random seed.

  • deterministic – Whether to evaluate the policy deterministically.

  • cutoff – When the absolute value of actions is below this threshold, they will be set to zero.

Returns:

The world

rollout(policy: Predictor | None = None, max_steps: int = -1, seed: int = 0, deterministic: bool = True, cutoff: float = 0) dict[str, Rollout]#

Performs a rollout of an episode

Parameters:
  • policy – The policy to apply; if not provided, it will randomly generate actions.

  • max_steps – The maximum number of steps to perform.

  • seed – The random seed.

  • deterministic – Whether to evaluate the policies deterministically.

  • cutoff – When the absolute value of actions is below this threshold, they will be set to zero.

Returns:

A dictionary, keyed by group, with the data collected during the rollout.