INTERNATIONAL JOURNAL OF MATHEMATICS AND COMPUTERS IN SIMULATION DOI: 10.46300/9102.2020.14.16 Volume 14, 2020 A Simulation Study for Waiting Line Systems by C Programming Ozer O]GHPLU Many problems which are not understand directly and are Abstract— Simulation is a method that using especially not possible to produce experimentally are started to solve by waiting line systems. In this study, a simulation study has made using method of simulation over computers after 1960. This for waiting line systems by C programming. The particular queue approach is used for solving problem as a quite common will be a place where customers are waiting for service behind scientific approach [2]. each other. For the purpose of this study, a simulation in C Simulation programs which are written for considering language is created in order to simulate the aforementioned queue ranking of conditions from invention which was inserted queue system. With this simulation, it is aimed to increase customers’ satisfaction by decreasing service cost, and to increase the quality are developed in 1980s [1]. of service with minimum waiting time. Considering alternative Simulation studies which can be useful for these kinds of solutions, the optimal system is obtained to ensure economical systems provide improving system, solving problems in the stability between the interests of the customers and the system and increasing satisfaction of manager, employee and management. customer in a certain economical stability. This study is prepared for improving queue systems which Keywords—C programming language, Cash desks system, are caused problems between people and producing a study for Simulation, Waiting line system. finding alternative solutions for problems. A market’s cash desk system which has only one queue is I. INTRODUCTION considered by using C programming in this study. Creating the most suitable system is purposed aspect of management and S imulation is a method that provides acting an original system by means of a mathematical model which is essential for using computer [3]. Simulation is used in customer. All good and bad ways of the present system are denoted after simulation study and suggestions are given for various spaces. One of the most useful spaces is queue system. improving bad ways of the present system. In short, this study This system can be called waiting line system. Today this is prepared for improving queue systems which are caused big system occurs in many states such as ticket queue, medicine problems between people and finding alternative solutions for queue, salary queue, bank queue or shopping queue and problems. Simulations of some distributions which are used in alternative solutions which are related with problem of queue this study will be denoted before simulation application. aspect of people satisfaction are investigated. There are several papers about simulation studies such as History of Simulation starts with China war’s games given in [8-17]. which are called “Weich” and comes from 5000 years ago. It continues until 1780s [1]. To considering simulation as a II. SIMULATION OF UNIFORM RANDOM VARIABLE method of experimentation and aim of scientific runs across 1944. It goes on a study about atom bomb which is prepared The probability density function of random variable X by approach of simulation of Von Neumann and Slam during Second World War. This study includes simulation of which is distributed uniformly in a, b is given as probability problems which are related with random neutron matching diffusion in fissile materiel. 1 for a x b A simulation method which is called “Monte Carlo” f ( x) b a . becomes popular by studies of Fermi, Von Neumann and Slam 0 for x a or x b and it is used for solving theoretical problems by using computers by many mathematicians, physicists and statisticians [2]. Simulation improves as a management tool by coming business computers and using them by combining The cumulative distribution function is: them in 1950s. Specialized languages of computers are developed in 1960s for considering extended size problems effectively [1]. Ozer OZDEMIR is with the Department of Statistics, Eskisehir Technical University Eskisehir 26470 TURKEY (corresponding author to provide phone: 902223350580-804668; e-mail: ozerozdemir@eskisehir.edu.tr). ISSN: 1998-0159 115 INTERNATIONAL JOURNAL OF MATHEMATICS AND COMPUTERS IN SIMULATION DOI: 10.46300/9102.2020.14.16 Volume 14, 2020 0 for x a, E t 1 x a F ( x) for a x b, b a for x b, 1 So its probability density function is: The expected value is f (t ) et for t 0, ab t from f (t ) . E x We can find random sample of , 2 Distribution function is: and variance is t (b a)2 F (t ) e x dx 1 e t for t 0, V ( x) 0 12 F (t ) R t F 1 ( R) Suppose that U is an uniform variable in 0,1 . 1 1 e t R t ln(1 R) . F x U for a x b, t 1 ln R for R[0,1], Solution of this equation is: is uniform number. For example, when 4 customers come for service in X a b a U an hour and R 0.9 , time is: properly [4-7]. 1 t ln 1 0.9 0.577 hour 4 III. SIMULATION OF EXPONENTIAL RANDOM VARIABLE 34.5 minutes If F x 1 e x then F 1 U can be found by until another customer comes. R should choose random. Table of random numbers is used for this choice [4-7]. solution of equation 1 e x u according to variable x . IV. RESULTS AND DISCUSSION X log 1 U Two cash desks system which are called “Express Cash Desk- Maximum Five Products” are going to consider in one of the most famous market in Turkey. Customers take service by Hence Y F 1 U log 1 U , whose expected using one queue from these cash desks and when customers value is 1, is distributed exponential for U which is uniform come for service, they take service from free cash desk. If two variable in 0,1 . cash desks are free then customers choose first cash desk. Mean of time which is between arrivals of customers for these cash desks will be defined by assuming that it corresponds 1 U 0,1 with exponential distribution. Also it will be defined by assuming that time of cashiers’ working corresponds with uniform distribution. Customers are serviced according to a is uniform [4-7]. principle that is “First service is given to customer who comes firstly”. Purpose of simulation is finding performance measures which can be listed as Short Example For Application 1. Mean usage time of two cash desks; t shows the time that is between arrivals of customers for a 2. Mean number of customers who queue(Mean length of barbershop. t indicates exponential distribution and its mean queue); is: 3. Mean waiting time of a customer who queues. ISSN: 1998-0159 116 INTERNATIONAL JOURNAL OF MATHEMATICS AND COMPUTERS IN SIMULATION DOI: 10.46300/9102.2020.14.16 Volume 14, 2020 Mean of time which is between arrivals of customers for Mean of time which is between arrivals of customers is two cash desks and time of cashiers’ working will be defined exponential distribution and its mean is 43 seconds according by considering system for 30 minutes for finding these to data. Time of service is 40-82 seconds for first cashier and performance measures. For that reason, this cash desk system 56-110 seconds for second cashier. is considered for 30 minutes and a table which is below is p denotes time which is between arrivals of customers, prepared (Between 17:00 and 17:30 o'clock). q1 denotes time of service for first cashier and q2 denotes Cash desk system considers customers who come for service in 30 minutes. 42 customers come for service in this time of service for second cashier for uniform random number time. Mean of time which is between arrivals of customers for 0 R 1 . two cash desks is found (M.A.C.); M.A.C. 17 : 29 : 40 17 : 00 :17 / 42 1 These values will be calculated with: 43 seconds. p 43ln R seconds for 0 R 1, Mean and standard deviation of time of cashiers’ working by using equation are calculated. 1 For first cashier; p ln R 1 61 Seconds and 1 21 Seconds q1 40 42R seconds for 0 R 1, For second cashier; q2 56 54R seconds for 0 R 1, 2 83 Seconds 2 27 Seconds by using equation Application can be changed as below after these reasons. q a b a R . Two cash desks system which are called “Express Cash Desk-Maximum Five Products” are going to consider in one of Performance measures are achieved by given data, the most famous market in Turkey. Customers take service by formulates and a program which is written by using “Microsoft using one queue from these cash desks and when customers Visual Studio C++ 6.0” (Number of customers is given 1000, come for service, they take service from free cash desk. If two if this number is increased, we can obtain better results). cash desks are free then customers choose first cash desk. Mean usage time of first cash desk is asked for first Mean of time which is between arrivals of customers for these performance measure. For answering this question, time that cash desks will be defined by assuming that it corresponds first cashier did not give service subtracts from time that first with exponential distribution whose mean is 43 seconds. cashier totally gave service and this result is divided by this Customers are serviced according to a principle that is “First total service time. There is similar operation for second cash service is given to customer who comes firstly”. Purpose of desk. simulation is finding performance measures which are Mean number of customers who queue or mean length of identified as: queue is asked for second performance measure. For answering this question, total waiting time is divided by 1. Mean usage time of two cash desks; simulation time. 2. Mean number of customers who queue(Mean length Mean waiting time of a customer who queues is asked for of queue); third performance measure. For answering this question, total 3. Mean waiting time of a customer who queues. waiting time is divided by number of customers. When the program which is convenient for problem and First cashier gives service between 40 61 21 40 data is run, output of the program is obtained. and 82 61 21 82 seconds by uniform distribution. Last customer comes for service at 17 hours (1000 customers approximately come for service in 17 hours). Second cashier gives service between Maximum length of queue is 2 customers for service. This 56 83 27 56 and 110 83 27 110 seconds by result is good aspect of management and cashiers who work uniform distribution. these cash desks. Because there is no accumulation for queue and there is no customers’ dissatisfaction so, cashiers work ISSN: 1998-0159 117 INTERNATIONAL JOURNAL OF MATHEMATICS AND COMPUTERS IN SIMULATION DOI: 10.46300/9102.2020.14.16 Volume 14, 2020 well. We can see from first performance measure that second [9] B. Khoshnevis, Discrete Systems Simulation, Mc Graw Hill Inc., 1994. [10] R. E. Shannon, System Simulation: The Art and Science, Prentice-Hall cashier works more than first cashier but this situation is Inc., 1975. observed because second cashier works slower than first. [11] W. C. Griffin, Queueing; Basic Teory and Aplications, Grid Inc., 1978. Mean length of queue is very small number as 0.08. Very short [12] G. S. Fishman, Discrete-Event Simulation-Modeling, Programming and queue is occurred obtaining from statistics of maximum length Analysis, Springer-Verlag New York Inc., 2001. [13] P. Bratley, B. L. Fox, L. E. Schrage, A Guide to Simulation, Springer- of queue. This result is very important aspect of management. Verlag New York Inc., 1987. Because management decides to increase or decrease numbers [14] J. A. Payne, Introduction to Simulation, Mc Graw-Hill Inc, 1982. of cash desks according to this result. If it decides to decrease [15] F. L. Severance, System Modeling and Simulation-An Introduction, John Wiley and Sons Ltd., 2001. numbers of cash desks, it provides benefit aspect of [16] L. Kosten, Stochastic Theory of Service Systems, Pergoman Pres. economical stability but its result can be seen a simulation Oxford, 1973. study again. Results can be obtained according to length of [17] T. K. Shridharbhai, Probability and statistics with reliability, queuing, and computer science applications, Prentice-Hall, 1982. queue after decreasing numbers of cash desks. A good result is seen from statistics of mean waiting time of a customer who queues as mean length of queue. 5.4 seconds is very short for Ozer Ozdemir was born in Turkey in 1982. He received his B.Sc., M.Sc. and waiting for a service. Consequently, mean waiting time of a Ph.D. degrees in statistics in the Department of Statistics at Anadolu customer who queues is appreciated by customers and University, Turkey, respectively in 2005, in 2008 and in 2013. He has worked manager. as a Research Assistant from 2006-2008, as a Lecturer from 2008-2014 and as an Assistant Professor from 2014-2018 in the Department of Statistics at Anadolu University, Turkey. He has worked as an Assistant Professor from V. CONCLUSIONS 2018 in the Department of Statistics at Eskisehir Technical University, A market’s cash desks system with one queue was considered Turkey. He has published over 70 international conference papers and journals in his in this study and results were obtained. 3 performance research areas. His research interests include Applied Statistics, Simulation, measures concern with system are obtained after this study. Artificial Neural Networks, Fuzzy Logic, Fuzzy Modeling, Time Series, Firstly, mean usage times of both two cash desks are very Computer Programming, Statistical Software and Computer Applications in close each other and these are found approximately %90. Statistics. Number of cash desks can be like this according to this result. If number of cash desks is increased, it may get economical Creative Commons Attribution License 4.0 burden aspect of management. Secondly, mean length of (Attribution 4.0 International, CC BY 4.0) queue of system which has one queue and two cash desks were simulated. Very short length of queue was obtained as 0.08 This article is published under the terms of the Creative customers. Finally, a result which likes second performance Commons Attribution License 4.0 measure was found. Mean waiting time of a customer who https://creativecommons.org/licenses/by/4.0/deed.en_US queues was found 5.4 seconds. Both customers and manager can be appreciated from these results. These results are indicator that management works well and there is not any problem concern with long queue. In further studies, various queue systems as bank queue, medicine queue, ticket queue or salary queue can be similarly considered like this study. Systems with many queues can be considered instead of one queue and systems with three or more cash desks can be considered instead of system with two cash desks. REFERENCES [1] A. Behiye, Simulasyon Nedir? [What is Simulation?], Retrieved September 10, 2007, from http://bilgibirikimi.tripod.com/simulasyon.htm, 2007. [2] K. Ozdamar, Bilgisayar ile Benzetim Yöntemleri (Benzetime Giriş), Anadolu U. Fen-Edebiyat F., 1988. [3] H. Sarıaslan, Sıra Bekleme Sistemlerinde Simülasyon(Benzetim) Tekniği, A.Ü.S.B.F. Matb., 1986. [4] A. H. Taha, Operational Research, Prentice-Hall, 2002. [5] J. Banks, J. S. Carson II, B. L. Nelson, D. M. Nicol, Discrete-event system simulation, Prentice-Hall, 2001. [6] S. M. Ross, Simulation, Elsevier Inc. 2006. [7] A. M. Law, W. D. Kelton, Simulation Modeling and Analysis, Mc Graw- Hill International Editions, 1991. [8] W. L. Winston, Operations Research Applications and Algorithms, PWS - KENT Publishing Company, 1991. ISSN: 1998-0159 118