88
Chapter 4 - The Simplex Method Overview of the simplex method. Why do we use it? How does it work? Chap 4 - 1

Chapter 4 Notes - University of Pittsburghbanwork/2001/Ch04.doc · Web view- The feasible region for any LP problem is a convex set. And if an LP has an optimal solution, it will

Embed Size (px)

Citation preview

Page 1: Chapter 4 Notes - University of Pittsburghbanwork/2001/Ch04.doc · Web view- The feasible region for any LP problem is a convex set. And if an LP has an optimal solution, it will

Chapter 4 - The Simplex Method

Overview of the simplex method.

Why do we use it?

How does it work?

Chap 4 - 1

Page 2: Chapter 4 Notes - University of Pittsburghbanwork/2001/Ch04.doc · Web view- The feasible region for any LP problem is a convex set. And if an LP has an optimal solution, it will

Converting LPs into Standard Form

In order to use the simplex method, each inequality constraint must be converted to an equality, and all variables must be non-negative. This is called standard form.

£ - add a slack variable si

³ - subtract an excess variable ei

add sign restrictions for the slack and excess variables

Chap 4 - 2

Page 3: Chapter 4 Notes - University of Pittsburghbanwork/2001/Ch04.doc · Web view- The feasible region for any LP problem is a convex set. And if an LP has an optimal solution, it will

Example - Problem 3, pg 127, Section 4.1

min z = 3x1 + x2

st x1 ³ 3x1 + x2 £ 42x1 - x2 = 3

x1, x2 ³ 0

min z = 3x1 + x2

st x1 - e1 = 3x1 + x2 + s1 = 42x1 - x2 = 3

x1, x2, e1, s1 ³ 0

Chap 4 - 3

Page 4: Chapter 4 Notes - University of Pittsburghbanwork/2001/Ch04.doc · Web view- The feasible region for any LP problem is a convex set. And if an LP has an optimal solution, it will

Basic and Basic Feasible Solutions

Def - A basic solution to Ax = b is obtained by settingn - m variables equal to 0 and solving for the values of the remaining m variables (where m is the number of linear equations, and n is the number of variables and n ³ m),assuming we get a unique solution.

To find a basic solution to Ax = b, we select a set of n - m variables (NBV) and set each of these to 0. Then solve for the remaining m variables (BV) that satisfy Ax = b.

Def - Any basic solution in which all variables are non-negative is a basic feasible solution ( bfs).

Example

x1 = 2, x2 = 3, and x3 = 0 is a bfs

x1 = -1, x2 = 4, and x3 = 0 is not a bfs

Chap 4 - 4

Page 5: Chapter 4 Notes - University of Pittsburghbanwork/2001/Ch04.doc · Web view- The feasible region for any LP problem is a convex set. And if an LP has an optimal solution, it will

Example of basic solutions and basic feasible solutions.

Max z = 3x1 + 2x2

s.t.2x1 + x2 £ 100x1 + x2 £ 80x1, x2 ³ 0

Convert to standard form.

Max z = 3x1 + 2x2

s.t.2x1 + x2 + s1 = 100x1 + x2 + s2 = 80x1, x2, s1, s2 ³ 0

Graph the problem

Chap 4 - 5

Page 6: Chapter 4 Notes - University of Pittsburghbanwork/2001/Ch04.doc · Web view- The feasible region for any LP problem is a convex set. And if an LP has an optimal solution, it will

Basic Non-Basic Basic PointVariables Variables Solutionx1,x2 s1,s2 x1=20, x2=60, s1=0, s2=0 Ax1, s1 x2,s2 x1=80, x2=0, s1=-60, s2=0 B Not a bfsx1, s2 x2,s1 x1=50, x2=0, s1=0, s2=30 Cx2, s1 x1,s2 x1=0, x2=80, s1=20, s2=0 Dx2, s2 x1,s1 x1=0, x2=100, s1=0, s2=-20 E Not a bfss1, s2 x1,x2 x1=0, x2=0, s1=100, s2=80 F

Chap 4 - 6

Page 7: Chapter 4 Notes - University of Pittsburghbanwork/2001/Ch04.doc · Web view- The feasible region for any LP problem is a convex set. And if an LP has an optimal solution, it will

Properties of Basic Variables and Basic Feasible Solutions

Theorem - The feasible region for any LP problem is a convex set. And if an LP has an optimal solution, it will occur at an extreme point.

Theorem - For an LP, there is a unique extreme point of the LP's feasible region corresponding to each bfs. Also, there is at least one bfs corresponding to each extreme point of the feasible region.

Def - For any LP with m constraints, two basic feasible solutions are said to be adjacent if their sets of BVs havem - 1 BVs in common.

An LP can have at most:

basic solutions, bfs, and iterations (assuming that no bfs is repeated), where n = number of variables, and m = number of linear equations.

The simplex algorithm is an iterative, improvement algorithm. Therefore, the simplex method can find the optimal bfs in a finite number of iterations.

Chap 4 - 7

Page 8: Chapter 4 Notes - University of Pittsburghbanwork/2001/Ch04.doc · Web view- The feasible region for any LP problem is a convex set. And if an LP has an optimal solution, it will

Example

n = 20 variablesm = 10 constraints

20C10 = 184,756

This is a lot of bfs solutions to examine!

Past experience shows that generally, the optimal solution can be found after examining fewer than 3m bfs. In our example this is 30.

Chap 4 - 8

Page 9: Chapter 4 Notes - University of Pittsburghbanwork/2001/Ch04.doc · Web view- The feasible region for any LP problem is a convex set. And if an LP has an optimal solution, it will

Graphical Interpretation of the Simplex Method

Chap 4 - 9

Page 10: Chapter 4 Notes - University of Pittsburghbanwork/2001/Ch04.doc · Web view- The feasible region for any LP problem is a convex set. And if an LP has an optimal solution, it will

