Degeneracy and the Convergence of the Simplex Algorithm

38
Degeneracy and the Convergence of the Simplex Algorithm LI Xiao-lei

description

Degeneracy and the Convergence of the Simplex Algorithm. LI Xiao-lei. Preview. The relationship (for a max problem) between the z-values for the current bfs and the new bfs: - PowerPoint PPT Presentation

Transcript of Degeneracy and the Convergence of the Simplex Algorithm

Page 1: Degeneracy and the Convergence of the Simplex Algorithm

Degeneracy and the Convergence of the Simplex

Algorithm

LI Xiao-lei

Page 2: Degeneracy and the Convergence of the Simplex Algorithm

Preview The relationship (for a max problem) bet

ween the z-values for the current bfs and the new bfs: z-value for new bfs= z-value of current bfs –

(value of entering variable in new bfs) (coefficient of entering variable in row 0 of current bfs) (15)

Page 3: Degeneracy and the Convergence of the Simplex Algorithm

Preview (coefficient of entering variable in row 0)

<0 and (value of entering variable in new bfs)≥0

We can deduce the following facts:if (value of entering variable in new bfs)>0, then

(z-value for new bfs)>(z-value for current bfs)If (value of entering variable in new bfs)=0, then

(z-value for new bfs)=(z-value for current bfs)

Page 4: Degeneracy and the Convergence of the Simplex Algorithm

Preview In each of the LP’s basic feasible solutio

ns, all the basic variables are positive(>0). An LP with this property is a nondegenerate LP.

When the simplex is used to solve a nondegenerate LP, it is impossible to encounter the same bfs twice. We are guaranteed to find the optimal solution in a finite number of iterations.

Page 5: Degeneracy and the Convergence of the Simplex Algorithm

PreviewThe simplex may fail for a degenerate L

P. DEFINITION

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

Page 6: Degeneracy and the Convergence of the Simplex Algorithm

example The following LP is degenerate:

max z=5x1+2x2

s.t. x1+x2≤6

x1-x2≤0 (16)

x1,x2≥0

Adding slack variables s1 and s2 to the two constraints.

Page 7: Degeneracy and the Convergence of the Simplex Algorithm

example A degenerate LP

z x1 x2 s1 s2 rhsBasic variable ratio

1 -5 -2 0 0 0 Z=00 1 1 1 0 6 S1=6 6

0 ① -1 0 1 0 S2=0 0*

The basic variable s2=0, thus, (16) is a degenerate LP.Note: any bfs that has at least one basic variable equal to zero( or equivalently, at least one constraint with a zero right-hand side) is a degenerate bfs.

Page 8: Degeneracy and the Convergence of the Simplex Algorithm

example Since -5<-2, we enter x1 into the basis. The

winning ratio is 0 in row 2.

z x1 x2 s1 s2 rhsBasic variable ratio

1 0 -7 0 5 0 Z=00 0 ② 1 -1 6 S1=6 6/2=3*

0 1 -1 0 1 0 x1=0 noneOur new bfs has the same z-value as the old bfs. In the new bfs, all variables have exactly the same values as they had before the pivot! Thus, our new bfs is also degenerate.

Page 9: Degeneracy and the Convergence of the Simplex Algorithm

example Continuing with the simplex, we enter x2 in row

1.

z x1 x2 s1 s2 rhsBasic variable

1 0 0 3.5 1.5 21 Z=210 0 1 0.5 -0.5 3 x2=3

0 1 0 0.5 0.5 3 x1=3

This is an optimal tableau, so the optimal solution to (16) is z=21, x2=3,x1=3,s1=s2=0.

Page 10: Degeneracy and the Convergence of the Simplex Algorithm

In solving a degenerate LP, we arit is possible for a pivot to leave the value of z unchanged.

A sequence of pivots like the following may occur: initial bfs(bfs 1):z=20 after first pivot(bfs 2):z=20 after second pivot(bfs 3):z=20 after third pivot(bfs 4):z=20 after fourth pivot(bfs 1):z=20In this situation, we encounter the same bfs twice. T

