Civil Engineering Systems Analysis Class Icive208.weebly.com/uploads/1/1/8/8/11887178/class_6.pdfMax...

24
Civil Engineering Systems Analysis Lecture VI Instructor: Prof. Naveen Eluru Department of Civil Engineering and Applied Mechanics

Transcript of Civil Engineering Systems Analysis Class Icive208.weebly.com/uploads/1/1/8/8/11887178/class_6.pdfMax...

Page 1: Civil Engineering Systems Analysis Class Icive208.weebly.com/uploads/1/1/8/8/11887178/class_6.pdfMax Z = 3x1+5x2 Subject to x1 + x3 =4 2x2 +x4 =12 3x1+2x2 +x5 =18 x1≥0,x2 ≥0 Simplex

Civil Engineering Systems Analysis

Lecture VI

Instructor: Prof. Naveen Eluru

Department of Civil Engineering and Applied Mechanics

Page 2: Civil Engineering Systems Analysis Class Icive208.weebly.com/uploads/1/1/8/8/11887178/class_6.pdfMax Z = 3x1+5x2 Subject to x1 + x3 =4 2x2 +x4 =12 3x1+2x2 +x5 =18 x1≥0,x2 ≥0 Simplex

Today’s Learning Objectives

Simplex Method

9/25/2012 2 CIVE 208: CIVIL ENGINEERING SYSTEMS ANALYSIS

Page 3: Civil Engineering Systems Analysis Class Icive208.weebly.com/uploads/1/1/8/8/11887178/class_6.pdfMax Z = 3x1+5x2 Subject to x1 + x3 =4 2x2 +x4 =12 3x1+2x2 +x5 =18 x1≥0,x2 ≥0 Simplex

Simplex : Example 2

9/25/2012 CIVE 208: CIVIL ENGINEERING SYSTEMS ANALYSIS 3

Max Z = 3x1+5x2

Subject to

x1≤4

2x2 ≤12

3x1+2x2 ≤18

x1≥0,x2 ≥0

Page 4: Civil Engineering Systems Analysis Class Icive208.weebly.com/uploads/1/1/8/8/11887178/class_6.pdfMax Z = 3x1+5x2 Subject to x1 + x3 =4 2x2 +x4 =12 3x1+2x2 +x5 =18 x1≥0,x2 ≥0 Simplex

Solution

9/25/2012 CIVE 208: CIVIL ENGINEERING SYSTEMS ANALYSIS 4

Augmented form

Max Z = 3x1+5x2

Subject to x1 + x3 =4

2x2 +x4 =12

3x1+2x2 +x5 =18

x1≥0,x2 ≥0

Simplex Table

x1 x2 x3 x4 x5 Solution

Z -3 -5 0 0 0 0

x3 1 0 1 0 0 4

x4 0 2 0 1 0 12

x5 3 2 0 0 1 18

Page 5: Civil Engineering Systems Analysis Class Icive208.weebly.com/uploads/1/1/8/8/11887178/class_6.pdfMax Z = 3x1+5x2 Subject to x1 + x3 =4 2x2 +x4 =12 3x1+2x2 +x5 =18 x1≥0,x2 ≥0 Simplex

Solution

9/25/2012 CIVE 208: CIVIL ENGINEERING SYSTEMS ANALYSIS 5

Solution (0,0,4,12,18) and Z =0

Do we have an optimal solution?

No

What is the entering variable?

x2

x1 x2 x3 x4 x5 Solution

Z -3 -5 0 0 0 0

x3 1 0 1 0 0 4

x4 0 2 0 1 0 12

x5 3 2 0 0 1 18

Page 6: Civil Engineering Systems Analysis Class Icive208.weebly.com/uploads/1/1/8/8/11887178/class_6.pdfMax Z = 3x1+5x2 Subject to x1 + x3 =4 2x2 +x4 =12 3x1+2x2 +x5 =18 x1≥0,x2 ≥0 Simplex

Solution

9/25/2012 CIVE 208: CIVIL ENGINEERING SYSTEMS ANALYSIS 6

Now compute the different ratios

We can see that row corresponding to x4 has

the minimum ratio

