Class DateBasedDiscreteEventScheduler
This class defines a scheduler for discrete event simulation. It is based on the
DateBasedTimer class which is used to manage the simulation time. The scheduler
uses a priority queue to manage the activation list of the activators.-
Nested Class Summary
Nested classes/interfaces inherited from class madkit.kernel.Scheduler
Scheduler.SimulationStateNested classes/interfaces inherited from class madkit.kernel.Agent
Agent.ReturnCode -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddActivator(Activator activator) Adds an activator to the scheduler.voidDefines a simulation step.Returns the activation list.Returns the current simulation time.voidLogs the activation list.voidremoveActivator(Activator activator) Removes an activator from the simulation engine.voidShould be used when an activator changes its next event date so that the new one is earlier.Methods inherited from class madkit.kernel.Scheduler
addEnvironmentActivator, addViewersActivator, executeAndLog, getActions, getActivators, getPause, getPauseSlider, getShedulerActions, getSimuTimer, getTimeLabel, getToolBar, logCurrrentTime, onActivation, onEnd, onLive, onSimulationStart, removeAllActivators, setPause, setSimulationTimeMethods inherited from class madkit.simulation.SimuAgent
createSimuGroup, getCommunity, getEngineGroup, getEnvironment, getLauncher, getModel, getModelGroup, getNextEventDate, getScheduler, getViewers, launchAgent, leaveRole, leaveSimuGroup, leaveSimuRole, playRole, prng, requestSimuRoleMethods inherited from class madkit.kernel.Agent
activate, broadcast, broadcastWithRole, broadcastWithRoleWaitForReplies, checkAgentAddress, createGroup, createGroup, createGroup, end, equals, executeThisAgent, executeThisAgent, exitOnKill, getAgentsWithRole, getAgentWithRole, getKernelAddress, getKernelConfig, getLogger, getMailbox, getName, getNetworkID, getOrganization, getReplyTo, handleRequestActionMessage, hashCode, isAlive, killAgent, killAgent, launchAgent, launchAgent, leaveGroup, leaveRole, live, nextMessage, pause, receiveMessage, reload, reply, replyWithRole, requestRole, requestRole, send, send, sendWaitReply, sendWaitReply, sendWithRole, sendWithRole, sendWithRoleWaitReply, sendWithRoleWaitReply, setupDefaultGUI, toString, waitAnswer, waitAnswer, waitNextMessage, waitNextMessage
-
Constructor Details
-
DateBasedDiscreteEventScheduler
public DateBasedDiscreteEventScheduler()Constructs a new scheduler with aDateBasedTimeras simulation time.
-
-
Method Details
-
doSimulationStep
public void doSimulationStep()Description copied from class:SchedulerDefines a simulation step. This method should be overridden to define a customized scheduling policy.- Specified by:
doSimulationStepin classScheduler<DateBasedTimer>
-
getCurrentTime
Returns the current simulation time.- Returns:
- the current simulation time
-
logActivationList
public void logActivationList()Logs the activation list. -
addActivator
Adds an activator to the scheduler. If the activator is aDateBasedDiscreteEventActivatorit is also added to the activation list.- Overrides:
addActivatorin classScheduler<DateBasedTimer>- Parameters:
activator- an activator to add to the simulation engine.- Returns:
trueif the activator has been added,falseif it was already added
-
updateActivatorRanking
Should be used when an activator changes its next event date so that the new one is earlier. So, this method triggers the reordering of this activator.- Parameters:
a-
-
removeActivator
Description copied from class:SchedulerRemoves an activator from the simulation engine.- Overrides:
removeActivatorin classScheduler<DateBasedTimer>- Parameters:
activator- an activator.
-
getActivationList
Returns the activation list.- Returns:
- the activation list
-