The Simplex Algorithm

Step 1 Convert the LP to standard form.

This includes converting the objective functionas follows:

z = c1x1 + c2x2 + ... + cnxntoz - c1x1 - c2x2 - ... - cnxn = 0

the objective function is now called row 0

Step 2 Obtain a bfs from the standard form.

Step 3 Determine if the bfs is optimal.

Step 4 If not optimal, determine which NBV shouldbecome a BV and consequently which BV should become a NBV (determine the entering and exiting variable) in order to improve the objective function. Break ties arbitrarily.

Step 5 Use elementary row operations (EROS) to find the new bfs with the better objective function value. Go to Step 3.

Chap 4 - 10

Page 11: Chapter 4 Notes - University of Pittsburghbanwork/2001/Ch04.doc · Web view- The feasible region for any LP problem is a convex set. And if an LP has an optimal solution, it will

Using the Simplex Method to Solve a Maximization Problem

Step 3 - Is the bfs optimal?

The bfs is optimal when all coefficients on all NBVs in Row 0 are positive.

Step 4 - Determine entering NBV and exiting BV.

Enter the NBV which has the most negative coefficient in Row 0.

Exit the BV which has the smallest ratio.

Chap 4 - 11

Page 12: Chapter 4 Notes - University of Pittsburghbanwork/2001/Ch04.doc · Web view- The feasible region for any LP problem is a convex set. And if an LP has an optimal solution, it will

Example - A maximization problem

Max z = 40x1 + 60x2 + 50x3

st 10x1 + 4x2 + 2x3 £ 950

2x1 + 2x2 £ 410

x1 + 2x3 £ 610

x1, x2, x3 ³ 0

Convert to Standard Form

How do we get an initial basic feasible solution?

Is this initial solution optimal?

Which NBV should become basic?

Which BV exits?

Chap 4 - 12

Page 13: Chapter 4 Notes - University of Pittsburghbanwork/2001/Ch04.doc · Web view- The feasible region for any LP problem is a convex set. And if an LP has an optimal solution, it will

Iteration 0

BasicEqn Var z x1 x2 x3 s1 s2 s3 RHS Ratio

0 z 1

1 0

2 0

3 0

Iteration 1

BasicEqn Var z x1 x2 x3 s1 s2 s3 RHS Ratio

0 z 1

1 0

2 0

3 0

Chap 4 - 13

Page 14: Chapter 4 Notes - University of Pittsburghbanwork/2001/Ch04.doc · Web view- The feasible region for any LP problem is a convex set. And if an LP has an optimal solution, it will

Iteration 2

BasicEqn Var z x1 x2 x3 s1 s2 s3 RHS Ratio

0 z 1

1 0

2 0

3 0

Iteration 3

BasicEqn Var z x1 x2 x3 s1 s2 s3 RHS Ratio

0 z 1

1 0

2 0

3 0

All nonbasic variables have coefficients in Row 0 that are non-negative. Therefore, no neighboring extreme points could be any better. Therefore:

the optimal value = z* = 20,350

the optimal solution = x* = [0, 85, 305, 0, 240, 0].

Chap 4 - 14

Page 15: Chapter 4 Notes - University of Pittsburghbanwork/2001/Ch04.doc · Web view- The feasible region for any LP problem is a convex set. And if an LP has an optimal solution, it will

Remarks Concerning the Simplex Method

1. The coefficient of a decision variable in row 0 is referred to as the reduced cost of the variable. The reduced cost is the amount that the objective function, z, will reduce if we increase the NBV by 1 (while the other NBVs remain 0).The reduced cost of a BV is always 0.

2. Interpreting the final solution. Both real variables and slacks.

3. Don’t have to use most negative coefficient in row 0 to enter - but that is the convention.

4. Must use the ratio test for pivoting - don’t want a negative RHS.

Chap 4 - 15

Page 16: Chapter 4 Notes - University of Pittsburghbanwork/2001/Ch04.doc · Web view- The feasible region for any LP problem is a convex set. And if an LP has an optimal solution, it will

Using the Simplex Method to Solve a Minimization Problem - Two Methods

I. Convert the problem to a maximization problem

Let the original objective be

Min z = 4x1 -x2

Convert that to

Max -z = -4x1 + x2

Now use -z as the basic variable in row 0 and solve the problem.

II. Modify the simplex method

Step 3 - Is the bfs optimal?

The bfs is optimal when all coefficients on all NBVs in Row 0 are negative.

Step 4 - Determine entering NBV and exiting BV.

Enter the NBV which has the most positive coefficient in Row 0.

Exit the BV which has the smallest ratio.

Chap 4 - 16

Page 17: Chapter 4 Notes - University of Pittsburghbanwork/2001/Ch04.doc · Web view- The feasible region for any LP problem is a convex set. And if an LP has an optimal solution, it will

Example - Problem 1, pg 145, Section 4.4

Min z = 4x1 - x2

st 2x1 + x2 £ 8

x2 £ 5

x1 - x2 £ 4

x1, x2 ³ 0

Convert to Standard Form

Chap 4 - 17

Page 18: Chapter 4 Notes - University of Pittsburghbanwork/2001/Ch04.doc · Web view- The feasible region for any LP problem is a convex set. And if an LP has an optimal solution, it will

Iteration 0

BasicEqn Var z x1 x2 s1 s2 s3 RHS Ratio

0 z 1 -4 1 0 0 0 0

1 s1 0 2 1 1 0 0 8 8

2 s2 0 0 1 0 1 0 5 5

3 s3 0 1 -1 0 0 1 4 ---

Enter x2 Exit s2

R0 = R0 - R2R1 = R1 - R2R3 = R3 + R2

Iteration 1