Hence x4 is the leaving variable

x1 x2 X3 x4 x5 Solution Ratio

Z -3 -5 0 0 0 0 -

x3 1 0 1 0 0 4 ∞

x4 0 2 0 1 0 12 12/2

x5 3 2 0 0 1 18 18/2

Entering variable

Leaving variable Pivot Element

Page 7: Civil Engineering Systems Analysis Class Icive208.weebly.com/uploads/1/1/8/8/11887178/class_6.pdfMax Z = 3x1+5x2 Subject to x1 + x3 =4 2x2 +x4 =12 3x1+2x2 +x5 =18 x1≥0,x2 ≥0 Simplex

Solution

9/25/2012 CIVE 208: CIVIL ENGINEERING SYSTEMS ANALYSIS 7

Start making the changes to the table

Step 1: for pivot row divide the pivot row elements

by pivot element (in the example 2)

Step 2: for every other row:

New row = current row – Pivot column coefficient * new

pivot row

x1 x2 x3 x4 x5 Solution

Z -3-0 -5+5 0-0 0+5/2 0-0 0+30

x3 1-0 0-0 1-0 0-0 0-0 4-0

x4x2 0/2 2/2 0/2 1/2 0/2 12/2

x5 3-0 2-2 0-0 0-1 1-0 18-12

Page 8: Civil Engineering Systems Analysis Class Icive208.weebly.com/uploads/1/1/8/8/11887178/class_6.pdfMax Z = 3x1+5x2 Subject to x1 + x3 =4 2x2 +x4 =12 3x1+2x2 +x5 =18 x1≥0,x2 ≥0 Simplex

Solution

9/25/2012 CIVE 208: CIVIL ENGINEERING SYSTEMS ANALYSIS 8

Consolidate

Solution (0,6,4,0,6) and Z = 30;

Are we optimal yet?

No

x1 will enter

Leaving variable

Min(4/1, 6/0, 6/3) => x5 leaves

x1 x2 x3 x4 x5 Solution

Z -3 0 0 5/2 0 30

x3 1 0 1 0 0 4

x2 0 1 0 1/2 0 6

x5 3 0 0 -1 1 6

Page 9: Civil Engineering Systems Analysis Class Icive208.weebly.com/uploads/1/1/8/8/11887178/class_6.pdfMax Z = 3x1+5x2 Subject to x1 + x3 =4 2x2 +x4 =12 3x1+2x2 +x5 =18 x1≥0,x2 ≥0 Simplex

Solution

9/25/2012 CIVE 208: CIVIL ENGINEERING SYSTEMS ANALYSIS 9

Do the operations

Consolidate

x1 x2 x3 x4 x5 Solution

Z -3+3 0-0 0-0 5/2-1 0+1 30+6

x3 1-1 0-0 1-0 0+1/3 0-1/3 4-2

x2 0 1-0 0-0 ½-0 0-0 6-0

x5x1 3/3 0/3 0/3 -1/3 1/3 6/3

x1 x2 x3 x4 x5 Solution

Z 0 0 0 3/2 1 36

x3 0 0 1 1/3 -1/3 2

x2 0 1 0 ½ 0 6

x1 1 0 0 -1/3 1/3 2

Optimal????? Yes – Solution (2,6,2,0,0)

Page 10: Civil Engineering Systems Analysis Class Icive208.weebly.com/uploads/1/1/8/8/11887178/class_6.pdfMax Z = 3x1+5x2 Subject to x1 + x3 =4 2x2 +x4 =12 3x1+2x2 +x5 =18 x1≥0,x2 ≥0 Simplex

Summary

9/25/2012 CIVE 208: CIVIL ENGINEERING SYSTEMS ANALYSIS 10

Subject to

x1≤4

2x2 ≤12

3x1+2x2 ≤18

x1≥0,x2 ≥0

x1 = 2, x2 = 6

So Eqn 1 has abundant resources

Eqn 2 and Eqn 3 lead to scarce resources

Page 11: Civil Engineering Systems Analysis Class Icive208.weebly.com/uploads/1/1/8/8/11887178/class_6.pdfMax Z = 3x1+5x2 Subject to x1 + x3 =4 2x2 +x4 =12 3x1+2x2 +x5 =18 x1≥0,x2 ≥0 Simplex

