This action might not be possible to undo. Are you sure you want to continue?

# Discrete/Stochastic Simulation

Using PROMODEL

Usages

• • • • • • • Business Process Re-engineering Manufacturing Process Design Service Process Design Operations Supply chains As a planning tool As an innovation and improvement tool

**Applications of Discrete Stochastic Simulation
**

• • • • • • • • • Resource management systems Pollution management systems Urban and regional planning Transportation systems Health systems Criminal justice systems Industrial systems Education systems eCommerce systems

**What Discrete Stochastic Simulation isn’t
**

• • • • Stocks, states, rates, flows, information Continuously changing variables Causal loop diagramming stock-and-flow diagramming

**What Discrete Stochastic Simulation is
**

• • • • • • Probabilistic occurrences Activity completions Processes Precedence relationships Probabilistic routing Events, Entities and Attributes

An example—Southwest Airlines airline turn--ACTIVITIES • • • • • • • • Disembark passengers Cabin cleanup Embark passengers Unload baggage Load Baggage Refuel Remove waste Refurbish snacks and drinks .

EVENTS for the airline gate turn • • • • • • • • • Arrival at gate Beginning of unloading Completion of passenger unloading Beginning of cleanup Ending of cleanup Beginning of passenger loading Ending of passenger loading Beginning of baggage unloading Ending of baggage unloading .

events and entities have attributes . – That time duration is in general random • Events are instants in time • Activities are sometimes engaged in by entities • Activities.ACTIVITIES & EVENTS • Activities always have time duration.

no of entities assoc. service areas --PERMANENT • Both entities and events possess ATTRIBUTES – Attributes of a server entity—mean service time. companies. piece parts. professors. students. Entities and Attributes • Entities may be permanent or temporary – Customers. facilities. std. servers. with it . dev. cities. distribution type – attributes of an event--event type. messages. of service time.Events. items. boxes.--TEMPORARY – Universities.

m. If there are more than 6 people waiting in line. arrivals to convenience stores are larger than normal. but the time is exponentially distributed..A typical service system scenario • In the early morning hours between 7 and 9 a. . Patrons shop for a time period that is uniformly distributed between 3 and 5 minutes. new arrivals will balk and go somewhere else. People arrive at the rate of 1 every second.

Convenience Store Scenario. who is less well paid but also much slower . . continued • It takes the checkout clerk an average of 43 sec to collect money from a customer and provide them with a receipt. but this time is normally distributed with a std dev. of 30 sec. • The manager can hire a second clerk. People will automatically enqueue themselves in front of the checkout stand.

Convenience Store Scenario. continued • The store manager is interested in – the average waiting time of his patrons in the queue – the average number of customers that balked .

With one store clerk: • average waiting time is 128 seconds • number of balked customers is 76 out of 1000 customers • Check out clerk is busy 86% of the time checking out customers .

respectively .With two store clerks: • average waiting time is 42 secs for the first server – 69 secs for the second • There are no balked customers • Servers are busy 70% and 40% of the time.

How does randomness come into play? • Probabilistic activity durations • Probabilistic routing ―decisions‖ • Probabilistic arrivals .

YES .000 times longer – Use an ALGORITHM? --YES.How is randomness created within a digital computer? • Monte Carlo--the computer generation of random numbers – Sample the clock?--no--not replicable – maintain a huge file of random numbers--no • Takes up too much space in primary memory • On secondary storage. is 500. its too slow • (when deciding to fetch from disk as opposed to primary memory. the time required.

Why use an algorithm? • The sequence it generates will be deterministic • Doesn’t take up much space in primary storage • Takes up no space on secondary storage .

but in fact are deterministic • Multiplicative Congruence is one method .An Algorithm for Generating Random Numbers • Must be fast (short and sweet) • Must be capable of generating numbers that have all of the characteristics of randomness.

About Random Numbers • Uniform on the interval zero to one • They are completely independent and therefore un-correlated • We represent them this way: U(0.1) .

4656613E-9. . int I) I = I * 1220703125. else U = I * 0.Multiplicative Congruence Algorithm • CI+1 = K*Ci function random(float u. return ―and‖ end. if I<0 then I = I + 2147483647 + 1.

Notes • Generates a sequence on the entire interval of 32-bit integers--0 to 2147483647 • Maps these onto the real interval of 0 to 1 • If the first multiplication causes integer overflow. the resultant number I will be negative--it is made positive by adding the largest 32-bit integer representable +1 The last multiplication is like dividing the number by the largest integer possible 1/2147483647 = .4656613x10 to the minus 9 .

You can easily generate random numbers in an EXCEL spreadsheet using the function RAND() .

What about non-uniform random numbers? Exponential Normal Gamma Poisson Lognormal Rectangular Triangular .

.ONE ANSWER: Use the inverse transformation method Every non-uniform random variate has an associated cumulative distribution function F(x) whose values are contained within the interval 0 to 1 and whose values are uniformly distributed over this interval If x is a non uniform random variate. y = F(x) is uniformly distributed over the interval 0 to 1.

.Strategy If the inverse of the cumulative distribution function F(x) exists so that x = F-1(y) can be determined. then 1) simply generate a random number uniformly distributed on the interval 0 to 1 2) call this number y and apply the inverse transformation F-1(y) to obtain a random number x with the appropriate distribution.