his occurrence is called cycling.

Page 11: Degeneracy and the Convergence of the Simplex Algorithm

If cycling occurs, we will loop forever among a set of basic feasible solutions and never get to the optimal solution.

The simplex algorithm can be modified to ensure that cycling will never occur.

In practice, cycling is an extremely rare occurrence.

If an LP has many degenerate basic feasible solutions (or a bfs with many basic variables equal to zero) , the simplex algorithm is often very inefficient.

Page 12: Degeneracy and the Convergence of the Simplex Algorithm

The big M method The simplex algorithm requires a starting

bfs. We found a starting bfs by using the slack variables as our basic variables.

If an LP has any ≥ or equality constraints, a starting bfs may not be readily apparent.

The big M method (or the two-phase simplex method) may be used.

Page 13: Degeneracy and the Convergence of the Simplex Algorithm

Example 4 Bevco manufactures an orange-flavored soft dr

ink called Oranj by combining orange soda and orange juice.

Each ounce of orange soda contains 0.5 oz of sugar and 1 mg of vitamin C. each ounce of orange juice contains 0.25 oz of sugar and 3 mg of vitamin C.

It costs Bevco 2¢ to produce an ounce of orange soda and 3¢ to produce an ounce of orange juice.

Page 14: Degeneracy and the Convergence of the Simplex Algorithm

Example 4 Bevco’s marketing department has decid

ed that each 10-oz bottle of Oanj must contain at least 20 mg of vitamin C and at most 4 oz of sugar.

Use LP to determine how Bevco can meet the marketing department’s requirements at minimum cost.

Page 15: Degeneracy and the Convergence of the Simplex Algorithm

Example 4 Solution

Let x1=number of ounces of orange soda in a bottle of Oranj

x2=number of ounces of orange juice in a bottle of Oranj

Then the appropriate LP is min z=2x1+3x2

s.t. 1/2x1+1/4x2≤4 (sugar constraint)

x1+ 3x2≥20 (vitamin C constraint) (17) x1+ x2=10 (10 oz in bottle of Oranj)

x1,x2≥0

Page 16: Degeneracy and the Convergence of the Simplex Algorithm

Example 4 Put (17) into standard form

z -2x1 -3x2 =0

1/2 x1+1/4x2+s1 =4

x1+ 3x2 -e2=20

x1+ x2 =10

All variables nonnegative

Page 17: Degeneracy and the Convergence of the Simplex Algorithm

Example 4 Search for a bfs

In row 1, s1=4 could be used as a basic variable

In row 2, e2=-20 violates the sign restriction.

In row 3, there is no readily apparent basic variable.

Page 18: Degeneracy and the Convergence of the Simplex Algorithm

Artificial variablesTo remedy this problem, we simply “invent” a ba

sic feasible variable for each constraint that needs one. These variables are created by us and are not real variables, we call them artificial variables.

If an artificial variable is added to row i, we lable it ai.

Page 19: Degeneracy and the Convergence of the Simplex Algorithm

Example 4 In th current problem, we need to add an a

rtificial variable a2 to row 2 and an artificial variable a3 to row 3. z -2x1 -3x2 =0

1/2 x1+1/4x2+s1 =4

x1+ 3x2 -e2+a2 =20 (18)

x1+ x2 +a3 =10

We now have a bfs: z=0,s1=4,a2=20,a3=10

Page 20: Degeneracy and the Convergence of the Simplex Algorithm

There is no guarantee that the optimal solution to (18) will be the same as the optimal solution to (17).

In a min problem, we can ensure that all the artificial variables will be zero by adding a term Mai to the objective function for each artificial variable ai. (in a max problem, add a term –Mai to the objective function.)

Here M represents a “very large” positive number.

Page 21: Degeneracy and the Convergence of the Simplex Algorithm

Example 4 In (18), we could change our objective function

to min z=2x1+3x2+Ma2+Ma3

