Class AbstractExtendedSimulationModel
- java.lang.Object
-
- fr.univ_artois.lgi2a.similar.microkernel.libs.abstractimpl.AbstractSimulationModel
-
- fr.univ_artois.lgi2a.similar.extendedkernel.simulationmodel.AbstractExtendedSimulationModel
-
- All Implemented Interfaces:
ISimulationModel
public abstract class AbstractExtendedSimulationModel extends AbstractSimulationModel
Models a simulation model in the extended kernel. This model adds a feature compared to the common libs of the micro-kernel: it separates the declaration of the simulation end criterion from the code of the simulation model.Benefits
This property has a huge benefit:- Simulation end criteria libraries can be built and re-used in many simulations.
- Author:
- Yoann Kubera
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface fr.univ_artois.lgi2a.similar.microkernel.ISimulationModel
ISimulationModel.AgentInitializationData, ISimulationModel.EnvironmentInitializationData
-
-
Constructor Summary
Constructors Constructor Description AbstractExtendedSimulationModel(ISimulationParameters simulationParameters, IEndCriterionModel endCriterionModel)
Builds an instance of an abstract extended simulation model, having a specific time stamp as initial time and a specific ending criterion.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract ISimulationModel.AgentInitializationData
generateAgents(ISimulationParameters simulationParameters, Map<LevelIdentifier,ILevel> levels)
Generates the agents of the simulation.ISimulationModel.AgentInitializationData
generateAgents(SimulationTimeStamp initialTime, Map<LevelIdentifier,ILevel> levels)
Generates the agents of the simulation.protected abstract ISimulationModel.EnvironmentInitializationData
generateEnvironment(ISimulationParameters simulationParameters, Map<LevelIdentifier,ILevel> levels)
Generates the environment of the simulation.ISimulationModel.EnvironmentInitializationData
generateEnvironment(SimulationTimeStamp initialTime, Map<LevelIdentifier,ILevel> levels)
Generates the environment of the simulation.protected abstract List<ILevel>
generateLevels(ISimulationParameters simulationParameters)
Generates the bare levels of the simulation.List<ILevel>
generateLevels(SimulationTimeStamp initialTime)
Generates the bare levels of the simulation.IEndCriterionModel
getEndCriterionModel()
Gets the end criterion model used in this simulation model.ISimulationParameters
getSimulationParameters()
Gets the parameters currently being used in the simulation.boolean
isFinalTimeOrAfter(SimulationTimeStamp currentTime, ISimulationEngine engine)
Tells if a time stamp is greater or equal to the final time stamp.-
Methods inherited from class fr.univ_artois.lgi2a.similar.microkernel.libs.abstractimpl.AbstractSimulationModel
getInitialTime
-
-
-
-
Constructor Detail
-
AbstractExtendedSimulationModel
public AbstractExtendedSimulationModel(ISimulationParameters simulationParameters, IEndCriterionModel endCriterionModel)
Builds an instance of an abstract extended simulation model, having a specific time stamp as initial time and a specific ending criterion.- Parameters:
simulationParameters
- The execution parameters of the simulation.endCriterionModel
- The end criterion model used in this simulation model.- Throws:
IllegalArgumentException
- If an argument isnull
.
-
-
Method Detail
-
getEndCriterionModel
public IEndCriterionModel getEndCriterionModel()
Gets the end criterion model used in this simulation model.- Returns:
- The end criterion model used in this simulation model.
-
getSimulationParameters
public ISimulationParameters getSimulationParameters()
Gets the parameters currently being used in the simulation.- Returns:
- The parameters currently being used in the simulation.
-
isFinalTimeOrAfter
public final boolean isFinalTimeOrAfter(SimulationTimeStamp currentTime, ISimulationEngine engine)
Tells if a time stamp is greater or equal to the final time stamp.- Parameters:
currentTime
- The last time the dynamic state of the simulation was in a partly consistent state.engine
- The simulation engine containing information about the currently running simulation.- Returns:
true
if the final time of the level was reached.
-
generateLevels
public final List<ILevel> generateLevels(SimulationTimeStamp initialTime)
Generates the bare levels of the simulation. These levels contain no agents and define no environment.- Parameters:
initialTime
- The initial time of the simulation.- Returns:
- The bare levels of the simulation.
-
generateLevels
protected abstract List<ILevel> generateLevels(ISimulationParameters simulationParameters)
Generates the bare levels of the simulation. These levels contain no agents and define no environment.- Parameters:
simulationParameters
- The execution parameters of the simulation.- Returns:
- The bare levels of the simulation.
-
generateEnvironment
public final ISimulationModel.EnvironmentInitializationData generateEnvironment(SimulationTimeStamp initialTime, Map<LevelIdentifier,ILevel> levels)
Generates the environment of the simulation. At this stage, no agent are generated in the simulation.This method should set the public local state of the environment for each level of the simulation.
- Parameters:
initialTime
- The initial time of the simulation.levels
- The levels of the simulation.- Returns:
- The generated environment and the influences to put in the state dynamics of the initial dynamic state of the levels.
-
generateEnvironment
protected abstract ISimulationModel.EnvironmentInitializationData generateEnvironment(ISimulationParameters simulationParameters, Map<LevelIdentifier,ILevel> levels)
Generates the environment of the simulation. At this stage, no agent are generated in the simulation.This method should set the public local state of the environment for each level of the simulation.
- Parameters:
simulationParameters
- The execution parameters of the simulation.levels
- The levels of the simulation.- Returns:
- The generated environment and the influences to put in the state dynamics of the initial dynamic state of the levels.
-
generateAgents
public final ISimulationModel.AgentInitializationData generateAgents(SimulationTimeStamp initialTime, Map<LevelIdentifier,ILevel> levels)
Generates the agents of the simulation.This method should only create the agents, without adding them in the levels. This task is performed by the simulation engine.
- Parameters:
initialTime
- The initial time of the simulationlevels
- The levels of the simulation.- Returns:
- The generated agents and the influences to put in the state dynamics of the initial dynamic state of the levels.
-
generateAgents
protected abstract ISimulationModel.AgentInitializationData generateAgents(ISimulationParameters simulationParameters, Map<LevelIdentifier,ILevel> levels)
Generates the agents of the simulation.This method should only create the agents, without adding them in the levels. This task is performed by the simulation engine.
- Parameters:
simulationParameters
- The execution parameters of the simulation.levels
- The levels of the simulation.- Returns:
- The generated agents and the influences to put in the state dynamics of the initial dynamic state of the levels.
-
-