Giter Site home page Giter Site logo

single-server-queuing-simulation-in-java's Introduction

SIMULATION OF QUEUING SYSTEMS

  • In a single server queue,

    • Calling population is infinite; Arrival rate doesn't change.
    • Units are served according to FIFO.
    • Arrivals are defined by the distribution of the time between arrivals to inter-arrival time.
    • Service times are according to a distribution.
    • Arrival rate must be less than the service rate (stable stystem), otherwise will grow unbounded (unstable system).
  • Queuing system state

    1. System
    • Server
    • Units (in queue or being served)
    • Clock
    1. State of the system
    • Number of units in the system
    • Status of the server (idle, busy)
    1. Events
    • Arrival of a unit
    • Departure of a unit
  • Arrival Event

    • If server is idle unit gets service, otherwise unit enters queue for service.
    • How do events occur?
      • Events occur randomly
  • Departure Event

    • If queue is not empty begin servicing next unit, otherwise server will be idle.

The single-server queuing model that will be simulated is as follows:

  1. The simulation will end when n = 1000 delays in queue have been completed.
  2. The interarrival and service times will now be modeled as independent random variables from exponential distributions with mean 1 minute for the interarrival times and mean 0.5 minute for the service times. Recall the pdf of an exponential distribution.
  3. The interarrival and service times are the generated input quantities from the exponential distribution.

The single-server queue with exponential interarrival and service times is commonly called the M/M/1 queue.
To simulate this model, we need a way to generate random variates from an exponential distribution. First, a random-number generator is invoked to generate a variate U that is distributed (continously) uniformly between 0 and 1. This distribution is referred to as U(0, 1). Note that the U(0, 1) distribution is fundamental to simulation modelling because a random variate from any distribution can be generated by first generating one or more U(0, 1) random variates then performing some kind of transformation.
After obtaining U, we shall take the natural logarithm of it, multiply the result by B(refer to the formula for pdf of an exponential distribution), and finally change the sign to return what we will show to be an exponential random variate with mean B, i.e. -B ln U. (B is the beta sign)

Remember to modularize the program into several subprograms to clarify the logic and interactions.

The simulation program includes a main program, routines for initialization, timing, report generation, and generating exponential random variates. (Refer to the flow chart for the next-event time-advance approach)

The event routines are as follows:

Event description Event Type
Arrival of a customer to the system 1
Departure of a customer from the system 2

Flowchart for arrival routine
Flowchart for departure routine

single-server-queuing-simulation-in-java's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.