Introduction - Simulation · 2018-09-04 · The Poisson Process The standard assumption in many...

36
1 Introduction - Simulation Simulation of Industrial Processes and Logistical Systems - MION40 Fredrik Olsson PhD, ETP Dept of: Production Management (Centre for Mathematical Sciences)

Transcript of Introduction - Simulation · 2018-09-04 · The Poisson Process The standard assumption in many...

Page 1: Introduction - Simulation · 2018-09-04 · The Poisson Process The standard assumption in many queuing models is that the arrival process is Poisson Two equivalent definitions of

1

Introduction -

Simulation

Simulation of Industrial Processes

and Logistical Systems - MION40

Fredrik Olsson PhD, ETP

Dept of:

Production Management

(Centre for Mathematical Sciences)

Page 2: Introduction - Simulation · 2018-09-04 · The Poisson Process The standard assumption in many queuing models is that the arrival process is Poisson Two equivalent definitions of

2

What is a model?

“A model is an external and explicit representation of part of reality as seen by the people who wish to use that model to understand, to change, to manage and to control that part of reality”

Pidd ”Tools for thinking”, 1996

”Model is defined as a representation of a system for the purpose of studying the system” Banks, Carson and Nelson ”Discrete-Event System Simulation”, 1996

Page 3: Introduction - Simulation · 2018-09-04 · The Poisson Process The standard assumption in many queuing models is that the arrival process is Poisson Two equivalent definitions of

3

Model types

PRESCRIPTIVE - formulate and optimize the problem

vs. (analytical)

DESCRIPTIVE - describe the behavior of the system

(numerical)

DISCRETE - state variables change only at a discrete

set of time points (assuming only a finite set of values) vs.

CONTINUOUS - state variables change continuously and smoothly over time (assuming any real values)

Page 4: Introduction - Simulation · 2018-09-04 · The Poisson Process The standard assumption in many queuing models is that the arrival process is Poisson Two equivalent definitions of

4

Model types

PROBABILISTIC - a response may take a range of values given the initial state and input (uses random variables - STOCHASTIC model)

DETERMINISTIC - all variables stated with certainty, completely determined by its initial state and inputs

STATIC - represent system at one time point

vs.

DYNAMIC - describe system in time

Page 5: Introduction - Simulation · 2018-09-04 · The Poisson Process The standard assumption in many queuing models is that the arrival process is Poisson Two equivalent definitions of

5

What is simulation?

Definitions of simulation:”Simulation is the process of designing a model

of a real system and conducting experiments with

this model with the purpose of either

understanding the behavior of the system or of

evaluating various strategies (within the limits

imposed by a criterion or set of criteria) for the

operation of the system”

– From Shannon R.E., ”Systems simulation: The art and

science”, 1975

Page 6: Introduction - Simulation · 2018-09-04 · The Poisson Process The standard assumption in many queuing models is that the arrival process is Poisson Two equivalent definitions of

6

What is simulation? (cont)

”The basic principles are simple enough: the

analyst builds a model of the system of

interest, writes computer programs which

embody model and uses a computer to

imitate the system’s behavior when subject

to a variety of operating policies”

– From Pidd, M., ”Computer Simulation in Management

Science”, Third Edition, John Wiley, New York, 1992

Page 7: Introduction - Simulation · 2018-09-04 · The Poisson Process The standard assumption in many queuing models is that the arrival process is Poisson Two equivalent definitions of

7

System – model - reality

We use the concept system when we

refer to the part of reality that we would

like to study.

We use the concept model for the

picture of reality that we create.

Page 8: Introduction - Simulation · 2018-09-04 · The Poisson Process The standard assumption in many queuing models is that the arrival process is Poisson Two equivalent definitions of

8

Simulation…

Generally, imitation of a system via computer

Involves a model — validity?

Does not provide an analytic solution

– Do not get exact results (bad)

– Allow for complex and realistic models (good)

Approximate answer to exact problem is better than exact answer to approximate problem (good)

One cannot predict the behavior of a model by using simulation (bad)

Page 9: Introduction - Simulation · 2018-09-04 · The Poisson Process The standard assumption in many queuing models is that the arrival process is Poisson Two equivalent definitions of

