sustaingym.envs.cogen.multiagent_env#

This module implements the CogenEnv class

Module Contents#

Classes#

MultiAgentCogenEnv

Multi-agent version of CogenEnv following the PettingZoo API (v1.24.1).

class sustaingym.envs.cogen.multiagent_env.MultiAgentCogenEnv(renewables_magnitude: float = 0.0, ramp_penalty: float = 2.0, supply_imbalance_penalty: float = 1000, constraint_violation_penalty: float = 1000, forecast_horizon: int = 12, forecast_noise_std: float = 0.1)[source]#

Bases: pettingzoo.utils.env.ParallelEnv

Multi-agent version of CogenEnv following the PettingZoo API (v1.24.1).

Parameters:
  • renewables_magnitude (float) –

  • ramp_penalty (float) –

  • supply_imbalance_penalty (float) –

  • constraint_violation_penalty (float) –

  • forecast_horizon (int) –

  • forecast_noise_std (float) –

metadata: dict[str, Any][source]#
step(actions: dict[str, dict[str, numpy.ndarray]]) tuple[dict[str, numpy.ndarray], dict[str, float], dict[str, bool], dict[str, bool], dict[str, dict]][source]#

Run one timestep of the Cogen environment’s dynamics.

Parameters:
  • action – an action provided by the environment

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

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

Return type:

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

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

Resets the environment.

Parameters:
  • seed (int | None) –

  • options (dict | None) –

Return type:

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

render() None[source]#

Render environment.

Return type:

None

close() None[source]#

Close the environment.

Return type:

None

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

agent (str) –

Return type:

gymnasium.spaces.Box

action_space(agent: str) gymnasium.spaces.Dict[source]#
Parameters:

agent (str) –

Return type:

gymnasium.spaces.Dict