26
Computational Methods for Management and Economics Carla Gomes Module 6b Simplex Pitfalls (Textbook – Hillier and Lieberman)

Computational Methods for Management and Economics Carla Gomes Module 6b Simplex Pitfalls (Textbook – Hillier and Lieberman)

Embed Size (px)

Citation preview

Page 1: Computational Methods for Management and Economics Carla Gomes Module 6b Simplex Pitfalls (Textbook – Hillier and Lieberman)

Computational Methods forManagement and Economics

Carla Gomes

Module 6b

Simplex Pitfalls

(Textbook – Hillier and Lieberman)

Page 2: Computational Methods for Management and Economics Carla Gomes Module 6b Simplex Pitfalls (Textbook – Hillier and Lieberman)

• Synopsis of simplex method

• Pitfalls:– Tie for the entering variable– Degeneracy– Unboundedness– Multiple optimal solutions– Initialization: Adapting to other forms

Page 3: Computational Methods for Management and Economics Carla Gomes Module 6b Simplex Pitfalls (Textbook – Hillier and Lieberman)

Simplex Method in Tabular Form

• Assumption: Standard form

max; only <= functional constraints; all vars have non-negativity constraints; rhs are positive

• Initialization– Introduce slack variables– Decision variables non-basic variables (set to 0)– Slack variables basic variables (set to corresponding rhs)– Transform the objective function and the constraints into equality constraints

• Optimality Test– Current solution is optimal iff all the coefficients of objective function are

non-negative

Page 4: Computational Methods for Management and Economics Carla Gomes Module 6b Simplex Pitfalls (Textbook – Hillier and Lieberman)

Simplex Method in Tabular Form (cont.)

• Iteration: Move to a better BFS

– Step1 Entering Variable – non-basic variable with the most negative coefficient in the objective function. Mark that column as the pivot column.

– Step2 Leaving basic variable – apply the minimum ratio test:• Consider in the pivot column only the coeffcients that are strictly positive

• Divide each of theses coefficients into the rhs entry for the same row

• Identify the row with the smallest of these ratios

• The basic variable for that row is the leaving variable; mark that row as the pivot row;

• The number in the intersection of the pivot row with the pivot column is the pivot number

Page 5: Computational Methods for Management and Economics Carla Gomes Module 6b Simplex Pitfalls (Textbook – Hillier and Lieberman)

Simplex Method in Tabular Form (cont.)

• Iteration: Move to a better BFS

– Step3 Solve for the new BFS by using elementary row operations to construct a new simplex tableau in proper form

• Divide pivot row by the pivot number

• for each row (including objective function) that has a negative coefficient in the pivot column, add to this row the product of the absolute value of this coefficient and the new pivot row.

• for each row that has a positive coefficient in the pivot column, add to this row the product the new pivot row.multiplied by the negative of the coefficient.

Page 6: Computational Methods for Management and Economics Carla Gomes Module 6b Simplex Pitfalls (Textbook – Hillier and Lieberman)

Tie for the entering variable

• Step1 Entering Variable – non-basic variable with the most negative coefficient in the objective function. Mark that column as the pivot column.

– What if more two or more variables are tied?Example: Z = 3 x1 + 3 x2

Break ties randomly (it may affect the number of iterations ),

Page 7: Computational Methods for Management and Economics Carla Gomes Module 6b Simplex Pitfalls (Textbook – Hillier and Lieberman)

Tie for the leaving variable - Degeneracy

– Step2 Leaving basic variable – apply the minimum ratio test:• Identify the row with the smallest of these ratios

– What if several rows have the smallest ratio? What does it mean?Does it matter?

• Several basic variables will become 0 as the entering variable increases therefore the variables not chosen to leave the basis will also have a value 0 (i.e., a basic variable with value 0 – called degenerate variable).

• If a degenerate variable is chosen as the leaving basic variable, that means that the new variable will also have to be 0 (why?)

• Z will not improve and therefore the simplex method may get into a loop.

Page 8: Computational Methods for Management and Economics Carla Gomes Module 6b Simplex Pitfalls (Textbook – Hillier and Lieberman)

x1

-3 3 1 0

-4 2 0 1

Degeneracy

=

= 2

6

x2 x4x3

3 -2 00

z

0

0

1 = 2

1x3

x4

BV

z

A bfs is degenerate if bj = 0 for some j. Otherwise, it is non-degenerate.

0

This bfs is degenerate.

0

Page 9: Computational Methods for Management and Economics Carla Gomes Module 6b Simplex Pitfalls (Textbook – Hillier and Lieberman)

x1

-3 3 1 0

-4 2 0 1

Degeneracy

=

= 2

6

x2 x4x3

3 -2 00

z

0

0

1 = 2

1x3

x4

BV

z

A bfs is degenerate if bj = 0 for some j. Otherwise, it is non-degenerate.

3

