MAT 4830 Mathematical Modeling

Slides:



Advertisements
Similar presentations
Simulating Single server queuing models. Consider the following sequence of activities that each customer undergoes: 1.Customer arrives 2.Customer waits.
Advertisements

CSCC69: Operating Systems
Modeling & Simulation. System Models and Simulation Framework for Modeling and Simulation The framework defines the entities and their Relationships that.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 16 Scheduling II.
Lecture 3 Concepts of Discrete-Event Simulation. 2 Discrete Event Model  In the discrete approach to system simulation, state changes in the physical.
Simscript II.5 Building simulation model with SIMSCRIPT II.5.
Simulating Single server queuing models. Consider the following sequence of activities that each customer undergoes: 1.Customer arrives 2.Customer waits.
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
CPSC 171 Introduction to Computer Science 3 Levels of Understanding Algorithms More Algorithm Discovery and Design.
MAT 4830 Mathematical Modeling Section 1.3 Conditional Statements
Designing a Discrete Event Simulation Tool Peter L. Jackson School of Operations Research and Industrial Engineering March 15, 2003 Cornell University.
MAT 4830 Mathematical Modeling 05 Mean Time Between Failures
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.
MAT 1235 Calculus II Section 8.5 Probability
MAT 4830 Mathematical Modeling Section 1.3 Conditional Statements
MAT 1235 Calculus II Section 6.4* General Log. and Exponential Functions
CE Operating Systems Lecture 7 Threads & Introduction to CPU Scheduling.
More Functions with Return Values CS303E: Elements of Computers and Programming.
MAT 4830 Mathematical Modeling
1 CMPSCI 187 Computer Science 187 Introduction to Introduction to Programming with Data Structures Lecture 13: Queues Announcements.
1 1 Slide © 2011 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole.
MAT 4830 Mathematical Modeling 04 Monte Carlo Integrations
 Simulation enables the study of complex system.  Simulation is a good approach when analytic study of a system is not possible or very complex.  Informational,
Introduction A probability distribution is obtained when probability values are assigned to all possible numerical values of a random variable. It may.
MAT 1235 Calculus II Section 8.5 Probability
Process Control Management Prepared by: Dhason Operating Systems.
Managerial Decision Making Chapter 13 Queuing Models.
Review for Test2. Scope 8 problems, 60 points. 1 Bonus problem (5 points) Coverage: – Test 1 coverage – Exception Handling, Switch Statement – Array of.
MAT 4725 Numerical Analysis Section 2.1 The Bisection Method
Chapter 6 – Continuous Probability Distribution Introduction A probability distribution is obtained when probability values are assigned to all possible.
UNIT–II: Process Management
REPETITION CONTROL STRUCTURE
Software Development Expansion of topics page 28 in Zelle
Data Types and Conversions, Input from the Keyboard
What’s cheating and what is not?
Topics Introduction to Repetition Structures
Homework Assignment #2 J. H. Wang Oct. 24, 2017.
Discrete Event Simulation
MAT 4725 Numerical Analysis
Functions CIS 40 – Introduction to Programming in Python
Modeling and Simulation CS 313
COMPUTER 2430 Object Oriented Programming and Data Structures I
Loops CS140: Introduction to Computing 1 Savitch Chapter 4 Flow of Control: Loops 9/18/13 9/23/13.
Siti Nurbaya Ismail Senior Lecturer
Creating a Workbook Part 2
ICS 143 Principles of Operating Systems
Microsoft Visual Basic 2005 BASICS
CPU Scheduling Basic Concepts Scheduling Criteria
Chapter 6: CPU Scheduling
Chapter 5: CPU Scheduling
How to develop a program?
Review for Final Exam.
So far…. Firmware identifies hardware devices present
COT 4600 Operating Systems Spring 2011
Chapter 5: CPU Scheduling
Lecture 2 Part 3 CPU Scheduling
Let’s all Repeat Together
Network performance project
Process Scheduling B.Ramamurthy 2/23/2019.
Review for Final Exam.
Do Now is on google classroom
The structure of programming
Chapter 4: Repetition Structures: Looping
Chapter 4: Simulation Designs
Bell work Build the following expressions to find which is greater:
Chapter 17 JavaScript Arrays
Scheduling 21 May 2019.
To Review for Test on Solving and Using Quadratic, Radical Equations
Cooperative & Experiential Education
Presentation transcript:

