Simulation and Modeling

Assignment 2: Event Scheduling Simulation

 

Objective:

To design a Simulation Engine using Event Scheduling Approach and build applications.

Description:

Based on the event scheduling approach explained below, design and implement a Simulation Engine. The assignment is divided into two parts as follows:

Program should be well commented and all three applications should be in different files.

Event Scheduling:

Discrete-event simulations model systems that discretely change over time by making transitions from state-to-state when events occurs. The most obvious way to write a simulation engine is to write methods to implement what each type of event does and to schedule the execution of these event by placing them on a time-ordered queue. Pull the imminent event off the queue, advance simulated time to the event time and execute the event which may modify the state of the system and/or schedule future events.

The event Package:

Create a package with the following three classes.
  1. public class Entity
    {
        // properties of this entity
    } // Entity class

  2. public abstract class Event implements Comparable
    {
        // entity involved
        // event time
        // occur method
    } // Event class

  3. public class Scheduler
    {
        private static PriorityQueue<Event> eventList = new PriorityQueue<Event> ();
        // schedule method
        // cancel method
        // handle method
    } // Scheduler

This class needs a future event list which is maintained using java.util.PriorityQueue.

You MUST use the jsim.variate, jsim.statistic and jsim.util packages. For this assignment you may NOT use any other jsim package.