CoreEnv

class maze.core.env.core_env.CoreEnv

Interface definition for core environments forming the basis for actual RL trainable environments.

abstract actor_id() → Tuple[Union[str, int], int]

Returns the currently executed actor along with the policy id. The id is unique only with respect to the policies (every policy has its own actor 0).

Note that identities of done actors can not be reused in the same rollout.

Returns

The current actor, as tuple (policy id, actor number).

abstract close()None

Performs any necessary cleanup.

get_kpi_calculator() → Optional[maze.core.log_events.kpi_calculator.KpiCalculator]

By default, Core Envs do not have to support KPIs.

abstract get_maze_state() → Any

Return current state of the environment.

:return The same state as returned by reset().

abstract get_renderer()maze.core.rendering.renderer.Renderer

Return renderer instance that can be used to render the env.

:return Renderer instance

abstract get_serializable_components() → Dict[str, Any]

List components that should be serialized as part of trajectory data.

get_step_events() → Iterable[maze.core.events.event_record.EventRecord]

Get all events recorded in the current step from the EventService.

:return An iterable of the recorded events.

abstract is_actor_done()bool

Returns True if the just stepped actor is done, which is different to the done flag of the environment.

Returns

True if the actor is done.

abstract reset() → Any

Reset the environment and return initial state.

Returns

The initial state after resetting.

abstract seed(seed: int)None

Sets the seed for this environment’s random number generator(s).

Param

seed: the seed integer initializing the random number generator.

abstract step(maze_action: Any) → Tuple[Any, Union[float, numpy.ndarray, Any], bool, Dict[Any, Any]]

Environment step function.

Parameters

maze_action – Environment MazeAction to take.

Returns

state, reward, done, info