9

Steps in a simulation project

8. Experimental Design

9. Model runs and analysis

10. More runsNoYes

3. Model conceptualization 4. Data Collection

5. Model Translation

6. Verified

7. Validated

Yes

No

No No

Yes

Phase 3

Experimentation

Phase 2

Model Building

11. Documentation, reporting and

implementation

Phase 4

Implementation

1. Problem formulation

2. Set objectives and overall project plan

Phase 1

Problem Definition

Page 10: Introduction - Simulation · 2018-09-04 · The Poisson Process The standard assumption in many queuing models is that the arrival process is Poisson Two equivalent definitions of

10

Simulation vs. direct

experimentation

Cost

– Simulation may often be cheaper alternative

Time

– Simulation allows compress or expand time

Replication

– Simulations are precisely repeatable

Safety

– Simulation offers risk-free environment

Legality

Page 11: Introduction - Simulation · 2018-09-04 · The Poisson Process The standard assumption in many queuing models is that the arrival process is Poisson Two equivalent definitions of

11

Continuous simulation

State variables change continuously over

time.

Typically involve differential equations

In this course, we will only deal with

discrete event simulation

Page 12: Introduction - Simulation · 2018-09-04 · The Poisson Process The standard assumption in many queuing models is that the arrival process is Poisson Two equivalent definitions of

12

Time aspect in discrete event

simulation

Two techniques for time increment

- ”next event” (move clocktime to next

event-time)

- ”time slice” (move forward one time-step

and check if something has happened)

Page 13: Introduction - Simulation · 2018-09-04 · The Poisson Process The standard assumption in many queuing models is that the arrival process is Poisson Two equivalent definitions of

13

Simulation software or general

programming tools?

Simlicity for model construction

Simulators

Simulation software

General

programming

software

Flexibility

Page 14: Introduction - Simulation · 2018-09-04 · The Poisson Process The standard assumption in many queuing models is that the arrival process is Poisson Two equivalent definitions of

14

Decision model

Page 15: Introduction - Simulation · 2018-09-04 · The Poisson Process The standard assumption in many queuing models is that the arrival process is Poisson Two equivalent definitions of

15

Applications

New projects

System developments

Problem solving

Staff education

Operational control

Page 16: Introduction - Simulation · 2018-09-04 · The Poisson Process The standard assumption in many queuing models is that the arrival process is Poisson Two equivalent definitions of

16

Pitfalls (fallgropar)

Too detailed model (very complicated model)

Looking for solutions that does not exist (e.g. Very high fill rates and low inventory levels)

Instable and chaotic systems (simulation of systems which are highly sensitive to parameter values)

Page 17: Introduction - Simulation · 2018-09-04 · The Poisson Process The standard assumption in many queuing models is that the arrival process is Poisson Two equivalent definitions of

17

You cannot simulate everything

It is hard to simulate social activities in a

computerized model

operational technical

social

Page 18: Introduction - Simulation · 2018-09-04 · The Poisson Process The standard assumption in many queuing models is that the arrival process is Poisson Two equivalent definitions of

18

Queueing theory - basics

Important queuing models with FIFO discipline The M/M/1 model

The M/M/c model

The M/M/c/K model (limited queuing capacity)

The M/M/c//N model (limited calling population)

Priority-discipline queuing models

Application of Queuing Theory to system

design and decision making

Page 19: Introduction - Simulation · 2018-09-04 · The Poisson Process The standard assumption in many queuing models is that the arrival process is Poisson Two equivalent definitions of

19

What is queueing theory?

Mathematical analysis of queues and waiting times in stochastic systems. Used extensively to analyze production and service

processes exhibiting random variability in market demand (arrival times) and service times

Queues arise when the short term demand for service exceeds the capacity Most often caused by random variation in service

times and the times between customer arrivals

If long term demand for service > capacity the queue will explode!

Page 20: Introduction - Simulation · 2018-09-04 · The Poisson Process The standard assumption in many queuing models is that the arrival process is Poisson Two equivalent definitions of

20

Why is queueing theory important?

Capacity problems are very common in industry and one of the main drivers of process redesign Need to balance the cost of increased capacity against the gains of

