prepared by mr. prabhu assistant professor, mechanical department veltech dr.rr & dr.sr...

198
Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Upload: elsa-albany

Post on 15-Dec-2015

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Prepared by Mr. PrabhuAssistant Professor, Mechanical DepartmentVelTech Dr.RR & Dr.SR Technical University

1

Operation and Planning ControlU7MEA37

Page 2: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Unit ILinear programming

2

Page 3: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Introduction to Operations Research

• Operations research/management science

– Winston: “a scientific approach to decision making, which seeks to determine how best to design and operate a system, usually under conditions requiring the allocation of scarce resources.”

– Kimball & Morse: “a scientific method of providing executive departments with a quantitative basis for decisions regarding the operations under their control.”

Page 4: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Introduction to Operations Research

• Provides rational basis for decision making– Solves the type of complex problems that turn up in

the modern business environment– Builds mathematical and computer models of

organizational systems composed of people, machines, and procedures

– Uses analytical and numerical techniques to make predictions and decisions based on these models

Page 5: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Introduction to Operations Research

• Draws upon – engineering, management, mathematics

• Closely related to the "decision sciences" – applied mathematics, computer science,

economics, industrial engineering and systems engineering

Page 6: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Methodology of Operations Research*The Seven Steps to a Good OR Analysis

Identify the Problemor Opportunity

Understand the System

Formulate a Mathematical Model

Verify the Model

Select the Best Alternative

Implement and Evaluate

Present the Results ofthe Analysis

Page 7: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Methodology of Operations Research*The Seven Steps to a Good OR Analysis

Identify the Problemor Opportunity

Understand the System

Formulate a Mathematical Model

Verify the Model

Select the Best Alternative

Implement and Evaluate

Present the Results ofthe Analysis

•What are the objectives?

•Is the proposed problem too narrow?

•Is it too broad?

Page 8: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Methodology of Operations Research*The Seven Steps to a Good OR Analysis

Identify the Problemor Opportunity

Understand the System

Formulate a Mathematical Model

Verify the Model

Select the Best Alternative

Implement and Evaluate

Present the Results ofthe Analysis

•What data should be collected?

•How will data be collected?

•How do different components of the system interact with each other?

Page 9: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Methodology of Operations Research*The Seven Steps to a Good OR Analysis

Identify the Problemor Opportunity

Understand the System

Formulate a Mathematical Model

Verify the Model

Select the Best Alternative

Implement and Evaluate

Present the Results ofthe Analysis

•What kind of model should be used?

•Is the model accurate?

•Is the model too complex?

Page 10: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Methodology of Operations Research*The Seven Steps to a Good OR Analysis

Identify the Problemor Opportunity

Understand the System

Formulate a Mathematical Model

Verify the Model

Select the Best Alternative

Implement and Evaluate

Present the Results ofthe Analysis

•Do outputs match current observations for current inputs?

•Are outputs reasonable?

•Could the model be erroneous?

Page 11: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Methodology of Operations Research*The Seven Steps to a Good OR Analysis

Identify the Problemor Opportunity

Understand the System

Formulate a Mathematical Model

Verify the Model

Select the Best Alternative

Implement and Evaluate

Present the Results ofthe Analysis

•What if there are conflicting objectives?

•Inherently the most difficult step.

•This is where software tools will help us!

Page 12: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Methodology of Operations Research*The Seven Steps to a Good OR Analysis

Identify the Problemor Opportunity

Understand the System

Formulate a Mathematical Model

Verify the Model

Select the Best Alternative

Implement and Evaluate

Present the Results ofthe Analysis

•Must communicate results in layman’s terms.

•System must be user friendly!

Page 13: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Methodology of Operations Research*The Seven Steps to a Good OR Analysis

Identify the Problemor Opportunity

Understand the System

Formulate a Mathematical Model

Verify the Model

Select the Best Alternative

Implement and Evaluate

Present the Results ofthe Analysis

•Users must be trained on the new system.

•System must be observed over time to ensure it works properly.

Page 14: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Linear ProgrammingLinear Programming

14

Page 15: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Objectives– Requirements for a linear programming model.

– Graphical representation of linear models.

– Linear programming results:• Unique optimal solution• Alternate optimal solutions• Unbounded models• Infeasible models

– Extreme point principle.

15

Page 16: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Objectives - continued

– Sensitivity analysis concepts:• Reduced costs• Range of optimality--LIGHTLY• Shadow prices• Range of feasibility--LIGHTLY• Complementary slackness• Added constraints / variables

– Computer solution of linear programming models

• WINQSB• EXCEL• LINDO

16

Page 17: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

• A Linear Programming model seeks to maximize or minimize a linear function, subject to a set of linear constraints.

• The linear model consists of the following components:– A set of decision variables.– An objective function.– A set of constraints.

– SHOW FORMAT17

3.1 Introduction to Linear Programming

Page 18: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

• The Importance of Linear Programming

– Many real static problems lend themselves to linear programming formulations.

– Many real problems can be approximated by linear models.

– The output generated by linear programs provides useful “what’s best” and “what-if” information.

18

Page 19: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Assumptions of Linear Programming

• The decision variables are continuous or divisible, meaning that 3.333 eggs or 4.266 airplanes is an acceptable solution

• The parameters are known with certainty• The objective function and constraints exhibit

constant returns to scale (i.e., linearity)• There are no interactions between decision variables

19

Page 20: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Methodology of Linear Programming

Determine and define the decision variablesFormulate an objective function

verbal characterizationMathematical characterization

Formulate each constraint

20

Page 21: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

MODEL FORMULATION

• Decisions variables::

– X1 = Production level of Space Rays (in dozens per week).

– X2 = Production level of Zappers (in dozens per week).

• Objective Function:

– Weekly profit, to be maximized

21

Page 22: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

The Objective FunctionThe Objective Function

Each dozen Space Rays realizes $8 in profit.Each dozen Space Rays realizes $8 in profit.Total profit from Space Rays is 8X1.Total profit from Space Rays is 8X1.Each dozen Zappers realizes $5 in profit.Each dozen Zappers realizes $5 in profit.Total profit from Zappers is 5X2.Total profit from Zappers is 5X2.The total profit contributions of both isThe total profit contributions of both is 8X1 + 5X28X1 + 5X2(The profit contributions are additive because of (The profit contributions are additive because of

the linearity assumption)the linearity assumption)

22

Page 23: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

The Linear Programming Model

Max 8X1 + 5X2 (Weekly profit)subject to2X1 + 1X2 < = 1200 (Plastic)3X1 + 4X2 < = 2400 (Production Time) X1 + X2 < = 800 (Total production) X1 - X2 < = 450 (Mix) Xj> = 0, j = 1,2 (Nonnegativity)

23

Page 24: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

3.4 The Set of Feasible Solutions for Linear Programs

24

The set of all points that satisfy all the

constraints of the model is called a

FEASIBLE REGIONFEASIBLE REGION

Page 25: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Using a graphical presentation

we can represent all the constraints,

the objective function, and the three

types of feasible points.

25

Page 26: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

26

1200

600

The Plastic constraint

Feasible

The plastic constraint: 2X1+X2<=1200

X2

Infeasible

Production Time3X1+4X2<=2400

Total production constraint: X1+X2<=800

600

800

Production mix constraint:X1-X2<=450

• There are three types of feasible pointsInterior points.

Boundary points.Extreme points.

X1

Page 27: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Linear Programming- Simplex method

• “...finding the maximum or minimum of linear functions in which many variables are subject to constraints.” (dictionary.com)

• A linear program is a “problem that requires the minimization of a linear form subject to linear constraints...” (Dantzig vii)

Page 28: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Important Note

• Linear programming requires linear inequalities

• In other words, first degree inequalities only!Good: ax + by + cz < 3

Bad: ax2 + log2y > 7

Page 29: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Lets look at an example...

