II. Discrete Event Simulation Systems (DESS)

advertisement
II. Discrete Event Simulation
Systems (DESS)
M. Peter Jurkat
CS452/Mgt532 Simulation for Managerial Decisions
The Robert O. Anderson Schools of Management
University of New Mexico
6/27/2016
MPJ/UNM CS452/Mgt532 II. Discrete Event Simulation
1
How Various Models are Studied
Deterministic
Stochastic
Static
If simple, what’s to
study? If complex,
logical/algebraic
analysis
Monte Carlo Methods
Dynamic: Discrete
Event
Mechanistic and
Algorithms
Queuing Theory and
Discrete Event
Simulation
Dynamic: Continuous Numerical Solution of
Event
Difference and/or
Differential Equations
(DEs)
6/27/2016
MPJ/UNM CS452/Mgt532 II. Discrete Event Simulation
Stochastic DEs –
Advanced Topic
2
Basic Example:
Single Server Queue (SSQ)

Components:
» Single server (S) is idle or busy
» Queue (Q) – can also be a storage (e.g., garage)
» Entities to be served which
– Arrive at server,
– wait in queue if server busy, and
– then are served in turn and depart


Complex systems often consist of many servers
and queues (e.g., intersection, manufacturing
facility, computer network)
In some applications server(s) go to entities
(shop floor machine repair) – entities queued are
physically spread out
6/27/2016
MPJ/UNM CS452/Mgt532 II. Discrete Event Simulation
3
Definition and Scope





DESS consists of entities (E), e.g., UML classes,
and objects w/ attributes (A) & values (V); servers
(S); other resources (Qs, storage facilities, etc.)
In GPSS entities are transactions (x-acts)
Events (maybe documented in an UML event
table)
Process consists of entities moving through
system from server to server, being affected by
these servers, and possibly being stored and/or
affecting other parts of the system
Entities originate (enter the system) at sources
and terminate (leave) at sinks
6/27/2016
MPJ/UNM CS452/Mgt532 II. Discrete Event Simulation
4
Definition and Scope (cont.)

System described by variables, IVs and DVs,
which are classified as
»
»
»
»


Endogenous: values determined by system
Exogenous: values determined outside of system
Parameters: values set by investigator (exogenous)
State: minimal set of variables from whose values the
system can be completely described (SV)
Event is an activity which changes the state of
the system (i.e., changes the value of one or more
of the state variables)
Discrete event implies events only occur at
specific times between which system remains in
a given state
6/27/2016
MPJ/UNM CS452/Mgt532 II. Discrete Event Simulation
5
Example: Event Table for SSQ
Event
Trigger
Source
Arrive
Arrival
Activity
Response
Destination
Type
External E joins
system
SV + 1,
Q+1
Q or S
External
Serve E in Q
begins and S
idle
System
Service
begins
Q – 1,
S busy
S
State
Depart Service
over
System
E
leaves
system
SV – 1,
S idle
Outside
system
boundary
Time
State variable SV = number of entities E in system
For MIS majors: Create a UML/SQD for each event in a SSQ
6/27/2016
MPJ/UNM CS452/Mgt532 II. Discrete Event Simulation
6
Stochastic DES

Will concentrate on stochastic systems =>
probability distributes govern:
» type of events (e.g., which checkout counter to
queue at, whether to chance lines)
» intervals between events (e.g., arrivals)
» duration of events (e.g., service times)



For SSQ events are next arrival (can occur at
random time interval) and service completion
(can take randomly long)
Other IVs unique to system being modeled
DVs (system measures) somewhat standard
6/27/2016
MPJ/UNM CS452/Mgt532 II. Discrete Event Simulation
7




If randomness sufficiently
regular then model with
probability distribution
Distribution: table of possible
outcomes and their probability
Values of probabilities either
observed or postulated
To select event get uniform
random number in interval [0,1]
on vertical axis and move to right
– first cumulative bar
encountered is that of the event
(inverse function method)
6/27/2016
Probability
Random Variation in Simulation
1
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0
MPJ/UNM CS452/Mgt532 II. Discrete Event Simulation
Cumulative Probability
Probability of Event
Event Event Event Event
1
2
3
4
8
Outcomes or
System Measures (DVs)


Since inputs can be stochastic, output measures are likely
to be statistical
Averages, variances/standard deviations, and/or
proportions of
»
»
»
»
»



Storage levels, inventory/queue levels (e.g., number of entities in system)
Entity times in system (e.g., waiting time plus service time) or in Q, flow rate
Value added times, processing times
Resource utilizations (e.g., proportion of time server is busy)
Yield, output, products completed, entities served
“Usual 7”: standard set of seven DVs on pp30-33 and
others
Since results of stochs can be different for identical
parameters, cannot tell if differences are due to
parameters variation or statistical variation
Implies that if two systems are to be compared, statistical
tests for significant differences can be used to overcome
human judgment limitations
6/27/2016
MPJ/UNM CS452/Mgt532 II. Discrete Event Simulation
9
Simulation Representation