increased productivity and service

Queuing and waiting time analysis is particularly important in service systems Large costs of waiting and of lost sales due to waiting

Prototype Example – ER at County Hospital Patients arrive by ambulance or by their own accord

One doctor is always on duty

More and more patients seeks help longer waiting times

Question: Should another MD position be instated?

Page 21: Introduction - Simulation · 2018-09-04 · The Poisson Process The standard assumption in many queuing models is that the arrival process is Poisson Two equivalent definitions of

21

A cost/capacity tradeoff model

Process capacity

Cost

Cost of waiting

Cost of

service

Total

cost

Page 22: Introduction - Simulation · 2018-09-04 · The Poisson Process The standard assumption in many queuing models is that the arrival process is Poisson Two equivalent definitions of

22

Components of basic a queueing

process

Calling

PopulationQueue

Service

Mechanism

Input Source The Queuing System

Jobs

Arrival

Process

Queue

Configuration

Queue

Discipline

Served

Jobs

Service

Process

leave the

system

Page 23: Introduction - Simulation · 2018-09-04 · The Poisson Process The standard assumption in many queuing models is that the arrival process is Poisson Two equivalent definitions of

23

Components of a queueing process

The calling population The population from which customers/jobs originate

The size can be finite or infinite (the latter is most common)

Can be homogeneous (only one type of customers/ jobs) or heterogeneous (several different kinds of customers/jobs)

The Arrival Process Determines how, when and where customer/jobs arrive to the

system

Important characteristic is the customers’/jobs’ inter-arrival times

To correctly specify the arrival process requires data collection of interarrival times and statistical analysis

Page 24: Introduction - Simulation · 2018-09-04 · The Poisson Process The standard assumption in many queuing models is that the arrival process is Poisson Two equivalent definitions of

24

Components of a queueing process

The queue configuration Specifies the number of queues

Single or multiple lines to a number of service stations

Their location

Their effect on customer behavior

Balking and reneging

Their maximum size (# of jobs

the queue can hold)

Distinction between infinite

and finite capacity

Page 25: Introduction - Simulation · 2018-09-04 · The Poisson Process The standard assumption in many queuing models is that the arrival process is Poisson Two equivalent definitions of

25

Example – Two Queue

Configurations

Servers

Multiple Queues

Servers

Single Queue

Page 26: Introduction - Simulation · 2018-09-04 · The Poisson Process The standard assumption in many queuing models is that the arrival process is Poisson Two equivalent definitions of

26

Multiple v.s. Single Customer

Queue Configuration

1. The service provided can be

differentiated

Ex. Supermarket express

lanes

2. Labor specialization possible

3. Customer has more flexibility

4. Balking behavior may be

deterred

Several medium-length lines

are less intimidating than one

very long line

1. Guarantees fairness

FIFO applied to all arrivals

2. No customer anxiety

regarding choice of queue

3. Avoids “cutting in” problems

4. The most efficient set up for

minimizing time in the queue

5. Jockeying (line switching) is

avoided

Multiple Line Advantages Single Line Advantages

Page 27: Introduction - Simulation · 2018-09-04 · The Poisson Process The standard assumption in many queuing models is that the arrival process is Poisson Two equivalent definitions of

27

Components of a Basic Queuing

Process The Service Mechanism

Can involve one or several service facilities with one or several parallel service channels (servers) - Specification is required

The service provided by a server is characterized by its service time

Specification is required and typically involves data gathering and statistical analysis.

Most analytical queuing models are based on the assumption of exponentially distributed service times, with some generalizations.

The queue discipline Specifies the order by which jobs in the queue are being served.

Most commonly used principle is FIFO.

Other rules are, for example, LIFO, SPT, EDD…

Can entail prioritization based on customer type.

Page 28: Introduction - Simulation · 2018-09-04 · The Poisson Process The standard assumption in many queuing models is that the arrival process is Poisson Two equivalent definitions of

28

Mitigating Effects of Long

Queues1. Concealing the queue from arriving customers

Ex. Restaurants divert people to the bar or use pagers, amusement parks require people to buy tickets outside the park, banks broadcast news on TV at various stations along the queue, casinos snake night club queues through slot machine areas