• Farm that produces Apples (x) and Oranges (y)• Each crop needs land, fertilizer, and time.• 6 acres of land: 3x + y < 6• 6 tons of fertilizer: 2x + 3y < 6• 8 hour work day: x + 5y < 8• Apples sell for twice as much as oranges• We want to maximize profit (z): 2x + y = z• We can't produce negative: x > 0, y > 0

Page 30: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Traditional Method

• Graph the inequalities• Look at the line we're trying to maximize.

x = 1.71y = .86z = 4.29

Page 31: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Problems...

• More variables?• Cannot eyeball the answer?

Page 32: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Simplex Method

• George B. Dantzig in 1951• Need to convert equations• Slack variables

Page 33: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Performing the Conversion

• -z + 2x + y = 0 (Objective Equation)• s1 + x + 5y = 8

• s2 + 2x + 3y = 6

• s3 + 3x + y = 6

• Initial feasible solution

Page 34: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

More definitions

• Non-basic: x, y• Basic variables: s1, s2, s3, z

• Current Solution: Set non-basic variables to 0• -z + 2x + y = 0 => z = 0• Valid, but not good!

Page 35: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Next step...

• Select a non-basic variable– -z + 2x + 1y = 0 – x has the higher coefficient

• Select a basic variable– s1 + 1x + 5y = 8 1/8

– s2 + 2x + 3y = 6 2/6

– s3 + 3x + y = 6 3/6

• 3/6 is the highest, use equation with s3

Page 36: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

New set of equations

• Solve for x– x = 2 - (1/3)s3 -(1/3)y

• Substitute in to other equations to get...– -z – (2/3)s3 +(1/3)y = -4

– s1– (1/3)s3 + (14/3)y = 6

– s2 – (2/3)s3 +(7/3)y = 2

– x + (1/3)s3 +(1/3)y = 2

Page 37: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Redefine everything...

• Update variables• Non-Basic: s3 and y

• Basic: s1, s2, z, and x

• Current Solution: – -z – (2/3)s3 +(1/3)y = -4 => z = 4

– x + (1/3)s3 +(1/3)y = 2 => x = 2

– y = 0

• Better, but not quite there.

Page 38: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Do it again!

• Repeat this process• Stop repeating when the coefficients in the

objective equation are all negative.

Page 39: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Improvements

• Different kinds of inequalities• Minimized instead of maximized• L. G. Kachian algorithm proved polynomial

Page 40: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Artificial Variable Technique (The Big-M Method)

Page 41: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Big-M Method of solving LPP

The Big-M method of handling instances with artificial variables is the “commonsense approach”. Essentially, the notion is to make the artificial variables, through their coefficients in the objective function, so costly or unprofitable that any feasible solution to the real problem would be preferred....unless the original instance possessed no feasiblesolutions at all. But this means that we need to assign, in theobjective function, coefficients to the artificial variables that areeither very small (maximization problem) or very large(minimization problem); whatever this value,let us call it Big M.In fact, this notion is an old trick in optimization in general; wesimply associate a penalty value with variables that we do notwant to be part of an ultimate solution(unless such an outcomeIs unavoidable).

Page 42: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Indeed, the penalty is so costly that unless any of the respective variables' inclusion is warranted algorithmically,such variables will never be part of any feasible solution.This method removes artificial variables from the basis. Here, we assign a large undesirable (unacceptable penalty) coefficients to artificial variables from the objective function point of view. If the objective function (Z) is to be minimized, then a very large positive price (penalty, M) is assigned to each artificial variable and if Z is to be minimized, then a very large negative price is to be assigned. The penalty will be designated by +M for minimization problem and by –M for a maximization problem and also M>0.

Page 43: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Example: Minimize Z= 600X1+500X2

subject to constraints,2X1+ X2 >or= 80 X1+2X2 >or= 60 and X1,X2 >or= 0Step1: Convert the LP problem into a system of linear equations.We do this by rewriting the constraint inequalities as equations by subtracting new “surplus & artificial variables" and assigning them zero & +M coefficientsrespectively in the objective function as shown below.So the Objective Function would be: Z=600X1+500X2+0.S1+0.S2+MA1+MA2

subject to constraints, 2X1+ X2-S1+A1 = 80 X1+2X2-S2+A2 = 60 X1,X2,S1,S2,A1,A2 >or= 0

Page 44: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Step 2: Obtain a Basic Solution to the problem.We do this by putting the decision variables X1=X2=S1=S2=0,so that A1= 80 and A2=60. These are the initial values of artificial variables.

Step 3: Form the Initial Tableau as shown.

Cj 600 500 0 0 M M

CB

Basic Variable (B)

Basic Soln(XB)

X1 X2 S1 S2 A1 A2

M A1 80 2 1 -1 0 1 0 80M A2 60 1 2 0 -1 0 1 60

3M 3M M M M M

600-3M 500-3M M M 0 0

Min.Ratio (XB/Pivotal

Col.)

Zj

Cj - Zj

Page 45: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

It is clear from the tableau that X2 will enter and A2 will leave the basis. Hence 2 is the key element in pivotal column. Now,the new row operations are as follows:R2(New) = R2(Old)/2R1(New) = R1(Old) - 1*R2(New)

Cj 600 500 0 0 M

CB

Basic Variable (B)

Basic Soln(XB)

X1 X2 S1 S2 A1

M A1 50 3 2 0 -1 1 2 1 100/3500 X2 30 1 2 1 0 - 1/2 0 60

3M/2+250 500 M M/2-250 M

350-3M/2 0 M 250-M/2 0

Min.Ratio (XB/Pivota

l Col.)

Zj

Cj - Zj

Page 46: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

It is clear from the tableau that X1 will enter and A1 will leave the basis. Hence 2 is the key element in pivotal column. Now,the new row operations are as follows:R1(New) = R1(Old)*2/3R2(New) = R2(Old) – (1/2)*R1(New)

Cj 600 500 0 0

CB

Basic Variable (B)

Basic Soln(XB)

X1 X2 S1 S2

600 X1 100/3 1 0 2 3 1 3500 X2 40/3 0 1 1 3 2 3

600 500 700 3 400 30 0 700 3 400 3

Zj

Cj - Zj

Min.Ratio (XB/Pivotal Col.)

Page 47: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Since all the values of (Cj-Zj) are either zero or positive and also both the artificial variables have been removed, an optimum solution has been arrived at with X1=100/3 , X2=40/3 and Z=80,000/3.

Page 48: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

48

Unit IIDynamic Programming

Characteristics and Examples

Page 49: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

49

Overview

• What is dynamic programming?• Examples• Applications

Page 50: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

50

What is Dynamic Programming?

• Design technique – ‘optimization’ problems (sequence of related decisions) – Programming does not mean ‘coding’ in this context, it

means ‘solve by making a chart’- or ‘using an array to save intermediate steps”. Some books call this ‘memoization’ (see below)

– Similar to Divide and Conquer BUT subproblem solutions are SAVED and NEVER recomputed

– Principal of optimality: the optimal solution to the problem contains optimal solutions to the subproblems (Is this true for EVERYTHING?)

Page 51: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

51

Characteristics

• Optimal substructure– Unweighted shortest path?– Unweighted longest simple path?

• Overlapping Subproblems– What happens in recursion (D&C) when this happens?

• Memoization (not a typo!)– Saving solutions of subproblems (like we did in Fibonacci)

to avoid recomputation

Page 52: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

52

Examples