Exponential Random variates 1) generate a random number U using the program given above 2)then apply EXPRND = -XMEAN * ALOG(U) (This is simply using the inverse distribution method) .

When Analytic inverses of the cumulative distribution function are unavailable You can use a table function You can use specialized algorithms that have been developed by academics over thirtyfive years of cumulative research .

blocked time – number of trips made in a given period of time. productivity. wait time. – system throughput within a given period of time • We can get this from the statistical reports provided after the simulation is finished . cycle time (time in the system).Outputs • The animation reveals bottlenecks • We are also interested in – idleness.

its subroutine is called .Discrete stochastic simulation time advance • Time is advanced from event to event. • The only time instants looked at are the event times • The events are stored chronologically in time in an event file known as an ―event calendar‖ • Corresponding to each event type is an event subroutine • When an event occurs.

Discrete-stochastic simulation as • A statistical experiment • Running times must be long enough to ensure sufficient samples are collected • Several runs are often averaged together • The starting random number seeds are changed and the model is rerun • The basic idea is to get the variance to converge to the actual real-world variance .

It is considering hiring another mechanic or adding another bay. .Another scenario • A mufflers-shocks-brakes shop is turning away business. It currently has four bays.

Trucks currently wait upon return for four hours before they can go out on another trip. it has four loading docks. At its loading warehouse. . Should the company add docks.Another scenario • A shipping company has just picked up additional customers and needs to add capacity. remove trucks. or both. It also has 10 trucks.

. Lines are very long and waiting times unacceptable. Should the shop hire more help or just shift some of its existing help from skis to boots or vice versa.Another scenario • A ski rental shop fits customers for boots and then skis. It currently has four people working in the boot area and four people working in the ski area.

period is of interest. Arrivals are Exponentially distributed. Patrons arrive at the rate of one every 45 secs.GO BACK TO 7-11 STORE example • Consider a 7-11 store in which the 7-9 a. Customers who encounter a queue of six customers or more upon arrival will . Management is considering hiring a second clerk. Patrons shop for a period that is uniformly distributed between 3 and 5 minutes. of 30 secs.m. The check out time for each customer is normal with a mean of 43 secs and a std. dev.

What are the activities? • • • • Arrivals Shopping Checkout What about waiting in Queue? – This is not an activity – This is handled automatically by the simulation .

What units on time? • Secs or mins? • Let’s go with SECONDS • We must be consistent!!!! .

Must also identify • Locations—points assoc with the starting and stopping events of an activity • Path network—the network the entity travels • Resources—permanent entities that act on ordinary temporary entities • Processes—the activities .

PROMODEL • • • • • • • • SELECT BACKGROUND--optional BUILD-->locations BUILD-->entities BUILD-->PATH NETWORK BUILD-->resources BUILD-->processes and routing BUILD-->arrivals RUN IT .

Locations • Places where an event of importance to the model occurs – Like an arrival – A beginning of customer checkout – An ending of customer checkout .

Entities • These are the temporary items that pass through the model of the system • Chits • Mail pieces • Piece parts • Students • Cars • People .

Path network • The network that will be followed by the entities and/or the resources .

Resources • Mobile permanent entities that can move over a network .

Processes • A process is required everywhere the entity undergoes an operation • An exit process is always required .

Routing • You must specify how the entities move through the model • Usually you inform PROMODEL what path network to use .

Arrivals • The statistics of the arrival process for each entity type must be communicated to PROMODEL .

Now let’s look at PROmodel .

• Exercise 1. The island will accommodate no more than two cars being filled with gas on a single side. There is space for no more than three cars in each of the two queues of cars waiting for each of the two service areas. Two lines of cars may form on either side of the island. . (15 points) A local convenience store has a self-service island from which it dispenses gasoline.

. Assuming the store is open 24 hours. Service times are normal with a mean of seven minutes and a standard deviation of two minutes. Once cars have entered the store’s gasoline facility. such as UNCONDITIONALLY to block 12. For BRANCH/ TRANSFERS. setup the model to determine how many cars are turned away in one 24-hour day. Formulate a model in BLOCKS to determine how many cars are turned away in a day. be sure to indicate the type.• Cars arrive at the rate of one every minute with a distribution that is exponential. Cars will drive away if more than six cars total are either waiting or in service (regardless of the line they are in). they will en-queue themselves into the shortest queue.

Promodel What do we need to know?? .

What the following are • • • • • • Locations Entities Path networks Resources Processes Arrivals .

What has to be specified before resources can be specified • Path networks .

In order to get more than one arrival. the freq must be set to • INFINITE .

In order to double the capacity of the number of turning machines and machining centers you would • Go to locations and increase the capacity from 1 to two for both of these locations .

in this case because the pallet was full .Failed Arrivals means • Arrivals that could not even get their foot in the door.

The important measures for this model were… • • • • • Throughput for the product Utilization of the resource Utilization of the locations Failed arrivals Amount of blocked time there is .

On the final you will be given a scenario like the ones above and asked to determine • Locations • Entities • Path networks—may be asked to draw these • Resources • Processes • Arrivals .

You will also need to know • what events and activities are • How random numbers are generated • How random variates (non-uniform) are generated • What is meant by MONTE CARLO .