Queens College Post Graduate Program Individual Assignment for the course ‘Quantitative Analysis for Decision Making” Chapter review Your individual assignment is chapter review on Simulation and Queuing Model. To do the individual assignment, you should arrange the topics and subtopics properly. Student name last Name Misganew Marew ID 0068/2015 course code P a g e | ii Page |1 Chapter six (6) 6. Simulation and Queuing Models 6.1 Definition of Simulation Simulation is the imitative representation of the functions and operation of a real-world system or process over a specified period of time. It involves generating an artificial history of a system and observing the artificial history to infer operating characteristics of the real system. Simulation can be done by hand, but usually, by computer with the appropriate software. Nowadays, simulation is more powerful than ever due to better computer and software available.(CHAPTER 2 LITERATURE REVIEW Figure 2-1 A Queue System, n.d.) Simulation is the imitative representation of the functions and operation of a real-world system or process over a specified period of time. It involves generating an artificial history of a system and observing the artificial history to infer operating characteristics of the real system. Simulation can be done by hand, but usually, by computer with the appropriate software. Nowadays, simulation is more powerful than ever due to better computer and software available. (Shastrakar, 2016) 6.2. Basic Simulation Model Components A simple simulation model consists of three types of major components: entity, queue, and resources. (CHAPTER 2 LITERATURE REVIEW Figure 2-1 A Queue System, n.d.)(Kumar, 2020) 6.2.1. Entities The first type of component is an entity: something that changes the state of the system. In many cases, particularly those involving service systems, the entity may be a person. In the customer service center, the entities are the customers. Entities do not necessarily have to be people; they can also be objects. Entity Batches:-The number of entities that arrive in the system at the same given time is known as the batch size. In some systems, the batch size is always one. In others, the entities may arrive in groups of different sizes. Examples of batch arrivals are families going to a movie theater. The batch sizes may be two, three, four, or more. Entity Inter-arrival Times:-The amount of time between batch arrivals is known as the inter-arrival time. It does not matter whether the normal batch size is one or more. We are interested only in the interval from when the last batch arrived to when the current batch arrives. The previous batch may have had only one entity, Page |2 whereas the next batch has more than one. Inter arrival time (λ) is also the reciprocal of the arrival rate. In collecting entity arrival data it is usually easier to collect the batch inter arrival time. However, some historical data may be in arrival rate format. Inter arrival time is considered input data that one would have to provide for the model. Entity Attributes:- Entities may also possess attributes. These are variables that have values unique to each entity in the system. Even though the entity attribute will have the same name, there could be as many Figure 26 Entities Arriving in a Queue different values as there are entities. An example of an attribute of this type involves the entity’s arrival time. Each entity’s attribute ARRTIME would store the simulation system time that the entity arrived in the system. So, unless a batch of entities arrived at the same time, each entity would have a unique value in its attribute ARRTIME. Some entity attributes may have the same value. In the case of airline passengers, the attribute PASSTYPE could hold a value corresponding to the type of passenger the entity represents. A value of 1 in PASSTYPE could represent a first-class passenger, and a value of 2 could represent a coach-class passenger. Thus, 20% of the entities in a simulation might have a value of 1 for PASSTYPE, and the remaining 80% would have a value of 2 for PASSTYPE. In the actual model, the attribute PASSTYPE would be used to prioritize the servicing and loading of passengers. Simulation programs may also utilize global variables. Global variables are not to be confused with entity attributes. These variables differ from entity attributes in that each global variable can maintain only one value at a given time. A typical use of a global variable in a simulation program is the variable that keeps track of the simulation run time 6.2.2. Queues The second major type of components that simple systems possess is queues. Queues are the simulation term for lines. Entities generally wait in a queue until it is their turn to be processed. Simple systems generally use firstin-first-out (FIFO) queue priorities. Another characteristic of simple systems is that once customers enter the system, they must enter the queue. Furthermore, once entities enter the queue, they cannot depart before receiving service.(Shastrakar, 2016)(Green, 2016)(Blunt et al., 2015)(Kumar, n.d 2020.)(Zhang, 2019) Queue Disciplines:- a) First in first out- this principle states that customers are served one at a time and that the customer that has been waiting the longest is served first b) Last in first out - this principle also serves customers one at a time, however the customer with the shortest waiting time will be served first. Also known as a stack c) Processor sharing- Service capacity is shared equally between customers. Page |3 d) Priority- Customers with high priority are served first. Priority queues can be of two types, nonpreemptive (where a job in service cannot be interrupted) and preemptive (where a job in service can be interrupted by a higher priority job). No work is lost in either model. e) Shortest job first- The next job to be served is the one with the smallest size. f) Preemptive shortest job first- The next job to be served is the one with the original smallest size. g) Shortest remaining processing time- The next job to serve is the one with the smallest remaining processing requirement.(Blunt et al., 2015; CHAPTER 2, 2003; CHAPTER 2 LITERATURE REVIEW Figure 2-1 A Queue System, n.d.; Green, n.d., 2016; Kumar, n.d., 2020; Shastrakar, 2016; Shortle et al., n.d.; Zhang, 2019, n.d.) 6.2.1. Characteristics of a Queuing System The most important characteristics of a queueing system.(Kumar, 2020)(Zhang, 2019)(Shastrakar, 2016) Queuing models allow a number of useful steady state performance measures to be determined, including: the average number in the queue, or the system, the average time spent in the queue, or the system, the statistical distribution of those numbers or times, the probability the queue is full, or empty, and in queuing theory, a special notation, Kendall’s notation is used to describe and classify the queuing system with the form [16]: A S c K N D o A describes the inter arrival time distribution o S describes the service time distribution o c presents the number of servers in the system Page |4 o K means the maximum number of jobs in the system, including the jobs in the server and the jobs in the waiting room. the capacity of the waiting room. If we assume the job number is infinite ( K = ), the notation can be simplified as A S c / / . o N presents the calling population. The calling population can be finite or infinite, which will affect how the arrival rate is defined. In an infinite queuing model, the arrival rate is not affected by the number of jobs in the system. While in a finite queuing model, the number of jobs in the system will significantly affect the arrival rate. o D presents the queue’s discipline, including the service discipline and the priority order In the notation, there are different symbols to describe the inter arrival time distribution and the service time distribution: M: exponential distribution (M stands for Markov) D: deterministic distribution G: General distribution the symbol G for general distribution is used to describe for the inter arrival time distribution ( A ) and the service time distribution ( S ). For example, the G/G/1 system is a queuing system which has general distribution for inter arrival time and service time, and there is only one server in the system 6.2.2 .Components of a Queuing System A queuing system is characterized by three components: 1) Arrival process 2) Service mechanism 3) Queue discipline Specifying the arrival process for a queueing system consists of describing how customers arrive to the system. Let Ai be the inter-arrival time between the arrivals of the (i – 1)th and i th customers. If A1, A2, A3…. are assumed to be IID random variables, we shall denote the means (or expected) inter-arrival time by E(A) and call (h)=1/E (A) the arrival rate of customers. The service mechanism for a queueing system is articulated by specifying the one queue feeding all servers, and the probability distribution of customers, service times. Let Si be the service time of the 1st arriving customer. If S1, S2,…. are IID random variables, we shall denote the mean service time of a customer by E(S) and call w= 1/E(S) the service rate of a server: a. FIFO: Customers are served in a first-in, first-out manner. b. LIFO: Customers are served in last-in, first-out manner. c. Priority: Customers are served in order of their importance or on the basis of their service requirements. Page |5 Consider a single-server queuing system as shown in figure 4.3 for which the inter-arrival times A1, A2, A3….are independent and identically distributed (IID) random variables. A customer who arrives and finds the server idle enters service immediately, and the service times S1, S2… of the successive customers are IID random variables that are independent of the inter-arrival times. A customer who arrives and finds the server busy joins the end of a Queuing System single queue. Upon completing service for a customer, the server chooses a customer from the queue (if any) in a first-in, first-out (FIFO) manner. Figure 4.3 Single-server queuing system Arrivals and services are described by the distribution of the time between arrivals and service times. The overall effective arrival rate must be less than the maximum service rate, or the waiting line will grow without bound. When queues grow without bound, they are termed “explosive” or unstable. An exceptional situation would be arrival rates that are greater than service rates for short period of time. The state of the system is the number of units in the system and the status of the server, busy or idle. An event is set of circumstances that cause in instantaneous change in the state of the system. In the single server queuing system there are two possible events that can affect the state of the system. They are: Entry of unit into the system i.e., the arrival event. The completion of service on a unit i.e., the departure event. Figure 4.4 Flow diagram of service just completed The queuing system includes: The server The unit being serviced Single-server queuing system Units in the queue (if any units are waiting). Page |6 The server can have only two possible conditions: Busy or Idle If service has been completed, the simulation proceeds as shown in figure 4.5. The next event that occurs after service just completed is new unit entering the system. The entered unit may find the server either idle or busy. If the server is busy, the unit enters the queue. If the server is idle and the queue is empty, the unit enters the server. It is impossible for the server to be idle and the queue to be not empty. The figure 4.5 shows the course of action taken when a unit enters the system. From the flow diagram (figure 4.5) a table 4.3 (below) can be drawn with columns as queue status and rows as server status. Table 4.3 Action taken on unit arrival event After the competition of a service the server may become idle or remain busy with the next unit. The course of action as described in points below: a. If the queue is not empty, another unit will enter the server and it will be busy. b. If the queue is empty, when all the services are complete including the servicing unit then the server will be idle. c. It is impossible for the server to become busy, if the queue is empty, when all the services are complete. d. It is impossible for the server to be idle after a service is completed, when the queue is not empty. Above stated point can be shown in tabular from as in table Page |7 Simulations of queueing system generally require the maintenance of an event list for determining what happens next. The event list indicates the times at which the different types of event occur for each unit in the queuing system. The times are “clock” that marks the occurrence of events in time. In simulation, the events usually occur at random. For example, it is not known how long the bank teller will take to complete a transaction or when the next customer will arrive at a grocery checkout counter. Random numbers are distributed uniformly and independently on the interval [0, 1]. Random digits can be used to form random number by selecting the proper number of digits for each random number and placing decimal point to the left of the value selected. Random numbers can also be generated. When numbers are generated using a set procedure they are often called as pseudo-random numbers. As the method is known, it is always possible to know what the sequence of numbers will be prior to the simulation. In a single-server queuing system inter arrival times and service times are determined from the distributions of these random variables. Let us simulate the arrival and servicing of N customers by a single server. Let the inter-arrival time of i)th The customer be ATi, which denotes the time gap between the arrivals of the (i - l)th customer and the ith customer into the system. Let the service time of ith customer be STi where i = 1, 2… N. Let cumulative arrival time of ith customer be CATi.Service times (STi) and inter-arrival times (ATi) are generated as samples from some specified probability distribution. Assuming, initially there is no queue and the server is free. When the first customer arrives, at time zero, directly goes to the service counter. After ST1 time, the first customer departs from the service counter. Second customer arrives at CAT2 = AT2 -------------------------------------------------- (4.1) If ST1 > CAT2 i.e., service time of first customer is greater than arrival time of second customer than the second customer has to wait in the queue. Let WTi is the waiting time of ith customer WT2 = ST1 – CAT2 (4.2) If ST1 < CAT2 i.e., service time of first customer is less than arrival time of second customer. This means, departure of first customer takes place before the arrival of second customer. Thus the service counter is free Waiting for the second customer to arrive. The idle time is given by IDT2 = CAT2 – ST1 ----------------------------------------------------- (4.3) Let us consider that (j -1) customers have arrived and (k -1) customers have left the system. The next customer to arrive is jth and the next customer to depart is kth . 1 <=j <= k <=N (4.4) Page |8 There for The queue length is given by k – j – 1 if k > j (4.5 The next arrival time is NAT = CATj (4.6 The next departure time is NDT = CDTk = Cumulative arrival time of k + waiting time of k = service time of k. NDT = CDTk = CATk + WTk + STk (4.7) Whether j would arrive first of k would depart first depends on difference between them. DIF = NAT – NDT (4.8) If difference DIF is positive than i. queue length is k – j – 1 ii. Departure would take place first. iii. Reduce the length of queue by 1 as departure takes place first. iv. If the length of queue is zero than the service counter will remain free waiting for a customer to arrive. If difference DIF is negative than (a) Arrival takes place first. (b) length of the queue is increased by one If difference DIF is zero than (a) The next arrival and departure takes place simultaneously. (b) The length of the queue remains same. Some of the finding for short-term simulations is as follows: The average waiting time (AWT) of the customer is calculated as follows: Average Waiting Time (in minutes) = Total time customer wait in queue (in minutes) i. Total number of customers The probability that a customer has to wait in a queue is calculated as: Probability (wait) = Number of customers who wait (4.10) Total number of customers. The probability that a server is idle can be calculated as: Probability of idle Server = Total run time of server (minutes) Total run time of simulation (minutes) The probability of server being busy is calculated as: (4.11) (4.9) Page |9 Probability of Busy Server = 1- Probability of idle server= 1 - Total run time of server (minutes) Total run time of simulation (minutes) (AST) The average service time (AST) is calculated as: Average service time (minutes) = Total service time (minutes) (4.13) Total number of customers Average time between arrival (minutes) = Sum of all time between arrivals (in minutes -----(4.14) Number of arrivals 1 One is subtracted from the denominator because the first arrival is assumed to occur at time 0. b. The average waiting time of those who wait is calculated as : Average waiting time (minutes) = Total time customers wait in queue (in minutes) (4.15) i. Total number of customers c. The average time a customer spends in the system is calculated in two ways. Average time customer spends = total time customers spend in the system (minutes) (4.16) Total number of customers (b) Average time customer spends in the system = an Average time customer spends waiting in the queue + Average time customer spends in service (4.17) (CHAPTER 2 LITERATURE REVIEW Figure 2-1 A Queue System, n.d.; Kumar, n.d., 2020; Shastrakar, 2016; Shortle et al., n.d.) 6.2.3. Resources The third component that simple systems contain is resources. Resources process or serve the entities that are in the queue. In simple models, resources can be either idle or busy. Resources are idle when they are available for processing, but there are no more entities waiting in the queue. Resources are busy when they are processing entities. In more complex models, resources may also be temporarily inactive or failed. Inactive resources are unavailable because of scheduled work breaks, meals, vacations, or preventive maintenance periods. Failed resources would correspond to broken machines or inoperative equipment Resources take a certain amount of processing time to service the entities, for example, the time to total an order and receive payment, process a loan, or machine a part. The processing time is also frequently referred to as processing delay time or service time. Processing time is considered input data that one would normally have to collect by observation or otherwise acquire. 6.3. Type of simulation The Leading Types of Simulation Model(4 Types of Simulation Models to Leverage in Your Business | MOSIMTEC, n.d.)(Zhang, 2019)(Zhang, n.d.)(Kumar, n.d.) P a g e | 10 6.3.1. Monte Carlo / Risk Analysis Simulation In simple terms, a Monte Carlo simulation is a method of risk analysis. Businesses use it prior to implementing a major project or change in a process, such as a manufacturing assembly line. Built on mathematical models, Monte Carlo analyses use the empirical data of the real system’s inputs and outputs (e.g., supply intake and production yield). It then identifies uncertainties and potential risks through probability distributions. The advantage of a Monte Carlo-based simulation is that it provides awareness and a thorough understanding of potential threats to your bottom-line and time-to-market. You can implement Monte Carlo simulations to practically any industry or field, including oil and gas, manufacturing, engineering, supply chain management, and many others. 6.3.2. Agent-Based Modeling & Simulation An agent-based simulation is a model that examines the impact of an ‘agent’ on the ‘system’ or ‘environment.’ In simple terms, just think of the impact a new laser-cutter or some other factory equipment has on your overall manufacturing line. The ‘agent’ in agent-based models could be people, equipment, and practically anything else. The simulation includes the agent’s ‘behavior,’ which serve as rules of how those agents must act in the system. You then look at how the system responds to those rules. However, you must draw your rules from real-world data — otherwise; you will not generate accurate insights. In a way, it serves as a means to examine a proposed change and identify potential risks and opportunities 6.3.3.Discrete Event Simulation A discrete event simulation model enables you to observe the specific events that result in your business processes. For example, the typical technical support process involves the enduser calling you, your system receiving and assigning the call, and your agent picking up the call. You would use a discrete event simulation model to examine that technical support process. You can use discrete event simulation models to study many types of systems (e.g., healthcare, manufacturing, etc), and for a diverse range of outcomes. For example, the Nebraska Medical Center had used discrete event simulation models to see how it could remove workflow bottlenecks, increase the utilization of its operating rooms, and lower patient/surgeon travel distance and time 6.3.4 System Dynamics Simulation Solutions This is a very abstract form of simulation modeling. Unlike agent-based modeling and discrete event modeling, system dynamics does not include specific details about the system. So for a manufacturing facility, this model will not factor in data about the machinery and labor. Rather, businesses would use system dynamics models to simulate for a long-term, strategic-level view of the overall system. In other words, the priority is to get aggregatelevel insights about the entire system in response to an action — e.g., a reduction in CAPEX, ending a product line, etc 6.4. Merits and Demerits of Simulation 6.4.1. Merit 1. Less Financial Risk:-Simulation is less expensive than real life experimentation. The potential costs of testing theories of real world systems can include those associated with changing to an untested process, hiring staff or even buying new equipment. Simulation allows you to test theories and avoid costly mistakes in real life. P a g e | 11 2. Exact Repeated Testing:-A simulation allows you to test different theories and innovations time after time against the exact same circumstances. This means you can thoroughly test and compare different ideas without deviation. 3. Examine Long-Term Impacts:-A simulation can be created to let you see into the future by accurately modeling the impact of years of use in just a few seconds. This lets you see both short and long-term impacts so you can confidently make informed investment decisions now that can provide benefits years into the future. 4. Gain Insights for Process Improvement:-The benefits of simulation are not only realised at the end of a project. Improvements can be integrated throughout an entire process by testing different theories. 5. Assess Random Events:-A simulation can also be used to assess random events such as an unexpected staff absence or supply chain issues. 6. Test Non-Standard Distributions:-A simulation can take account of changing and non-standard distributions, rather than having to repeat only set parameters. For example, when simulating a supermarket you can input different types of customer who will move through the shop at different speeds. A young businesswoman who is picking up a sandwich will move through the shop differently from an old couple or a mother doing a weekly shop with two children in tow. 7. Encourages In-Depth Thinking:-Even the process of designing a simulation and determining the different parameters can offer solutions. By thinking in-depth about a process or procedure it is possible to come up with solutions or innovations without even using the final simulation. 8. Improve Stakeholder Buy-In:-A visual simulation can also help improve buy-in from partners, associates and stakeholders. You can visually demonstrate the results of any process changes and how they were achieved, improving engagement with interested parties or even enabling a simulation based sales pitch(What Is Simulation? What Does It Mean? (Definition and Examples) - TWI, n.d.) 6.4.2. Disadvantage/demerit Mistakes may be made in the programming or rules of the simulation or model. Simulation does not produce optimum results. When the model deals with uncertainties, the results of simulation are only reliable approximations subject to statistical errors. Quantification of the variables is another difficulty. In a number of situations it is not possible to quantify all the variables that affect the behavior of the system. P a g e | 12 In very large and complex problems, the large number of variables and the interrelationships between them make the problem very unwieldy and hard to program. The number of variables may be too large and may exceed the capacity of the available computer. The cost of a simulation model can be high. The cost of running several different simulations may be high. Time may be needed to make sense of the results. People’s reactions to the model or simulation might not be realistic or reliable.(4 Types of Simulation Models to Leverage in Your Business | MOSIMTEC, n.d.; Simulation Types, Benefits, Limitations, Models, Phases, n.d.; What Is Simulation? What Does It Mean? (Definition and Examples) - TWI, n.d.; Kumar, n.d., 2020; Shastrakar, 2016) 6.5. Random numbers In simulation modeling we will assume that specific processes will be distributed according to a specific random variable For instance we will assume that an employee in a donut shop takes a random time to serve customers distributed according to a Normal random variable with mean μ and variance σ2 . In order to then carry out a simulation the computer will need to generate random serving times. This corresponds to simulating number that is distributed according to a specific distribution. The first step to simulate numbers from a distribution is to be able to independently simulate random numbers u1,u2,…,uN from a continuous uniform distribution between zero and one. From the previous chapter, you should remember that such a random variables has pdff The second requirement the numbers u1.., uN need to respect is independence. This means that the probability of observing a value in a particular sub-interval of (0,1)(0,1) is independent of the previous values drawn P a g e | 13 6.6. Pseudo random numbers Pseudo means false, in the sense that the number are not really random! They are generated according to a deterministic algorithm whose aim is to imitate as closely as possible what randomness would look like. In particular, for numbers u1,…,uN it means that they should look like independence instances of a Uniform distribution between zero and one. Possible departures from ideal numbers are: the numbers are not uniformly distributed; the mean of the numbers might not be 1/2; the variance of the numbers might not be 1/12; the numbers might be discrete-valued instead of continuous; Independence might not hold. some important properties/considerations that need to be taken into account when generating pseudo-random numbers: the random generation should be very fast. In practice, we want to use random numbers to do other computations (for example simulate a little donut shop) and such computations might be computationally intensive: if random generation were to be slow, we would not be able to perform them. the cycle of random generated numbers should be long. The cycle is the length of the sequence before numbers start to repeat themselves. The random numbers should be repeatable. Given a starting point of the algorithm, it should be possible to repeat the exact same sequence of numbers. This is fundamental for debugging and for reproducibility. The method should be applicable in any programming language/platform. And of course most importantly, the random numbers should be independent and uniformly distributed. 6.7. Application areas of simulation Simulation is applicable in the following areas Logistics simulation:- Optimize complex and dynamic logistics processes with simulation P a g e | 14 Simulation in production:- Includes modeling single production lines, from the design of production resources and buffer sizes to the simulation of entire production plants Detailed production planning:-Optimization of preliminary planning while taking into account dynamic factors like current availabilities or disruptions, resources, inventories, filling level of the facility, etc. Emulation:-Virtual testing of control software with simulation Artificial Intelligence:-AI technology in use for process optimization in production and logistics Hospital Simulation:-Verification of processes and material flows in hospitals Planning of machine scheduling:-Optimizing machine capacity utilization by minimizing set-up times and avoiding standby- and waiting times Control station simulation:-Optimization of control strategies with the help of simulation Personnel simulation: Assistance for personnel resource planning and personnel dispatching Supply Chain simulation:-Modeling and analysis of supply network(Simulation - Types, Benefits, Limitations, Models, Phases, n.d.).