This bfs is non-degenerate.

3

Page 10: Computational Methods for Management and Economics Carla Gomes Module 6b Simplex Pitfalls (Textbook – Hillier and Lieberman)

Degenerate the solution may stay the same z stays the same

x1

-3 3 1 0

-4 2 0 1

Degeneracy

=

= 2

6

x2 x4x3

3 -2 00

z

0

0

1 = 2

1

x1 = 0 x2 = x3 = 6 - 3 x4 = 0 - 2 z = 2 + 2

x3

x4

BV

z

A bfs is degenerate if bj = 0 for some j. Otherwise, it is non-degenerate.

0

Suppose that variable x2 will enter the basis.

Page 11: Computational Methods for Management and Economics Carla Gomes Module 6b Simplex Pitfalls (Textbook – Hillier and Lieberman)

In this case the solution did not change. (But the tableau did.)

x1

-3 3 1 0

-4 2 0 1

A degenerate pivot

=

=

6

x2 x4x3

3 -2 00

-z

0

0

1 = 2

1

x1 = 0 x2 = x3 = 6 x4 = 0 z = 2

x3

x4

BV

z

The entering variable is x2. The exiting variable is the one in constraint 2.

0-2 1 0 1/2 0

1 0 0 -1 2

3 0 1 -3/2 6

Page 12: Computational Methods for Management and Economics Carla Gomes Module 6b Simplex Pitfalls (Textbook – Hillier and Lieberman)

x1

-3 3 1 0

-4 2 0 1

Non-degeneracy leads to strict improvement

=

= 2

6

x2 x4x3

3 -2 00

z

0

0

1 = 2

1

x1 = 0 x2 = x3 = 6 - 3 x4 = 2 - 2 z = 2+ 2

x3

x4

BV

z

If the BFS is non-degenerate, then the entering variable can strictly increase, and the objective value will strictly improve.

Page 13: Computational Methods for Management and Economics Carla Gomes Module 6b Simplex Pitfalls (Textbook – Hillier and Lieberman)

Handling Degeneracy

Perturb the RHS just a little, in just the right way

No basis is degenerate

Every bfs to the purturbed problem is also a bfs for the original problem

The optimal basis for the perturbed problem is optimal for the original problem

Page 14: Computational Methods for Management and Economics Carla Gomes Module 6b Simplex Pitfalls (Textbook – Hillier and Lieberman)

An LP before perturbation

x1

-3 3 1 0

-4 2 0 1

=

= 2.

6.

x2 x4x3

3 -2 00

-z

0

0

1 = 0

1x3

x4

BV

z

Goal: modify the problem by changing the RHS just a little

Perturb it so little that solving the perturbed problem also solves the original problem.

Perturb it to avoid degeneracy

Page 15: Computational Methods for Management and Economics Carla Gomes Module 6b Simplex Pitfalls (Textbook – Hillier and Lieberman)

An example of a perturbed initial BFS

x1

-3 3 1 0

-4 2 0 1

=

= 2.00000000000041

6.00000000000013

x2 x4x3

3 -2 00

-z

0

0

1 = 0

1x3

x4

BV

z

In theory perturbations are even smaller

In practice, the simplex method works fine without perturbations, that is, it really obtains the optimum basic feasible solution.

Page 16: Computational Methods for Management and Economics Carla Gomes Module 6b Simplex Pitfalls (Textbook – Hillier and Lieberman)

Some Remarks on Degeneracy• It might seem that degeneracy would be rare. After all, why should

we expect that the RHS would be 0 for some variable?

• In reality, degeneracy is incredibly common.

In practice:

• LP Simplex based solvers automatically use the perturbation method and special breaking tie rules (e.g., Cplex)

• If the problem is very degenerate we may need to use solve the LP using a method different than a simplex

based method to solve the problem(e.g., interior point method)

Page 17: Computational Methods for Management and Economics Carla Gomes Module 6b Simplex Pitfalls (Textbook – Hillier and Lieberman)

No leaving basic variable Unbounded Z

Variable leaving the basis

– One of the basic variables will become non-basic; write all the basic variables as a function of the entering variable; the most stringent value (i.e., smallest) will be the value for the new entering variable;

What if no variable puts a limit on the value of the entering variable – this happens when all the coefficients of the entering variable are negative or zero.

Unbounded Z

Page 18: Computational Methods for Management and Economics Carla Gomes Module 6b Simplex Pitfalls (Textbook – Hillier and Lieberman)

x1 = x2 = 1 x3 = 3 x4 = 0 z = 2

x1 = x2 = 1 + 2 x3 = 3 + 3. x4 = 0 z = 2 +

x1

Unboundedness

=

=

x2 x4x3z

0

0

1 =

Set x1 = and x4 = 0.

-2 1 0 .5

1 0 0 1

-3 0 1 -1.5

1

2

3