Simulation Table
» 2-D array which supports computation and display of system
variable values
» Rows may represent event occurrence times, entities, etc.
» Columns usually represent input, intermediate, and output
variables – entries in the table are their values

Example: Banks et al, Example 2.1, Table 2.10 (p31) and
supporting tables 2.2-2.9 (p25+)
» Made operational in Banks2t10-SSQ.xls


Spreadsheet ok for simple, often unrealistic systems but
cannot easily model complex ones – need software that
supports greater capability
See Banks et al, Chapter 4 for survey
6/27/2016
MPJ/UNM CS452/Mgt532 II. Discrete Event Simulation
10
Interlude 1: Time out to learn GPSS
Introduction to GPSS:
» 532-02-IntroToGPSS.ppt
» Banks et al, Section 4.5, p112-117
– see Figure 4.10, p114 for block diagram
– GPSS/H differs
» GPSS-ShortIntro.doc
» See Schriber (1991)
» Reference and Tutorial Manuals of GPSS World

Run Banks4Example2-1.gps - SSQ –
compare results to “usual 7” on pp32-33
6/27/2016
MPJ/UNM CS452/Mgt532 II. Discrete Event Simulation
11
Two Server Queuing System




6/27/2016
If queue before each server then system
consists of two SSQs unless queue switching is
allowed – need to specify logic and probability
of switching
For single queue and two servers need to
specify which server is used when system is
empty and a new arrival occurs
See Abel Baker Call Center system in Banks et
al, Example 2.2 (p35-39)
Run Banks4Example2-2.gps Abel-Baker Call
Center – compare Caller Delay to p38
MPJ/UNM CS452/Mgt532 II. Discrete Event Simulation
12
Assignment
3.
Abel-Baker: do the following exercises using GPSS –
examples will be considered in a laboratory session
a) Make 10 runs with 100 calls and 10 runs with 400
calls and for each run determine the 7 output
measures on pp30-33 - Measures 3 and 4 should be
calculated for Able and Baker individually - record
results in Excel and use two population tests on each
measure to see if there is a difference (t-test for
averages and z-test for proportions)
b) Investigate the difference between random
assignment of calls if both are idle as compared to
always having Abel take the call – two populations,
sample 10 replications of 400 callers each and test
differences
6/27/2016
MPJ/UNM CS452/Mgt532 II. Discrete Event Simulation
13
Extra Credit Assignment
(could be used for DESS project with sufficient
enhancements)
 ECA 1: Add Charlie, a third call taker to the
Abel-Baker Call Center. Charlie has a service
distribution one minute longer than Baker at
each of the four probabilities. Investigate the
difference between a random and hierarchical
call assignment.

ECA 2: Investigate to what extent Java has built
in classes/class libraries for list processing with
which queues and event lists could be
implemented. Use these with the code in
Section 4.4 to create a running simulation of the
grocery checkout counter.
6/27/2016
MPJ/UNM CS452/Mgt532 II. Discrete Event Simulation
14
Interlude 2: Statistical Testing

Single model: tests and
confidence intervals for:
» Mean: t-test (includes test for
the mean of differences in
paired samples from two
populations)
» Variance: c2-test
» Proportion: z-test
» Distributions: c2-test

Two models: tests for
differences in
» Means: paired and unpaired
t-test
» Variances: F-test
» Proportions: z-test
6/27/2016

More than two models:
» Means: ANOVA
» Proportions: c2-test

See
»
»
»
»

TestingHypotheses.doc,
StatisticalTestingInExcel.xls
SPSS (ASM Computer Lab)
Box, Hunter, and Hunter
(1978)
All except paired sample
tests assume independent
sample points
MPJ/UNM CS452/Mgt532 II. Discrete Event Simulation
15
Interlude 3: Excel
See Liengme (2003), ExcelTutorial.doc
 For next assignments review/learn

» rand() for uniform random number in (0,1) in
formulas
» vlookup() function for selecting event
» random number with given statistical
distribution using Analysis ToolPak Random
Number Generation procedure (Excel -> Tools > Data Analysis … -> Random Number
Generation)
6/27/2016
MPJ/UNM CS452/Mgt532 II. Discrete Event Simulation
16
How Various Models are Studied
Static
Deterministic
Stochastic
If simple, what’s to
study? If complex,
logical/algebraic
analysis
Monte Carlo
Methods
Dynamic: Discrete Mechanistic and
Event
Algorithms
Queuing Theory
and Discrete Event
Simulation
Dynamic:
Continuous Event
Stochastic DEs –
Advanced Topic
6/27/2016
Difference and/or
Differential
Equations (DEs)
MPJ/UNM CS452/Mgt532 II. Discrete Event Simulation
17
Monte Carlo Simulation




