Computer Science 112 Fundamentals of Programming II Modeling and Simulation.

Slides:



Advertisements
Similar presentations
Chapter 13 Queueing Models
Advertisements

Chapter 6 Queues and Deques.
Decision Maths Lesson 14 – Simulation. Wiltshire Simulation There are many times in real life where we need to make mathematical predictions. How long.
Queues.
New Mexico Computer Science For All Designing and Running Simulations Maureen Psaila-Dombrowski.
CS 206 Introduction to Computer Science II 03 / 04 / 2009 Instructor: Michael Eckmann.
Fundamentals of Python: From First Programs Through Data Structures
Chapter 7 Queues. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.1-2 Chapter Objectives Examine queue processing Define a queue abstract.
Queue RIZWAN REHMAN CENTRE FOR COMPUTER STUDIES DIBRUGARH UNIVERSITY.
Event-drive SimulationCS-2303, C-Term Project #3 – Event-driven Simulation CS-2303 System Programming Concepts (Slides include materials from The.
Comp 245 Data Structures Queues. Introduction to the Queue ADT It is a FIFO (first-in, first-out) structure Access to the Queue can take place at two.
Simulation. Example: A Bank Simulator We are given: –The number of tellers –The arrival time of each customer –The amount of time each customer requires.
Module F: Simulation. Introduction What: Simulation Where: To duplicate the features, appearance, and characteristics of a real system Why: To estimate.
Queues Chapter 6. Chapter Objectives  To learn how to represent a waiting line (queue) and how to use the methods in the Queue interface for insertion.
© 2006 Pearson Addison-Wesley. All rights reserved8-1 Chapter 8 Queues CS102 Sections 51 and 52 Marc Smith and Jim Ten Eyck Spring 2008.
1 Queues Queue Concept Queue Design Considerations Queues in Java Collections APIs Queue Applications Reading L&C , 9.3.
CS 206 Introduction to Computer Science II 03 / 06 / 2009 Instructor: Michael Eckmann.
27 March, 2000 CS1001 Lecture 9 Program Debugging Previews of Arrays, Functions, and Subroutines More Project Design and code segments.
CS 206 Introduction to Computer Science II 10 / 17 / 2008 Instructor: Michael Eckmann.
CS 206 Introduction to Computer Science II 10 / 20 / 2008 Instructor: Michael Eckmann.
CS 206 Introduction to Computer Science II 10 / 15 / 2008 Instructor: Michael Eckmann.
CS 206 Introduction to Computer Science II 10 / 26 / 2009 Instructor: Michael Eckmann.
Fall 2007CS 2251 Queues Chapter 6. Fall 2007CS 2252 Chapter Objectives To learn how to represent a waiting line (queue) and how to use the methods in.
Queues Chapter 6. Chapter 6: Queues2 Chapter Objectives To learn how to represent a waiting line (queue) and how to use the methods in the Queue interface.
Simulation Waiting Line. 2 Introduction Definition (informal) A model is a simplified description of an entity (an object, a system of objects) such that.
Project 2: ATM’s & Queues
Queues What is a Queue? Queue Implementations: Queue As Array
CS 206 Introduction to Computer Science II 10 / 28 / 2009 Instructor: Michael Eckmann.
DC Cafeteria Simulation Exit Entrance Mr. SubChopsticks Manager of DC caf would like a simulation of the customer activity in a day. You are given the.
Chapter 7 Queues. Copyright © 2005 Pearson Addison-Wesley. All rights reserved. 7-2 Chapter Objectives Examine queue processing Define a queue abstract.
Introduction to Discrete Event Simulation Customer population Service system Served customers Waiting line Priority rule Service facilities Figure C.1.
Simulation Examples ~ By Hand ~ Using Excel
CHP-4 QUEUE.
© 2006 Pearson Addison-Wesley. All rights reserved8 A-1 Chapter 8 Queues (slightly modified by Dan Fleck)
TK1924 Program Design & Problem Solving Session 2011/2012 L6: Queues.
Stacks and Queues Introduction to Computing Science and Programming I.
Operations management using System Dynamics Part II.
Computer Science 101 Modeling and Simulation. Scientific Method Observe behavior of a system and formulate an hypothesis to explain it Design and carry.
ITI Introduction to Computing II Lab-8 Dewan Tanvir Ahmed University of Ottawa.
Project 2: ATM’s & Queues. ATM’s & Queues  Certain business situations require customers to wait in line for a service Examples:  Waiting to use an.
1 CS 132 Spring 2008 Chapter 8 Queues. 2 Queue A data structure in which the elements are added at one end, called the rear, and deleted from the other.
1 QUEUES. 2 Definition A queue is a linear list in which data can only be inserted at one end, called the rear, and deleted from the other end, called.
Data Structures Using C++ 2E Chapter 8 Queues. Data Structures Using C++ 2E2 Objectives Learn about queues Examine various queue operations Learn how.
Waiting Lines and Queuing Models. Queuing Theory  The study of the behavior of waiting lines Importance to business There is a tradeoff between faster.
C++ Programming: Program Design Including Data Structures, Fourth Edition Chapter 18: Stacks and Queues (part 3)
OOSE Use Case. Requirement Functional: –Features, capabilities, and security Non Functional: –Usability: Human factors, help, and documentation –Reliability:
CSC 205 Programming II Lecture 22 Carwash Simulation.
Fall 2007CS 2251 Queues Chapter 6. Fall 2007CS 2252 Chapter Objectives To learn how to represent a waiting line (queue) and how to use the methods in.
Queues Chapter 6. Chapter 6: Queues Chapter Objectives To learn how to represent a waiting line (queue) and how to use the five methods in the Queue interface:
Data Structures Using Java1 Chapter 7 Queues. Data Structures Using Java2 Chapter Objectives Learn about queues Examine various queue operations Learn.
1 5. Abstract Data Structures & Algorithms 5.1 Data Structure Fundamentals.
OPERATING SYSTEMS CS 3530 Summer 2014 Systems with Multi-programming Chapter 4.
1 Simulation Implementation Using high-level languages.
Chapter 2 Fundamental Simulation Concepts
1 CMPSCI 187 Computer Science 187 Introduction to Introduction to Programming with Data Structures Lecture 13: Queues Announcements.
MODELING EXAMPLES Types of model Conceptual Containing components that have not been clearly Identified in terms of theoretic categories such as state,
Chapter 8 Queues. © 2004 Pearson Addison-Wesley. All rights reserved 8-2 The Abstract Data Type Queue A queue –New items enter at the back, or rear, of.
OPERATING SYSTEMS CS 3530 Summer 2014 Systems and Models Chapter 03.
Chapter 7 Queues Introduction Queue applications Implementations.
Simulation modelling real processes to make predictions.
Simulation of single server queuing systems
Chapter 1 What is Simulation?. Fall 2001 IMSE643 Industrial Simulation What’s Simulation? Simulation – A broad collection of methods and applications.
Data Structures Using C++ 2E
2.7: Simulation.
Introduction to Data Structure
Queues What is a Queue? Queue Implementations: As Array
Visit for more Learning Resources
Using a Queue Chapter 8 introduces the queue data type.
Using a Queue Chapter 8 introduces the queue data type.
CSCS-200 Data Structure and Algorithms
Presentation transcript:

