public abstract class SimulationManagerAgent
extends jade.core.Agent
Modifier and Type | Field and Description |
---|---|
protected java.util.Hashtable<jade.core.AID,java.lang.Object> |
agentAnswers
The answers/next state of all involved agents.
|
protected boolean |
debug
The debug indicator.
|
protected EnvironmentModel |
myEnvironmentModel
The environment model which contains an abstract and a displayable environment model as well as a time model
|
protected ServiceSensorManager |
mySensor
The ServiceSensorManager for this agent.
|
protected SimulationServiceHelper |
simHelper
The SimulationServiceHelper.
|
Constructor and Description |
---|
SimulationManagerAgent() |
Modifier and Type | Method and Description |
---|---|
protected void |
addSimulationBehaviour()
This method adds the mandatory CyclicSimulationBehavior to this agent.
|
void |
doNextSimulationStep()
This method has to be called if the next simulation step can be executed.
|
abstract void |
doSingleSimulationSequennce()
The logic of the simulation is implemented here.
|
AbstractEnvironmentModel |
getAbstractEnvironment()
Returns the current abstract environment model.
|
java.util.Hashtable<jade.core.AID,java.lang.Object> |
getAgentAnswers()
Gets the agent answers.
|
DisplaytEnvironmentModel |
getDisplayEnvironment()
Returns the current display environment.
|
EnvironmentModel |
getEnvironmentModel()
Provides the environment model.
|
EnvironmentModel |
getEnvironmentModelFromSetup()
This method is used for initialising the simulation during the .setup()-method of the agent.
|
java.util.Vector<EnvironmentNotification> |
getNotifications()
Returns the Vector of current EnvironmentNotification's.
|
TimeModel |
getTimeModel()
Provides the current time model.
|
protected void |
onManagerNotification(EnvironmentNotification notification)
This method will be executed if a ManagerNotification arrives this agent.
|
protected void |
proceedAgentAnswers(java.util.Hashtable<jade.core.AID,java.lang.Object> agentAnswers)
This method is called if a stimulus from the outside reached this agent.
|
void |
putAgentAnswers(java.util.Hashtable<jade.core.AID,java.lang.Object> agentAnswers,
boolean aSynchron)
This method will be used by the
ServiceActuatorManager to inform
this manager about agent answers for environment changes. |
protected void |
removeSimulationBehaviour()
Removes the simulation behaviour.
|
void |
resetEnvironmentInstanceNextParts()
Resets the answers of the agents in the simulation service to an empty Hashtable.
|
boolean |
sendAgentNotification(jade.core.AID receiverAID,
java.lang.Object notification)
This method can be used to transfer any kind of information to one member of the current environment model.
|
void |
sendDisplayAgentNotification(DisplayAgentNotification displayAgentNotification)
Notify display agents about environment changes with concrete messages.
|
void |
sendDisplayAgentNotificationUpdateEnvironmentModel()
Notify all AbstractDisplayAgents about environment changes by using the SimulationService.
|
protected void |
sensorPlugIn()
This Method plugs IN the service sensor.
|
protected void |
sensorPlugOut()
This Method plugs OUT the service sensor.
|
void |
setAbstractEnvironment(AbstractEnvironmentModel abstractEnvironment)
Sets the abstract environment.
|
void |
setAgentAnswers(java.util.Hashtable<jade.core.AID,java.lang.Object> agentAnswers)
Sets the agent answers.
|
void |
setDisplayEnvironment(DisplaytEnvironmentModel displayEnvironment)
Sets the display environment.
|
void |
setEnvironmentModel(EnvironmentModel environmentModel)
Sets the environment model.
|
void |
setManagerNotification(EnvironmentNotification notification)
This method can be invoked from the simulation service, if
a notification for the manager has to be delivered.
|
void |
setNotifications(java.util.Vector<EnvironmentNotification> notifications)
Sets the notifications.
|
abstract void |
setPauseSimulation(boolean isPauseSimulation)
Notifies the manager to pause or restart the simulation.
|
void |
setTimeModel(TimeModel timeModel)
Sets the current time model.
|
protected void |
setup()
Mandatory setup()-functionality.
|
void |
stepSimulation(EnvironmentModel environmentModel,
int answersExpected)
Steps the simulation.
|
void |
stepSimulation(int answersExpected)
Steps the simulation.
|
protected void |
takeDown() |
addBehaviour, afterClone, afterMove, beforeClone, beforeMove, blockingReceive, blockingReceive, blockingReceive, blockingReceive, changeStateTo, clean, createMessageQueue, doActivate, doClone, doDelete, doMove, doSuspend, doTimeOut, doWait, doWait, doWake, getAgentState, getAID, getAID, getAMS, getArguments, getBehavioursCnt, getBootProperties, getContainerController, getContentManager, getCurQueueSize, getDefaultDF, getExecutedBehavioursCnt, getHap, getHelper, getLocalName, getName, getO2AInterface, getO2AObject, getPostedMessagesCnt, getProperty, getQueueSize, getReceivedMessagesCnt, getState, here, isAlive, isRestarting, join, notifyChangeBehaviourState, notifyRestarted, postMessage, putBack, putO2AObject, receive, receive, registerO2AInterface, removeBehaviour, removeTimer, restartLater, restore, restoreBufferedState, run, send, setArguments, setEnabledO2ACommunication, setGenerateBehaviourEvents, setO2AManager, setQueueSize, waitUntilStarted, write
protected boolean debug
getEnvironmentModelFromSetup()
).protected SimulationServiceHelper simHelper
protected ServiceSensorManager mySensor
protected EnvironmentModel myEnvironmentModel
protected java.util.Hashtable<jade.core.AID,java.lang.Object> agentAnswers
protected void setup()
setup
in class jade.core.Agent
protected void takeDown()
takeDown
in class jade.core.Agent
protected void sensorPlugIn()
protected void sensorPlugOut()
protected void addSimulationBehaviour()
protected void removeSimulationBehaviour()
public EnvironmentModel getEnvironmentModelFromSetup()
EnvironmentModel
with your own data, just overwrite this method.EnvironmentModel
, configured in the setuppublic abstract void doSingleSimulationSequennce()
public void doNextSimulationStep()
public void stepSimulation(int answersExpected) throws jade.core.ServiceException
answersExpected
- the expected number answers from the involved SimulationAgent
'sjade.core.ServiceException
- the ServiceExceptionpublic void stepSimulation(EnvironmentModel environmentModel, int answersExpected) throws jade.core.ServiceException
environmentModel
- the new EnvironmentModel
to setanswersExpected
- the expected number answers from the involved SimulationAgent
'sjade.core.ServiceException
- the ServiceExceptionpublic void resetEnvironmentInstanceNextParts() throws jade.core.ServiceException
jade.core.ServiceException
- ServiceExceptionpublic void putAgentAnswers(java.util.Hashtable<jade.core.AID,java.lang.Object> agentAnswers, boolean aSynchron)
ServiceActuatorManager
to inform
this manager about agent answers for environment changes. It can be either
used to do this asynchronously or synchronously. It is highly recommended
to do this asynchronously, so that the agency can act parallel and not
sequentially.agentAnswers
- the agent answers as a HashtableaSynchron
- true, if this should be done asynchronouslyprotected void proceedAgentAnswers(java.util.Hashtable<jade.core.AID,java.lang.Object> agentAnswers)
agentAnswers
- the agent answers as a Hashtablepublic boolean sendAgentNotification(jade.core.AID receiverAID, java.lang.Object notification)
receiverAID
- the AID of the receivernotification
- the notificationpublic void sendDisplayAgentNotificationUpdateEnvironmentModel()
public void sendDisplayAgentNotification(DisplayAgentNotification displayAgentNotification)
displayAgentNotification
- the display agent messagepublic void setManagerNotification(EnvironmentNotification notification)
notification
- the new EnvironmentNotification for this manager agentprotected void onManagerNotification(EnvironmentNotification notification)
notification
- the EnvironmentNotification for this agentpublic abstract void setPauseSimulation(boolean isPauseSimulation)
isPauseSimulation
- the is pause simulationpublic EnvironmentModel getEnvironmentModel()
public void setEnvironmentModel(EnvironmentModel environmentModel)
environmentModel
- the new environment modelpublic TimeModel getTimeModel()
public void setTimeModel(TimeModel timeModel)
timeModel
- the new time modelpublic AbstractEnvironmentModel getAbstractEnvironment()
public void setAbstractEnvironment(AbstractEnvironmentModel abstractEnvironment)
abstractEnvironment
- the new abstract environmentpublic DisplaytEnvironmentModel getDisplayEnvironment()
public void setDisplayEnvironment(DisplaytEnvironmentModel displayEnvironment)
displayEnvironment
- the new display environmentpublic java.util.Hashtable<jade.core.AID,java.lang.Object> getAgentAnswers()
public void setAgentAnswers(java.util.Hashtable<jade.core.AID,java.lang.Object> agentAnswers)
agentAnswers
- the agent answerspublic java.util.Vector<EnvironmentNotification> getNotifications()
public void setNotifications(java.util.Vector<EnvironmentNotification> notifications)
notifications
- the new notifications