• Matrix chain• Longest common subsequence (called the LCS

problem”

Page 53: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

53

Review of Technique

• You have already applied dynamic programming and understand it why it may result in a good algorithm – Fibonacci– Ackermann– Combinations

Page 54: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

54

Principal of Optimality

• Often called the “optimality condition” • What it means in plain English: you apply the divide

and conquer technique so the subproblems are SMALLER VERSIONS OF THE ORIGINAL PROBLEM: if you solve “optimize” the answer to the small problems , does that fact automatically mean that the solution to the big problem is also optimized????? If the answer is yes , then DP applies to his problem

Page 55: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

55

Example 1

• Assume your problem is to draw a straight line between two points A and B. You solve this by divide and conquer by drawing a line from A to the midpoint and from the midpoint to B. QUESTION: if you paste the two smaller lines together will the RESULTING LINE FROM A TO B BE THE SHORTEST DISTANCE FROM A to B???

Page 56: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

56

Example 2

• Say you want to buy Halloween candy – 100 candy bars. You do plan to do this by divide and conquer – buying 10 sets of 10 bars. Is this necessarily less expensive per bar than just buying 2 packages of 50? Or perhaps 1 package of 100?

Page 57: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

57

How To Apply DP

• There are TWO ways to apply dynamic programming– METHOD 1: solve the problem at hand recursively,

notice where the same subproblem is being ‘re-solved’ and implement the algorithm as a TABLE (example: fibonacci)

– METHOD 2: generate all feasible solutions to a problem but prune (eliminate) the solutions that cannot be optimal (example: shortest path)

Page 58: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

58

Practice Is the Only Way to Learn This Technique

• See class webpage for homework.• Do problems in textbook not assigned but for

practice – even after term ends. It took me two years after I took this course before I could apply DP in the real world.

Page 59: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

59

Dynamic programmingDesign technique, like divide-and-conquer.

Example: Longest Common Subsequence (LCS)• Given two sequences x[1 . . m] and y[1 . . n], find

a longest subsequence common to them both.

x: A B C B D A B

y: B D C A B A

“a” not “the”

BCBA = LCS(x, y)

functional notation, but not a function

Page 60: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Review: Dynamic programming• DP is a method for solving certain kind of

problems• DP can be applied when the solution of a

problem includes solutions to subproblems• We need to find a recursive formula for the

solution• We can recursively solve subproblems,

starting from the trivial case, and save their solutions in memory

• In the end we’ll get the solution of the whole problem

04/18/23 60

Page 61: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Properties of a problem that can be solved with dynamic programming

• Simple Subproblems– We should be able to break the original

problem to smaller subproblems that have the same structure

• Optimal Substructure of the problems– The solution to the problem must be a

composition of subproblem solutions

• Subproblem Overlap– Optimal subproblems to unrelated problems can

contain subproblems in common

04/18/23 61

Page 62: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Review: Longest Common Subsequence (LCS)

• Problem: how to find the longest pattern of characters that is common to two text strings X and Y

• Dynamic programming algorithm: solve subproblems until we get the final solution

• Subproblem: first find the LCS of prefixes of X and Y.

• this problem has optimal substructure: LCS of two prefixes is always a part of LCS of bigger strings

04/18/23 62

Page 63: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Review: Longest Common Subsequence (LCS) continued

• Define Xi, Yj to be prefixes of X and Y of length i and j; m = |X|, n = |Y|

• We store the length of LCS(Xi, Yj) in c[i,j]

• Trivial cases: LCS(X0 , Yj ) and LCS(Xi, Y0) is empty (so c[0,j] = c[i,0] = 0 )

• Recursive formula for c[i,j]:

04/18/23 63

otherwise]),1[],1,[max(

],[][ if1]1,1[],[

jicjic

jyixjicjic

c[m,n] is the final solution

Page 64: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Review: Longest Common Subsequence (LCS)

• After we have filled the array c[ ], we can use this data to find the characters that constitute the Longest Common Subsequence

• Algorithm runs in O(m*n), which is much better than the brute-force algorithm: O(n 2m)

04/18/23 64

Page 65: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

0-1 Knapsack problem

• Given a knapsack with maximum capacity W, and a set S consisting of n items

• Each item i has some weight wi and benefit

value bi (all wi , bi and W are integer values)

• Problem: How to pack the knapsack to achieve maximum total value of packed items?

04/18/23 65

Page 66: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

0-1 Knapsack problem:a picture

04/18/23 66

W = 20

wi bi

109

85

54

43

32

Weight Benefit value

This is a knapsackMax weight: W = 20

Items

Page 67: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

0-1 Knapsack problem• Problem, in other words, is to find

04/18/23 67

Ti

iTi

i Wwb subject to max

The problem is called a “0-1” problem, because each item must be entirely accepted or rejected.

Just another version of this problem is the “Fractional Knapsack Problem”, where we can take fractions of items.

Page 68: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

0-1 Knapsack problem: brute-force approach

Let’s first solve this problem with a straightforward algorithm

• Since there are n items, there are 2n possible combinations of items.

• We go through all combinations and find the one with the most total value and with total weight less or equal to W

• Running time will be O(2n)

04/18/23 68

Page 69: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

0-1 Knapsack problem: brute-force approach

• Can we do better?

• Yes, with an algorithm based on dynamic programming

• We need to carefully identify the subproblems

04/18/23 69

Let’s try this:If items are labeled 1..n, then a subproblem would be to find an optimal solution for Sk = {items labeled 1, 2, .. k}

Page 70: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Defining a Subproblem If items are labeled 1..n, then a subproblem

would be to find an optimal solution for Sk = {items labeled 1, 2, .. k}

• This is a valid subproblem definition.

• The question is: can we describe the final solution (Sn ) in terms of subproblems (Sk)?

• Unfortunately, we can’t do that. Explanation follows….

04/18/23 70

Page 71: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Defining a Subproblem

04/18/23 71

Max weight: W = 20For S4:Total weight: 14;total benefit: 20

w1 =2

b1 =3

w2 =4

b2 =5

w3 =5

b3 =8

w4 =3

b4 =4 wi bi

10

85

54

43

32

Weight Benefit

9

Item

#

4

3

2

1

5

S4

S5

w1 =2

b1 =3

w2 =4

b2 =5

w3 =5

b3 =8

w4 =9

b4 =10

For S5:Total weight: 20total benefit: 26

Solution for S4 is not part of the solution for S5!!!

?

Page 72: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Defining a Subproblem (continued)

• As we have seen, the solution for S4 is not part of the solution for S5

• So our definition of a subproblem is flawed and we need another one!

• Let’s add another parameter: w, which will represent the exact weight for each subset of items

• The subproblem then will be to compute B[k,w]

04/18/23 72

Page 73: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Recursive Formula for subproblems

• It means, that the best subset of Sk that has total weight w is one of the two:

1) the best subset of Sk-1 that has total weight w, or

2) the best subset of Sk-1 that has total weight w-wk plus the item k

04/18/23 73