Computer Science 112 Fundamentals of Programming II Modeling and Simulation

Models and Simulation A model is a simplified description of a real-world situation or process A simulation starts with a model in an initial state and runs a process on it until a final state is reached Parameters vary the initial states, and feedback from the final states can be used to improve the model

Examples Traffic flows on highways Life cycles of organisms Power grid usage during heat waves

Case Study: Supermarket Checkout How many checkout clerks are needed at various times of the day? What is the maximum amount of time a customer should have to wait in line?

Important Factors in the Situation frequency of customer arrival number of cashiers available amount of time to serve a customer total period of time

Variability of the Factors customers don’t always show up at regular intervals number and types of items in a cart may vary time to transfer items from cart to counter may vary –age of customer –distracted by children

Simulating Time As in complexity analysis, use abstract units or ticks of an abstract clock (each unit represents a minute, in this case) If a customer arrives once every 4 minutes on the average –generate a random number between 0 and 1 on each tick –if that number is less than.25, then add a new customer to the checkout line

Queues for Checkout Lines Each arriving customer goes at the rear of a cashier’s queue On each tick of the clock, the customer at the front of the queue receives a unit of service When a cashier is finished serving a customer, that customer is popped from the queue

Classes for the Simulation Queue (array or link-based) Customer Cashier MarketModel MarketView

Responsibilities of Customer Maintains its arrival time and its amount of service time Knows when its cashier has provided enough service Generates a new instance according to the probability of arrival

Responsibilities of Cashier Maintains a queue of customers Adds and removes customers to/from its queue Gives the front customer a unit of service and removes it from the queue when its service is finished

Responsibilities of MarketModel Runs the simulation Creates the cashiers Sends new customers to the cashiers Maintains the abstract clock, tracking the total running time During each tick, tells the cashiers to provide another unit of service

Inputs to the Simulation The total running time The average processing time per customer The probability of arrival of new customers The number of cashiers

Outputs of the Simulation For each cashier –the cashier’s ID number –the total number of customers processed –the average wait time per customer –the number of customers left in the line at the end of the simulation

Terminal-Based User Interface

GUI-Based UI

For Friday Introduction to Lists