system simulation dr. dessouky. description simulation is a very powerful and widely used management...

Download System Simulation Dr. Dessouky. Description Simulation is a very powerful and widely used management science technique for the analysis and study of complex

If you can't read please download the document

Upload: evan-wiggins

Post on 17-Dec-2015

212 views

Category:

Documents


0 download

TRANSCRIPT

  • Slide 1
  • System Simulation Dr. Dessouky
  • Slide 2
  • Description Simulation is a very powerful and widely used management science technique for the analysis and study of complex systems. Simulation may be defined as a technique that imitates the operation of a real-world system as it evolves over time. This is normally done by developing a simulation model. A simulation model usually takes the form of a set of assumptions about the operation of the system, expressed as mathematical or logical relations between the objects of interest in the system. Simulation has its advantages and disadvantages. We will focus our attention on simulation models and the simulation technique.
  • Slide 3
  • Simulation What is simulation: The process of designing a mathematical or logical model of a real-system and then conducting computer-based experiments with the model to describe, explain, and predict the behavior of the real system.
  • Slide 4
  • Simulation Where simulation fits in Simulation Programming Analysis Modeling Probability & Statistics
  • Slide 5
  • Basic Terminology In most simulation studies, we are concerned with the simulation of some system. Thus, in order to model a system, we must understand the concept of a system. Definition: A system is a collection of entities that act and interact toward the accomplishment of some logical end. Systems generally tend to be dynamic their status changes over time. To describe this status, we use the concept of the state of a system.
  • Slide 6
  • Example Simulation Model Ford - # of Panels per day (throughput) Emergency Room (beds, doctors, nurses), (minor, moderate, major, critical) TRW Ballistic Missile Survivability against Soviet Threat Paramount Farms Pistachio Miami University Parking HMT Disks Throughput Christopher Ranch Garlic Capacity Power Integration Semiconductor Capacity, and random machine down times
  • Slide 7
  • Value of Simulation Empirical Method verses mathematical model Allow you to calculate the extreme values not just the expected value
  • Slide 8
  • Simulation What is simulation Simulation is the actual running of the model system to gain insight into its performance.
  • Slide 9
  • Simulation Why use simulation Simulation is used to better understand the expected performance of the real system and to test the effectiveness of the system design.
  • Slide 10
  • Simulation Why use simulation Without building them experimental system new concepts Without disturbing them costly experimentation unsafe experimentation. Without destroying them Determine limits of stress
  • Slide 11
  • Queuing systems Performance measures (output) Data requirements (input) Uses of model Kendalls notation
  • Slide 12
  • Queuing systems System Performance measures (outputs) Expected number of customers in system Expected number of customers in queue Expected time in system Expected time in queue Server utilization Probability of n customers in system Throughput
  • Slide 13
  • Queuing systems Data requirements (Inputs) Interarrival time distribution Service time distribution Number of servers Queue discipline System capacity Size of input population Kendalls notation (M/M/s/FCFS/K/M)
  • Slide 14
  • Alternative to simulation Simulation Analytic models Physical experimentation Visit other sites
  • Slide 15
  • Simulation vs. analytic modeling Advantage: various performance measures greater realism easier to understand model the steady-state as well as the transit behavior. Disadvantage: May not provide you with the optimal solution time to construct model will be longer.
  • Slide 16
  • Simulation vs. Physical Advantage: High Speed Not disruptive Replication easy Control variations Generally less costly Disadvantage: Realism Validity
  • Slide 17
  • Simulation vs. Alternatives VASP Realism VA VASP Cost
  • Slide 18
  • Representing system System: a collection of mutually interacting objects designed to accomplish a goal (machines repair system) Entities: denotes an element/object within boundary of system (machines, operators, repairman) Entity work being performed on object Resource performing the work
  • Slide 19
  • Representing system Attribute: Characteristic or property or an entity (machine ID, Type of breakdown, time that machine went down) Activity: transforms the state of an object usually over some time (repairman service time, machine run time)
  • Slide 20
  • Representing system State of the system: Numeric values that contain all the information necessary to describe the system at any time. Delays: Processes that take a conditional length of time in the system
  • Slide 21
  • Representing system Events: Change the state of the system(end of service of machine,machine breaks down) Queue: it is set, used to model waiting
  • Slide 22
  • Ex. Elevator systems Entities Elevators, people Sets People waiting at each floor Attributes Elevators capacity, speed, destination, current location of each elevator People inter-arrival time at each floor, destination of each people
  • Slide 23
  • Ex. Elevator systems State of system: # of people on each elevator # of people in each floor Activities Load/Unloading passenger Travel to next floor (speed and distance) Persons travel to elevator
  • Slide 24
  • Ex. Elevator systems Delays: Persons waiting for elevator Events: Elevator arrival End unloading End Loading Person Arrival
  • Slide 25
  • Static Simulation vs. Dynamic Simulation There are two types of simulation models, static and dynamic. Definition: A static simulation model is a representation of a system at a particular point in time. We usually refer to a static simulation as a Monte Carlo simulation.
  • Slide 26
  • Static Simulation vs. Dynamic Simulation Definition: A dynamic simulation is a representation of a system as it evolves over time. Within these two classifications, a simulation may be deterministic or stochastic. A deterministic simulation model is one that contains no random variables; a stochastic simulation model contains one or more random variables.
  • Slide 27
  • Discrete Event vs. Continuous Event Simulation Discrete event: state of system changes only at discrete points in time(events) ex. Machine repair problem Programming Look at system only when events occur; time is advanced from event to event.
  • Slide 28
  • Discrete Event vs. Continuous Event Simulation Continuous event: state of system changes continuously over time Ex. Level of fluid in tank Programming: Advances time in small intervals. Use differential equations to represent flows.
  • Slide 29
  • An Example of a Discrete-Event Simulation To simulate a queuing system, we first have to describe it. We assume arrivals are drawn from an infinite calling population. There is unlimited waiting room capacity, and customers will be serve in the order of their arrival (FCFS). Arrivals occur one at a time in a random fashion. All arrivals are eventually served with the distribution of service teams as shown in the book.
  • Slide 30
  • Service times are also assumed to be random. After service, all customers return to the calling population. For this example, we use the following variables to define the state of the system: (1) the number of customers in the system; (2) the status of the server that is, whether the server is busy or idle; and (3)the time of the next arrival. An event is defined as a situation that causes the state of the system to change instantaneously.
  • Slide 31
  • All the information about them is maintained in a list called the event list. Time in a simulation is maintained using a variable called the clock time. We begin this simulation with an empty system and arbitrarily assume that our first event, an arrival, takes place at clock time 0. Next we schedule the departure time of the first customer. Departure time = clock time now + generated service time
  • Slide 32
  • Also, we now schedule the next arrival into the system by randomly generating an interarrival time from the interarrival time distribution and setting the arrival time as Arrival time = clock time now + generated interarrival time Both these events are their scheduled times are maintained on the event list. This approach of simulation is called the next-event time-advance mechanism, because of the way the clock time is updated. We advance the simulation clock to the time of the most imminent event.
  • Slide 33
  • As we move from event to event, we carry out the appropriate actions for each event, including any scheduling of future events. The jump to the next event in the next-event mechanism may be a large one or a small one; that is, the jumps in this method are variable in size. We contrast this approach with the fixed-increment time-advance method. With this method, we advance the simulation clock in increments of t time units, where t is some appropriate time unit, usually 1 time unit.
  • Slide 34
  • For most models, however, the next event mechanism tends to be more efficient computationally. Consequently, we use only the next-event approach for the development of the models for the rest of the chapter. To demonstrate the simulation model, we need to define several variables: TM = clock time of the simulation AT = scheduled time of the next arrival
  • Slide 35
  • DT = scheduled time of the next departure SS = status of the server (1=busy, 0=idle) WL = length of the waiting line MX = length (in time units) of a simulation run We now begin the simulation by initializing all the variables. This simple example illustrates some of the basic concepts in simulation and the way in which simulation can be used to analyze a particular problem.
  • Slide 36
  • World View The Structure concepts and views under which the simulation is guided for the development of the simulation model Event Orientation defines the changes in state that occur at each event time Process Orientation describes the process through which the entities in the system flow Activity Scanning Orientation describes the activities in which the entities in the system engage
  • Slide 37
  • Discrete Event Simulation Event scheduling Write modules that describe changes in the state of the system at each event Main program advances time One subprogram for each event General purpose programming language
  • Slide 38
  • Discrete Event Simulation Process interaction Write modules that describe the progress of entities through the system As entities move the systems changes state Entities are held to represent activities and delays Promodel programming language
  • Slide 39
  • Event scheduling Time is advanced from event to event Future events list ordered list of upcoming events As events are scheduled, they are added to the list As events occur they are removed from list Activities in event ( one / event type)
  • Slide 40
  • Event scheduling List is required to keep track of entities in a set Statistics Two types Sample statistics average of some values (W) W = (W 1 +W 2 + +W n )/n = Total Wait / # of wait Time average statistics time weighted (L) L = (0(t 1 ) + 1(t 2 -t 1 ) + 2(t 3 -t 2 ) + 1(t 4 -t 3 )) / t 4
  • Slide 41
  • Activity scanning Time is modeled in fixed time increments to check if activity occurred Small time increments is inefficient Large time increments may miss activity describes the activities in which the entities in the system engage.
  • Slide 42
  • Process Oriented Process oriented: Many simulation models include elements which occur in defined patterns The logic associated with such a system or events can be generalized and defined by a single statement A simulation language could then translate such statement into the appropriate sequence of events describes the processes through which the entities in the system flow.
  • Slide 43
  • Process Oriented Process oriented: These statements, define a sequence of events which are automatically executed by the simulation language as the entities move through the process Create arrival entities every t time units However, since we are normally restricted to a set of standardized statement, provided by the simulation language, our model flexibility is not as great as with the event condition
  • Slide 44
  • Feature provided by a language Conceptual framework(entities, attributes, resource, queues) Maintenance of event list Random variable generation Animation Debugging function Output analysis Input analysis Report generation
  • Slide 45
  • Simulation Languages One of the most important aspects of a simulation study is the computer programming. Several special-purpose computer simulation languages have been developed to simplify programming. The best known and most readily available simulation languages, including GPSS, GASP IV and SLAM. Most simulation languages use one of two different modeling approaches or orientations; event scheduling or process interaction.
  • Slide 46
  • GPSS uses the process-interaction approach. SLAM allows the modeler to use either approach or even a mixture of the two, whichever is the most appropriate for the model being analyzed. Of the general-purpose languages, FORTRAN is the most commonly used in simulation. In fact, several simulation languages, including GASP IV and SLAM, use a FORTRAN base.
  • Slide 47
  • To use GASP IV we must provide a main program, an initialization routine, and the event routines. For the rest of the program, we use the GASP routines. Because of these prewritten routines, GASP IV provides a great deal of programming flexibility. GPSS, in contrast to GASP, is a highly structured special-purpose language. GPSS does not require writing a program in the usual sense.
  • Slide 48
  • Building a GPSS model then consist of combining these sets of blocks into a flow diagram so that it represents the path an entity takes as it passes through the system. SLAM was developed by Pritsket and Pegden (1979). It allows us to develop simulation model as network models, discrete-event models, continuous models, or any combination of these.
  • Slide 49
  • The decision of which language to use is one of the most important that a modeler or an analyst must make in performing a simulation study. The simulation language offer several advantages. The most important of these is that the special- purpose languages provide a natural framework for simulation modeling and most of the features needed in programming a simulation model.
  • Slide 50
  • The Simulation Modeling Steps We now discuss the process for a complete simulation study and present a systematic approach of carrying out a simulation. A simulation study normally consists of several distinct stages. (See Figure in the book) However, not all simulation studies consist of all these stages or follow the order stated here. On the other hand, there may even be considerable overlap between some of these stages.
  • Slide 51
  • Problem/Model Formulation State the objective of the study. Identify the Problem. Determine any underlying causes if possible. Determine the input variables. Controllable Variables. Uncontrollable Variables. Make assumptions / boundaries that were used to simplify the model. Determine Performance measures used to measure the objective. (Output)
  • Slide 52
  • Data collection/acquisition Determine the Data Collection System or Estimates to be used. Observe the system Historical or Similar Systems Theoretical Estimates Engineering Estimates Operator Estimates Vendor Estimates Identify the data collected. How it was collected. How it was represented in the model.
  • Slide 53
  • Model Construction or Development Identify The Real System Determine Conceptual Model -Activities and Events Develop the Logical Model. Identify the Programming Language used. Computer Implementation (Promodel, Arena, Slam Systems).
  • Slide 54
  • Model Construction or Development Modeling Tips Art vs. Science Over Simplification vs. Unnecessary Detail Start Simple Add stronger assumptions
  • Slide 55
  • Model Verification and Validation Verification: Determining whether simulation model works as intended. Verifying the Model. Structure: Walk Through of the Model Debugger. Trace = print or writing in process calculations. Animation. Model testing Analytical Model.
  • Slide 56
  • Model Verification and Validation Verification. Logical Model. Are events represented correctly? Are mathematical formulas and relationships correct? Are statistical measures formulated correctly? Computer Model/Simulation Model. Does the code contain all aspects of the logical model? Are the statistics and formulas calculated correctly? Does the model contain coding errors?
  • Slide 57
  • Model Verification and Validation Validation:Determine whether Simulation of The Model is a credible representation of a Real System. Compare the model with the actual systems by performing statistical tests. T-Test & C.I. Conceptual Model. Does the model contain all relevant elements, events and relationships? Will the model answer the questions of concern?
  • Slide 58
  • Model Verification and Validation Logical Model. Does the model contain all events included in the conceptual model? Does the model contain all the relationships of the conceptual model? Computer Model/Simulation Model. Is the computer model a valid representation of the real system? Can the computer model duplicate the performance of the real system? Does the computer model output have credibility with system experts and decision makers?
  • Slide 59
  • Experimentation and Analysis of Results Experimentation The execution of the simulation model to obtain output values Analysis of Results The process of analyzing the simulation outputs to draw inferences and make recommendations for problem resolution
  • Slide 60
  • Implementation and Documentation The process of implementing decisions resulting from the simulation and documenting the model and its use.
  • Slide 61
  • Manual Simulation Example Given the following arrival times for a single server system what will be the average number in the queue, average number in the system, average time in system, average time in queue, the number of completed jobs, number in the queue, number in the system, and server utilization at time 15 if the service time is 3 time units for each entity. 1, 3, 5, 9,13,15,17
  • Slide 62
  • Data Collection Activities may be represented as Constants Random variables Collection of data Design a data collection form Record more than single attribute in case you need to use data in a different way. Use several session to get representative data Use control charts
  • Slide 63
  • Data Collection MachineBegin RepairEnd RepairTime Elapsed
  • Slide 64
  • Data Collection Testing data Independence Randomness Homogeneity
  • Slide 65
  • Data Collection Test of Independence Ho: Measure A is independent of measure B H1: Measure A is not independent of measure B. Inventory and day of week
  • Slide 66
  • Data Collection Test of Randomness Ho: f(xi/xj) = f(xi) =Independent Hi: f(xi/xj) f(xi) : Dependent For example, when simulation a production process in which the items can be defective or good, it would be important to know if successive items are randomly distributed with reputation good items followed by some of defective items.
  • Slide 67
  • Data Collection Test of Homogeneity Tests for whether multiple sets of data can be considered as coming from statistical population are generally referred to as tests of homogeneity distribution free. Ho : G(x) =H(x) H1 : G(x) H(x) Two different workers working on the same machine.
  • Slide 68
  • Random Variable Two types Discrete Continuous
  • Slide 69
  • Random Variable Probability mass function Discrete P(X = x i ) = p(x i ) p(x i ) = 1
  • Slide 70
  • Random Variable Probability density function Continuous f(x) = e x x > 0 P(X = a) = 0 - f(x) dx = 1 P(a < x < b) = a b f(x) dx
  • Slide 71
  • Random Variable Cumulative distribution function (CDF) F(X) = P(X
  • Selecting a Distribution Theoretical prior knowledge Random arrival => exponential IAT Sum of large manufactures => Normal CLT Compare histogram with probability mass or probability density
  • Slide 92
  • Data Collection Little variability model as a constant. Variability model as a random variable. Empirical vs. Theoretical, Select a Distribution, Estimate Parameter of distribution, goodness or fit test.
  • Slide 93
  • X 2 goodness of fit test Compare observed versus theoretical density A collection of data can be as a sample from a specified p.d.f H 0 : Xis are IID r.v. with density f(x) H 1 : Xis are not IID r.v. with density f(x)
  • Slide 94
  • X 2 goodness of fit test Critical value If H 0 is true, TS ~ X 2 k-1-(# of par estimated), A large T.S.would cause rejection of H 0 Reject H o if T.S. > X 2 critical
  • Slide 95
  • X 2 goodness of fit test Issues test is an art Number of intervals > 2 Size of intervals: Ei ~ same > 5 Requires relatively large amount of data
  • Slide 96
  • K-S test Compare observed with theoretical CDF Limited to continuous distribution, known parameters H 0 : X i are IID r.v. with CDF F(x) H 1 : X i are not IID r.v. with CDF F(x) Test statistic From table
  • Slide 97
  • K-S test Critical value A large T.S would cause rejection Critical value
  • Slide 98
  • Parameter estimation Set of datax 1, x 2, x m Methods of moments => equate E(X), V(X) to x and S 2
  • Slide 99
  • Parameter estimation Maximum likelihood => find parameter that max the likelihood of obtaining the given sample Produces efficient and consistent estimates Not always unbiased Superior properties to methods of moments Common sense.
  • Slide 100
  • Statistical Analysis of Simulations As previously mentioned, output data from simulation always exhibit random variability, since random variables are input to the simulation model. We must utilize statistical methods to analyze output from simulations. The overall measure of variability is generally stated in the form of a confidence interval at a given level of confidence. Thus, the purpose of the statistical analysis is to estimate this confidence interval.
  • Slide 101
  • Output analysis Need multiple observations to estimate variability Y1, Y2, Y3, . Yn Estimate a confidence interval for the measure of performance Estimate the number of observations required to obtain the desired precision
  • Slide 102
  • Output analysis What is an observation? Is observation a sample statistic or time average statistic? Is this a steady state simulation or terminating simulation? Are the observations independent or correlated?
  • Slide 103
  • Terminating vs Steady State Simulation Often, the type of model determines which type of output analysis is appropriate for a particular simulation. However, the system or model may not always be the best indicator of which simulation would be the most appropriate. It is quite possible to use the terminating simulation approach for systems more suited to steady-state simulations, and vice versa.
  • Slide 104
  • Observation vs Time Based Observation (Sample) Average Time In System Average Time In Queue Time Based Average Number in System Average Number in Queue Machine Utilization
  • Slide 105
  • Terminating simulation Simulation in which the output measure of performance is defined over a specific interval of time with a specific starting condition and a specific ending condition Retail sales during a business day Project network Time to produce a batch of parts in a work cell Military Simulations
  • Slide 106
  • Terminating simulation Has a specified starting and ending condition. Each observation must have the same starting and ending. Observations are obtained by replication. Use a different seed for random number generation.
  • Slide 107
  • Steady state simulation Simulation in which the output measure of performance is defined over an infinite interval of time independent of the initial state of the system and stopping condition Average production from an assembly line of well trained employees Inventory simulation
  • Slide 108
  • Steady state simulation Independent of starting and ending condition. Remove initial condition bias Specify warm-up period (transient period). Set initial condition too steady state. Have a very long run length
  • Slide 109
  • Steady state simulation 1. Individual Yi average of individuals. 2. Replication Yi average of each one. 3. Batch means batch by time, by number.
  • Slide 110
  • Terminating vs. Steady state simulation Terminating Observations are obtained by replication Each observation must reflect the specified starting and ending condition Use a different seed for each replication Y1, Y2, , Yr => one independent observation per replication
  • Slide 111
  • Confidence interval for steady state simulation Y1, Y2, . Yn Trying to estimate a long run performance measure independent of starting and ending conditions Two problems Initial condition bias Dependent observations
  • Slide 112
  • Confidence interval for steady state simulation Outline Removing initial condition bias Creating independent observation Replication/ deletion Batch means
  • Slide 113
  • Confidence interval for replication Let Y1, Y2, and Y3YR be measures of performance from R independent replication. Independent -> different seed for each run
  • Slide 114
  • Confidence interval for replication Approximate due to need for Yi ~ Normal (1- ) Confidence Interval => Probability of containing true mean
  • Slide 115
  • Number of replication needed Suppose we desire a confidence interval Based on a preliminary run of R 0 replication, we have an estimate of S 2 and confidence interval
  • Slide 116
  • Number of replication needed Find R such that If R is large,
  • Slide 117
  • Test for comparing two means
  • Slide 118
  • Test for comparing two means Equal Variance
  • Slide 119
  • Test for comparing two means
  • Slide 120
  • Slide 121
  • Test for comparing two means Unequal Variance
  • Slide 122
  • Test for comparing two means
  • Slide 123
  • Test for comparing two variances
  • Slide 124
  • Common Random Number The process of comparing cases with the same set of random numbers creating identical condition Observation Confident Interval Use the paired test
  • Slide 125
  • Random Numbers Generation of U(0,1) random number algorithm used by the RND function Generation of random variates from various distributions algorithm used by EXPONENTIAL, UNIFORM, and so on (these algorithms use U(0,1) random numbers.
  • Slide 126
  • Random Number Generation Desirable properties Fast and efficient Capable of repeating same sequence Statistically equivalent to U(0,1) Independent and dense Large cycle length or period Low storage requirements Old method tables
  • Slide 127
  • Random Number Generation Pseudo random number generators A non random sequence of numbers each completely determined by its predecessor, the algorithm, and initially, the seed.
  • Slide 128
  • Linear Congruential Generator Z i = ( a * Z i-1 + C ) mod m Z 0 = seed U i = Z i / m (Random Number) If we choose a, C, and m correctly, => then we achieve a maximum period 0
  • Acceptance\Rejection Method Applicable to distribution functions that are hard to integrate Idea Find a majoring function t(x) where t(x) > f(x) Sample values of x from t(x) call it x* Sample Ui < f(x*) / t(x*), accept x* Simplification for this class we will always use a rectangular majoring function
  • Slide 144
  • 9.3 Random Numbers and Monte Carol Simulation The procedure of generating these times from the given probability distributions is known as sampling from probability distributions, or random variate generation, or Monte Carlo sampling. We will discuss several different methods of sampling from discrete distributions. The principle of sampling from discrete distributions is based on the frequency interpretation of probability.
  • Slide 145
  • In addition to obtaining the right frequencies, the sampling procedure should be independent; that is, each generated service time should be independent of the service times that precede it and follow it. This procedure of segmentation and using a roulette wheel is equivalent to generating integer random numbers between 00 and 99. This follows from the fact that each random number in a sequence has an equal probability of showing up, and each random number is independent of the numbers that precede and follow it.
  • Slide 146
  • A random number, R i, is defined as an independent random sample drawn from a continuous uniform distribution whose probability density function (pdf) is given by
  • Slide 147
  • Random Number Generators Since our interest in random numbers is for use within simulations, we need to be able to generate them on a computer. This is done by using mathematical functions called random number generators. Most random number generators use some form of a congruential relationships. Examples of such generators include linear congruential generator, the multiplicative generator, and the mixed generator. The lineal congruential generator is by far the most widely used.
  • Slide 148
  • Each random number generated using this methods will be a decimal number between 0 and 1. Random numbers generated using congruential methods are called pseudorandom numbers. Random number generators must have these important characteristics: 1.The routine must be fast 2.The routine should not require a lot of core storage 3.The random numbers should be replicable; and 4.The routine should have a sufficiently long cycle
  • Slide 149
  • Most programming languages have built-in library functions that provide random (or pseudorandom) numbers directly.
  • Slide 150
  • Computer Generation of Random Numbers We now take the method of Monte Carlo sampling a stage further and develop a procedure using random numbers generated on a computer. The idea is to transform the U(0,1) random numbers into integer random numbers between 00 and 99 and then to use these integer random numbers to achieve the segmentation by numbers. We now formalize this procedure and use it to generate random variates for a discrete random variable.
  • Slide 151
  • The procedure consists of two steps: 1.We develop the cumulative probability distribution (cdf) for the given random variable, and 2.We use the cdf to allocate the integer random numbers directly to the various values of the random variables.
  • Slide 152
  • 9.4 An Example of Monte Carlo Simulation The book uses a Monte Carlo simulation to simulate a news vendor problem. The procedure in this simulation is different from the queuing simulation, in that the present simulation does not evolve over time in the same way. Here, every day is an independent simulation. Such simulations are commonly referred to as Monte Carlo simulations.
  • Slide 153
  • 9.5 Simulations with Continuous Random Variables In many simulations, it is more realistic and practical to use continuous random variables. We present and discuss several procedures for generating random variates from continuous distributions. The basic principle is similar to the discrete case. We first generate U(0,1) random number and then transform it into a random variate from the specified distribution.
  • Slide 154
  • The selection of a particular algorithm will depend on the distribution from which we want to generate, taking into account such factors as the exactness of the random variables, the computations and storage efficiencies, and the complexity of the algorithm. The two most common used algorithms are the inverse transformation method (ITM) and the acceptance-rejection method (ARM).
  • Slide 155
  • Inverse Transformation Method The inverse transformation method is generally used for distribution whose cumulative distribution function can be obtained in closed form. Examples include the exponential, the uniform, the triangular, and the Weibull distributions. For distributions whose cdf does not exist in closed form, it may be possible to use some numerical method, such as a power-series expansion, within the algorithm to evaluate the cdf.
  • Slide 156
  • The ITM is relatively easy to describe and execute. It consists of the following steps: Step1: Given the probability density formula f(x) for a random variable X, obtain the cumulative distribution function F(x) as Step 2: Generate a random number r. Step 3: Set F(x) = r and solve for x.
  • Slide 157
  • We consider the distribution given by the function A function of this type is called a ramp function. To obtain random variates from the distribution using the inverse transformation method, we first computer the cdf as 0 x 2 otherwise
  • Slide 158
  • In Step 2, we generate a random number r. Finally, in Step 3, we set F(x) =r and solve for x. Since the service time are defined only for positive values of x, a service time of as the solution for x. This equation is called a random variate generator or a process generator. Thus, to obtain a service time, we first generate a random number and then transform it using the preceding equation.
  • Slide 159
  • As this example shows, the major advantage of the inverse transformation method is its simplicity and ease of application.
  • Slide 160
  • Acceptance Rejection Method There are several important distributions, including the Erlang (used in queuing models) and the beta (used in PERT), whose cumulative distribution functions do not exist in closed form. For these distributions, we must resort to other methods of generating random variates, one of which is the acceptance rejection method (ARM). This method is generally used for distributions whose domains are defined over finite intervals.
  • Slide 161
  • Given a distribution whose pdf, f(x), is defined over the interval a x b, the algorithm consists of the following steps: Step 1: Select a constant M such that M is the largest value of f(x) over the interval [a, b]. Step 2: Generate two random numbers, r 1 and r 2. Step 3: Computer x* = a + (b a)r1. (This ensures that each member of [a, b] has an equal chance to be chosen as x*.) Step 4: Evaluate the function f(x) at the point x*. Let this be f(x*).
  • Slide 162
  • Step 5: If deliver x* as a random variate from the distribution whose pdf is f(x). Otherwise, reject x* and go back to Step 2. Note that the algorithm continues looping back to Step 2 until a random variate is accepted. This may take several iterations. For this reason, the algorithm can be relatively inefficient. The efficiency, however, is highly dependent on the shape of the distribution.
  • Slide 163
  • There are several ways by which the method can be made more efficient. One of these is to use a function in Step 1 instead of a constant. We now give an intuitive justification of the validity of the ARM. In particular, we want to show that the ARM does generate observations from the given random variable X.
  • Slide 164
  • Direct and Convolution Methods for the Normal Distribution Both the inverse transformation method and the acceptance reject method are inappropriate for the normal distribution, because (1) the cdf does not equal in closed form and (2) the distribution is not defined over a finite interval. Other methods such as an algorithm based on convolution techniques, and then a direct transformation algorithm that produces two standard normal variates with mean 0 and variance 1.
  • Slide 165
  • The Convolution Algorithm In the convolution algorithm, we make direct use of the Central Limit Theorem. The Central Limit Theorem states that the sum Y of n independent and identically distributed random variables ( say Y 1, Y 2,Y n ), each with mean and finite variance 2 ) is approximately normally distributed with mean n and variance n 2. If we want to generate a normal variate X with mean and variance 2, we first generate Z using this process generator then transform it using the relation X = + Z. Unique to normal distribution.
  • Slide 166
  • The Direct Method The direct methods for the normal distribution was developed by Box and Muller (1958). Its not as efficient as some of the newer techniques, it is easy to apply and execute. The algorithm generates two U(0,1) random numbers, r 1 and r 2, and then transforms them into two normal variates, each with mean 0 and variance 1, using the direct transformation.
  • Slide 167
  • It is easy to transform these standardized normal variates intro normal variates X1 and X2 from the distribution with mean and variance 2, using the equations
  • Slide 168
  • 9.6 An Example of a Stochastic Simulation Cabot Inc. is a large mail order firm in Chicago. Orders arrive into the warehouse via telephones. At present, Cabot maintains 10 operators on-line 24 hours a day. The operators take the orders and feed them directly into a central computer, using terminals. Each operator has one terminal. At present, the company has a total of 11 terminals. That is, if all terminals are working, there will be 1 spare terminal.
  • Slide 169
  • Cabot managers believe that the terminal system needs evaluation, because the downtime of operators due to broken terminals has been excessive. They feel that the problem can be solved by the purchase of some additional terminals for the spares pool. It has been determined that a new terminal will cost a total of $75 per week. It has also been determined that the cost of terminal downtime, in terms of delays, lost orders, and so on is $1000 per week.
  • Slide 170
  • Given this information, the Cabot managers would like to determine how many additional terminals they should purchase. This model is a version of the machine repair problem. It is easy to find an analytical solution to the problem using the birth-death processes. However, in analyzing the historical data for the terminals, it has been determined that although the breakdown times can be represented by the exponential distribution, the repair times can be adequately represented only by the exponential distribution.
  • Slide 171
  • This implies that analytical methods cannot be used and that we must use simulation. To simulate this system, we first require the parameters of both the distributions. The data show that the breakdown rate is exponential and equal to 1 per week per terminal. In other words, the time breakdowns for a terminal is exponential with a mean equal to 1 week. Analysis for the repair times shows that this distribution can be represented by the triangular distribution which has a mean of 0.075 week.
  • Slide 172
  • The repair stuff on average can repair 13.33 terminals per week. To find the optimal number of terminals, we must balance the cost of the additional terminals against the increased revenues generated as a result of the increase in the number of terminals. In this simulation we increase the number of terminals in the system, n, from the present total of 11 in increments of 1.
  • Slide 173
  • For this fixed value of n, we then run our simulation model to estimate the net revenue. Net revenue here is defined as the difference between the increase in revenues due to the additional terminals and the cost of these additional terminals. We keep on adding terminals until the net revenue position reaches a peak. To calculate the net revenue, we first computer the average number of on-line terminals, EL n, for a fixed number of terminals in the system, n.
  • Slide 174
  • Once we have a value of EL n, we can computer the expected weekly downtime costs, given by 1000(10-EL n ). Then the increase in revenue as a result of increasing the number of terminals from 11 to n is 1000(EL n EL 11 ). Mathematically, we compute EL n
  • Slide 175
  • where T = length of simulation N(t) = number of terminals on-line at time t (0tT) A i = area of rectangle under N(t) between e i-1 and e i (where e i is the time of the ith event) m = number of events that occur in the interval [0,T] Between time 0 and time e 1, the time of the first event, the total on-line time for all the terminals is given by 10e i, since each terminal is on-line for a period of e 1 time units.
  • Slide 176
  • If we now run this simulation over T time units and sum up the areas A 1, A 2, A 3,, we can get an estimate for EL10 by dividing this sum by T. This statistic is called a time-average statistic. We would like to set up the process in such way that it will be possible to collect the statistics to computer the areas A 1, A 2, A 3,. That is, as we move from event to event, we would like to keep track of at least the number of terminals on-line between the events and the time between events.
  • Slide 177
  • We first define the state of the system as the number of terminals in the repair facility. The only time the state of the system will change is when there is either a breakdown or a completion of a repair. Therefore, there are two events in this simulation: breakdown and completion of repairs. To set up the simulation, our first task is to determine the process generators for both the breakdown and the repair times.
  • Slide 178
  • We use the ITM to develop the process generators. For the exponential distribution the process generator is simply x = -log r In case of the repair times, applying the ITM gives us and as the process generators.
  • Slide 179
  • For each n, we start the simulation in the state where there are no terminals in the repair facility. In this state, all 10 operators are on-line and any remaining terminals are in the spares pool. Our first action is the simulation is to schedule the first series of events, the breakdown times for the terminals presently on-line. Having scheduled these events, we next determine the first event, the first breakdown, by searching through the current event list.
  • Slide 180
  • We then move the simulation clock to the time of this event and process this breakdown. To process a breakdown, we take two separate series of actions 1.Determine whether a spare is available. 2.Determine whether the repair staff is idle. These actions are summarized in the system flow diagram showed in the book in Figure 17. Otherwise, we process a completion of a repair.
  • Slide 181
  • To process the completion of a repair, we also undertake two series of actions. 1.At the completion of a repair, we have an additional working terminal, so we determine whether the terminal goes directly to an operator or to the spares pool. 2.We check the repair queue to see whether any terminals are waiting to be repaired. We proceed with the simulation by moving from event to event until the termination time T. At this time, we calculate all the relevant measures of performance from the statistical counters.
  • Slide 182
  • Our key measure is the net revenue for the current value of n. If this revenue is greater than the revenue for a system with n-1 terminals, we increase the value of n by 1 and repeat the simulation with n +1 terminals in the system. Otherwise, the net revenue has reached a peak. The simulation outlined in this example can be used to analyze other policy options that management may have.
  • Slide 183
  • The simulation model provides a very flexible mechanism for evaluating alternative policies.