Interface ISimulationEngine
-
- All Known Implementing Classes:
AbstractMonothreadedEngine
,AbstractSimulationEngine
,AbstractSimulationEngineWithInitialization
,EngineMonothreadedDefaultdisambiguation
public interface ISimulationEngine
Models a simulation engine, i.e. the object moving the simulation through time.- Author:
- Yoann Kubera, Gildas Morvan
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addProbe(String identifier, IProbe probe)
Adds a probe to this simulation engine.ConsistentPublicLocalDynamicState
disambiguation(TransitoryPublicLocalDynamicState transitoryDynamicState)
Disambiguates a public local dynamic state, i.e. transforms a transitory state into a fully observable state.Set<IAgent4Engine>
getAgents()
Gets the set of all the agents lying in the simulation.Set<IAgent4Engine>
getAgents(LevelIdentifier level)
Gets the set of all the agents lying in a specific level of the simulation.IEnvironment4Engine
getEnvironment()
Gets the environment the simulation.Set<LevelIdentifier>
getLevelIdentifiers()
Gets the set of level identifiers contained in the simulation.Map<LevelIdentifier,ILevel>
getLevels()
Gets the list of levels contained in the simulation.Set<String>
getProbesIdentifiers()
Lists the identifier of all the probes that are registered to this engine.IPublicDynamicStateMap
getSimulationDynamicStates()
Gets the current dynamic states of the simulation.IProbe
removeProbe(String identifier)
Removes a probe from the simulation engine.void
requestSimulationAbortion()
Requests the abortion of the simulation currently running with this simulation engine.void
runNewSimulation(ISimulationModel simulationModel)
Initializes and then runs completely a simulation.
-
-
-
Method Detail
-
addProbe
void addProbe(String identifier, IProbe probe)
Adds a probe to this simulation engine.- Parameters:
identifier
- An unique identifier for the probe.probe
- The probe to add to this simulation engine.- Throws:
IllegalArgumentException
- If the arguments arenull
, or if a probe is already defined for this identifier.
-
removeProbe
IProbe removeProbe(String identifier)
Removes a probe from the simulation engine.- Parameters:
identifier
- The identifier of the probe to remove.- Returns:
- The removed probe,
null
if no probe having the provided identifier was registered to this engine. - Throws:
IllegalArgumentException
- If the arguments arenull
.
-
getProbesIdentifiers
Set<String> getProbesIdentifiers()
Lists the identifier of all the probes that are registered to this engine.- Returns:
- The identifier of all the probes that are registered to this engine.
-
requestSimulationAbortion
void requestSimulationAbortion()
Requests the abortion of the simulation currently running with this simulation engine. In response, the simulation engine will stop the simulation once the simulation reaches a partly-consistent state.
-
runNewSimulation
void runNewSimulation(ISimulationModel simulationModel)
Initializes and then runs completely a simulation.This method has the responsibility to call the appropriate methods of the probes at the different moments of the simulation.
- Parameters:
simulationModel
- The simulation model running the simulation.- Throws:
IllegalArgumentException
- If the arguments arenull
.ExceptionSimulationAborted
- if the simulation has ended because it was aborted by the user.
-
getSimulationDynamicStates
IPublicDynamicStateMap getSimulationDynamicStates()
Gets the current dynamic states of the simulation.Usage
This method is used in probes to read the data about the simulation, when the simulation reaches a time stamp.
- Returns:
- The dynamic state of the simulation, containing either consistent states (the current time stamp of the simulation is equal to the time stamp of the level) or transitory states (in the other case).
-
getAgents
Set<IAgent4Engine> getAgents()
Gets the set of all the agents lying in the simulation.Usage
This method is used in probes to read the data about the simulation, when the simulation reaches a time stamp.
This method has to ensure that two consecutive iterations over this set always return its items in the same order.
- Returns:
- The set of all the agents lying in the simulation.
-
getLevelIdentifiers
Set<LevelIdentifier> getLevelIdentifiers()
Gets the set of level identifiers contained in the simulation.This method has to ensure that two consecutive iterations over this set always return its items in the same order.
- Returns:
- The list of levels contained in the simulation.
-
getLevels
Map<LevelIdentifier,ILevel> getLevels()
Gets the list of levels contained in the simulation.This method has to ensure that two consecutive iterations over this set always return its items in the same order.
- Returns:
- The list of levels contained in the simulation.
-
getAgents
Set<IAgent4Engine> getAgents(LevelIdentifier level)
Gets the set of all the agents lying in a specific level of the simulation.Usage
This method is used in probes to read the data about the simulation, when the simulation reaches a time stamp.
This method has to ensure that two consecutive iterations over this set always return its items in the same order.
- Parameters:
level
- The levels where to get the agents.- Returns:
- The set of all the agents lying in a specific level of in the simulation.
- Throws:
NoSuchElementException
- If no such level was defined for the simulation.
-
getEnvironment
IEnvironment4Engine getEnvironment()
Gets the environment the simulation.Usage
This method is used in probes to read the data about the simulation, when the simulation reaches a time stamp.
- Returns:
- The environment of the simulation.
-
disambiguation
ConsistentPublicLocalDynamicState disambiguation(TransitoryPublicLocalDynamicState transitoryDynamicState)
Disambiguates a public local dynamic state, i.e. transforms a transitory state into a fully observable state.This operation can introduce biases since it provides an estimation of the real state of a level, using the information stored into a transitory dynamic state.
- Parameters:
transitoryDynamicState
- The transitory state for which a disambiguation is computed.- Returns:
- the observable dynamic state corresponding to the disambiguation of the transitory dynamic state.
-
-