BasicEqn Var z x1 x2 s1 s2 s3 RHS Ratio

0 z 1 -4 0 0 -1 0 -5

1 s1 0 2 0 1 -1 0 3

2 x2 0 0 1 0 1 0 5

3 s3 0 1 0 0 1 1 9

All nonbasic variables have coefficients in Row 0 that are negative. Therefore, no extreme points could be any better. Therefore:

the optimal value = z* = -5

the optimal solution = x* = [0, 5, 3, 0, 9].

Note: that the optimal objective function value can be negative as in this example.

Chap 4 - 18

Page 19: Chapter 4 Notes - University of Pittsburghbanwork/2001/Ch04.doc · Web view- The feasible region for any LP problem is a convex set. And if an LP has an optimal solution, it will

In Class Example - Problem 2, pg 143, Section 4.3

Max z = 2x1 + 3x2

st x1 + 2x2 £ 6

2x1 + x2 £ 8

x1, x2 ³ 0

Convert to Standard Form

Chap 4 - 19

Page 20: Chapter 4 Notes - University of Pittsburghbanwork/2001/Ch04.doc · Web view- The feasible region for any LP problem is a convex set. And if an LP has an optimal solution, it will

Iteration 0

BasicEqn Var z x1 x2 s1 s2 RHS Ratio

0 z 1

1 0

2 0

Iteration 1

BasicEqn Var z x1 x2 s1 s2 RHS Ratio

0 z 1

1 0

2 0

Chap 4 - 20

Page 21: Chapter 4 Notes - University of Pittsburghbanwork/2001/Ch04.doc · Web view- The feasible region for any LP problem is a convex set. And if an LP has an optimal solution, it will

Iteration 2

BasicEqn Var z x1 x2 s1 s2 RHS Ratio

0 z 1

1 0

2 0

Chap 4 - 21

Page 22: Chapter 4 Notes - University of Pittsburghbanwork/2001/Ch04.doc · Web view- The feasible region for any LP problem is a convex set. And if an LP has an optimal solution, it will

Alternative Optimal Solutions

Recall that all bv's must have a zero coefficient in row 0 (otherwise they wouldn't be bv's).

If a nbv has a zero coefficient in row 0, this may indicate that the problem has multiple optimal solutions.

You must pivot in the nbv to tell for certain.

Remember that if the problem has two optimal extreme points, then there are an infinite number of optimal solutions indicated by any point on the line segment joining the optimal extreme points.

Chap 4 - 22

Page 23: Chapter 4 Notes - University of Pittsburghbanwork/2001/Ch04.doc · Web view- The feasible region for any LP problem is a convex set. And if an LP has an optimal solution, it will

Example - Problem 1, pg 148, Section 4.5

The objective function is now max z = 4x1 + 2x2

Iteration 0Basic

Eqn Var z x1 x2 s1 s2 s3 RHS Ratio

0 z 1 -4 -2 0 0 0 0

1 s1 0 2 1 1 0 0 100

2 s2 0 1 1 0 1 0 80

3 s3 0 1 0 0 0 1 40

R0 = R0 + 4R3R1 = R1 - 2R3R2 = R2 - R3

Iteration 1Basic

Eqn Var z x1 x2 s1 s2 s3 RHS Ratio

0 z 1 0 -2 0 0 4 160

1 s1 0 0 1 1 0 -2 20

2 s2 0 0 1 0 1 -1 40

3 x1 0 1 0 0 0 1 40

R0 = R0 + 2R1R2 = R2 - R1

Chap 4 - 23

Page 24: Chapter 4 Notes - University of Pittsburghbanwork/2001/Ch04.doc · Web view- The feasible region for any LP problem is a convex set. And if an LP has an optimal solution, it will

Iteration 2

BasicEqn Var z x1 x2 s1 s2 s3 RHS Ratio

0 z 1 0 0 2 0 0 200

1 x2 0 0 1 1 0 -2 20 ---

2 s2 0 0 0 -1 1 1 20 20

3 x1 0 1 0 0 0 1 40 40

This is an optimal solution:

the optimal value = z* = 200

the optimal solution = x* = [40, 20, 0,20, 0].

Observe that the nbv s3 has a zero coefficient in Row 0 of the optimal tableau. To see if we have an alternative optimal solution, move s3 into the basis, and allow s2 to leave.

R1 = R1 + 2R2R3 = R3 - R2

Iteration 3Basic

Eqn Var z x1 x2 s1 s2 s3 RHS Ratio

0 z 1 0 0 2 0 0 200

1 x2 0 0 1 -1 2 0 60

2 s3 0 0 0 -1 1 1 20

3 x1 0 1 0 1 -1 0 20

Thus another optimal solution is obtained:

the optimal value = z* = 200

the optimal solution = x* = [20, 60, 0, 0, 20].

Chap 4 - 24

Page 25: Chapter 4 Notes - University of Pittsburghbanwork/2001/Ch04.doc · Web view- The feasible region for any LP problem is a convex set. And if an LP has an optimal solution, it will

Unbounded LPs

When we get an unbounded LP, this generally indicates a flaw in the problem formulation.

We can recognize the situation by examining the simplex tableau. An unbounded LP for a max/min problem occurs when a variable with a negative/positive coefficient in row 0 has a nonpositive coefficient in each constraint.

Chap 4 - 25

Page 26: Chapter 4 Notes - University of Pittsburghbanwork/2001/Ch04.doc · Web view- The feasible region for any LP problem is a convex set. And if an LP has an optimal solution, it will

Example - Problem 2, pg 151, Section 4.6

min z = -2x1 - 3x2

st x1 - x2 £ 1

x1 - 2x2 £ 2

x1, x2 ³ 0

Iteration 0Basic

Eqn Var z x1 x2 s1 s2 RHS Ratio