else }],1[],,1[max{

if ],1[],[

kk

k

bwwkBwkB

wwwkBwkB

Recursive formula for subproblems:

Page 74: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Recursive Formula

• The best subset of Sk that has the total weight w, either contains item k or not.

• First case: wk>w. Item k can’t be part of the solution, since if it was, the total weight would be > w, which is unacceptable

• Second case: wk <=w. Then the item k can be in the solution, and we choose the case with greater value

04/18/23 74

else }],1[],,1[max{

if ],1[],[

kk

k

bwwkBwkB

wwwkBwkB

Page 75: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

0-1 Knapsack Algorithmfor w = 0 to W

B[0,w] = 0

for i = 0 to n

B[i,0] = 0

for w = 0 to W

if wi <= w // item i can be part of the solution

if bi + B[i-1,w-wi] > B[i-1,w]

B[i,w] = bi + B[i-1,w- wi]

else

B[i,w] = B[i-1,w]

else B[i,w] = B[i-1,w] // wi > w 04/18/23 75

Page 76: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Running timefor w = 0 to W

B[0,w] = 0

for i = 0 to n

B[i,0] = 0

for w = 0 to W

< the rest of the code >

04/18/23 76

What is the running time of this algorithm?

O(W)

O(W)

Repeat n times

O(n*W)Remember that the brute-force algorithm

takes O(2n)

Page 77: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Example

04/18/23 77

Let’s run our algorithm on the following data:

n = 4 (# of elements)W = 5 (max weight)Elements (weight, benefit):(2,3), (3,4), (4,5), (5,6)

Page 78: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Example (2)

04/18/23 78

for w = 0 to WB[0,w] = 0

0

0

0

0

0

0

W0

1

2

3

4

5

i 0 1 2 3

4

Page 79: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Example (3)

04/18/23 79

for i = 0 to nB[i,0] = 0

0

0

0

0

0

0

W0

1

2

3

4

5

i 0 1 2 3

0 0 0 0

4

Page 80: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Example (4)

04/18/23 80

if wi <= w // item i can be part of the solution if bi + B[i-1,w-wi] > B[i-1,w] B[i,w] = bi + B[i-1,w- wi] else B[i,w] = B[i-1,w] else B[i,w] = B[i-1,w] // wi > w

0

0

0

0

0

0

W0

1

2

3

4

5

i 0 1 2 3

0 0 0 0i=1bi=3

wi=2

w=1w-wi =-1

Items:1: (2,3)2: (3,4)3: (4,5) 4: (5,6)

4

0

Page 81: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Example (5)

04/18/23 81

if wi <= w // item i can be part of the solution if bi + B[i-1,w-wi] > B[i-1,w] B[i,w] = bi + B[i-1,w- wi] else B[i,w] = B[i-1,w] else B[i,w] = B[i-1,w] // wi > w

0

0

0

0

0

0

W0

1

2

3

4

5

i 0 1 2 3

0 0 0 0i=1bi=3

wi=2

w=2w-wi =0

Items:1: (2,3)2: (3,4)3: (4,5) 4: (5,6)

4

0

3

Page 82: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Example (6)

04/18/23 82

if wi <= w // item i can be part of the solution if bi + B[i-1,w-wi] > B[i-1,w] B[i,w] = bi + B[i-1,w- wi] else B[i,w] = B[i-1,w] else B[i,w] = B[i-1,w] // wi > w

0

0

0

0

0

0

W0

1

2

3

4

5

i 0 1 2 3

0 0 0 0i=1bi=3

wi=2

w=3w-wi=1

Items:1: (2,3)2: (3,4)3: (4,5) 4: (5,6)

4

0

3

3

Page 83: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Example (7)

04/18/23 83

if wi <= w // item i can be part of the solution if bi + B[i-1,w-wi] > B[i-1,w] B[i,w] = bi + B[i-1,w- wi] else B[i,w] = B[i-1,w] else B[i,w] = B[i-1,w] // wi > w

0

0

0

0

0

0

W0

1

2

3

4

5

i 0 1 2 3

0 0 0 0i=1bi=3

wi=2

w=4w-wi=2

Items:1: (2,3)2: (3,4)3: (4,5) 4: (5,6)

4

0

3

3

3

Page 84: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Example (8)

04/18/23 84

if wi <= w // item i can be part of the solution if bi + B[i-1,w-wi] > B[i-1,w] B[i,w] = bi + B[i-1,w- wi] else B[i,w] = B[i-1,w] else B[i,w] = B[i-1,w] // wi > w

0

0

0

0

0

0

W0

1

2

3

4

5

i 0 1 2 3

0 0 0 0i=1bi=3

wi=2

w=5w-wi=2

Items:1: (2,3)2: (3,4)3: (4,5) 4: (5,6)

4

0

3

3

3

3

Page 85: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Example (9)

04/18/23 85

if wi <= w // item i can be part of the solution if bi + B[i-1,w-wi] > B[i-1,w] B[i,w] = bi + B[i-1,w- wi] else B[i,w] = B[i-1,w] else B[i,w] = B[i-1,w] // wi > w

0

0

0

0

0

0

W0

1

2

3

4

5

i 0 1 2 3

0 0 0 0i=2bi=4

wi=3

w=1w-wi=-2

Items:1: (2,3)2: (3,4)3: (4,5) 4: (5,6)

4

0

3

3

3

3

0

Page 86: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Example (10)

04/18/23 86

if wi <= w // item i can be part of the solution if bi + B[i-1,w-wi] > B[i-1,w] B[i,w] = bi + B[i-1,w- wi] else B[i,w] = B[i-1,w] else B[i,w] = B[i-1,w] // wi > w

0

0

0

0

0

0

W0

1

2

3

4

5

i 0 1 2 3

0 0 0 0i=2bi=4

wi=3

w=2w-wi=-1

Items:1: (2,3)2: (3,4)3: (4,5) 4: (5,6)

4

0

3

3

3

3

0

3

Page 87: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Example (11)

04/18/23 87

if wi <= w // item i can be part of the solution if bi + B[i-1,w-wi] > B[i-1,w] B[i,w] = bi + B[i-1,w- wi] else B[i,w] = B[i-1,w] else B[i,w] = B[i-1,w] // wi > w

0

0

0

0

0

0

W0

1

2

3

4

5

i 0 1 2 3

0 0 0 0i=2bi=4

wi=3

w=3w-wi=0

Items:1: (2,3)2: (3,4)3: (4,5) 4: (5,6)

4

0

3

3

3

3

0

3

4

Page 88: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Example (12)

04/18/23 88

if wi <= w // item i can be part of the solution if bi + B[i-1,w-wi] > B[i-1,w] B[i,w] = bi + B[i-1,w- wi] else B[i,w] = B[i-1,w] else B[i,w] = B[i-1,w] // wi > w

0

0

0

0

0

0

W0

1

2

3

4

5

i 0 1 2 3

0 0 0 0i=2bi=4

wi=3

w=4w-wi=1

Items:1: (2,3)2: (3,4)3: (4,5) 4: (5,6)

4

0

3

3

3

3

0

3

4

4

Page 89: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Example (13)

04/18/23 89

if wi <= w // item i can be part of the solution if bi + B[i-1,w-wi] > B[i-1,w] B[i,w] = bi + B[i-1,w- wi] else B[i,w] = B[i-1,w] else B[i,w] = B[i-1,w] // wi > w

0

0

0

0

0

0

W0

1

2

3

4

5

i 0 1 2 3

0 0 0 0i=2bi=4

wi=3

w=5w-wi=2

Items:1: (2,3)2: (3,4)3: (4,5) 4: (5,6)

4

0

3

3

3

3

0

3

4

4

7

Page 90: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Example (14)

04/18/23 90

if wi <= w // item i can be part of the solution if bi + B[i-1,w-wi] > B[i-1,w] B[i,w] = bi + B[i-1,w- wi] else B[i,w] = B[i-1,w] else B[i,w] = B[i-1,w] // wi > w

0

0

0

0

0

0

W0

1

2

3

4

5

i 0 1 2 3

0 0 0 0i=3bi=5

wi=4

w=1..3

Items:1: (2,3)2: (3,4)3: (4,5) 4: (5,6)

4

0

3

3

3

3

00

3

4

4

7

0

3

4

Page 91: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Example (15)

04/18/23 91

if wi <= w // item i can be part of the solution if bi + B[i-1,w-wi] > B[i-1,w] B[i,w] = bi + B[i-1,w- wi] else B[i,w] = B[i-1,w] else B[i,w] = B[i-1,w] // wi > w

0

0

0

0

0

0

W0

1

2

3

4

5

i 0 1 2 3

0 0 0 0i=3bi=5

wi=4

w=4w- wi=0

Items:1: (2,3)2: (3,4)3: (4,5) 4: (5,6)

4

0 00

3

4

4

7

0

3

4

5

3

3

3

3

Page 92: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Example (15)

04/18/23 92

if wi <= w // item i can be part of the solution if bi + B[i-1,w-wi] > B[i-1,w] B[i,w] = bi + B[i-1,w- wi] else B[i,w] = B[i-1,w] else B[i,w] = B[i-1,w] // wi > w

0

0

0

0

0

0

W0

1

2

3

4

5

i 0 1 2 3

0 0 0 0i=3bi=5

wi=4

w=5w- wi=1

Items:1: (2,3)2: (3,4)3: (4,5) 4: (5,6)

4

0 00

3

4

4

7

0

3

4

5

7

3

3

3

3

Page 93: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Example (16)

04/18/23 93

if wi <= w // item i can be part of the solution if bi + B[i-1,w-wi] > B[i-1,w] B[i,w] = bi + B[i-1,w- wi] else B[i,w] = B[i-1,w] else B[i,w] = B[i-1,w] // wi > w

0

0

0

0

0

0

W0

1

2

3

4

5

i 0 1 2 3

0 0 0 0i=3bi=5

wi=4

w=1..4

Items:1: (2,3)2: (3,4)3: (4,5) 4: (5,6)

4

0 00

3

4

4

7

0

3

4

5

7

0

3

4

5

3

3

3

3

Page 94: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Example (17)

04/18/23 94

if wi <= w // item i can be part of the solution if bi + B[i-1,w-wi] > B[i-1,w] B[i,w] = bi + B[i-1,w- wi] else B[i,w] = B[i-1,w] else B[i,w] = B[i-1,w] // wi > w

0

0

0

0

0

0

W0

1

2

3

4

5

i 0 1 2 3

0 0 0 0i=3bi=5

wi=4

w=5

Items:1: (2,3)2: (3,4)3: (4,5) 4: (5,6)

4

0 00

3

4

4

7

0

3

4

5

7

0

3

4

5

7

3

3

3

3

Page 95: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Comments

• This algorithm only finds the max possible value that can be carried in the knapsack

• To know the items that make this maximum value, an addition to this algorithm is necessary

• Please see LCS algorithm from the previous lecture for the example how to extract this data from the table we built

04/18/23 95

Page 96: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Conclusion• Dynamic programming is a useful technique

of solving certain kind of problems

• When the solution can be recursively described in terms of partial solutions, we can store these partial solutions and re-use them as necessary

• Running time (Dynamic Programming algorithm vs. naïve algorithm):– LCS: O(m*n) vs. O(n * 2m)

– 0-1 Knapsack problem: O(W*n) vs. O(2n)04/18/23 96

Page 97: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Unit IIIUnit IIINetwork ModelsNetwork Models

Page 98: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Chapter Outline

12.1 Introduction

12.2 Minimal-Spanning Tree Technique

12.3 Maximal-Flow Technique

12.4 Shortest-Route technique

Page 99: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Learning Objectives

Students will be able to– Connect all points of a network while minimizing

total distance using the minimal-spanning tree technique.

– Determine the maximum flow through a network using the maximal-flow technique.

– Find the shortest path through a network using the shortest-route technique.

– Understand the important role of software in solving network problems.

Page 100: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Minimal-Spanning Tree Technique

• Determines the path through the network that connects all the points while minimizing total distance.

Page 101: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Minimal-Spanning TreeSteps

1. Select any node in the network.2. Connect this node to the nearest node that minimizes the

total distance.3. Considering all of the nodes that are now connected, find

and connect the nearest node that is not connected.4. Repeat the third step until all nodes are connected.5. If there is a tie in the third step and two or more nodes that

are not connected are equally near, arbitrarily select one and continue. A tie suggests that there might be more than one optimal solution.

Page 102: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Minimal-Spanning TreeLauderdale Construction

1

2

3

4

5

7

8

6

33

3 54

2

13

25

2

6

7

Page 103: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Minimal-Spanning TreeIterations 1&2

1

2

3

4

5

7

8

6

33

3 54

2

13

25

2

6

7

3

1

2

3

4

5

7

8

6

33 5

4

2

13

25

2

6

7

First Iteration

Second IterationSecond Iteration

Page 104: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Minimal-Spanning TreeIterations 3&4

1

2

3

4

5

7

8

6

33

3 54

2

13

25

2

6

7

3

1

2

3

4

5

7

8

6

33 5

4

2

13

25

2

6

7

Third IterationThird Iteration

Fourth IterationFourth Iteration

Page 105: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Minimal-Spanning TreeIterations 4&5

1

2

3

4

5

7

8

6

33

3 54

2

13

25

2

6

7

3

1

2

3

4

5

7

8

6

33 5

4

2

13

25

2

6

7

Fourth IterationFourth Iteration

Fifth IterationFifth Iteration

Page 106: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Minimal-Spanning TreeIterations 6&7

1

2

3

4

5

7

8

6

33

3 54

2

13

25

2

6

7

3

1

2

3

4

5

7

8

6

33 5

4

2

13

25

2

6

7

Sixth iterationSixth iteration

Seventh & final Seventh & final iterationiteration

Minimum Distance: 16Minimum Distance: 16

Page 107: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

The Maximal-Flow Technique

1. Pick any path (streets from west to east) with some flow.

2. Increase the flow (number of cars) as much as possible.

3. Adjust the flow capacity numbers on the path (streets).

4. Repeat the above steps until an increase in flow is no longer possible.

Page 108: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Maximal-FlowRoad Network for Waukesha

1

2

4

3

5

6

12

1

1 1

1

2

0

6

1

2

30

10

23

0

1

EastPoint

WestPoint

Page 109: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Maximal-FlowRoad Network for Waukesha

1

2

4

3

5

6

12

1

1 1

1

2

0

6

1

2

30

10

23

0

1

EastPoint

WestPoint

Add 2Add 2

Subtract 2Subtract 2

Page 110: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Road Network for WaukeshaFirst Iteration

12-110

1

2

4

3

5

6

30

1

1 1

1

4

0

6

1

2

30

10

21

0

1

EastPoint

WestPoint

Add 1Add 1

Subtract 1Subtract 1

Page 111: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Road Network for WaukeshaSecond Iteration

1

2

4

3

5

6

40

0

2 0

2

4

0

6

1

2

30

10

20

0

1

EastPoint

WestPoint

Add 2Add 2

Subtract 2Subtract 2

Page 112: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Road Network for WaukeshaThird Iteration

1

2

4

3

5

6

40

0

2 0

2

4

2

4

3

0

32

8

20

0

1

EastPoint

WestPoint

Path Flow (CarsPer Hour)

1-2-6 2001-2-4-6 1001-3-5-6 200Total 500

Page 113: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

The Shortest-Route Technique• 1. Find the nearest node to the origin (plant). Put the

distance in a box by the node.– In some cases, several paths will have to be checked to

find the nearest node.• 2. Repeat this process until you have gone through the

entire network. The last distance at the ending node will be the distance of the shortest route. You should note that the distances placed in the boxes by each node are the shortest route to this node. These distances are used as intermediate results in finding the next nearest node.

Page 114: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Shortest-Route ProblemRay Design, Inc.

200

1 6

53

42

Roads from Ray’s Plant to the Roads from Ray’s Plant to the WarehouseWarehouse

Plant Warehouse

100

100

100

150

100

40

50

200

Page 115: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Ray Design, Inc.First Iteration

200

1 6

53

42

Plant Warehouse

100

100

100

150

100

40

50

200

100

Page 116: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Ray Design, Inc.Second Iteration

200

1 6

53

42

Plant Warehouse

100

100

100

150

100

40

50

200

100

150

Page 117: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Ray Design, Inc.Third Iteration

200

1 6

53

42

Plant Warehouse

100

100

100

150

100

40

50

200

100

150 190

Page 118: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Ray Design, Inc.Fourth Iteration

200

1 6

53

42

Plant Warehouse

100

100

100

150

100

40

50

200

100

150 190

290

Page 119: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Project Management - CPM/PERT

Page 120: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

120

Project Scheduling and Control Techniques

Gantt Chart

Critical Path Method (CPM)

Program Evaluation and Review Technique (PERT)

Page 121: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

121

History of CPM/PERT

• Critical Path Method (CPM)– E I Du Pont de Nemours & Co. (1957) for construction of new

chemical plant and maintenance shut-down– Deterministic task times– Activity-on-node network construction– Repetitive nature of jobs

• Project Evaluation and Review Technique (PERT)– U S Navy (1958) for the POLARIS missile program– Multiple task time estimates (probabilistic nature)– Activity-on-arrow network construction– Non-repetitive jobs (R & D work)

Page 122: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

122

Project Network• Network analysis is the general name given to certain specific techniques which can be used for the planning, management and control of projects• Use of nodes and arrows Arrows An arrow leads from tail to head directionally

– Indicate ACTIVITY, a time consuming effort that is required to perform a part of the work.

Nodes A node is represented by a circle- Indicate EVENT, a point in time where one or more activities start and/or

finish.• Activity

– A task or a certain amount of work required in the project

– Requires time to complete

– Represented by an arrow

• Dummy Activity

– Indicates only precedence relationships

– Does not require any time of effort

Page 123: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

123

CPM calculation

• Path– A connected sequence of activities leading from

the starting event to the ending event

• Critical Path– The longest path (time); determines the project

duration

• Critical Activities– All of the activities that make up the critical path

Page 124: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

124

Forward Pass• Earliest Start Time (ES)

– earliest time an activity can start – ES = maximum EF of immediate predecessors

• Earliest finish time (EF)– earliest time an activity can finish– earliest start time plus activity time

EF= ES + t

Latest Start Time (LS)

Latest time an activity can start without delaying critical path time

LS= LF - t

Latest finish time (LF)

latest time an activity can be completed without delaying critical path time

LS = minimum LS of immediate predecessors

Backward Pass

Page 125: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

125

CPM analysis

• Draw the CPM network• Analyze the paths through the network• Determine the float for each activity

– Compute the activity’s float float = LS - ES = LF - EF

– Float is the maximum amount of time that this activity can be delay in its completion before it becomes a critical activity, i.e., delays completion of the project

• Find the critical path is that the sequence of activities and events where there is no “slack” i.e.. Zero slack– Longest path through a network

• Find the project duration is minimum project completion time

Page 126: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Consider below table summarizing the details of a project involving 10 activities

Activity Immediate precedence durationa - 6b - 8c - 5d b 13e c 9f a 15g a 17h f 9i g 6j d,e 12

Construct the CPM network. Determine the critical path and project completion time .Also compute total float and free floats for the non-critical activities

126

Page 127: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

127

CPM Example: • CPM Network

a, 6a, 6a, 6a, 6

f, 15f, 15f, 15f, 15

b, 8b, 8b, 8b, 8

c, 5c, 5c, 5c, 5e, 9e, 9e, 9e, 9

d, 13d, 13d, 13d, 13

g, 17g, 17g, 17g, 17 h, 9h, 9h, 9h, 9

i, 6i, 6i, 6i, 6

j, 12j, 12j, 12j, 12

Page 128: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

128

CPM Example• ES and EF Times

a, 6a, 6a, 6a, 6

f, 15f, 15f, 15f, 15

b, 8b, 8b, 8b, 8

c, 5c, 5c, 5c, 5

e, 9e, 9e, 9e, 9

d, 13d, 13d, 13d, 13

g, 17g, 17g, 17g, 17 h, 9h, 9h, 9h, 9

i, 6i, 6i, 6i, 6

j, 12j, 12j, 12j, 12

0 6

0 8

0 5

Page 129: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

129

CPM Example

• ES and EF Times

a, 6a, 6a, 6a, 6

f, 15f, 15f, 15f, 15

b, 8b, 8b, 8b, 8

c, 5c, 5c, 5c, 5

e, 9e, 9e, 9e, 9

d, 13d, 13d, 13d, 13

g, 17g, 17g, 17g, 17 h, 9h, 9h, 9h, 9

i, 6i, 6i, 6i, 6

j, 12j, 12j, 12j, 12

0 6

0 8

0 5

5 14

8 21

6 23

6 21

Page 130: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

130

CPM Example

• ES and EF Times

a, 6a, 6a, 6a, 6

f, 15f, 15f, 15f, 15

b, 8b, 8b, 8b, 8

c, 5c, 5c, 5c, 5

e, 9e, 9e, 9e, 9

d, 13d, 13d, 13d, 13

g, 17g, 17g, 17g, 17 h, 9h, 9h, 9h, 9

i, 6i, 6i, 6i, 6

j, 12j, 12j, 12j, 12

0 6

0 8

0 5

5 14

8 21 21 33

6 23 21 30

23 29

6 21

Project’s EF = 33Project’s EF = 33

Page 131: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

131

CPM Example

• LS and LF Times

a, 6a, 6a, 6a, 6

f, 15f, 15f, 15f, 15

b, 8b, 8b, 8b, 8

c, 5c, 5c, 5c, 5

e, 9e, 9e, 9e, 9

d, 13d, 13d, 13d, 13

g, 17g, 17g, 17g, 17

h, 9h, 9h, 9h, 9

i, 6i, 6i, 6i, 6

j, 12j, 12j, 12j, 12

0 6

0 8

0 5

5 14

8 21 21 33

6 23

21 30

23 29

6 21

21 33

27 33

24 33

Page 132: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

132

CPM ExampleCPM Example

• LS and LF Times

a, 6a, 6a, 6a, 6

f, 15f, 15f, 15f, 15

b, 8b, 8b, 8b, 8

c, 5c, 5c, 5c, 5

e, 9e, 9e, 9e, 9

d, 13d, 13d, 13d, 13

g, 17g, 17g, 17g, 17

h, 9h, 9h, 9h, 9

i, 6i, 6i, 6i, 6

j, 12j, 12j, 12j, 12

0 6

0 8

0 5

5 14

8 21 21 33

6 23

21 30

23 29

6 21

4 10

0 8

7 12

12 21

21 33

27 33

8 21

10 27

24 33

18 24

Page 133: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

133

CPM ExampleCPM Example• Float

a, 6a, 6a, 6a, 6

f, 15f, 15f, 15f, 15

b, 8b, 8b, 8b, 8

c, 5c, 5c, 5c, 5e, 9e, 9e, 9e, 9

d, 13d, 13d, 13d, 13

g, 17g, 17g, 17g, 17

h, 9h, 9h, 9h, 9

i, 6i, 6i, 6i, 6

j, 12j, 12j, 12j, 12

0 6

0 8

0 5 5 14

8 21 21 33

6 23

21 30

23 29

6 21

3 9

0 8

7 12 12 21

21 33

27 33

8 21

10 27

24 33

9 24

3 4

3

3

4

0

0

7 7

0

Page 134: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

134

CPM Example• Critical Path

a, 6a, 6a, 6a, 6

f, 15f, 15f, 15f, 15

b, 8b, 8b, 8b, 8

c, 5c, 5c, 5c, 5

e, 9e, 9e, 9e, 9

d, 13d, 13d, 13d, 13

g, 17g, 17g, 17g, 17 h, 9h, 9h, 9h, 9

i, 6i, 6i, 6i, 6

j, 12j, 12j, 12j, 12

Page 135: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

darla/smbs/vit 135

PERT • PERT is based on the assumption that an activity’s duration

follows a probability distribution instead of being a single value• Three time estimates are required to compute the parameters

of an activity’s duration distribution:– pessimistic time (tp ) - the time the activity would take if

things did not go well– most likely time (tm ) - the consensus best estimate of the

activity’s duration– optimistic time (to ) - the time the activity would take if

things did go well

Mean (expected time): te =tp + 4 tm + to

6

Variance: Vt =2 =tp - to

6

2

Page 136: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

136

PERT analysis• Draw the network.• Analyze the paths through the network and find the critical path.• The length of the critical path is the mean of the project duration

probability distribution which is assumed to be normal• The standard deviation of the project duration probability

distribution is computed by adding the variances of the critical activities (all of the activities that make up the critical path) and taking the square root of that sum

• Probability computations can now be made using the normal distribution table.

Page 137: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

137

Probability computation

Determine probability that project is completed within specified time

Z = x -

where = tp = project mean time

= project standard mean time

x = (proposed ) specified time

Page 138: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

138

Normal Distribution of Project Time

= tp Timex

Z

Probability

Page 139: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

139

PERT Example Immed. Optimistic Most Likely Pessimistic

Activity Predec. Time (Hr.) Time (Hr.) Time (Hr.) A -- 4 6 8B -- 1 4.5 5C A 3 3 3

D A 4 5 6 E A 0.5 1 1.5 F B,C 3 4 5 G B,C 1 1.5 5 H E,F 5 6 7 I E,F 2 5 8 J D,H 2.5 2.75 4.5 K G,I 3 5 7

Page 140: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

140

PERT Example

AA

DD

CC

BBFF

EE

GG

II

HH

KK

JJ

PERT Network

Page 141: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

141

PERT Example Activity Expected Time Variance A 6 4/9

B 4 4/9 C 3 0 D 5 1/9 E 1 1/36 F 4 1/9 G 2 4/9 H 6 1/9 I 5 1 J 3 1/9 K 5 4/9

Page 142: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

142

PERT Example

Activity ES EF LS LF Slack A 0 6 0 6 0 *critical

B 0 4 5 9 5 C 6 9 6 9 0 * D 6 11 15 20 9 E 6 7 12 13 6 F 9 13 9 13 0 * G 9 11 16 18 7 H 13 19 14 20 1 I 13 18 13 18 0 * J 19 22 20 23 1 K 18 23 18 23 0 *

Page 143: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

143

PERT Example

Vpath = VA + VC + VF + VI + VK

= 4/9 + 0 + 1/9 + 1 + 4/9 = 2path = 1.414

z = (24 - 23)/(24-23)/1.414 = .71 From the Standard Normal Distribution

table: P(z < .71) = .5 + .2612 = .7612

Page 144: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

PROJECT COST

Page 145: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

145

Cost consideration in project

• Project managers may have the option or requirement to crash the project, or accelerate the completion of the project.

• This is accomplished by reducing the length of the critical path(s).• The length of the critical path is reduced by reducing the duration

of the activities on the critical path.• If each activity requires the expenditure of an amount of money to

reduce its duration by one unit of time, then the project manager selects the least cost critical activity, reduces it by one time unit, and traces that change through the remainder of the network.

• As a result of a reduction in an activity’s time, a new critical path may be created.

• When there is more than one critical path, each of the critical paths must be reduced.

• If the length of the project needs to be reduced further, the process is repeated.

Page 146: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

146

Project Crashing• Crashing

– reducing project time by expending additional resources• Crash time

– an amount of time an activity is reduced• Crash cost

– cost of reducing activity time• Goal

– reduce project duration at minimum cost

Page 147: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

147

Time-Cost Relationship Crashing costs increase as project duration decreases Indirect costs increase as project duration increases Reduce project length as long as crashing costs are less than

indirect costsTime-Cost Tradeoff

cost

time

Direct cost

Indirect cost

Total project costMin total cost = optimal project time

Page 148: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

148

Benefits of CPM/PERT• Useful at many stages of project management• Mathematically simple• Give critical path and slack time• Provide project documentation• Useful in monitoring costs

•How long will the entire project take to be completed? What are the risks involved? •Which are the critical activities or tasks in the project which could delay the entire project if they were not completed on time? •Is the project on schedule, behind schedule or ahead of schedule? •If the project has to be finished earlier than planned, what is the best way to do this at the least cost?

CPM/PERT can answer the following important questions:

Page 149: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

149

Limitations to CPM/PERT• Clearly defined, independent and stable activities• Specified precedence relationships• Over emphasis on critical paths• Deterministic CPM model• Activity time estimates are subjective and depend on judgment• PERT assumes a beta distribution for these time estimates, but

the actual distribution may be different• PERT consistently underestimates the expected project

completion time due to alternate paths becoming critical

To overcome the limitation, Monte Carlo simulations can be performed on the network to eliminate the optimistic bias

Page 150: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

150

CPM PERT

CPM uses activity oriented network. PERT uses event oriented Network.

Durations of activity may be estimated with a fair degree of accuracy.

Estimate of time for activities are not so accurate and definite.

It is used extensively in construction projects.

It is used mostly in research and development projects, particularly projects of non-repetitive nature.

Deterministic concept is used. Probabilistic model concept is used.

CPM can control both time and cost when planning.

PERT is basically a tool for planning.

In CPM, cost optimization is given prime importance. The time for the completion of the project depends upon cost optimization. The cost is not directly proportioned to time. Thus, cost is the controlling factor.

In PERT, it is assumed that cost varies directly with time. Attention is therefore given to minimize the time so that minimum cost results. Thus in PERT, time is the controlling factor.

PERT vs CPM

Page 151: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Unit IVUnit IVInventory ManagementInventory Management

The objective of inventory The objective of inventory management is to strike a balance management is to strike a balance between inventory investment and between inventory investment and

customer servicecustomer service

Page 152: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Inventory control

It means stocking adequate number and kind of stores, so that the materials are available whenever required and wherever required. Scientific inventory control results in optimal balance

Page 153: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

What is inventory?

Inventory is the raw materials, component parts, work-in-process, or finished products

that are held at a location in the supply chain.

Page 154: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Input MaterialManagement department

Inventory(money)

Goods in storesWork-in-progressFinished products

Equipment etc.

OutputProductiondepartment

Basic inventory model

Page 155: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37
Page 156: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Zero Inventory?

• Reducing amounts of raw materials and purchased parts and subassemblies by having suppliers deliver them directly.

• Reducing the amount of works-in process by using just-in-time production.

• Reducing the amount of finished goods by shipping to markets as soon as possible.

Page 157: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Importance of InventoryImportance of Inventory

One of the most expensive assets of many companies representing as much as 50% of total invested capital

Operations managers must balance inventory investment and customer service

Page 158: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

FUNCTIONS OF INVENTORY

• To meet anticipated demand.

• To smoothen production requirements.

• To decouple operations.

SUPPLY PROCESS

PRODUCTS

DEMAND

INVENTORY

PRODUCTS

DEMAND

DEMANDPROCESS

Page 159: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Functions Of Inventory (Cont’d)

• To protect against stock-outs.

• To take advantage of order cycles.

• To help hedge against price increases.

• To permit operations.

• To take advantage of quantity discounts.

Page 160: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Types of InventoryTypes of Inventory Raw material

Purchased but not processed

Work-in-process Undergone some change but not completed

A function of cycle time for a product

Maintenance/repair/operating (MRO) Necessary to keep machinery and processes productive

Finished goods Completed product awaiting shipment

Page 161: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

The Material Flow CycleThe Material Flow Cycle

Input Wait for Wait to Move Wait in queue Setup Run Outputinspection be moved time for operator time time

Cycle time

95% 5%

Page 162: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Service level

Safety Stock

Probabilityof stock-out

Safety stock =(safety factor z)(std deviation in LT demand)

Read z from Normal table for a given service level

Page 163: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Average Inventory = (Order Qty)/2 + Safety Stock

Receive order

Time

Placeorder

Lead Time

InventoryLevel

Order Quantity

Safety Stock (SS)

EOQ/2AverageInventory

Page 164: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Managing Inventory Managing Inventory

1. How inventory items can be classified

2. How accurate inventory records can be maintained

Page 165: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Inventory Models for Inventory Models for Independent DemandIndependent Demand

1. Basic economic order quantity

2. Production order quantity

3. Quantity discount model

Need to determine when and how Need to determine when and how much to ordermuch to order

Page 166: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Economic order of quantityEOQ = Average Monthly Consumption X Lead Time [in

months] + Buffer Stock – Stock on hand

CARRYING COST

PURCHASING COST

ECONOMIC ORDER OF QUANTITY(EOQ)

Page 167: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

•Re-order level: stock level at which fresh order is placed.•Average consumption per day x lead time + buffer stock•Lead time: Duration time between placing an order & receipt of material•Ideal – 2 to 6 weeks.

Page 168: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Basic EOQ ModelBasic EOQ Model

1. Demand is known, constant, and independent

2. Lead time is known and constant

3. Receipt of inventory is instantaneous and complete

4. Quantity discounts are not possible

5. Only variable costs are setup and holding

6. Stockouts can be completely avoided

Important assumptions

Page 169: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

An EOQ ExampleAn EOQ Example

Determine optimal number of needles to orderD = 1,000 unitsS = $10 per orderH = $.50 per unit per year

Q* =2DS

H

Q* =2(1,000)(10)

0.50= 40,000 = 200 units

Page 170: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

An EOQ Example

Determine optimal number of needles to orderD = 1,000 units Q* = 200 unitsS = $10 per orderH = $.50 per unit per year

= N = =Expected

number of orders

DemandOrder quantity

DQ*

N = = 5 orders per year 1,000200

Page 171: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

An EOQ Example

Determine optimal number of needles to orderD = 1,000 units Q* = 200 unitsS = $10 per order N = 5 orders per yearH = $.50 per unit per year

= T =Expected time between orders

Number of working days per year

N

T = = 50 days between orders250

5

Page 172: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Classification Criteria

A-B-C Annual value of consumption of the items

V-E-D Critical nature of the components with respect to products.

H-M-L Unit price of material

F-S-N Issue from stores

S-D-E Purchasing problems in regard to availability

S-O-S Seasonality

G-O-L-F Channel for procuring the material

X-Y-Z Inventory value of items stored

Classification of Materials for

Inventory Control

Page 173: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Holding costsHolding costs - the costs of holding or “carrying” inventory over time

Ordering costsOrdering costs - the costs of placing an order and receiving goods

Setup costsSetup costs - cost to prepare a machine or process for manufacturing an order

Relevant Inventory Costs

Page 174: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

• Stationary

• Clerical and processing, salaries/rentals

• Postage

• Processing of bills

• Staff work in expedition /receiving/ inspection and documentation

Ordering Costs

Page 175: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Holding/Carrying Costs

• Storage space (rent/depreciation)• Property tax on warehousing• Insurance• Deterioration/Obsolescence• Material handling and maintenance, equipment• Stock taking, security and documentation• Capital blocked (interest/opportunity cost)• Quality control

Page 176: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

• Loss of business/ profit/ market/ advise

• Additional expenditure due to urgency of purchases

a) telegraph / telephone charges

b) purchase at premium

c) air transport charges