MAT 4830 Mathematical Modeling 07 Servicing Requests II http://myhome.spu.edu/lauw

HW Individual HW

HW HW 4 – well done One of you earned bonus points for your next exam.

HW HW 5 – I hope your MCM paper is explained better than this HW. Last night, I started this HW at 8pm and hoped that I would be home for dinner by 9:30pm. Describing how the codes works is not the same as explaining the idea of the solutions.

Preview Look at Server-Customer Systems with Queues Maple: The function nature of proc Use of user-defined proc Strings Handling

Server-Customer System with Queues Suppose requests cannot be rejects Requests will be assigned to the (first) server with the shortest wait One queue, multi-server (Post Office) We want to know the average waiting time of customers

Server-Customer System with Queues

Example 1: Suppose we have 1 server to handle requests.

Idea Generate 𝑛 customers If the server is busy, record the waiting time of the customer Compute the average waiting time

Tool: Clocks System Clock t: Indicate the current time Server Clock s: Indicate the completion time for the last customer being served

Tool: Clocks System Clock t: Indicate the current time Server Clock s: Indicate the completion time for the last customer being served if s<t, the server is idle

Tool: Clocks System Clock t: Indicate the current time Server Clock s: Indicate the completion time for the last customer being served if s≥t, the server is busy

Idea n T t S s W 1 7 12 19 2 11 18 14 33 3 8 26 40 4 15 41 48 5 6 47 10 58 9 57 66

Idea n T t S s W 1 7 12 19 2 11 18 14 33 3 8 26 40 4 15 41 48 5 6 47 10 58 9 57 66 First customer comes in at t=7 s<t? Idle?

Idea n T t S s W 1 7 12 19 2 11 18 14 33 3 8 26 40 4 15 41 48 5 6 47 10 58 9 57 66 The server will be busy until t=7+12=19

Idea n T t S s W 1 7 12 19 2 11 18 14 33 3 8 26 40 4 15 41 48 5 6 47 10 58 9 57 66 Next customer comes in 11 min. after the first customer. s<t? Idle?

Idea n T t S s W 1 7 12 19 2 11 18 15 33 3 8 26 40 4 41 48 5 6 47 10 58 9 57 66 Update the Wait counter with W=0+1

Idea n T t S s W 1 7 12 19 2 11 18 14 33 3 8 26 40 4 15 41 48 5 6 47 10 58 9 57 66 The server will be busy until t=19+14=33

Idea n T t S s W 1 7 12 19 2 11 18 14 33 3 8 26 40 4 15 41 48 5 6 47 10 58 9 57 66 Next customer comes in 8 min. after the last customer. s<t? Idle?

Idea n T t S s W 1 7 12 19 2 11 18 14 33 3 8 26 40 4 15 41 48 5 6 47 10 58 9 57 66 Update the Wait counter with W=1+(33-26)=8

Idea n T t S s W 1 7 12 19 2 11 18 14 33 3 8 26 40 4 15 41 48 5 6 47 10 58 9 57 66 The server will be busy until t=33+7=40

Idea n T t S s W 1 7 12 19 2 11 18 14 33 3 8 26 40 4 15 41 48 5 6 47 10 58 9 57 66 Next customer comes in 15 min. after the last customer. s<t? Idle?

Idea n T t S s W 1 7 12 19 2 11 18 14 33 3 8 26 40 4 15 41 48 5 6 47 10 58 9 57 66 The server will be busy until t=41+7=48

Idea n T t S s W 1 7 12 19 2 11 18 14 33 3 8 26 40 4 15 41 48 5 6 47 10 58 9 57 66

Idea n T t S s W 1 7 12 19 2 11 18 14 33 3 8 26 40 4 15 41 48 5 6 47 10 58 9 57 66

Idea n T t S s W 1 7 12 19 2 11 18 14 33 3 8 26 40 4 15 41 48 5 6 47 10 58 9 57 66

Idea n T t S s W 1 7 12 19 2 11 18 14 33 3 8 26 40 4 15 41 48 5 6 47 10 58 9 57 66