0 z 1 2 3 0 0 0

1 s1 0 1 -1 1 0 1

2 s2 0 1 -2 0 1 2

This LP is unbounded because x2, which has a positive coefficient in Row 0, has nonpositive coefficients in all of its constraints.

If we increase x2, while holding the other NBV = 0, we can simply increase the BV and keep equations 1 and 2 valid. Which means we can decrease z to negative infinity.

Equation 1 s1 = 1 + x2

Equation 2 s2 = 2 + 2x2

Chap 4 - 26

Page 27: Chapter 4 Notes - University of Pittsburghbanwork/2001/Ch04.doc · Web view- The feasible region for any LP problem is a convex set. And if an LP has an optimal solution, it will

Scaling and Degeneracy

Read Section 4.8 on scaling of LP problems. We will not discuss this in class but it is an important consideration.

Degeneracy

Def - An LP is degenerate if it has at least one bfs in which a basic variable is equal to zero.

Degeneracy occurs when we have n decision variables and n+1 or more constraints are binding at an extreme point.

Example: Problem 1, p.163, Section 4.9

max z = 5x1 + 3x2

s.t. 4x1 + 2x2 £ 124x1 + x2 £ 10x1 + x2 £ 4x1, x2 ³ 0

Chap 4 - 27

Page 28: Chapter 4 Notes - University of Pittsburghbanwork/2001/Ch04.doc · Web view- The feasible region for any LP problem is a convex set. And if an LP has an optimal solution, it will

The simplex method may have difficulty solving a degenerate LP problem.

Cycling can occur where we loop around a set of bfs's and never get the optimal solution (or if we do it may take a very long time).

Example of degeneracy

max z = 2x1 + 3x2

st x1 + x2 £ 3

x1 + 2x2 £ 4

4x1 + 3x2 £ 12

x1, x2 ³ 0

Chap 4 - 28

Page 29: Chapter 4 Notes - University of Pittsburghbanwork/2001/Ch04.doc · Web view- The feasible region for any LP problem is a convex set. And if an LP has an optimal solution, it will

Solution 1

Iteration 0

BasicEqn Var z x1 x2 s1 s2 s3 RHS Ratio

0 z 1 -2 -3 0 0 0 0

1 s1 0 1 1 1 0 0 3 3

2 s2 0 1 2 0 1 0 4 2

3 s3 0 4 3 0 0 1 12 4

Enter x2 Exit s2

R0 = R0 + (3/2)R2R1 = R1 - (1/2)R2R2 = (1/2)R2R3 = R3 - (3/2)R2

Iteration 1

BasicEqn Var z x1 x2 s1 s2 s3 RHS Ratio

0 z 1 -1/2 0 0 3/2 0 6

1 s1 0 1/2 0 1 -1/2 0 1 2

2 x2 0 1/2 1 0 1/2 0 2 4

3 s3 0 5/2 0 0 -3/2 1 6 2.4

Enter x1 Exit s1

R0 = R0 + R1R1 = 2R1R2 = R2 - R1

Chap 4 - 29

Page 30: Chapter 4 Notes - University of Pittsburghbanwork/2001/Ch04.doc · Web view- The feasible region for any LP problem is a convex set. And if an LP has an optimal solution, it will

R3 = R3 - 5R1

Chap 4 - 30

Page 31: Chapter 4 Notes - University of Pittsburghbanwork/2001/Ch04.doc · Web view- The feasible region for any LP problem is a convex set. And if an LP has an optimal solution, it will

Iteration 2

BasicEqn Var z x1 x2 s1 s2 s3 RHS Ratio

0 z 1 0 0 1 1 0 7

1 x1 0 1 0 2 -1 0 2

2 x2 0 0 1 -1 1 0 1

3 s3 0 0 0 -5 1 1 1

This is an optimal solution :

the optimal value = z* = 7

the optimal solution = x* = [2, 1, 0, 0, 1].

Solution 2

Iteration 0

BasicEqn Var z x1 x2 s1 s2 s3 RHS Ratio

0 z 1 -2 -3 0 0 0 0

1 s1 0 1 1 1 0 0 3 3

2 s2 0 1 2 0 1 0 4 4

3 s3 0 4 3 0 0 1 12 3

Enter x1 Exit s1

R0 = R0 + 2R1R2 = R2 - R1R3 = R3 - 4R1

Chap 4 - 31

Page 32: Chapter 4 Notes - University of Pittsburghbanwork/2001/Ch04.doc · Web view- The feasible region for any LP problem is a convex set. And if an LP has an optimal solution, it will

Iteration 1

BasicEqn Var z x1 x2 s1 s2 s3 RHS Ratio

0 z 1 0 -1 2 0 0 6

1 x1 0 1 1 1 0 0 3 3

2 s2 0 0 1 -1 1 0 1 1

3 s3 0 0 -1 -4 0 1 0 --- Degenerate

Enter x2 Exit s2

R0 = R0 + R2R1 = R1 - R2R3 = R3 + R2

Iteration 2

BasicEqn Var z x1 x2 s1 s2 s3 RHS Ratio

0 z 1 0 0 1 1 0 7

1 x1 0 1 0 2 -1 0 2

2 x2 0 0 1 -1 1 0 1

3 s3 0 0 0 -5 1 1 1

This is the same optimal solution and tableau as achieved in Solution 1, using a different path:

the optimal value = z* = 7

the optimal solution = x* = [2, 1, 0, 0, 1].

Chap 4 - 32

Page 33: Chapter 4 Notes - University of Pittsburghbanwork/2001/Ch04.doc · Web view- The feasible region for any LP problem is a convex set. And if an LP has an optimal solution, it will

Solution 3

Iteration 0

BasicEqn Var z x1 x2 s1 s2 s3 RHS Ratio

