ie 303 discrete-event simulation - isik un · 2016-10-19 · event scheduling algorithm in our...

26
LECTURE 3: EVENT-SCHEDULING ALGORITHM IE 303 Discrete-Event Simulation

Upload: others

Post on 08-May-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: IE 303 Discrete-Event Simulation - ISIK UN · 2016-10-19 · Event Scheduling Algorithm In our simulations so far, we went trough entities, e.g. arriving customers, daily demand to

L E C T U R E 3 : E V E N T - S C H E D U L I N G A L G O R I T H M

IE 303 Discrete-Event Simulation

Page 2: IE 303 Discrete-Event Simulation - ISIK UN · 2016-10-19 · Event Scheduling Algorithm In our simulations so far, we went trough entities, e.g. arriving customers, daily demand to

Outline

Event Scheduling Algorithm

Single Server Queue (Revisited)

List processing

Page 3: IE 303 Discrete-Event Simulation - ISIK UN · 2016-10-19 · Event Scheduling Algorithm In our simulations so far, we went trough entities, e.g. arriving customers, daily demand to

Review of the Previous Lecture

Properties of random random numbers

Uniformity

Independence from history

As sample size->∞, histogram of random numbers -> uniform distr.

Coin tossing game

Single server queue

-> -> -> ->

Page 4: IE 303 Discrete-Event Simulation - ISIK UN · 2016-10-19 · Event Scheduling Algorithm In our simulations so far, we went trough entities, e.g. arriving customers, daily demand to

Event Scheduling Algorithm

In our simulations so far, we went trough entities, e.g. arriving customers, daily demand to newsvendor, coin tosses,

What if our simulation is more complex?

Example: Assume we are simulating a port. We have 3 types of ships:

Container ships, Bulk carriers, Tankers

Each ship should be served by different types of machinery…

Page 5: IE 303 Discrete-Event Simulation - ISIK UN · 2016-10-19 · Event Scheduling Algorithm In our simulations so far, we went trough entities, e.g. arriving customers, daily demand to

Event Scheduling Algorithm

Keeping track of events in a simulation model is much harder if we do it through ship arrivals…

So, we use event scheduling algorithm:

The idea of the algorithm is at each event occurrence (activity) e.g. arrival of a customer, start of production etc,

future event is generated and written into Future Event List (FEL).

Page 6: IE 303 Discrete-Event Simulation - ISIK UN · 2016-10-19 · Event Scheduling Algorithm In our simulations so far, we went trough entities, e.g. arriving customers, daily demand to

Event Scheduling Algorithm

Activity vs. Delay: Activity a duration of time of specified length (statistical distributions)

(e.g. service time or interarrival time), which is known when it begins.

Delay a duration of time of unspecified indefinite length, which is not known until it ends (e.g. a customer’s delay in a last-in-first-out waiting line)

Single Server Queue:

Event: Arrivals of customers, service completion in the server

Activity: Service time

Delay: customers’ waiting in the queue

Page 7: IE 303 Discrete-Event Simulation - ISIK UN · 2016-10-19 · Event Scheduling Algorithm In our simulations so far, we went trough entities, e.g. arriving customers, daily demand to

Event Scheduling Algorithm

At any given time t, the FEL contains all previously scheduled events and their associated event times in chronological order:

t < t1 ≤ t2 ≤ t3 ≤ ··· ≤ tn

Time t is the value of CLOCK, current value of simulated time. The event associated t1 is the next event (imminent event) that will occur.

Page 8: IE 303 Discrete-Event Simulation - ISIK UN · 2016-10-19 · Event Scheduling Algorithm In our simulations so far, we went trough entities, e.g. arriving customers, daily demand to

Event Scheduling Algorithm

As time proceeds, the system state and future events and statistics are handled with such a table.

Page 9: IE 303 Discrete-Event Simulation - ISIK UN · 2016-10-19 · Event Scheduling Algorithm In our simulations so far, we went trough entities, e.g. arriving customers, daily demand to

Event Scheduling Algorithm

Also, every simulation should have a stopping event (E), which should be kept in FEL.

How would you draw the flow diagram of this algorithm?

Page 10: IE 303 Discrete-Event Simulation - ISIK UN · 2016-10-19 · Event Scheduling Algorithm In our simulations so far, we went trough entities, e.g. arriving customers, daily demand to

Event Scheduling Algorithm