• Loss of labor hours

Stock out Costs

Page 177: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Balancing Carrying against Ordering Costs

16

Annual Cost ($)Annual Cost ($)

Order QuantityOrder Quantity

MinimumMinimumTotal AnnualTotal Annual

Stocking CostsStocking Costs

AnnualAnnualCarrying CostsCarrying Costs

AnnualAnnualOrdering CostsOrdering Costs

Total AnnualTotal AnnualStocking CostsStocking Costs

SmallerSmaller LargerLarger

Lo

wer

Lo

wer

Hig

her

Hig

her

EOQEOQ

Page 178: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Unit V Queuing Theory

Page 179: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Outlines

Page 180: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Introduction

• Involves the mathematical study of queues or waiting line.• The formulation of queues occur whenever the demand for a

service exceeds the capacity to provide that service.• Decisions regarding the amount of capacity to provide must

be made frequently in industry and elsewhere.• Queuing theory provides a means for decision makers to

study and analyze characteristics of the service facility for making better decisions.

Page 181: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Basic structure of queuing model• Customers requiring service are generated over time by an

input source.• These customers enter the queuing system and join a queue.• At certain times, a member of the queue is selected for

service by some rule know as the service disciple.• The required service is then performed for the customer by

the service mechanism, after which the customer leaves the queuing system