0 z 1 -2 -3 0 0 0 0

1 s1 0 1 1 1 0 0 3 3

2 s2 0 1 2 0 1 0 4 4

3 s3 0 4 3 0 0 1 12 3

Enter x1 Exit s3

R0 = R0 + (1/2)R3R1 = R1 - (1/4)R3R2 = R2 - (1/4)R3R3 = (1/4)R3

Iteration 1

BasicEqn Var z x1 x2 s1 s2 s3 RHS Ratio

0 z 1 0 -3/2 0 0 1/2 6

1 s1 0 0 1/4 1 0 -1/4 0 0 Degenerate

2 s2 0 0 5/4 0 1 -1/4 1 0.8

3 x1 0 1 3/4 0 0 1/4 3 4

Enter x2 Exit s1

R0 = R0 + 6R1R1 = 4R1R2 = R2 - 5R1

Chap 4 - 33

Page 34: Chapter 4 Notes - University of Pittsburghbanwork/2001/Ch04.doc · Web view- The feasible region for any LP problem is a convex set. And if an LP has an optimal solution, it will

R3 = R3 - 3R1

Chap 4 - 34

Page 35: Chapter 4 Notes - University of Pittsburghbanwork/2001/Ch04.doc · Web view- The feasible region for any LP problem is a convex set. And if an LP has an optimal solution, it will

Iteration 2

BasicEqn Var z x1 x2 s1 s2 s3 RHS Ratio

0 z 1 0 0 6 0 -1 6

1 x2 0 0 1 4 0 -1 0 -- Degenerate

2 s2 0 0 0 -5 1 1 1 1

3 x1 0 1 0 -3 0 1 3 3

Enter s3 Exit s2

R0 = R0 + R2R1 = R1 + R2R3 = R3 - R2

Iteration 3

BasicEqn Var z x1 x2 s1 s2 s3 RHS Ratio

0 z 1 0 0 1 1 0 7

1 x2 0 0 1 -1 1 0 1

2 s3 0 0 0 -5 1 1 1

3 x1 0 1 0 2 -1 0 2

This is the same optimal solution as achieved in Solutions 1 and 2, although the rows are interchanged.

the optimal value = z* = 7

the optimal solution = x* = [2, 1, 0, 0, 1].

Chap 4 - 35

Page 36: Chapter 4 Notes - University of Pittsburghbanwork/2001/Ch04.doc · Web view- The feasible region for any LP problem is a convex set. And if an LP has an optimal solution, it will

Note, from Iteration 1 to 2 there was no improvement in z, the degeneracy causes the minimal ratio to be 0 and thus there is no improvement. This is the type of cycling that can occur - the basis changes but you do not improve the objective.

LP Complications - No simple initial bfs.

Why is this a problem?

Our book discusses two methods which will yield an initial bfs when one is not readily apparent:

1) The Big M Method2) The Two-Phase Simplex Method

This generally occurs when an LP has any ³ or = constraints.

The Big M Method uses artificial variables ai.

We use the artificial variables to get an initial bfs. However, since the variables are “artificial” we want to make sure they equal 0 at the end of the simplex algorithm.We accomplish this by giving them a large penalty in the objective function.

Chap 4 - 36

Page 37: Chapter 4 Notes - University of Pittsburghbanwork/2001/Ch04.doc · Web view- The feasible region for any LP problem is a convex set. And if an LP has an optimal solution, it will

Description of the Big M Method

Step 1 Modify the constraints so that each RHS isnon-negative.

Step 2 Convert each inequality constraint to standardform.

Step 3 Add an artificial variable ai to each ³ or =constraint. Also add the sign restriction, ai ³ 0.

Step 4 Let M denote a very large positive number. Fora min/max problem add/subtract M * ai to theobjective function.

Step 5 Eliminate all artificial variables from Row 0before beginning the simplex method.

Step 6 Apply Simplex Method as usual.

Chap 4 - 37

Page 38: Chapter 4 Notes - University of Pittsburghbanwork/2001/Ch04.doc · Web view- The feasible region for any LP problem is a convex set. And if an LP has an optimal solution, it will

Example

Max z = 2x1 + 5x2 + 3x3

st 3x1 - 6x2 ³ 30

6x1 + 12x2 + 3x3 = 75

xi ³ 0

Standard Form

Max z = 2x1 + 5x2 + 3x3 - 0e1

st 3x1 - 6x2 - e1 = 30

6x1 + 12x2 + 3x3 = 75

xi, e1 ³ 0

The initial tableau is:

BasicEqn Var z x1 x2 x3 e1 RHS Ratio

0 z 1 -2 -5 -3 0 0

1 ? 0 3 -6 0 -1 30

2 ? 0 6 12 3 0 75

Notice that this is not in the usual form. We can not readily assign the initial bv's.

Chap 4 - 38

Page 39: Chapter 4 Notes - University of Pittsburghbanwork/2001/Ch04.doc · Web view- The feasible region for any LP problem is a convex set. And if an LP has an optimal solution, it will

Using the Big M Method

Max z = 2x1 + 5x2 + 3x3 - 0e1

st 3x1 - 6x2 - e1 = 30

6x1 + 12x2 + 3x3 = 75

xi, e1 ³ 0

The tableau now is

BasicEqn Var z x1 x2 x3 e1 a1 a2 RHS Ratio

0 z 1 -2 -5 -3 0

1 a1 0 3 -6 0 -1

2 a2 0 6 12 3 0

BasicEqn Var z x1 x2 x3 e1 a1 a2 RHS Ratio

0 z 1 -2-9M -5-6M -3-3M M 0 0 -105M

1 a1 0 3 -6 0 -1 1 0 30

2 a2 0 6 12 3 0 0 1 75

Finally the matrix is in proper canonical form.

