233CS Chapter 1
233CS Chapter 1
233CS Chapter 1
1.1The nature of simulation 1.2 Systems, Models and Simulation 1.3 Discrete-Event Simulation 1.3.1 Time-Advance Mechanisms 1.3.2 Components and organization of Discrete Event Simulation Model
Conceptions
Simulation course is about techniques for using computers to imitate or simulate the operations of various kinds of real world facilities or processes System: the facility or process of interest Model(): a set of assumptions about how the system works, which usually take the form of mathematical or logical relationships, constitute a model that is used to try to gain more understanding of how the corresponding system behaves. Analytic solution() : to obtain exact information on questions of intresets. Simulation) ( : use a computer to evaluate a model numerically, and data are gathered in order to estimate the desired true characteristics of the model.
3
Example
a manufacturing company contemplates building a large extension onto one of its plants, but is not sure if the potential gain in productivity would justify the construction cost.
Academic level
Winter Simulation Conference (600-700 people every year) It isone of the three important operationsresearch techniques (in serveys related to the use of operations research techniques: math programming, statistics, simulation) The second only to math programming among 13 techniques considered (in 1294 papers from the journal Interfaces from 1970 through 1992)
6
Impediments
Models used to study large-scale systems tend to be very complex, and writing computer programs to execute them can be an arduous task indeed. (excellent software products ) Large amount of computer time is sometimes required. (cheaper and faster computer) An unfortunate impression that simulation is just an exercise in computer programming, albeit a complicated one. (attitude, simulation methodology)
Continue...
Study on a system: try to gain some insight into the relationships among various components, or to predict performance under some new conditions being considered. Ways to study a system
System Experiment with a model of the system Physical model Mathematical model
Analytical solution
Figure 1.1 Ways to study a system
Simulation
10
Example
If one wants to study on a bank to determine the number of tellers needed to provide adequate service for customers who want just to cash a check or make a savings deposit, the system can be defined to be that portion of the bank consisting of the tellers and the customers waiting in line or being served. If the loan officer and the safety deposit boxes are to be included, the definition of the system must be expanded in an 11 obvious way.
12
Example 1.1
Single-server queuing system: a barbershop, to estimate the (expected) average delay in queue (line) of arriving customers
State variables: the status of the server (busy or idle), the number of customers waiting in queue to be served, the time of arrival of each person waiting in queue. Events: the arrival of a customer and the completion of service for a customer, which results in the customers departure.
14
1.3.1.Time-Advance Mechanism
Simulation clock: the variable in a simulation model that gives the current value of simulated time.
to keep track of the current value of simulated time as the simulation proceeds to advance simulated time from one value to another
Example 1.2
Notation:
16
e0
0
e1
t1
e2 e3
t2 c1
e4
t3
e5
c2 Time
A1
A2
A3
S1
S2
Figure 1.2 The next-event time-advance approach illustrated for the singleserver queuing system
17
Components
Initialization routine: A subprogram to initialize the simulation model at time 0 Timing routine: A subprogram that determines the next event from the event list and then advances the simulation clock to the time when that event is to occur Event routine: A subprogram that updates the system state when a particular type of event occurs (there is one event routine for each event type) Library routines: A set of subprograms used to generate random observations from probability distributions that were determined as part of the simulation model
19
Report generator: A subprogram that computes estimates (from the statistical counters) of the desired measures of performance and produces a report when the simulation ends Main program: A subprogram that invokes the timing routine to determine the next event and then transfers control to the corresponding event routine to update the system state appropriately. The main program may also check for termination and invoke the report generator when the simulation is over.
20
Start
Initialization routine
1. Set simulation 0 clock=0 2. Initialize system state and statistical counters 3. Initialize event list
Main program
0. Invoke the initialization routine 1. Invoke the timing routine Repeatedly 2. Invoke event routine 2 Event routine i 1.Update system state 2.Update statistical counters 3.Generate future events and add to event list Is simulation over? Report generator No 1
Time routine
1. Determine the next event type, say, i 2. Advance the simulation clock