Page 182: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

The basic queuing process

Input source Queue

Service mechanis

mCustomers

Served Customers

Queuing system

Page 183: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Characteristics of queuing models• Input or arrival (interarrival) distribution• Output or departure (service) distribution• Service channels• Service discipline• Maximum number of customers allowed in the system• Calling source

Page 184: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Kendall and Lee’s Notation

Kendall and Lee introduced a useful notation representing the 6 basic characteristics of a queuing model.

Notation: a/b/c/d/e/fwherea = arrival (or interarrival) distributionb = departure (or service time) distributionc = number of parallel service channels in the systemd = service disciplee = maximum number allowed in the system (service + waiting)f = calling source

Page 185: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Conventional Symbols for a, b

M = Poisson arrival or departure distribution (or equivalently exponential distribution or service times distribution)

D = Deterministic interarrival or service timesEk = Erlangian or gamma interarrival or service time distribution

with parameter kGI = General independent distribution of arrivals (or interarrival

times)G = General distribution of departures (or service times)

Page 186: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Conventional Symbols for d

• FCFS = First come, first served• LCFS = Last come, first served• SIRO = Service in random order• GD = General service disciple

Page 187: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Transient and Steady StatesTransient state• The system is in this state when its operating characteristics

vary with time.• Occurs at the early stages of the system’s operation where its

