1. Sequence Diagram of an experiment run¶
Each experiment run can be split up in three parts:
The initialization
The main loop
Shutdown
1.1. Initialization¶
After starting an experiment run with the CLI using the command palaestrai
experiment-start path/to/experiment, the initialization process starts by
handing the experiment path over to the Executor’s
execute() method. The Executor first launches the
RunGovernor and sends an ExperimentStartRequest to it
afterwards. The RunGovernor handles most of the initialization:
It sets up the
SimulationController,EnviornmentConductor, andAgentConductor(in order)Sends a
SimulationStartRequestto theSimulationController, which proceeds to request the initialization of theEnviornmentfrom theEnvironmentConductor, and starts it afterwards.Then the SimulationController sends a
AgentSetupRequestto theAgentConductor, which now initializes all needed brains and muscles for the experiment.
After receiving an AgentSetupResponse from the
AgentConductor, the RunGovernor changes back into the
Transceiving state and waits for new Requests. This concludes the
initialization part of the experiment run.
1.2. Main Loop¶
The Main Loop is mainly a back and forth between the
SimulationController and the Environment or
 The SimulationController sends either an
:class:`~EnvironmentUpdateRequest to the Environment, which then updates and
responds with an EnvironmentUpdateResponse, or an
AgentUpdateRequest to a muscle, which then sends a
MuscleUpdateRequest to its corresponding brain. After receiving a
MuscleUpdateResponse from its brain, the muscle can finally respond
to the SimulationController with an AgentUpdateResponse.
1.3. Shutdown¶
The shutdown usually gets initialized by an EnvironmentUpdateResponse
with the is_terminal=True flag. The Executor then sends an
ExpermimentRunShutdownRequest to the RunGovernor. The RunGovernor forwards
this request in form of a SimulationStopRequest to the
SimulationController which in turn will send shutdown requests to all muscles,
which forward those to their brains, Environments and finally Agent- and
EnvironmentConductors. After receiving a shutdown response from everyone the
SimulationController sends a SimulationStopResponse to the RunGovernor and
gets terminated. The RunGovernor forwards the Response as
ExperimentShutdownResponse to the Executor then cleans up any left over
sub processes and shuts down aswell.