If the coefficients in the entering column are 0, then the solution is unbounded from above

Express unboundedness in terms of algebraic notation.

The entering variable is x1.

-2

-1

-3

Page 19: Computational Methods for Management and Economics Carla Gomes Module 6b Simplex Pitfalls (Textbook – Hillier and Lieberman)

1 3 1 0

-1 2 0 1

Multiple Optima (maximization)

=

= 2

6

x2 x4x3

0 4 00

z

0

0

1 = 8

This basic feasible solution is optimal! Is there another optimal solution?

Suppose that x1 entered the basis. What would leave?

x1

z = 8 + 0 x1 + x2

How much can x1 be increased?

Page 20: Computational Methods for Management and Economics Carla Gomes Module 6b Simplex Pitfalls (Textbook – Hillier and Lieberman)

1 3 1 0

-1 2 0 1

Multiple Optima (maximization)

=

= 2

6

x2 x4x3

0 4 00

z

0

0

1 = 8

x1

Use the min ratio rule to determine which variable leaves the basis.

c1 c2

There may be alternative optima ifcj 0 for all j and cj = 0 for some j where xj is non-basic

Page 21: Computational Methods for Management and Economics Carla Gomes Module 6b Simplex Pitfalls (Textbook – Hillier and Lieberman)

1 3 1 0

-1 2 0 1

Multiple Optima (maximization)

=

= 2

6

x2 x4x3

0 4 00

z

0

0

1 = 8

Let x1 enter the basis. Let the basic variable in constraint 1 leave the basis.

x1

1 3 1 0

0 4 0 0 8

6

0 5 1 1 8

Note: the solution is different, but the objective value is the same.

Page 22: Computational Methods for Management and Economics Carla Gomes Module 6b Simplex Pitfalls (Textbook – Hillier and Lieberman)

Multiple Optimal Solutions.

0 2 4 6 8

8

6

4

10

2

Feasible

region

Production rate for doorsD

W

2 W =12

D = 4

3 D + 2 W = 18

Production rate for windows

Maximize P = 3 D + 2 W

subject to

D ≤ 42W ≤ 123D + 2W ≤ 18

and

D ≥ 0, W ≥ 0.

Every point on this line isAn optimal solution with P=18

Page 23: Computational Methods for Management and Economics Carla Gomes Module 6b Simplex Pitfalls (Textbook – Hillier and Lieberman)

ratio OptimalBas Var equation Z x1 x2 x3 x4 x5 RHSZ 0 1 -3 -2 0 0 0 0x3 1 0 1 0 1 0 0 4 4/1=2x4 2 0 0 2 0 1 0 12x5 3 0 3 2 0 0 1 18 18/3=6

NO

Z 0 1 0 -2 3 0 0 12x1 1 0 1 0 1 0 0 4x4 2 0 0 2 0 1 0 12 12/2=6x5 3 0 0 2 -3 0 1 6 6/2=3 NO

Z 0 1 0 0 0 0 1 18x1 1 0 1 0 1 0 0 4 4/1=4x4 2 0 0 0 3 1 0 6 6/3=2x2 3 0 0 1 -1 1/2 0 1/3 3 YES

Z 0 1 0 0 0 0 1 18x1 1 0 1 0 0 1/3 1/3 2x3 2 0 0 0 1 1/3 - 1/3 2x2 3 0 0 1 0 1/2 0 6 YES

Two optimal solutions – what are they? Are there others?

Multiple Optimal Solutions.

Page 24: Computational Methods for Management and Economics Carla Gomes Module 6b Simplex Pitfalls (Textbook – Hillier and Lieberman)

Multiple Optimal Solutions.

At least one of the non-basic variables has a coefficient 0 in the Z row – so increasing any such a variable will not change the value of Z. Therefore these other BF optimal solutions can be identifiedNote: Simplex only identifies BFS (that correspond to CPF solutions).All other solutions are convex combinations of the BF optimalsolutions

The simplex method stops after the first optimal solution;

In practice – good idea to look at other solutions – they may be betterfrom other points of view.

How do we see that a problem has multiple optima by looking at the Tableau?

Page 25: Computational Methods for Management and Economics Carla Gomes Module 6b Simplex Pitfalls (Textbook – Hillier and Lieberman)

Two optimal solutions – what are they? Are there others?

Multiple Optimal Solutions.

Every point on the line segment between (2,6) and (4,3) is optimal

all the optimal solutions are a weighted average of these two solutions

x1

x2

= 2

6

4

3

w1 +

w2w1,w2 ≥ 0w1+w2=1

Every convex combination of the two optimal BFS’s is optimal:

Convex Combination

What solution do we get if w1=w2=0.5?

Page 26: Computational Methods for Management and Economics Carla Gomes Module 6b Simplex Pitfalls (Textbook – Hillier and Lieberman)

Initialization: Adapting to other forms

(next module)