Chap 4 - 39

Page 40: Chapter 4 Notes - University of Pittsburghbanwork/2001/Ch04.doc · Web view- The feasible region for any LP problem is a convex set. And if an LP has an optimal solution, it will

An example with ³ and = constraints

Max z = 12x1 + 20x2 + 8x3

st (1) 3x1 - 2x3 ³ -2

(2) -4x1 - x2 + 12x3 ³ 4

(3) -x1 + 3x3 £ -6

(4) 3x1 + 4x2 - 6x3 = -12

(5) x2 + 9x3 = 31

x1, x2, x3 ³ 0

(1) -3x1 + 2x3 £ 2

-3x1 + 2x3 + s1 = 2

(2) -4x1 - x2 + 12x3 - e2 + a2 = 4

(3) x1 - 3x3 ³ 6

x1 - 3x3 - e3 + a3 = 6

(4) -3x1 - 4x2 + 6x3 = 12

-3x1 - 4x2 + 6x3 + a4 = 12

(5) x2 + 9x3 + a5 = 31

Chap 4 - 40

Page 41: Chapter 4 Notes - University of Pittsburghbanwork/2001/Ch04.doc · Web view- The feasible region for any LP problem is a convex set. And if an LP has an optimal solution, it will

Restated in standard form:

Max z = 12x1 + 20x2 + 8x3 - Ma2 - Ma3 - Ma4 - Ma5

st (1) -3x1 +2x3 + s1 = 2

(2) -4x1 - x2 + 12x3 - e2 + a2= 4

(3) x1 - 3x3 - e3 + a3 = 6

(4) -3x1 - 4x2 + 6x3 + a4 = 12

(5) x2 + 9x3 + a5 = 31

all variables ³ 0

BasicEqn Var z x1 x2 x3 s1 e2 a2 e3 a3 a4 a5 RHS Ratio

0 z 1 -12 -20 -8 0 0 M 0 M M M 0

1 s1 0 -3 0 2 1 0 0 0 0 0 0 2

2 a2 0 -4 -1 12 0 -1 1 0 0 0 0 4

3 a3 0 1 0 -3 0 0 0 -1 1 0 0 6

4 a4 0 -3 -4 6 0 0 0 0 0 1 0 12

5 a5 0 0 1 9 0 0 0 0 0 0 1 31

R0 = R0 + (-M)R2 + (-M)R3 + (-M)R4 + (-M)R5

Chap 4 - 41

Page 42: Chapter 4 Notes - University of Pittsburghbanwork/2001/Ch04.doc · Web view- The feasible region for any LP problem is a convex set. And if an LP has an optimal solution, it will

BasicEqn Var z x1 x2 x3 s1 e2 a2 e3 a3 a4 a5 RHS Ratio

0 z 1 -12 -20 -8 0 M 0 M 0 0 0 -53M+6M +4M -24M

1 s1 0 -3 0 2 1 0 0 0 0 0 0 2

2 a2 0 -4 -1 12 0 -1 1 0 0 0 0 4

3 a3 0 1 0 -3 0 0 0 -1 1 0 0 6

4 a4 0 -3 -4 6 0 0 0 0 0 1 0 12

5 a5 0 0 1 9 0 0 0 0 0 0 1 31

The matrix is now in proper canonical form.

Chap 4 - 42

Page 43: Chapter 4 Notes - University of Pittsburghbanwork/2001/Ch04.doc · Web view- The feasible region for any LP problem is a convex set. And if an LP has an optimal solution, it will

Example

Max z = 5000x1 + 4000x2

st 10x1 + 15x2 £ 150

20x1 + 10x2 £ 160

30x1 + 10x2 ³ 135

x1, x2 ³ 0

Converted to standard form:

Max z = 5000x1 + 4000x2 +

st 10x1 + 15x2 + = 150

20x1 + 10x2 = 160

30x1 + 10x2 = 135

all variables ³ 0

Iteration 0

BasicEqn Var z x1 x2 RHS Ratio

0 z 1 -5000 -4000

1 s1 0 10 15

2 s2 0 20 10

3 a3 0 30 10

This is not in canonical form yet.

Chap 4 - 43

Page 44: Chapter 4 Notes - University of Pittsburghbanwork/2001/Ch04.doc · Web view- The feasible region for any LP problem is a convex set. And if an LP has an optimal solution, it will

R0 = R0 - (M)R3

Chap 4 - 44

Page 45: Chapter 4 Notes - University of Pittsburghbanwork/2001/Ch04.doc · Web view- The feasible region for any LP problem is a convex set. And if an LP has an optimal solution, it will

Iteration 0

BasicEqn Var z x1 x2 s1 s2 e3 a3 RHS Ratio

0 z 1 -5000-30M

-4000-10M

0 0 M 0 -135M

1 s1 0 10 15 1 0 0 0 150 15

2 s2 0 20 10 0 1 0 0 160 8

3 a3 0 30 10 0 0 -1 1 135 4.5

Enter x1 Exit a3

R0 = R0 + [(5000 + 30M)/30]R3R1 = R1 - (1/3)R3R2 = R2 - (2/3)R3R3 = (1/30)R3

Iteration 1

BasicEqn Var z x1 x2 s1 s2 e3 a3 RHS Ratio

0 z 1 0 -7000/3 0 0 -500/3 M+ 500/3 22500

1 s1 0 0 35/3 1 0 1/3 -1/3 105 9

2 s2 0 0 10/3 0 1 2/3 -2/3 70 21

3 x1 0 1 1/3 0 0 -1/30 1/30 4.5 13.5

Enter x2 Exit s1

R0 = R0 + 200R1R1 = (3/35)R1R2 = R2 - (10/35)R1

Chap 4 - 45

