sustaingym.envs.evcharging.multiagent_env#

The module implements a multi-agent version of the EVChargingEnv.

Module Contents#

Classes#

MultiAgentEVChargingEnv

Multi-agent EV charging environment.

class sustaingym.envs.evcharging.multiagent_env.MultiAgentEVChargingEnv(data_generator: sustaingym.envs.evcharging.event_generation.AbstractTraceGenerator, periods_delay: int = 0, moer_forecast_steps: int = 36, project_action_in_env: bool = True, discrete: bool = False, verbose: int = 0)[source]#

Bases: pettingzoo.ParallelEnv

Multi-agent EV charging environment.

Each charging station is modeled as an independent agent with a single action of the pilot signal to supply.

This environment’s API is known to be compatible with PettingZoo v1.24.1

Observations for each agent are flattened.

Parameters:
# attributes required by pettingzoo.ParallelEnv
agents#

list[str], agent IDs (which are the charging station IDs)

possible_agents#

list[str], same as agents

observation_spaces#

dict[str, spaces.Box], observation space for each agent

action_spaces#

dict[str, spaces.Box], action space for each agent

# attributes specific to MultiAgentEVChargingEnv
single_env#

EVChargingEnv, single-agent EVChargingEnv

periods_delay#

int, time periods of delay for inter-agent communication

metadata[source]#
step(actions: dict[str, numpy.ndarray]) tuple[dict[str, numpy.ndarray], dict[str, float], dict[str, bool], dict[str, bool], dict[str, dict[str, Any]]][source]#
Returns:
  • obss – dict mapping agent_id to observation

  • rewards – dict mapping agent_id to reward

  • terminateds – dict mapping agent_id to terminated

  • truncateds – dict mapping agent_id to truncated

  • infos – dict mapping agent_id to info

Parameters:

actions (dict[str, numpy.ndarray]) –

Return type:

tuple[dict[str, numpy.ndarray], dict[str, float], dict[str, bool], dict[str, bool], dict[str, dict[str, Any]]]

reset(seed: int | None = None, options: dict | None = None) tuple[dict[str, numpy.ndarray], dict[str, numpy.ndarray]][source]#

Resets the environment.

Parameters:
  • seed (int | None) –

  • options (dict | None) –

Return type:

tuple[dict[str, numpy.ndarray], dict[str, numpy.ndarray]]

render() None[source]#

Render environment.

Return type:

None

close() None[source]#

Close the environment.

Return type:

None

observation_space(agent: str) gymnasium.spaces.Space[source]#
Parameters:

agent (str) –

Return type:

gymnasium.spaces.Space

action_space(agent: str) gymnasium.spaces.Box | gymnasium.spaces.Discrete[source]#
Parameters:

agent (str) –

Return type:

gymnasium.spaces.Box | gymnasium.spaces.Discrete