1 / 25

Outline

Outline. simulating GI / G /1 queues M / M /1 queues theoretical results of queueing systems an inventory system simulation program with an event calendar hand simulation. To Simulate an GI / G /1 Queue. definition of variables definition of events pseudo code flow chart of program.

alyson
Download Presentation

Outline

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Outline • simulating GI/G/1 queues • M/M/1 queues • theoretical results of queueing systems • an inventory system • simulation program with an event calendar • hand simulation

  2. To Simulate an GI/G/1 Queue • definition of variables • definition of events • pseudo code • flow chart of program

  3. Yes TnowTmax No ouput L/Tnow and L/K arrival service next event Yes N = 0 No N = 1 No Yes Flow Chart for Simulating an GI/G/1 Queue N = L = K = T = 0; Ta = random inter-arrival time; Ts = infinity L = L + (Ta - Tnow)N; Tnow = Ta; N = N + 1; K = K +1; Ta = Tnow + random inter-arrival time L = L + (Ts - Tnow)N; Tnow = Ts; N = N - 1 Ts = infinity Ts = Tnow + random service time Ts = Tnow + random service time

  4. To Simulate an GI/G/1 Queue • definition of variables • definition of events • pseudo code • flow chart of program • Java program

  5. Variations of GI/G/1 Queues • M/M/1-based queue • standard: Java program • with queue limit: Java program

  6. Terms Associated with a Customer other names of time in queue = waiting time in queue = delay time • for customer i • arrival time, tai • time to start service, tsi • time to leave system, tdi • time in queue, Di = tsi – tai • service time, Si = tdi – tsi • time in system, Wi = tdi – tai other names of time in system = waiting time in system = total time in system

  7. n Machine (Server) ... ... ... n n-1 Queue (FIFO) n n-2 n-1 n-3 n-1 n-2 n Theoretical Result: Conservation of Time tag nth customer ... for each customer, his time in system = time in queue + service time ave. time in system = ave. time in queue + E(service time)

  8. 6 0 10 13 17 23 26 t average # of customers up to t = 26: Sample-Path Results of a Queueing System • state: N(t), number of customers in system 4 3 N(t) 2 1 0

  9. Sample-Path Results of a Queueing System • total length of rectangular boxes of the same color = waiting time of the corresponding customer in system average # in system = (arrival rate) (average waiting time)

  10. Theoretical Result: Little’s Formula • very general result • for any system: L = w • L = average # of customers in system •  = arrival rate of customers • w = average time in system

  11. Theoretical Result: Little’s Formula • GI/G/1 queue • the whole system • average # in system = (arrival rate) (average time in system) • the waiting queue as the system • average # in queue = (arrival rate) (average time in queue) • the server as the system • utilization of server = (arrival rate) E(service time)

  12. demand of the Day n Dn ~ Geo(0.1) (Q, s) policy: order Q items at the end of a day if inventory on hand s An Inventory System $0.1 per unit on hand at the beginning of a day after receiving any outstanding order lost sales, no back order ordering cost: $20 per order penalty: $1 per piece lost leadtime of orders: equally likely to be 0 to 4 days (i.e., the ordered quantity can possibly arrive the next day) at the beginning of Day n:update inventory if ordered quantity arrives Day n at most one outstanding order

  13. Inventory System • inventory system • definition of variables • definition of events • pseudo code • flow chart • Java program

  14. Simulating Complex Systems • simple system (up to now) • chess piece, machine, GI/G/1 queue, inventory system • tailor-made programs for these problems • complex problems • generic program structure • event scheduled by an event calendar

  15. Generic Program Structure for Complex Systems • Initialization Event while (not stopping (e.g., TNOW < TTERM)) { switch (Next Event Type) { case 1: tasks of type 1 event; break; .. .. .. .. case n: tasks of type n event; break; } } Termination Event need to keep track of the timing of events

  16. Conceptual Structure of an Event Calendar • event: (time, type, tasks to do) • event calendar: a link list with scheduledfuture events in ascending order of time • example • four events scheduled at epoch 0 • event 1: (24.3, type = 4, tasks to do) • event 2: (35.6, type = 1, tasks to do) • event 3: (41.3, type = 2, tasks to do) • event 4: (5000, type = END, tasks to do = end program)

  17. tasks to do 24.3 type 4 Event. Cal. End simulation 5000 END tasks to do 35.6 type 1 tasks to do 41.3 type 2 Event Calendar of a Simulation Program TNOW = 0: 1 2 3 4

  18. tasks to do 24.3 type 4 Event. Cal. End simulation End simulation End simulation End simulation End simulation 5000 5000 5000 5000 5000 END END END END END tasks to do tasks to do tasks to do tasks to do tasks to do 35.6 35.6 35.6 35.6 35.6 type 1 type 1 type 1 type 1 type 1 tasks to do tasks to do tasks to do tasks to do tasks to do 41.3 41.3 41.3 41.3 41.3 type 2 type 2 type 2 type 2 type 2 Event Calendar of a Simulation Program suppose that no new event is created by a type 4 event TNOW = 0: move time to TNOW = 24.3 execute first event and update event calendar 1 2 3 4

  19. tasks to do tasks to do tasks to do tasks to do 39.1 39.1 39.1 24.3 type 4 type 4 type 4 type 4 Event. Cal. End simulation End simulation End simulation End simulation 5000 5000 5000 5000 END END END END tasks to do tasks to do tasks to do tasks to do 35.6 35.6 35.6 35.6 type 1 type 1 type 1 type 1 tasks to do tasks to do tasks to do tasks to do 41.3 41.3 41.3 41.3 type 2 type 2 type 2 type 2 Event Calendar of a Simulation Program suppose that a new event is created by an type 4 event at 39.1 TNOW = 0: move time to TNOW = 24.3 execute first event and update event calendar 1 2 3 4

  20. Operations of the Event Calendar • delete an event that has (just) occurred • after completing all tasks at TNOW, remove the first event in the event calendar • insert a new event • get the event time of the new event • check where to insert the event • move backward one rank for events occurring after the new event • insert the new event Describe concept only; actual implementation depends on the data structure used

  21. A Crude Pseudo-Code of GI/G/1Queue with Event Calendar • 1 initialization • set TNOW = 0; initialize variables; set termination event; set initial events • 2 get next event type • 3 while { next event != termination } { • get next event time and next event details • set TNOW to next event time • update the Event Calendar • execute next event, including updating variables and possibly adding new events to Event Calendar • get next event type • } • 4 execute the termination Event

  22. An GI/G/1Queue with the Event Calendar • inter-arrival times ~ exp of mean 10 • service times ~ exp of mean 5 • Java Program

  23. Simulation by Hand • simulate the system for 20 time units to get • total # of customers served (in the time horizon) • average and maximum waiting time in queue • time-average and maximum number in queue • average and maximum total time in system • utilization (proportion of busy time of station)

  24. Input Data • Initially (time 0) empty and idle • Part Number Arrival Time Interarrival Time Service Time 1 0.00 1.73 2.90 2 1.73 1.35 1.76 3 3.08 0.71 3.39 4 3.79 0.62 4.52 5 4.41 14.28 4.46 6 18.69 0.70 4.36 7 19.39 15.52 2.07 8 34.91 3.15 3.36 9 38.06 1.76 2.37 10 39.82 1.00 5.38 11 40.82 . . . . . . • Stop when 20 minutes of (simulated) time have passed

  25. hand simulation

More Related