Page 46: Chapter 4 Notes - University of Pittsburghbanwork/2001/Ch04.doc · Web view- The feasible region for any LP problem is a convex set. And if an LP has an optimal solution, it will

R3 = R3 - (1/35)R1

Chap 4 - 46

Page 47: Chapter 4 Notes - University of Pittsburghbanwork/2001/Ch04.doc · Web view- The feasible region for any LP problem is a convex set. And if an LP has an optimal solution, it will

Iteration 2

BasicEqn Var z x1 x2 s1 s2 e3 a3 RHS Ratio

0 z 1 0 0 200 0 -100 M+ 43500 100

1 x2 0 0 1 3/35 0 1/35 -1/35 9 315

2 s2 0 0 0 -10/35 1 4/7 -4/7 40 70

3 x1 0 1 0 -1/35 0 -3/70 3/70 1.5 ---

Enter e3 Exit s2

R0 = R0 + 175R2R1 = R1 - (1/20)R2R2 = (7/4)R2R3 = R3 + (3/40)R2

Iteration 3

BasicEqn Var z x1 x2 s1 s2 e3 a3 RHS Ratio

0 z 1 0 0 150 175 0 M 50500

1 x2 0 0 1 1/10 -1/20 0 0 7

2 e3 0 0 0 -1/2 7/4 1 -1 70

3 x1 0 1 0 -1/20 3/40 0 0 4.5

This is the optimal solution:

the optimal value = z* = 50,500

the optimal solution = x* = [4.5, 7, 0, 0, 70, 0].

Chap 4 - 47

Page 48: Chapter 4 Notes - University of Pittsburghbanwork/2001/Ch04.doc · Web view- The feasible region for any LP problem is a convex set. And if an LP has an optimal solution, it will

Note that a3 = 0.

Chap 4 - 48

Page 49: Chapter 4 Notes - University of Pittsburghbanwork/2001/Ch04.doc · Web view- The feasible region for any LP problem is a convex set. And if an LP has an optimal solution, it will

Note, that when an artificial variable leaves the basis, the column may be dropped from all future tableaus.

Example

Max z = 2x1 + 5x2 + 3x3 - Ma1 - Ma2

st 3x1 - 6x2 - e1 + a1 = 30

6x1 + 12x2 + 3x3 + a2 = 75

Iteration 0

BasicEqn Var z x1 x2 x3 e1 a1 a2 RHS Ratio

0 z 1 -9M -6M -3M M 0 0 -105M-2 -5 -3

1 a1 0 3 -6 0 -1 1 0 30 10

2 a2 0 6 12 3 0 0 1 75 25/2

Enter x1 Exit a1

R0 = R0 + [(9M+2)/3]R1R1 = (1/3)R1R2 = R2 - 2R1

We can eliminate the a1 column.

Chap 4 - 49

Page 50: Chapter 4 Notes - University of Pittsburghbanwork/2001/Ch04.doc · Web view- The feasible region for any LP problem is a convex set. And if an LP has an optimal solution, it will

Iteration 1

BasicEqn Var z x1 x2 x3 e1 a2 RHS Ratio

0 z 1 0 -24M -3M -2M 0 -15M -9 -3 -2/3 +20

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

2 a2 0 0 24 3 2 1 15 5/8

Enter x2 Exit a2

R0 = R0 + [(24M+9)/24]R2R1 = R1 + (1/12)R2R2 = (1/24)R2

We can eliminate the a2 column.

Iteration 2

BasicEqn Var z x1 x2 x3 e1 RHS Ratio

0 z 1 0 0 -15/8 1/12 205/8

1 x1 0 1 0 1/4 -1/6 45/4 45

2 x2 0 0 1 1/8 1/12 5/8 5

Enter x3 Exit x2

R0 = R0 + 15R2R1 = R1 - 2R2R2 = 8R2

Chap 4 - 50

Page 51: Chapter 4 Notes - University of Pittsburghbanwork/2001/Ch04.doc · Web view- The feasible region for any LP problem is a convex set. And if an LP has an optimal solution, it will

Iteration 3

BasicEqn Var z x1 x2 x3 e1 RHS Ratio

0 z 1 0 15 0 4/3 35

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

2 x3 0 0 8 1 2/3 5

This is the optimal solution:

the optimal value = z* = 35

the optimal solution = x* = [10, 0, 5].

Some final notes about the Big M Method

· An infeasible LP can be spotted when any artificial variable is positive in the optimal Big M tableau. There is an example on p.169-170.

· Most computer codes solve LPs by using the two-phase simplex method instead of the Big M Method due to difficulty in assigning a value for M. Generally M should be at least 100 times larger than the largest coefficient in the original objective function.

Chap 4 - 51

Page 52: Chapter 4 Notes - University of Pittsburghbanwork/2001/Ch04.doc · Web view- The feasible region for any LP problem is a convex set. And if an LP has an optimal solution, it will

LP Complications - A special case occurs when the variables are unrestricted-in-sign (urs).

This means that the variable can take on negative values. The simplex method which we have defined will no longer work, and must be modified.

For each urs variable, xi, replace xi with xi' - xi''. Also add the sign restrictions xi' ³ 0 and xi'' ³ 0. We will then find that:

· xi' and xi'' will not be in the basis at the same time, thus we will see one of three cases

1. xi' > 0 and xi'' = 0

2. xi' = 0 and xi'' > 0

3. xi' = 0 and xi'' = 0

· Also, the column xi' will always be the negative of column xi'' in each iteration

Chap 4 - 52

Page 53: Chapter 4 Notes - University of Pittsburghbanwork/2001/Ch04.doc · Web view- The feasible region for any LP problem is a convex set. And if an LP has an optimal solution, it will

Example, Problem 2, Section 4.12, pg 177

Max z = 2x1 + x2

st 3x1 + x2 £ 6