Idea n T t S s W 1 7 12 19 2 11 18 14 33 3 8 26 40 4 15 41 48 5 6 47 10 58 9 57 66

Idea n T t S s W 1 7 12 19 2 11 18 14 33 3 8 26 40 4 15 41 48 5 6 47 10 58 9 57 66

Idea n T t S s W 1 7 12 19 2 11 18 14 33 3 8 26 40 4 15 41 48 5 6 47 10 58 9 57 66

Example 2: Suppose we have 2 servers to handle requests Requests will be assigned to the server with the shortest wait

Idea n T t S s1 s2 W 1 7 12 19 2 11 18 14 32 3 8 26 33 4 29 39 5 6 35 10 45 36 47

Idea n T t S s1 s2 W 1 7 12 19 2 11 18 14 32 3 8 26 33 4 29 39 5 6 35 10 45 36 47

Idea n T t S s1 s2 W 1 7 12 19 2 11 18 14 32 3 8 26 33 4 29 39 5 6 35 10 45 36 47

Idea n T t S s1 s2 W 1 7 12 19 2 11 18 14 32 3 8 26 33 4 29 39 5 6 35 10 45 36 47

Idea n T t S s1 s2 W 1 7 12 19 2 11 18 14 32 3 8 26 33 4 29 39 5 6 35 10 45 36 47

Idea n T t S s1 s2 W 1 7 12 19 2 11 18 14 32 3 8 26 33 4 29 39 5 6 35 10 45 36 47

Idea n T t S s1 s2 W 1 7 12 19 2 11 18 14 32 3 8 26 33 4 29 39 5 6 35 10 45 36 47

Idea n T t S s1 s2 W 1 7 12 19 2 11 18 14 32 3 8 26 33 4 29 39 5 6 35 10 45 36 47

Idea n T t S s1 s2 W 1 7 12 19 2 11 18 14 32 3 8 26 33 4 29 39 5 6 35 10 45 36 47

Idea n T t S s1 s2 W 1 7 12 19 2 11 18 14 32 3 8 26 33 4 29 39 5 6 35 10 45 36 47

Idea n T t S s1 s2 W 1 7 12 19 2 11 18 14 32 3 8 26 33 4 29 39 5 6 35 10 45 36 47

Idea n T t S s1 s2 W 1 7 12 19 2 11 18 14 32 3 8 26 33 4 29 39 5 6 35 10 45 36 47

Idea n T t S s1 s2 W 1 7 12 19 2 11 18 14 32 3 8 26 33 4 29 39 5 6 35 10 45 36 47

Idea n T t S s1 s2 W 1 7 12 19 2 11 18 14 32 3 8 26 33 4 29 39 5 6 35 10 45 36 47

Idea n T t S s1 s2 W 1 7 12 19 2 11 18 14 32 3 8 26 33 4 29 39 5 6 35 10 45 36 47

Idea n T t S s1 s2 W 1 7 12 19 2 11 18 14 32 3 8 26 33 4 29 39 5 6 35 10 45 36 47

Example 3: Suppose we have 𝑚 servers to handle requests Requests will be assigned to the server with the shortest wait

Example 3: 𝒎 Servers 𝑠[1], 𝑠[2],…, 𝑠[𝑚] are the server clocks Find the (first) server with the minimum value Find 𝑘 such that

Maple Let us switch to Maple

The Function nature of proc Maple returns the result of the last executable statement in a procedure. We can also use return() to return the output. return() can be placed anywhere in the program. The output can be assigned to a variable Useful when called within another procedure

Example 4a Write a program to compute the function value of Of course, there are easier ways to do this. We only want to demo the point. Example 4b below does not represent the best programming practices

Example 4a

Example 4b

Example 4c Write a function(procedure) to Generate a normally generated random number 𝑥 with 𝑚𝑒𝑎𝑛=0 and 𝑠𝑡𝑑=1. Compute the square root of the cut off of 𝑥. Output this as the function value for the procedure. Call the cut off function from example 4b.

Example 4c

Maple: Strings Handling

Maple: Strings Handling Assignments

Maple: Strings Handling Subscripting

Maple: Strings Handling Subscripting

Maple: Strings Handling Subscripting

Maple: Strings Handling Counting