Professional Documents
Culture Documents
Objectives
Review Week4 Queueing Process Queue Characteristics Kendalls Notation Erlang Distribution Algorithms Flowcharts
f(x) 0 f(x) = 1
x
2.
2. f(x)dx = 1
-
Binomial Distribution
let p = probability that an event will happen q = 1-p, probability that the event will fail
The probability that the event will happen exactly x times in n trials
Normal Distribution
Any variable X following normal distribution with mean and standard deviation can be linearly transformed to the standard normal distribution by subtracting mean and dividing by standard deviation. Z be the standard variable corresponding to X X Z = --------------
March 20, 2012
Poisson Distribution
The probability distribution of the Poisson random variable X, in a given time interval is given by e-t (t)x P(x:t) = ------------------- x= 0, 1, 2,. x! where is the average number of outcomes per unit time
March 20, 2012
Queueing Theory
Introduction
Queueing Process consists of
Customers arriving at a service facility Then waiting in a line (queue) if all servers are busy Eventually receiving service Finally departing from the service
Introduction
Queueing system is a
Set
of customers Set of servers An order where customers arrive and are processed
Introduction
It is a birth-death process with a population consists of customers either waiting for service or currently in service Birth occurs when a customer arrives at the service facility Death occurs when a customer departs from the facility State of the system is the number of customers in the facility.
Queue Characteristics
Queueing systems are characterized by five components
Arrival pattern of customers Service pattern Number of servers The capacity of the facility to hold customers The order in which customers are served
Arrival Patterns
Arrival of a customer is usually specified by interarrival time, the time between successive customer arrivals Arrival patterns may be Deterministic (exactly known) Random (known probability distributions) Depends on the number of customers already in the system or may be state-independent
Arrival Patterns
Balking, occurs when a customer refuses to enter the service facility because the queue is too long
Reneging, occurs when a customer already in queue leaves the facility because the queue is too long
Service Patterns
It is specified by service time, the time required by one server to serve a customer Service time may be
Deterministic Random variable
Service Patterns
Depend on the number of customers already in the system or may be stateindependent A customer may be served
By a single server A sequence of servers
System Capacity
It is the maximum number of customers, permitted in the service facility at the same time
In the service In the queue
When a customer arrives at a facility that is full, the customer is denied entrance
System Capacity
The customer who is denied entrance is not allowed to wait outside the facility. The customer is forced to leave without receiving service Why ???????
A system with no limit has infinite capacity A system with a limit has finite capacity
Queue disciplines
Queue discipline is the order in which customers are served
FIFO (first in first out) LIFO (last in first out) Random basis Priority basis
Kendalls notation
Kendalls notation for specifying a queue characteristics is v/ w/ x/ y/ z v indicates arrival pattern w denotes service pattern x denotes the number of servers y represents system capacity (number of customers) z designates queue discipline
March 20, 2012
Meaning
Deterministic Exponentially distributed Erlang type distributed Any other distribution First in first out Last in first out Service in random order Priority ordering Any other ordering
Interarrival time
or
Service time
Queue discipline
Erlang distribution
It is a continuous probability distribution. Developed by A. K. Erlang, to examine the of telephone calls which might be made at the same time to the operators of the switching stations. This distribution, measures the time between incoming calls, is used in conjunction with the expected duration of incoming calls to produce information about the traffic load. It is used for traffic modelling (traffic engineering) for applications such as the design of call centres.
Please Note
If y or z are not specified it is taken to be (infinity) or FIFO respectively y is assumed as (infinity) z is taken as FIFO
Example
A D/ D/ 1 has
Deterministic values for Interarrival times Deterministic values for Service times Only one server
A typical programming task can be divided into two phases: Problem solving phase
produce an ordered sequence of steps that describe solution of problem this sequence of steps is called an algorithm implement the program in some programming language
(Algorithms and Flowcharts)
Implementation phase
First produce a general step by step process (pseudocode) Refine the step by step process successively to get a detailed algorithm that is very close to a computer language. Pseudocode is an artificial and informal language that helps programmers develop algorithms. Pseudocode is very similar to everyday English.
(Algorithms and Flowcharts)
Example
Write an algorithm to determine a students final grade and indicate whether it is passing or failing. The final grade is calculated as the average of four marks.
Example - Pseudocode
Pseudocode: Input a set of 4 marks Calculate their average by summing and dividing by 4 if average is below 50 Print FAIL else Print PASS
(Algorithms and Flowcharts)
March 20, 2012
Example - Algorithm
Step 1: Step 2: Step 3: Input M1,M2,M3,M4 GRADE (M1+M2+M3+M4)/4 if (GRADE < 50) then Print FAIL else Print PASS endif
(Algorithms and Flowcharts)
Flowchart
A Flowchart
shows logic of an algorithm emphasizes individual steps and their interconnections They allow a process to be described in a step-by-step manner e.g. control flow from one action to the next
Terminators
Start
Oval Shape One line in or out Used to indicate the beginning and end of a process
Stop
Data Boxes
Input
Parallelogram shaped One line in, One line out Used to indicate the input or output of data from the system.
Output
(Developing Flowcharts, Putting Algorithms to work)
Process Boxes
Rectangle shaped One line in, One line out Used to indicate a process step
Process
Decision Boxes
Diamond shaped One line in, two lines out Must contain a binary question (Yes/No, True/False, 0/1, etc) Used to branch a program dependent upon a condition being met
Yes/No Question
Parallelogram
Rectangle
Diamond
Denotes a decision (or branch) to be made. The program should continue along one of two routes. (e.g. IF/THEN/ELSE)
Hybrid
Flow line
Simple Flowchart
Flowchart - Example
START Input M1,M2,M3,M4
GRADE(M1+M2+M3+M4)/4
Step 1: Input M1,M2,M3,M4 Step 2: GRADE (M1+M2+M3+M4)/4 Step 3: if (GRADE <50) then Print FAIL else Print PASS endif
Y (Algorithms and Flowcharts)
IS GRADE<5 0
PRINT PASS
PRINT FAIL
STOP
March 20, 2012
Sequence
Events happen one after the other, with no branching Flow is directly from top to bottom
Decision
Uses a decision box to branch to one of two options Flow is downwards Lines rejoin the flow at lines, NOT boxes.
Repetition
Used to repeat a process, or wait until a condition is met before proceeding. Flow is upwards. Lines join at lines, NOT boxes.
Start
Read A, B
Yes Print A
Is A > B
No Print B
End
March 20, 2012
NO
Bad design
What is wrong with this chart? The box has two lines in, one line out Lines must join other lines, never boxes!
Bad design
What is wrong with this flowchart? Never use curved lines. Always straight Always vertical or horizontal.
Summary
Summary
A typical programming task can be divided into two phases : Problem solving phase and Implementation phase Pseudocode is a general step by step process An Algorithm is a refined Pseudocode All flowcharts are composed of three basic control structures : Sequence, Decision and Repetition
Reference
R Bronson : Theory and Problems of Operations Research, Schaum's Outline series, McGraw Hill Computer Fundamentals, Prof. B. I. Khodanpur, R. V. College of Engineering. Developing Flowcharts, Putting Algorithms to work.