2. Use the customer as a resourceEx. Patient filling out medical history form while waiting for physician

3. Making the customer’s wait comfortable and distracting their attention

Ex. Complementary drinks at restaurants, computer games, internet stations, food courts, shops, etc. at airports

4. Explain reason for the wait

5. Provide pessimistic estimates of the remaining wait timeWait seems shorter if a time estimate is given

6. Be fair and open about the queuing disciplines used

Page 29: Introduction - Simulation · 2018-09-04 · The Poisson Process The standard assumption in many queuing models is that the arrival process is Poisson Two equivalent definitions of

29

Queueing Modeling and System

Design• Two fundamental questions when designing (queuing)

systems – Which service level should we aim for?

– How much capacity should we acquire?

• The cost of increased capacity must be balanced against the cost reduction due to shorter waiting time Specify a waiting cost or a shortage cost accruing when

customers have to wait for service or…

… Specify an acceptable service level and minimize the capacity under this condition

• The shortage or waiting cost rate is situation dependent and often difficult to quantify Should reflect the monetary impact a delay has on the

organization where the queuing system resides

Page 30: Introduction - Simulation · 2018-09-04 · The Poisson Process The standard assumption in many queuing models is that the arrival process is Poisson Two equivalent definitions of

30

Analyzing Design-Cost Tradeoffs Given a specified shortage or waiting cost function the

analysis is straightforward

Define WC = Expected Waiting Cost (shortage cost) per time unit

SC = Expected Service Cost (capacity cost) per time unit

TC = Expected Total system cost per time unit

The objective is to minimize the total expected system cost

Min TC = WC + SC

Process capacity

Cost

WC

SC

TC

Page 31: Introduction - Simulation · 2018-09-04 · The Poisson Process The standard assumption in many queuing models is that the arrival process is Poisson Two equivalent definitions of

31

Analyzing Linear Waiting Costs

Expected Waiting Costs as a function of the number of customers in the system Cw = Waiting cost per customer and time unit

CwN = Waiting cost per time unit when N customers in the system

LCnPCWC w0n

nw

Expected Waiting Costs as a function of the number of customers in the queue

qwLCWC

Page 32: Introduction - Simulation · 2018-09-04 · The Poisson Process The standard assumption in many queuing models is that the arrival process is Poisson Two equivalent definitions of

32

Analyzing Service Costs

The expected service costs per time unit, SC, depend on the number of servers and their speed

Definitions c = Number of servers

= Average server intensity (average time to serve one customer)

CS() = Expected cost per server and time unit as a function of

SC = c*CS()

Page 33: Introduction - Simulation · 2018-09-04 · The Poisson Process The standard assumption in many queuing models is that the arrival process is Poisson Two equivalent definitions of

33

A Decision Model for System

DesignDetermining and c Both the number of servers and their speed can be varied

Usually only a few alternatives are available

Definitions

A= The set of available - options

WC)(CcTCMin s,...1,0c,A

Optimization:

Enumerate all interesting combinations of and c, compute TC and

choose the cheapest alternative

Page 34: Introduction - Simulation · 2018-09-04 · The Poisson Process The standard assumption in many queuing models is that the arrival process is Poisson Two equivalent definitions of

34

The Poisson Process

The standard assumption in many queuing models is that the arrival process is Poisson

Two equivalent definitions of the Poisson process

1. The times between arrivals are independent, identically distributed and exponential

2. X(t) is a Poisson process with arrival rate iff:a) X(t) have independent increments

b) For a small time interval h it holds that

P(exactly 1 event occurs in the interval [t, t+h]) = h + o(h)

P(more than 1 event occurs in the interval [t, t+h]) = o(h)

Page 35: Introduction - Simulation · 2018-09-04 · The Poisson Process The standard assumption in many queuing models is that the arrival process is Poisson Two equivalent definitions of

35

Properties of the Poisson

Process

Page 36: Introduction - Simulation · 2018-09-04 · The Poisson Process The standard assumption in many queuing models is that the arrival process is Poisson Two equivalent definitions of

36

Stochastic Processes in

Continuous Time

X(t)=# Calls

t