Page 11: IE 303 Discrete-Event Simulation - ISIK UN · 2016-10-19 · Event Scheduling Algorithm In our simulations so far, we went trough entities, e.g. arriving customers, daily demand to

Event Scheduling Algorithm

Lets build a simulation of a single server queue using the event scheduling algorithm…

Page 12: IE 303 Discrete-Event Simulation - ISIK UN · 2016-10-19 · Event Scheduling Algorithm In our simulations so far, we went trough entities, e.g. arriving customers, daily demand to

Event Scheduling Algorithm

Four output measures:

: Number of service starts . It will be incremented every time the service of a new customer is started.

: Server utilization is defined by total server busy time

divided by total time, TE .

: Average waiting time is defined by total waiting time number of service (W/ NS).

: Average queue length

: Service length

: Queue length

SN

B

TE

W

LQ

LS

Page 13: IE 303 Discrete-Event Simulation - ISIK UN · 2016-10-19 · Event Scheduling Algorithm In our simulations so far, we went trough entities, e.g. arriving customers, daily demand to

Event Scheduling Algorithm

Page 14: IE 303 Discrete-Event Simulation - ISIK UN · 2016-10-19 · Event Scheduling Algorithm In our simulations so far, we went trough entities, e.g. arriving customers, daily demand to

Event Scheduling Algorithm

Page 15: IE 303 Discrete-Event Simulation - ISIK UN · 2016-10-19 · Event Scheduling Algorithm In our simulations so far, we went trough entities, e.g. arriving customers, daily demand to

Dump Truck Example

Page 16: IE 303 Discrete-Event Simulation - ISIK UN · 2016-10-19 · Event Scheduling Algorithm In our simulations so far, we went trough entities, e.g. arriving customers, daily demand to

Dump Truck Example

Page 17: IE 303 Discrete-Event Simulation - ISIK UN · 2016-10-19 · Event Scheduling Algorithm In our simulations so far, we went trough entities, e.g. arriving customers, daily demand to

Dump Truck Example

Page 18: IE 303 Discrete-Event Simulation - ISIK UN · 2016-10-19 · Event Scheduling Algorithm In our simulations so far, we went trough entities, e.g. arriving customers, daily demand to

Dump Truck Example

Page 19: IE 303 Discrete-Event Simulation - ISIK UN · 2016-10-19 · Event Scheduling Algorithm In our simulations so far, we went trough entities, e.g. arriving customers, daily demand to

Dump Truck Example

Page 20: IE 303 Discrete-Event Simulation - ISIK UN · 2016-10-19 · Event Scheduling Algorithm In our simulations so far, we went trough entities, e.g. arriving customers, daily demand to

Dump Truck Example

Page 21: IE 303 Discrete-Event Simulation - ISIK UN · 2016-10-19 · Event Scheduling Algorithm In our simulations so far, we went trough entities, e.g. arriving customers, daily demand to

Dump Truck Example

Page 22: IE 303 Discrete-Event Simulation - ISIK UN · 2016-10-19 · Event Scheduling Algorithm In our simulations so far, we went trough entities, e.g. arriving customers, daily demand to

Dump Truck Example

Page 23: IE 303 Discrete-Event Simulation - ISIK UN · 2016-10-19 · Event Scheduling Algorithm In our simulations so far, we went trough entities, e.g. arriving customers, daily demand to

Dump Truck Example

Page 24: IE 303 Discrete-Event Simulation - ISIK UN · 2016-10-19 · Event Scheduling Algorithm In our simulations so far, we went trough entities, e.g. arriving customers, daily demand to

List Processing

As can be seen FEL plays a crucial role in the simulation algorithm.

It is important to know and manage FEL list which can get very long in real-life simulation applications.

FEL can be stored in arrays by a computer.

Page 25: IE 303 Discrete-Event Simulation - ISIK UN · 2016-10-19 · Event Scheduling Algorithm In our simulations so far, we went trough entities, e.g. arriving customers, daily demand to

List Processing

Storing event list in arrays is a straightforward way.

It has pros and cons at the same time. From any perspective it is important to establish main operations on FEL list:

Removing a record from the top of the list

Removing a record from any location on the list

Adding a record to the bottom or top of the list

Adding a record to an arbitrary location.

Page 26: IE 303 Discrete-Event Simulation - ISIK UN · 2016-10-19 · Event Scheduling Algorithm In our simulations so far, we went trough entities, e.g. arriving customers, daily demand to

END OF LECTURE 4

Next Lecture Chapter 5.1, 5.3, 5.4