behavior is dependent on the initial conditions.

Steady state• The system is in this state when the behavior of the system

becomes independent of time.• Most attention in queuing theory analysis has been directed

to the steady state results.

Page 188: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Queuing Model Symbols

n = Number of customers in the systems = Number of serverspn(t) = Transient state probabilities of exactly n customers in the

system at time tpn = Steady state probabilities of exactly n customers in the

systemλ = Mean arrival rate (number of customers arriving per unit

time)μ = Mean service rate per busy server (number of customers

served per unit time)

Page 189: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Queuing Model Symbols (Cont’d)

ρ = λ/μ = Traffic intensityW = Expected waiting time per customer in the systemWq = Expected waiting time per customer in the queueL = Expected number of customers in the systemLq = Expected number of customers in the queue

Page 190: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Relationship Between L and W

If λn is a constant λ for all n, it can be shown that

L = λWLq = λ Wq

If λn are not constant then λ can be replaced in the above equations by λbar,the average arrival rate over the long run.

If μn is a constant μ for all n, thenW = Wq + 1/μ

Page 191: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Relationship Between L and W (cont’d)

These relationships are important because:• They enable all four of the fundamental quantities L, W, Lq

and Wq to be determined as long as one of them is found analytically.

• The expected queue lengths are much easier to find than that of expected waiting times when solving a queuing model from basic principles.