Minimum Ratio - Notes

9/25/2012 CIVE 208: CIVIL ENGINEERING SYSTEMS ANALYSIS 11

In the simplex table computing minimum ratio

has two components

Coefficients for the entering variable

Have to be >0

RHS

≥ 0

Hence Minimum Ratio ≥ 0 given you meet the above

constraints

So if RHS is 0 and coefficient is –ive that is not a valid

ratio to consider

Page 12: Civil Engineering Systems Analysis Class Icive208.weebly.com/uploads/1/1/8/8/11887178/class_6.pdfMax Z = 3x1+5x2 Subject to x1 + x3 =4 2x2 +x4 =12 3x1+2x2 +x5 =18 x1≥0,x2 ≥0 Simplex

Insights on simplex

9/25/2012 CIVE 208: CIVIL ENGINEERING SYSTEMS ANALYSIS 12

What if there is a tie for entering variable? At a juncture in the simplex tableau you can have two

variable –ive and of the same magnitude

How do we determine what enters

Choose arbitrarily! Eventually you will reach the solution

What if tie in the Minimum ratio test What does it imply?

Two constraints are such that they yield a same lower limit on entering variable i.e. two current basic variables go to 0 simultaneously

Referred to as degeneracy

How to address it Break tie arbitrarily

You might enter a loop, if so, then the time of the tie use the other variable as leaving variable

Page 13: Civil Engineering Systems Analysis Class Icive208.weebly.com/uploads/1/1/8/8/11887178/class_6.pdfMax Z = 3x1+5x2 Subject to x1 + x3 =4 2x2 +x4 =12 3x1+2x2 +x5 =18 x1≥0,x2 ≥0 Simplex

Degeneracy example

9/25/2012 CIVE 208: CIVIL ENGINEERING SYSTEMS ANALYSIS 13

Max Z = 3x1+9x2

x1+4x2 ≤ 8

x1+2x2 ≤ 4

x1, x2 ≥ 0

Entering variable?

x2

Leaving variable : Min(8/4, 4/2)

Lets decide as x4

x1 x2 x3 x4 Solution

Z -3 -9 0 0 0

x3 1 4 1 0 8

x4 1 2 0 1 4

Page 14: Civil Engineering Systems Analysis Class Icive208.weebly.com/uploads/1/1/8/8/11887178/class_6.pdfMax Z = 3x1+5x2 Subject to x1 + x3 =4 2x2 +x4 =12 3x1+2x2 +x5 =18 x1≥0,x2 ≥0 Simplex

Degeneracy example

9/25/2012 CIVE 208: CIVIL ENGINEERING SYSTEMS ANALYSIS 14

x2 enters and x4 leaves

So we reached optimal value

x1 x2 x3 x4 Solution

Z -3+9/2 -9+9 0+0 0+9/2 0+18

x3 1-2 4-4 1-0 0-2 8-8

x4x2 1/2 2/2 0/2 1/2 4/2

x1 x2 x3 x4 Solution

Z 3/2 0 0 9/2 18

x3 -1 0 1 -2 0

x2 ½ 1 0 1/2 2

Page 15: Civil Engineering Systems Analysis Class Icive208.weebly.com/uploads/1/1/8/8/11887178/class_6.pdfMax Z = 3x1+5x2 Subject to x1 + x3 =4 2x2 +x4 =12 3x1+2x2 +x5 =18 x1≥0,x2 ≥0 Simplex

Degeneracy example

9/25/2012 CIVE 208: CIVIL ENGINEERING SYSTEMS ANALYSIS 15

What if we picked the other variable

Push x3 out in the first iteration

Now x1 enters

What leaves? x4

x1 x2 x3 x4 Solution

Z -3+9/4 -9+9 0+9/4 0+0 0+18

x3x2 ¼ 4/4 1/4 0/4 8/4

x4 1-2/4 2-2 0-2/4 1-0 4-4

x1 x2 x3 x4 Solution

Z -3/4 0 9/4 0 18

