Class DateBasedDiscreteEventScheduler

java.lang.Object
madkit.kernel.Agent
madkit.simulation.SimuAgent
madkit.kernel.Scheduler<DateBasedTimer>
madkit.simulation.scheduler.DateBasedDiscreteEventScheduler

public class DateBasedDiscreteEventScheduler extends Scheduler<DateBasedTimer>
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.
  • Constructor Details

    • DateBasedDiscreteEventScheduler

      public DateBasedDiscreteEventScheduler()
      Constructs a new scheduler with a DateBasedTimer as simulation time.
  • Method Details

    • doSimulationStep

      public void doSimulationStep()
      Description copied from class: Scheduler
      Defines a simulation step. This method should be overridden to define a customized scheduling policy.
      Specified by:
      doSimulationStep in class Scheduler<DateBasedTimer>
    • getCurrentTime

      public LocalDateTime getCurrentTime()
      Returns the current simulation time.
      Returns:
      the current simulation time
    • logActivationList

      public void logActivationList()
      Logs the activation list.
    • addActivator

      public boolean addActivator(Activator activator)
      Adds an activator to the scheduler. If the activator is a DateBasedDiscreteEventActivator it is also added to the activation list.
      Overrides:
      addActivator in class Scheduler<DateBasedTimer>
      Parameters:
      activator - an activator to add to the simulation engine.
      Returns:
      true if the activator has been added, false if it was already added
    • updateActivatorRanking

      public void updateActivatorRanking(Activator a)
      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

      public void removeActivator(Activator activator)
      Description copied from class: Scheduler
      Removes an activator from the simulation engine.
      Overrides:
      removeActivator in class Scheduler<DateBasedTimer>
      Parameters:
      activator - an activator.
    • getActivationList

      public PriorityQueue<DateBasedDiscreteEventActivator> getActivationList()
      Returns the activation list.
      Returns:
      the activation list