x1 + x2 £ 4

x1 ³ 0, x2 urs

Replace x2 with (x2' - x2'')

z - 2x1 - = 0

st 3x1 + = 6

x1 + = 4

all variables ³ 0

Iteration 0

BasicEqn Var z x1 x2' x2'' s1 s2 RHS Ratio

0 z 1 -2

1 s1 0 3

2 s2 0 1

R0 = R0 + (2/3)R1R1 = (1/3)R1

Chap 4 - 53

Page 54: Chapter 4 Notes - University of Pittsburghbanwork/2001/Ch04.doc · Web view- The feasible region for any LP problem is a convex set. And if an LP has an optimal solution, it will

R2 = R2 - (1/3)R1

Chap 4 - 54

Page 55: Chapter 4 Notes - University of Pittsburghbanwork/2001/Ch04.doc · Web view- The feasible region for any LP problem is a convex set. And if an LP has an optimal solution, it will

Iteration 1

BasicEqn Var z x1 x2' x2'' s1 s2 RHS Ratio

0 z 1 0 -1/3 1/3 2/3 0 4

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

2 s2 0 0 2/3 -2/3 -1/3 1 2 3

Enter x2' Exit s2

R0 = R0 + (1/2)R2R1 = R1 - (1/2)R2R2 = (3/2)R2

Iteration 2

BasicEqn Var z x1 x2' x2'' s1 s2 RHS Ratio

0 z 1 0 0 0 1/2 1/2 5

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

2 x2' 0 0 1 -1 -1/2 3/2 3

This is the optimal solution:

the optimal value = z* = 5

x2 = x2' - x2'' = 3 - 0 = 3

the optimal solution = x* = [1, 3].

Note how column x2' is the negative of column x2'' throughout all the tableaus.

Chap 4 - 55

Page 56: Chapter 4 Notes - University of Pittsburghbanwork/2001/Ch04.doc · Web view- The feasible region for any LP problem is a convex set. And if an LP has an optimal solution, it will

Solving the LP Using Software

LINDO - Linear Interactive and Discrete Optimizer

EXCEL - Solver

Both are available in the computer labs and you have a personal copy of LINDO that came with the textbook.

We will discuss LINDO in class and there is additional information contained in the text.

LINDO is the more common of the two.

You may choose to do your work in either LINDO or EXCEL.

Chap 4 - 56

Page 57: Chapter 4 Notes - University of Pittsburghbanwork/2001/Ch04.doc · Web view- The feasible region for any LP problem is a convex set. And if an LP has an optimal solution, it will

Comments Regarding LINDO:

1. The first thing you input is the objective function.

2. The constraints need to be in the form where all of the variables are on the left hand side and the constant value (RHS) is on the right hand side.

3. The program handles inequality constraints and will automatically add slack and excess variables.

4. The program handles unrestricted sign variables.

5. The DOS version of LINDO has an adequate editor but it is limited - if you are inputting a large model save your work frequently. The Windows version seems more robust and it has a better editor.

Chap 4 - 57

Page 58: Chapter 4 Notes - University of Pittsburghbanwork/2001/Ch04.doc · Web view- The feasible region for any LP problem is a convex set. And if an LP has an optimal solution, it will

Using LINDO

1. There are some notes in the course notes - but primarily reference the book pages 192 to 194.

2. Not menu driven. However the “COM” command will show you a list of all the commands. You can type “HELP COM” to get help for a particular command.

3. Remember that you need the s.t. (subject to) line.

4. Particularly useful commands for the DOS version:

TAKE - Lets you make the file in a word processor such as Word and then read into LINDO. (This is easier than composing the whole thing in LINDO.) Requires the following:

(1) Format the problem like it looks in LINDO when you use a look all command, i.e., include the words Max/Min, Subject To, and End in their correct places.

(2) Put the word Leave on the last line.

EDIT - The screen editor. This is much easier to use than the ALTER command for changing a model.

You can save (SAVE) and retrieve (RETR) your work.

To print out, use the DIVERT command to divert the output to a file and then print the file. (User RVRT to return to on screen mode)

Chap 4 - 58

Page 59: Chapter 4 Notes - University of Pittsburghbanwork/2001/Ch04.doc · Web view- The feasible region for any LP problem is a convex set. And if an LP has an optimal solution, it will

5. For the Windows version recall the following items:

a. Note that there is a model window and a reports window. You change the model in the model window and the output is printed in the reports window. If you run the model several times but only want the last output use the clear all option in the reports window, then run the model. Then you will only have the one output that you can print out.

b. If you have errors in your model LINDO will try to get you to the correct line so that you can fix them.

Recall that you have a copy of the LINDO software that came with your book.

Chap 4 - 59

Page 60: Chapter 4 Notes - University of Pittsburghbanwork/2001/Ch04.doc · Web view- The feasible region for any LP problem is a convex set. And if an LP has an optimal solution, it will

MIN 50 BR + 20 IC + 30 COLA + 80 PC SUBJECT TO 2) 400 BR + 200 IC + 150 COLA + 500 PC >= 500 3) 3 BR + 2 IC >= 6 4) 2 BR + 2 IC + 4 COLA + 4 PC >= 10 5) 2 BR + 4 IC + COLA + 5 PC >= 8 END LP OPTIMUM FOUND AT STEP 2

OBJECTIVE FUNCTION VALUE

1) 90.00000

VARIABLE VALUE REDUCED COST BR .000000 27.500000 IC 3.000000 .000000 COLA 1.000000 .000000 PC .000000 50.000000

ROW SLACK OR SURPLUS DUAL PRICES 2) 250.000000 .000000 3) .000000 -2.500000 4) .000000 -7.500000 5) 5.000000 .000000

NO. ITERATIONS= 2

Chap 4 - 60