1 NAME: MWANGI ERIC REGNO: HDB212-0754/2020 UNIT: SIMULATION AND MODELING COURSE: BBIT ASSINGMENT 1&2 2 Assignment 1 a) A TV repairman finds that the time spent on his jobs has an Exponential distribution with mean 20 minutes. If he repairs sets in the order in which they come in, and if the arrival of sets is approximately Poisson with an average rate of 10 per 8-hour day, what is repairman’s expected idle time each day? How many jobs are ahead of the average set just brought-in? b) In a railway marshalling yard, goods trains arrive at a rate of 30 trains per day. Assuming that the inter-arrival time follows an exponential distribution and the service time distribution is also exponential with an average 30 minutes, calculate the following a) The mean queue size (line length) b) The probability that the queue size exceeds 10 c) If the input of the train increases to an average 33 per day, what will be the change in (a) and (b)? d) Explain the benefit of simulation, modeling and analysis. Cost-effective: Simulation, modeling, and analysis are typically much cheaper and faster than conducting real-world experiments or building physical prototypes. They allow engineers, scientists, and researchers to test different scenarios, evaluate the impact of different factors, and optimize performance without incurring the cost and time associated with actual testing. Risk reduction: Simulation, modeling, and analysis can help identify potential problems or risks early in the design process, before any actual testing or implementation is done. This can help 3 reduce the likelihood of costly errors, failures, or delays, and can also help improve the safety and reliability of the system. Flexibility: Simulation, modeling, and analysis allow for easy modification and refinement of the system or model being studied. This can help researchers quickly explore different design options and evaluate their impact on performance, without the need for expensive or timeconsuming modifications. Insight: Simulation, modeling, and analysis can provide valuable insights into the behavior of complex systems that may be difficult or impossible to observe in the real world. For example, simulation can help visualize the internal workings of a system, or help identify patterns or relationships in large datasets. Predictive power: Simulation, modeling, and analysis can help predict how a system will perform under different conditions, or how it will respond to changes in input parameters. This can help engineers and designers make informed decisions about the design and operation of the system e) In the production shop of a company the breakdown of the machine is found to be Poisson with an average rate of 2 machines per hour. Breakdown time at one machine costs Rs. 40 per hour to the company. There are two choices before the company for hiring the repairmen. One of the repairmen is slow but cheap, the other fast but expensive. The slow-cheap repairman demands Rs. 20 per hour and will repair the broken machines exponentially at the rate of 3 per hour. The fast expensive repairman demands KSh. 20 per hour and will repair machines exponentially at an average rate of 6 per hour. Which repairman should be hired? f) Explain the roles of random number in the Monte-Carlo simulation. 1. Random numbers play a crucial role in Monte Carlo simulation by providing a source of stochasticity or randomness. In Monte Carlo simulation, random numbers are used to generate 4 random samples or events that represent uncertain or probabilistic factors in a system. These random samples are then used to estimate the behavior of the system and its outcomes. 2. Monte Carlo simulation is a computational technique that involves repeated random sampling to obtain numerical solutions to complex problems that are difficult or impossible to solve analytically. By generating random numbers according to specified probability distributions, Monte Carlo simulation allows analysts to simulate the behavior of complex systems and calculate statistical measures such as means, variances, and probabilities of outcomes. 3. In Monte Carlo simulation, random numbers are used to model uncertain or probabilistic factors in a system. For example, if we are simulating a stock price, we may model the daily returns as random numbers generated from a normal distribution with a specified mean and standard deviation. Similarly, if we are simulating a queueing system, we may model the arrival times of customers and the service times of servers as random numbers generated from appropriate probability distributions. 4.Random numbers are also used in Monte Carlo simulation to generate multiple scenarios or simulations that represent possible outcomes of a system. By generating a large number of simulations, Monte Carlo simulation allows analysts to calculate the probability of different outcomes and to quantify the uncertainty associated with the system. This makes Monte Carlo simulation a powerful tool for decision-making under uncertainty. f) A supermarket has a single cashier. During the peak hours, customers arrive at a rate of 10 customers per hour. The average number of customers that can be processed by the cashier is 20 per hour. Calculate: a) Probability that the cashier is idle. b) Average number of customers in the queueing system. c) Queue size d) Average time a customer spends in the system 5 ASSIGNMENT 2 a) Describe the following terms as used in queuing systems i) Reneging- refers to the situation where a customer who has entered a queue or waiting line, leaves the queue before being served. (ii)Balking-refers- to the situation where a customer arrives at a queuing system but decides not to join the queue due to various reasons such as the length of the queue. iii) Jockeying- refers to the situation where a customer switches between different queues or lines to try to reduce their waiting time. iv) System capacity- System Capacity refers to the maximum number of customers that a queuing system can serve at a given time. v) Queue Discipline- refers to the set of rules that determine how customers are served from the queue. b) Describe five applications of simulation and modeling in real life 1. Manufacturing: Simulation and modeling are used to optimize the design and operation of manufacturing systems, including production lines, assembly lines, and supply chain networks. By creating digital models of manufacturing systems, engineers can test different scenarios, identify bottlenecks, and optimize the system to improve efficiency and productivity. 2. Transportation: Simulation and modeling are used to analyze traffic flow, optimize route planning, and improve safety in transportation systems. For example, computer simulations can be used to model the behavior of individual vehicles and pedestrians in urban areas, allowing city planners to identify areas of congestion and improve traffic flow. 3. Healthcare: Simulation and modeling are used in healthcare to optimize treatment plans, predict disease outcomes, and improve patient outcomes. For example, simulations can be used to test different treatment options for cancer patients, allowing doctors to determine the best course of action and improve survival rates. 4. Finance: Simulation and modeling are used in finance to model financial markets, predict asset prices, and evaluate investment strategies. For example, Monte Carlo simulations can be used to model the behavior of stock prices, allowing investors to evaluate the risk of different investment portfolios. 5. Defense: Simulation and modeling are used in defense to test and optimize the performance of weapons systems, simulate battlefield scenarios, and train soldiers. For example, computer 6 simulations can be used to model the behavior of missiles and other weapons systems, allowing engineers to test different designs and improve their effectiveness in combat. c) Describe the five types of queue discipline 1.First-In-First-Out (FIFO): In this discipline, customers are served in the order in which they arrive in the queue. The first customer to arrive is the first to be served, and so on. This is the most common and widely used queue discipline, and it ensures that customers are served fairly and in the order they arrive. 2.Last-In-First-Out (LIFO): In this discipline, the last customer to arrive is the first to be served. This is also known as a "stack" discipline and is used in situations where the last customer is considered the most important or urgent, such as in a lifeguard station where the last person to enter the pool may be in need of immediate assistance. 3.Priority Queueing: In this discipline, customers are served based on their priority level. Customers with higher priority are served before those with lower priority. Priority levels can be determined by various factors such as customer type, service type, or urgency of the service request. 4.Round Robin: In this discipline, customers are served in a cyclic manner, with each customer receiving a fixed amount of service time before the next customer is served. This discipline is commonly used in situations where each customer requires the same amount of service time. 5.Fair Queueing: In this discipline, customers are assigned a share of the service time based on the length of their waiting time. Customers who have waited longer are given a larger share of the service time, ensuring that all customers are served fairly and that no customer is left waiting for an excessively long period. d) Describe the elements of queuing systems 1.Arrival process: This refers to how customers arrive at the system. It can be modeled as either a Poisson process or a deterministic process, and is often characterized by the rate or frequency of arrivals. 2.Service process: This refers to how customers are served once they enter the system. It can be modeled as either a single server or multiple servers, and is often characterized by the average service time or the service rate. 3.Queue: This refers to the waiting line where customers wait for service. It can be modeled as a finite or infinite queue, and is often characterized by the queue length or the queue capacity. 4.Exit process: This refers to how customers leave the system once they have received service. It can be modeled as either a random or deterministic process, and is often characterized by the exit rate or the probability of abandonment. 7 e) List five advantages of simulation 1.Flexibility: Simulation models are highly flexible and can be easily modified to incorporate changes in the system being analyzed. This makes simulation an ideal tool for exploring different scenarios and testing various strategies and policies. 2.Risk-free experimentation: Simulation allows for risk-free experimentation, as it enables analysts to test different scenarios and strategies without having to implement them in the real world. This can be particularly useful in situations where implementing changes would be expensive, time-consuming, or risky. 3.Insights into complex systems: Simulation can provide valuable insights into complex systems, such as those found in manufacturing, transportation, and healthcare. By modeling these systems, analysts can better understand their behavior, identify potential bottlenecks and inefficiencies, and develop strategies for improving performance. 4.Cost-effective: Simulation can be a cost-effective way of analyzing systems and testing different scenarios, as it eliminates the need for expensive physical prototypes or extensive field testing. This can be particularly useful in situations where resources are limited. 5.Realistic representation: Simulation can provide a realistic representation of the system being analyzed, as it takes into account various factors such as variability, randomness, and interdependence of different elements. This can help to ensure that the results of the analysis are accurate and reliable. f) Describe at least three classifications of simulation model. 1.Discrete-event simulation (DES): In DES models, the state of the system is updated at discrete points in time, which correspond to events such as arrivals, departures, and service completions. DES models are often used to analyze systems where events occur at irregular intervals, such as queuing systems, transportation networks, and manufacturing processes. 2.Continuous simulation: In continuous simulation models, the state of the system is updated continuously over time, based on differential equations that describe the behavior of the system. Continuous simulation models are often used to analyze systems where the behavior of the system can be described by continuous mathematical functions, such as in fluid flow systems, chemical reactions, and electrical circuits. 3.Agent-based simulation: In agent-based simulation models, the system is modeled as a collection of autonomous agents, each with its own set of behaviors and decision-making rules. Agent-based models are often used to analyze complex systems where the behavior of the system is emergent, meaning it arises from the interactions of individual agents. Examples of agentbased models include simulations of social networks, market dynamics, and ecological systems. 8 g) List the features of simulation software environments 1.Modeling capabilities: Simulation software environments should provide a range of modeling capabilities, including the ability to create, modify, and analyze models of different types. 2.Simulation engines: Software environments should include simulation engines that allow for the execution of simulation models and the generation of results. 3.Input and output facilities: The software environment should provide facilities for inputting data into the simulation model and outputting the results in a format that can be easily interpreted and analyzed. 4.Visualizations and animation: Simulation software should provide visualizations and animation tools that allow users to visualize the behavior of the system being simulated and to interact with the simulation in real-time. 5.Data analysis and reporting: Simulation software should provide tools for analyzing and reporting simulation results, including statistical analysis, graphical representation of results, and the ability to generate reports. 6.Flexibility and extensibility: Simulation software environments should be flexible and extensible, allowing users to modify the software to suit their specific needs and to incorporate new features and functionality as required. 7.User interface: The software environment should have a user-friendly interface that allows users to easily navigate and interact with the software, and to quickly learn how to use it. h) Explain why optimization via simulation is difficulty 1.Time-consuming: Simulation models are typically complex and computationally expensive, which makes optimization via simulation a time-consuming process. Running multiple simulations to find the optimal solution can take a long time, especially for large-scale problems. 2.Search space: The search space for optimization via simulation can be very large and complex, with many possible combinations of input parameters and decision variables. This can make it difficult to find the optimal solution, especially if the search space is not well-defined. 3.Uncertainty: Simulation models often involve uncertainty in input parameters and output variables, which makes it difficult to accurately predict the behavior of the system being simulated. This can make it difficult to identify the optimal solution, as there may be multiple optimal solutions depending on the level of uncertainty. 4.Optimization algorithms: Choosing the right optimization algorithm for a given simulation model can be difficult, as different algorithms may perform better or worse depending on the specific characteristics of the model. Moreover, some optimization algorithms may require extensive tuning and customization in order to be effective. 9 5.Validation and verification: Validating and verifying the simulation model can be difficult, as simulation models are often complex and involve many interconnected components. This can make it challenging to ensure that the model accurately represents the real-world system being simulated. i) State the properties of a good Arithmetic Number generator. 1.Randomness: The generator should produce a sequence of numbers that appear to be randomly distributed, with no apparent patterns or correlations. 2.Uniformity: The generator should produce a sequence of numbers that are uniformly distributed over the interval [0,1]. 3.Independence: Each number in the sequence should be independent of the others, i.e., the value of each number should not depend on the values of the previous numbers. 4.Reproducibility: Given the same initial seed value, the generator should produce the same sequence of numbers each time it is run. 5.Efficiency: The generator should be efficient and not require a large amount of computational resources to produce a large number of random numbers. 6.Periodicity: The generator should have a long period, meaning that the sequence of numbers it produces should not repeat itself for a large number of iterations. 7.Security: The generator should be secure and not be susceptible to cryptographic attacks or other forms of tampering. 8.Easy to use: The generator should be easy to use and integrate into software applications, with clear documentation and well-defined interfaces.