palaestrai.simulation package

Submodules

palaestrai.simulation.vanilla_sim_controller module

class palaestrai.simulation.vanilla_sim_controller.VanillaSimController(agent_conductor_ids: Sequence[str], environment_conductor_ids: Sequence[str], agents: Dict[str, Dict], mode: Mode, termination_conditions: Sequence[Dict[str, Any]], *args, **kwargs)[source]

Bases: SimulationController

Scatter-gather simulation controller for agents

This simulation controller implements an execution strategy in which agents act in parallel.

async advance()[source]

Advances the whole simulation one time step

This method advances the state of the simulation by one step. What precisely one step is depends on the simulation control paradigm the individual controller implements, but often it means that at least one agent has acted and at least one environment was updated. So this method calls ::.act to let one or more agents act, and ::.step to evaluate the given environments. The corresponding properties most often needed are:

  • ::.agents and ::.environments for data about all known agents and environments, respectively

  • ::.sensor_readings for current data from all environments

  • ::.rewards for current agent rewards.

The ::.act and ::.step methods update all relevant state information. In addtion, the two methods also handle flow control: If an agent or an environment interrupt the normal simulation flow, the ::FlowControlChange exception is thrown. You don’t have to catch it in this method, as usually a change in simulation control flow should be propagated further. Should you ever want to interrupt the simulation control flow yourself outside of the usual termination conditions handling, you are free to raise the ::FlowControlChange exception yourself. However, this should be rarely needed. In case of errors, please raise any other exception that makes sense, i.e., mostly a RuntimeError.

Advance is a simpler version of the ::.simulate method. While overwriting ::.simulate allows complete control over the loop, this method is called for every time step and can update agents and environments however they please. On call to this method implies that time has advanced.

Advance does not return anything.

palaestrai.simulation.vanilla_simcontroller_termination_condition module

class palaestrai.simulation.vanilla_simcontroller_termination_condition.VanillaSimControllerTerminationCondition(*args, **kwargs)[source]

Bases: EnvironmentTerminationCondition

Module contents