The row 0 will change to z-2x1-3x2-Ma2-Ma3=0

With this modified objective function, it seems reasonable that the optimal solution to (18) will have a2=a3=0. in this case, the optimal solution to (18) will solve the original problem (17).

Some of the artificial variables may assume positive values in the optimal solution. If this occurs, the original problem has no feasible solution.

Page 22: Degeneracy and the Convergence of the Simplex Algorithm

Description of big M method Step 1

Modify the constraints so that the right-hand side of each constraint is nonnegative.

Each constraint with a negative right-hand side be multiplied through by -1. if you multiply an inequality by any negative number, the direction of the inequality is reversed.

For example, x1+x2≥-1 into –x1-x2≤1 x1-x2≤-2 into -x1+x2≥2

Page 23: Degeneracy and the Convergence of the Simplex Algorithm

Description of big M method Step 1’

Identify each constraint that is now an = or ≥ constraint. Prepare for step 3 – which constraint will the artificial variable to be added.

Step 2Convert each inequality constraint to standard f

orm.For ≤ constraint i, we add a slack variable si;For ≥ constraint i, we add an excess variable ei;

Page 24: Degeneracy and the Convergence of the Simplex Algorithm

Description of big M method Step 3

If constraint i is a ≥ or = constraint, add an artificial variable ai, also add the sign restriction ai≥0.

Step 4Let M denote a vary large positive number.If the LP is a min problem, add (for each artificial

variable) Mai to the objective function.If the LP is a max problem, add (for each artificial

variable) -Mai to the objective function.

Page 25: Degeneracy and the Convergence of the Simplex Algorithm

Description of big M method Step 5

Since each artificial variable will be in the starting basis, all artificial variables must be eliminated from row 0 before beginning the simplex. This ensures that we begin with a canonical form. In choosing the entering variable, remember that M is a very large positive number.

Page 26: Degeneracy and the Convergence of the Simplex Algorithm

Description of big M methodFor example, 4M-2 is more positive than

3M+900, and -6M-5 is more negative than -5M-40.

Now solve the transformed problem by the simplex. If all artificial variables are equal to zero in the

optimal solution, we have found the optimal solution to the original problem.

If any artificial variables are positive in the optimal solution, the original problem is infeasible.

Page 27: Degeneracy and the Convergence of the Simplex Algorithm

Example 4 (continued)Solution Step 1

Since none of the constraints has a negative right-hand side, we don’t have to multiply any constraint through by -1.

Step 1’Constraints 2 and 3 will require artificial

variables.

Page 28: Degeneracy and the Convergence of the Simplex Algorithm

Example 4 (continued) Step 2

Add a slack variable s1 to row 1 and subtract an excess variable e2 from row 2.

min z= 2x1+ 3x2

row 1: 1/2x1+1/4x2+s1 =4

row 2: x1+ 3x2 -e2=20

row 3: x1+ x2 =10

Page 29: Degeneracy and the Convergence of the Simplex Algorithm

Example 4 (continued) Step 3

Add an artificial variable a2 to row 2 and an artificial variable a3 to row 3.

min z= 2x1+ 3x2

row 1: 1/2x1+1/4x2+s1 =4 row 2: x1+ 3x2 -e2+a2=20 row 3: x1+ x2 +a3=10From this tableau, the initial bfs will be s1=4,a2=20

and a3=10.

Page 30: Degeneracy and the Convergence of the Simplex Algorithm

Example 4 (continued) Step 4

For the min problem, we add Ma2+Ma3 to the objective function.

The objective function is now min z=2x1+3x2+Ma2+Ma3

Page 31: Degeneracy and the Convergence of the Simplex Algorithm

Example 4 (continued) Step 5

Row 0 is now z-2x1-3x2-Ma2-Ma3=0To eliminate a2 and a3 from row 0, simply replace