Although all stochastic simulations are Monte Carlo
simulations, the term is often reserved for static (a
single event) system
Parameters are varied randomly
Spreadsheet implementation often successful
Examples:
»
»
»
»

Company profits next quarter w/ interest rates, demand, supply
prices as parameters
Success of venture w/ sales, degree of technological success,
feature implementation as parameters
Measures of systems w/ no analytic description
Spreadsheet example: MonteCarlo-NewFab.xls
Multiple samples of single population – usually show
results as confidence intervals
6/27/2016
MPJ/UNM CS452/Mgt532 II. Discrete Event Simulation
18
Assignment
5.
6/27/2016
Elevator: Banks Exercise 2.8 – this may
be easier to do by hand rather than
programming all formulas into a
spreadsheet – can use Excel for random
numbers generation and calculation (use
vlookup() function as in Banks2t10SSQ.xls)
MPJ/UNM CS452/Mgt532 II. Discrete Event Simulation
19
“Newsboy” Problem


Order once for a given selling period
Examples:
» Perishable items (e.g., food, newspapers)
» Spare parts while factory setup exists
» Seasonable items



DV: Profit = Revenue from Sales
- Cost of Goods
- Excess Demand Lost Sales
+ Revenue from Salvage
Stochastic: demand, type of sales situation
See Banks et al, Example 2.3, pp40-43
6/27/2016
MPJ/UNM CS452/Mgt532 II. Discrete Event Simulation
20
Assignment
6. Mother’s Day Cards: Banks Exercise 11.10
 For now, develop the simulation only – the
expected total profit with an estimated error
will be considered later
 This may best be done with Excel
6/27/2016
MPJ/UNM CS452/Mgt532 II. Discrete Event Simulation
21
How Various Models are Studied
Static
Deterministic
Stochastic
If simple, what’s to
study? If complex,
logical/algebraic
analysis
Monte Carlo
Methods
Dynamic: Discrete Mechanistic and
Event
Algorithms
Queuing Theory
and Discrete Event
Simulation
Dynamic:
Continuous Event
Stochastic DEs –
Advanced Topic
6/27/2016
Difference and/or
Differential
Equations (DEs)
MPJ/UNM CS452/Mgt532 II. Discrete Event Simulation
22
Inventory Systems


Static: one order for a single selling period –
called “newsboy” problem – stochastic demand
Dynamic:
» Stocking for extended selling period – stochastic
demand
» Reorders can be periodic or at random times
» Reorders can be specified amount or enough to
achieve a given inventory level (warehouse capacity?)
» Backorders may or may not be allowed – if not sales
are lost or reorder costs are at retail

Usual DV is total cost or profit over given time –
for long time periods use discounted cash flow
6/27/2016
MPJ/UNM CS452/Mgt532 II. Discrete Event Simulation
23
(M, N) Inventory System



Reorders occur at a given intervals N units long –
lead time may be zero or greater
Reorders are enough to bring inventory level up
to M units after backorders satisfied
Events:
» Demand for items from inventory
» Review of inventory position
» Order and receipt of order from supplier


Stochastic: demand, lead time
See Banks et al, Example 2.4, in
Banks4Exmpl2-4Inv.gps
6/27/2016
MPJ/UNM CS452/Mgt532 II. Discrete Event Simulation
24
Assignment
4.
Inventory Policy: Banks Exercise 11.6a
For now just create the simulation and make the four
required replications.
Banks4Example2-4Inventory.gps implements an (M, N)
inventory model similar to that described in Example
2.4 starting on page 44. Start with this program and
modify it to
(1) add a reorder point as required by Exercise 11.6 and
(2) code/procedures to account for costs as specified
in Exercise 11.6.
This problem will be considered in a computer
laboratory session.
6/27/2016
MPJ/UNM CS452/Mgt532 II. Discrete Event Simulation
25
Discrete Event Simulation
Systems
Creation of simulation table, clock, list
(queue) processing, and output measures
has long been automated in simulation
software
 See Banks et al, Chapters 3 and 4, for the
principles behind such software and
current implementation
 Section 4.4 provides some Java classes

6/27/2016
MPJ/UNM CS452/Mgt532 II. Discrete Event Simulation
26
DESS Implementation

Based on classifying activities into
» B types (bound to occur) and
» C types (will occur based on conditions)

FEL (future event list): whenever one or more events are
to occur
» Add them and their times to the FEL
» Sort all events in the FEL by their times in increasing order

Three phases in each cycle
» Phase A: remove the next event(s) to occur from the FEL and set
the simulation clock to the time of its/their occurrence
» Phase B: execute all B type events (may change system state)
» Phase C: execute all C type events if their conditions are true –
may need to recycle through Phase B and C

FEL and general list processing is hard to implement in a
spreadsheet – use special purpose software
6/27/2016
MPJ/UNM CS452/Mgt532 II. Discrete Event Simulation
27
Download