x2 ¼ 1 1/4 0 2

x4 1/2 0 -1/2 1 0

Page 16: Civil Engineering Systems Analysis Class Icive208.weebly.com/uploads/1/1/8/8/11887178/class_6.pdfMax Z = 3x1+5x2 Subject to x1 + x3 =4 2x2 +x4 =12 3x1+2x2 +x5 =18 x1≥0,x2 ≥0 Simplex

Degeneracy example

9/25/2012 CIVE 208: CIVIL ENGINEERING SYSTEMS ANALYSIS 16

Optimal?

x1 x2 x3 x4 Solution

Z -3/4+3/4 0-0 9/4+3/4 0+3/2 18+0

x2 ¼-1/4 1-0 ¼+1/4 0-1/2 2-0

x4x1 ½*2 0*2 -1/2*2 1*2 0*2

x1 x2 x3 x4 Solution

Z 0 0 3 3/2 18

X2 0 1 1/2 -1/2 2

X1 1 0 -1 2 0

Page 17: Civil Engineering Systems Analysis Class Icive208.weebly.com/uploads/1/1/8/8/11887178/class_6.pdfMax Z = 3x1+5x2 Subject to x1 + x3 =4 2x2 +x4 =12 3x1+2x2 +x5 =18 x1≥0,x2 ≥0 Simplex

Insights on simplex

9/25/2012 CIVE 208: CIVIL ENGINEERING SYSTEMS ANALYSIS 17

Just as you can have two possible leaving

variables – you can have 0 variables for leaving

Happens when Z is unbounded

The basic variable entering can be increased

indefinitely

Page 18: Civil Engineering Systems Analysis Class Icive208.weebly.com/uploads/1/1/8/8/11887178/class_6.pdfMax Z = 3x1+5x2 Subject to x1 + x3 =4 2x2 +x4 =12 3x1+2x2 +x5 =18 x1≥0,x2 ≥0 Simplex

Unbounded Z

9/25/2012 CIVE 208: CIVIL ENGINEERING SYSTEMS ANALYSIS 18

Max z =2x1 + x2

x1-x2 ≤ 10

2x1 ≤40

x1,x2 ≥ 0

Entering variable x1, leaving variable x3

x1 x2 x3 x4 Solution

Z -2 -1 0 0 0

x3 1 -1 1 0 10

x4 2 0 0 1 40

x1 x2 x3 x4 Soluti

on

Z -2+2 -1-2 0+2 0+0 0+20

x3x1 1 -1 1 0 10

x4 2-2 0+2 0-2 1-0 40-20

x1 x2 x3 x4 Soluti

on

Z 0 -3 2 0 20

x1 1 -1 1 0 10

x4 0 2 -2 1 20

Page 19: Civil Engineering Systems Analysis Class Icive208.weebly.com/uploads/1/1/8/8/11887178/class_6.pdfMax Z = 3x1+5x2 Subject to x1 + x3 =4 2x2 +x4 =12 3x1+2x2 +x5 =18 x1≥0,x2 ≥0 Simplex

Unbounded Z

9/25/2012 CIVE 208: CIVIL ENGINEERING SYSTEMS ANALYSIS 19

Entering variable x2

Leaving variable x4

Now x3 entering.. But no leaving variable..

x1 x2 x3 x4 Soluti

on

Z 0+0 -3+3 2-3 0+3/2 20+30

x1 1-0 -1+1 1-1 0+1/2 10+10

x4x2 0/2 2/2 -2/2 1/2 20/2

x1 x2 x3 x4 Soluti

on

Z 0 0 -1 1/2 50

x1 1 0 0 ½ 20

x2 0 1 -1 ½ 10

Page 20: Civil Engineering Systems Analysis Class Icive208.weebly.com/uploads/1/1/8/8/11887178/class_6.pdfMax Z = 3x1+5x2 Subject to x1 + x3 =4 2x2 +x4 =12 3x1+2x2 +x5 =18 x1≥0,x2 ≥0 Simplex

Multiple Optimal Solutions

9/25/2012 CIVE 208: CIVIL ENGINEERING SYSTEMS ANALYSIS 20

