CPSC 531: Introduction to Systems Modeling and Simulation Instructor: Anirban Mahanti Office: ICT 745 Email: mahanti@cpsc.ucalgary.ca Class Location: TRB 101 Lectures: TR 15:30 – 16:45 hours Class web page: http://pages.cpsc.ucalgary.ca/~mahanti/teaching/F05/CPSC531/ Notes derived from “Simulation Modeling and Analysis” by A. Law and W. Kelton, Third edition, McGraw Hill, 2000. CPSC 531: Introduction 1 What is this course about? This course is primarily about imitating the operation of real-world systems using computer programs. Our focus will be on “discrete-event” simulations. We will learn how to: Abstract real-world systems into models Implement models using software Experiment design Systems modeling requires understanding of Basic probability, statistics, elementary calculus We will also talk about analytically solving models CPSC 531: Introduction 2 Tentative topics and schedule Introduction (1 week) General Principles and Examples (1.5 weeks) Statistical Models (1.5 weeks) Queuing Models (2 weeks) Generating Random-Numbers (1 week) Generating Random-Variates (1 week) Input Modelling (1 week) Output Data Analysis (1 week) Experiment Design and Analysis (1.5 weeks) Simulation of Computer Systems (1 week) - time permitting CPSC 531: Introduction 3 Books and software Lecture material primarily drawn from: Discrete-Event System Simulation (Fourth Edition), Banks, Carson, Nelson, and Nicol, Prentice-Hall, 2005. Henceforth, referred to as [BCNN05]. Simulation Modeling and Analysis (Third Edition), Law and Kelton, McGraw Hill, 2000. Henceforth, referred to as [LK00]. Other texts – see class web pages. Software: C/C++, Unix, CSIM simulation tool Learn CSIM on your own; TAs will provide help. CPSC 531: Introduction 4 Assignment, exams, and grading Four assignments – programming in C/C++/CSIM, problem-solving questions Need to cumulatively obtain a passing grade in the assignment component of the course Midterm examination – closed book/notes Final examination – closed book/notes Need to obtain a passing grade in the final exam Grading – moderate (class average ~ B?) Conclusion – need to work hard; read the text; attend classes and tutorials; learn a lot! CPSC 531: Introduction 5 Basics of Modeling and Simulation What is simulation? How to study a system? When to use simulations? Application areas of simulation Terminology – system, state, events Model classification Types of simulation Steps in a simulation study Advantages, disadvantages, and pitfalls in a simulation study CPSC 531: Introduction 6 What is a simulation? Simulation – is imitation of the operation of a facility or process, usually using a computer Facility being simulated is also called a “system” Assumptions/approximations, both logical and mathematical, are made about how the system works These assumptions form a model of the system Models have many applications and can answer questions such as: Why does my Web performance suffer when my room-mate starts using the WiFi connection? What will be the path of a hurricane? Etc. CPSC 531: Introduction 7 How to study a system? CPSC 531: Introduction 8 When to use simulations? Simulations can be used: To study complex system, i.e., systems where analytic solutions are infeasible. To compare design alternatives for a system that doesn’t exist. To study the effect of alterations to an existing system. Why not change the system?? To reinforce/verify analytic solutions. Simulations should not be used: If model assumptions are simple such that mathematical methods can be used to obtain exact answers (analytical solutions) CPSC 531: Introduction 9 Application Areas Design and performance evaluation of computer systems Determining hardware requirements or protocols for communications networks Studying CPU Scheduling algorithms Evaluation of Web caching policies Design and analysis of manufacturing systems Operation of a production line Evaluating designs for service organizations Study call centers, fast-food restaurants, hospitals, and post offices Evaluating military weapons systems or their logistics requirements Designing and operating transportation systems such as airports, freeways, ports, and subways Analyzing financial or economic systems CPSC 531: Introduction 10 Terminology System: A collection of objects that act and interact together toward some logical end State of a system: Collection of variables and their values necessary to characterize a system at a particular time E.g. Determine number of cashiers needed to provide express service to customers with 10 or less item at a superstore – system consists of express cashiers and customers with 10 or less items Might depend on desired objectives, performance measures SS Example: # of express cashiers, time of arrival of customers with 10 or less items, etc. Event: A change in system state Customer arrival, start of service, and customer departure CPSC 531: Introduction 11 Model Classification [Jain91] Continuous-time vs. discrete-time models Continuous-event vs. discrete-event models Deterministic vs. probabilistic models Static vs. dynamic models Linear vs. non-linear models Open vs. closed models CPSC 531: Introduction 12 Continuous and Discrete-time models Number of students in cpsc 531 Number of cust. in queue Time (a) Continuous-time Time (b) Discrete-time CPSC 531: Introduction 13 Continuous and Discrete-event models Distance traveled by plane Number of cust. in queue Time (a) Continuous-event Time (b) Discrete-event CPSC 531: Introduction 14 Deterministic and Stochastic Models Deterministic models produce deterministic results Stochastic or probabilistic models are subject to random effects Typically, they have one or more random inputs (e.g., arrival of customers, service time etc.). Outputs from stochastic models are “estimates” of the true characteristics of the system Need to repeat experiments number of times Need to have confidence in the results CPSC 531: Introduction 15 More on models Static and dynamic models Static models – system state independent of time Dynamic models - system state change with time Linear and non-linear models Linear models – output is a linear function of input parameters Open and closed models (a) Open Model (b) Closed Model CPSC 531: Introduction 16 Types of Simulation (1/2) Monte Carlo simulation No time element (usually) Used for evaluating non-probabilistic expressions (e.g., an integral) using probabilistic methods Wide variety of mathematical problems Trace-driven simulation Extensively used in computer systems performance evaluation; e.g., paging algorithms Advantages: credibility, easy validation, less randomness, accurate workload Disadvantages: complexity, only a snap-shot, representative?, single point of validation CPSC 531: Introduction 17 Types of Simulation (2/2) Monte Carlo simulation Trace-driven simulation Discrete-event simulation: a simulation using a discrete-event (also called discrete-state) model of the system E.g., Widely used for studying computer systems Continuous-event simulation: uses a continuous-state models E.g., Widely used in chemical/pharmaceutical studies Our focus will be on discrete-event systems. CPSC 531: Introduction 18 Steps in a Simulation Study CPSC 531: Introduction 19 Advantages, disadvantages, and pitfalls in a simulation study Advantages Simulation allows great flexibility in modeling complex systems, so simulation models can be highly valid Easy to compare alternatives Control experimental conditions Can study system with a very long time frame Disadvantages Stochastic simulations produce only estimates – with noise Simulation models can be expensive to develop Simulations usually produce large volumes of output – need to summarize, statistically analyze appropriately Pitfalls Failure to identify objectives clearly up front Inappropriate level of detail (both ways) Inadequate design and analysis of simulation experiments Inadequate education, training CPSC 531: Introduction 20