row 0 by row 0+M(row 2)+M(row 3). This yieldsRow 0: z- 2x1 -3x2 -Ma2-Ma3=0M(row 2): mx1+3Mx2-Me2+Ma2 =20MM(row 3): Mx1 +Mx2 +Ma3=10MNew row 0: z+(2M-2)x1+(4M-3)x2-Me2 =30M

Page 32: Degeneracy and the Convergence of the Simplex Algorithm

Example 4 (continued)

z x1 x2 s1 e2 a2 a3 rhsBasic variable ratio

1 2M-2 4M-3 0 -M 0 0 30M z=30M

0 ½ ¼ 1 0 0 0 4 s1=4 16

0 1 ③ 0 -1 1 0 20 a2=20 20/3*

0 1 1 0 0 0 1 10 a3=10 10

Initial tableau for Bevco

Since we are solving a min problem, the variable with the most positive coefficient in row 0 should enter the basis.Since 4M-3>2M-2, variable x2 should enter the basis. The ratio test indicates that x2 should enter the basis in row 2.

Page 33: Degeneracy and the Convergence of the Simplex Algorithm

Example 4 (continued) Replace row 2 by 1/3(row 2). The new ro

w 2 is 1/3x1+x2-1/3e2+1/3a2=20/3

Eliminate x2 from row 0 by adding –(4M-3)(new row 2) to row 0. the new row 0 is z+(2M-3)/3x1+(M-3)/3e2+(3-4M)/3a2=(60+10M)/3

Using ero’s to eliminate x2 from row 1 and 3.

Page 34: Degeneracy and the Convergence of the Simplex Algorithm

Example 4 (continued)

z x1 x2 s1 e2 a2 a3 rhsBasic variable ratio

1 (2M-3)/3

0 0 (M-3)/3

(3-4M)/3

0 (60+10M)/3

z=(60+10M)/3

0 5/12 0 1 1/12 -1/12 0 7/3 s1=7/3 28/5

0 1/3 1 0 -1/3 1/3 0 20/3 x2=20/3 20

0 2/3 0 0 1/3 -1/3 1 10/3 a3=10/3 5*

First tableau for Bevco

The ratio test indicates that x1 should enter the basis in the third row of the current tableau.

Page 35: Degeneracy and the Convergence of the Simplex Algorithm

Example 4 (continued) Replace row 3 by 3/2(row 3). The new ro

w 3 is x1+1/2e2-1/2a2+3/2a3=5

Eliminate x1 from row 0 by adding (3-2M)/3 (new row 3) to row 0. the new row 0 is z-1/2e2+(1-2M)/2a2+(3-2M)/2a3=25

Using ero’s to eliminate x1 from row 1 and 2.

Page 36: Degeneracy and the Convergence of the Simplex Algorithm

Example 4 (continued)

Since all variables in row 0 have nonpositive coefficients, this is an optimal tableau.

Since all artificial variables are equal to zero, we have found the optimal solution to the Bevco problem.

The optimal solution to the Bevco problem: z=25,x1=x2=5, s1=1/4,e2=0.

z x1 x2 s1 e2 a2 a3 rhsBasic variable

1 0 0 0 -1/2 (1-2M)/2

(3-2M)/2

25 z=25

0 0 0 1 -1/8 1/8 -5/8 ¼ s1=1/4

0 0 1 0 -1/2 ½ -1/2 5 x2=5

0 1 0 0 1/2 -1/2 3/2 5 x1=5

Optimal tableau for Bevco

Page 37: Degeneracy and the Convergence of the Simplex Algorithm

Example 4 (continued)Note The a2 column could have been dropped

after a2 left the basis (at the conclusion of the first pivot), and the a3 column could have been dropped after a3 left the basis( at the conclusion of the second pivot).

Page 38: Degeneracy and the Convergence of the Simplex Algorithm

summary If any artificial variable is positive in the o

ptimal Big M tableau, the original LP has no feasible solution.

When the Big M method is used, it is difficult to determine how large M should be. Generally, M is chosen to be at least 100 times larger than the largest coefficient in the original objective function.