Max Z = 2x1+4x2

x1+2x2 ≤5

x1+x2 ≤4

x1,x2≥0

x2 enters … leaving variable x3

Z = 10 and (0,5/2,0,3/2)

Basic Z x1 x2 x3 x4

Solut

ion

Z 1 -2 -4 0 0 0

x3 0 1 2 1 0 5

x4 0 1 1 0 1 4

Basic Z x1 x2 x3 x4

Solut

ion

Z 1-0 -2+2 -4+4 0+4/2 0-0 0+10

x3x2 0/2 ½ 2/2 1/2 0/2 5/2

x4 0-0 1-1/2 1-1 0-1/2 1-0 4-5/2

Z x1 x2 x3 x4 Solu

tion

Z 1 0 0 2 0 10

x2 0 ½ 1 ½ 0 5/2

x4 0 ½ 0 -1/2 1 3/2

Page 21: Civil Engineering Systems Analysis Class Icive208.weebly.com/uploads/1/1/8/8/11887178/class_6.pdfMax Z = 3x1+5x2 Subject to x1 + x3 =4 2x2 +x4 =12 3x1+2x2 +x5 =18 x1≥0,x2 ≥0 Simplex

Multiple Optimal Solutions

9/25/2012 CIVE 208: CIVIL ENGINEERING SYSTEMS ANALYSIS 21

We reached optimal but see that x1 and x2

have 0 coefficients

Lets try to look at z

We notice that one of the non-basic variables

has a coefficient of 0 .. So without changing z

we can have x1 enter

If x1 enters x4 leaves

Z x1 x2 x3 x4

Solu

tion

Z 1 0 0 2 0 10

x2 0 ½-1/2 1-0 ½+1/

2 0-1

5/2-

3/2

x4

x1

0 ½ *2 0*2 -

1/2*2 1*2 3/2*2

Z x1 x2 x3 x4 Solu

tion

Z 1 0 0 2 0 10

x3 0 0 1 1 -1 1

x1 0 1 0 -1 2 3

Z = 10 and (3,1,0,0)

Page 22: Civil Engineering Systems Analysis Class Icive208.weebly.com/uploads/1/1/8/8/11887178/class_6.pdfMax Z = 3x1+5x2 Subject to x1 + x3 =4 2x2 +x4 =12 3x1+2x2 +x5 =18 x1≥0,x2 ≥0 Simplex

Summary of special cases

9/25/2012 CIVE 208: CIVIL ENGINEERING SYSTEMS ANALYSIS 22

Entering ties

Degeneracy Results from multiple leaving options

Possibility of a loop

Unbounded Z Simplex is unable to find the corner point

Multiple optimal solutions Results when an edge is the optimal solution

Page 23: Civil Engineering Systems Analysis Class Icive208.weebly.com/uploads/1/1/8/8/11887178/class_6.pdfMax Z = 3x1+5x2 Subject to x1 + x3 =4 2x2 +x4 =12 3x1+2x2 +x5 =18 x1≥0,x2 ≥0 Simplex

Simplex assumptions

9/25/2012 CIVE 208: CIVIL ENGINEERING SYSTEMS ANALYSIS 23

So far we examined simplex.. But implicitly we

made the following assumptions for the

standard problem

≤ constraints

Slack variables … easily provide basic feasible solution

All the RHS values are non-negative

Ensure the variables are not <0

Maximization

We have –ive values in simplex (these enter)

But we need to know how to adapt the simplex for

other forms also!

Page 24: Civil Engineering Systems Analysis Class Icive208.weebly.com/uploads/1/1/8/8/11887178/class_6.pdfMax Z = 3x1+5x2 Subject to x1 + x3 =4 2x2 +x4 =12 3x1+2x2 +x5 =18 x1≥0,x2 ≥0 Simplex

References

9/25/2012 CIVE 208: CIVIL ENGINEERING SYSTEMS ANALYSIS 24

Hillier F.S and G. J. Lieberman. Introduction to

Operations Research, Ninth Edition, McGraw-

Hill, 2010

Revelle C.S, E.E. Whitlatch and J. R. Wright.

Civil and Environmental Systems Engineering