Page 192: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Single server queuing models• M/M/1/FCFS/∞/∞ Model

when the mean arrival rate λn and mean service μn are all constant we have

,...2,1for,1

Thus

11

1

1

1

where

,...2,1for,

Therefore

,...2,1for,

11

0

1

0

0

np

p

npp

nc

nn

n

n

n

n

nn

nn

n

Page 193: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Single server queuing models (cont’d)

Consequently

11

1

1)1()1(

)1()1(

0

00

d

d

d

d

d

dnL

n

n

n

n

n

n

Page 194: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Single server queuing models (cont’d)

qq

nnq

LW

LW

pLpnL

1

istimewaitingexpectedThe

)(1)1(

Similarly2

01

Page 195: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Multi server queuing models

• M/M/s/FCFS/∞/∞ ModelWhen the mean arrival rate λn and mean service μn, are all constant, we have the following rate diagram

Page 196: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Multi server queuing models (cont’d)

,1,!

1!!

1where,,2,1

!

Therefore

,1,!

,,2,1!

havewecasethisIn

0

00

ssnpss

ssn

psnpn

p

ssnss

snnc

sn

n

sn

n

n

sn

n

n

n

Page 197: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Multi server queuing models (cont’d)

1

)()!1(

thatfollowsIt

02

1

q

qq

q

s

q

WW

LW

LL

pss

L

Page 198: Prepared by Mr. Prabhu Assistant Professor, Mechanical Department VelTech Dr.RR & Dr.SR Technical University 1 Operation and Planning Control U7MEA37

Thank You

198