1 / 71

Chapter 21 Simulation

Chapter 21 Simulation. to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston. Copyright (c) 2004 Brooks/Cole, a division of Thomson Learning, Inc. Description.

miron
Télécharger la présentation

Chapter 21 Simulation

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 21Simulation to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c) 2004 Brooks/Cole, a division of Thomson Learning, Inc.

  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.

  3. 21.1 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.

  4. Definition: The state of a system is the collection of variables necessary to describe the status of the system at any given time. • Customers arrive and depart, the status of the system changes. To describe these changes in status, we require a set of variables called the state variables. • In a system, an object of interest is called an entity, and any properties of an entity are called attributes. • Systems may be classified as discrete or continuous.

  5. Definition: A discrete system is one in which the state variables change continuously over time. A bank is an example of a discrete system. • Definition: A continuous system is one in which the state variables change continuously over time. • 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.

  6. We usually refer to a static simulation as a Monte Carlo 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.

  7. 21.2 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.

  8. 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.

  9. 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

  10. 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.

  11. 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.

  12. 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

  13. 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. Details of the example are found in the book. • 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.

  14. 21.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.

  15. 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.

  16. A random number, Ri, is defined as an independent random sample drawn from a continuous uniform distribution whose probability density function (pdf) is given by

  17. 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.

  18. 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: • The routine must be fast • The routine should not require a lot of core storage • The random numbers should be replicable; and • The routine should have a sufficiently long cycle

  19. Most programming languages have built-in library functions that provide random (or pseudorandom) numbers directly.

  20. 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.

  21. The procedure consists of two steps: • We develop the cumulative probability distribution (cdf) for the given random variable, and • We use the cdf to allocate the integer random numbers directly to the various values of the random variables.

  22. 21.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.

  23. 21.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.

  24. 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).

  25. 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.

  26. 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.

  27. 0 ≤ x ≤ 2 otherwise • 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

  28. 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.

  29. Thus, to obtain a service time, we first generate a random number and then transform it using the preceding equation. • As this example shows, the major advantage of the inverse transformation method is its simplicity and ease of application.

  30. 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.

  31. 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, r1 and r2. • 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*).

  32. 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.

  33. 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.

  34. 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.

  35. 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 Y1, Y2,…Yn), 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.

  36. The Direct Method • The direct methods for the normal distribution was developed by Box and Muller (1958). • It’s 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, r1and r2, and then transforms them into two normal variates, each with mean 0 and variance 1, using the direct transformation.

  37. 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

  38. 21.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.

  39. 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.

  40. 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.

  41. 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.

  42. 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.

  43. 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, ELn, for a fixed number of terminals in the system, n.

  44. Once we have a value of ELn, we can computer the expected weekly downtime costs, given by 1000(10-ELn). • Then the increase in revenue as a result of increasing the number of terminals from 11 to n is 1000(ELn – EL11). Mathematically, we compute ELn

  45. where T = length of simulation N(t) = number of terminals on-line at time t (0≤t≤T) Ai = area of rectangle under N(t) between ei-1 and ei (where ei is the time of the ith event) m = number of events that occur in the interval [0,T] • Between time 0 and time e1, the time of the first event, the total on-line time for all the terminals is given by 10ei, since each terminal is on-line for a period of e1 time units.

  46. If we now run this simulation over T time units and sum up the areas A1, A2, A3,…, 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 A1, A2, A3,…. • 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.

  47. 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.

  48. 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 usandas the process generators.

  49. 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.

  50. 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 • Determine whether a spare is available. • 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.

More Related