The Simplex Method The TwoPhase Simplex Method Expanding

  • Slides: 29
Download presentation
The Simplex Method The Two-Phase Simplex Method

The Simplex Method The Two-Phase Simplex Method

Expanding Our Reach Until now, we have only considered LPs with “<=” constraints, nonnegative

Expanding Our Reach Until now, we have only considered LPs with “<=” constraints, nonnegative variables, and nonnegative right-hand-side values. n Why? n – Remember that simplex needs a place to start – it must start from a bfs then move to another bfs to improve the objective value. – With these assumptions, we can obtain an initial bfs/dictionary by letting all slack variables be basic, all original variables be nonbasic.

Expanding Our Reach n Obviously, these assumptions do not hold for every LP. What

Expanding Our Reach n Obviously, these assumptions do not hold for every LP. What do we do when they don’t? n This is where Two-Phase Simplex comes in. It involves two phases (thus the name!): – Phase I: Works to achieve feasibility. – Phase II: Works to achieve optimality.

Example: Two-Phase Step 1: make all right-hand-side Values nonnegative.

Example: Two-Phase Step 1: make all right-hand-side Values nonnegative.

Example: Two-Phase Step 2: put the LP in standard form.

Example: Two-Phase Step 2: put the LP in standard form.

Example: Two-Phase What if we wrote the initial dictionary? Infeasible! Basic var?

Example: Two-Phase What if we wrote the initial dictionary? Infeasible! Basic var?

Artifical Variables When we had a slack variable in each constraint, it was easy

Artifical Variables When we had a slack variable in each constraint, it was easy to find an initial bfs to initiate simplex. n When there are rows without slack variables, it isn’t so obvious how to begin simplex. n To deal with the problem, we will use artificial variables. n Essentially, we will invent a basic variable for each row without a slack (we will use the slacks when they are available). n

Example: Two-Phase (cont’d) Step 3: add an artificial variable to each row without a

Example: Two-Phase (cont’d) Step 3: add an artificial variable to each row without a slack.

Example: Two-Phase (cont’d) Step 4: write the initial dictionary, using slack and artificial variables

Example: Two-Phase (cont’d) Step 4: write the initial dictionary, using slack and artificial variables as basic variables.

A Problem n We have essentially made up extra variables to make our lives

A Problem n We have essentially made up extra variables to make our lives easier. Is this a valid thing to do? n Yes and no. We can not start simplex with a bfs that utilizes artificial variables. We can use artificial variables as a tool to obtain a starting bfs.

Solving the Problem n How do we use them? Starting with our dictionary that

Solving the Problem n How do we use them? Starting with our dictionary that uses artificial variables, we use simplex to find a bfs in which all artificial variables are equal to zero. Then they don’t affect the real solution. X X

Forcing Artificials = 0 n To force all artificial variables to be zero, we

Forcing Artificials = 0 n To force all artificial variables to be zero, we minimize the sum of all artifical variables. – If the minimum is zero, then all artificial variables equal zero (this is what we want!!) – If the minimum is nonzero, then some artificial variable is positive. This implies feasibility!!!

Example: Two-Phase (cont’d) Step 5: replace the objective with minimizing the sum of all

Example: Two-Phase (cont’d) Step 5: replace the objective with minimizing the sum of all artificial variables (call it “w” to keep it separate from the original objective).

Example: Two-Phase (cont’d) If the objective value is zero, then both artificial variables are

Example: Two-Phase (cont’d) If the objective value is zero, then both artificial variables are also zero, and we have found a feasible solution to our original LP. Otherwise, one of the artificial variables has a postive value, and there is no feasible solution to our original LP. If there IS a feasible solution, the minimum will be zero.

Example: Two-Phase (cont’d) The LP given above (original constraints with artificial variables, and new

Example: Two-Phase (cont’d) The LP given above (original constraints with artificial variables, and new objective) is called the Phase I Linear Program.

Example: Two-Phase (cont’d) Write the dictionary for the Phase I LP: Basic variables on

Example: Two-Phase (cont’d) Write the dictionary for the Phase I LP: Basic variables on the right-hand-side!! Step 6: write the new objective in terms of nonbasic variables.

Example: Two-Phase (cont’d)

Example: Two-Phase (cont’d)

Example: Two-Phase (cont’d) Step 7: solve the Phase I LP. Entering Variable? (Remember: we’re

Example: Two-Phase (cont’d) Step 7: solve the Phase I LP. Entering Variable? (Remember: we’re minimizing!) Leaving Variable?

Example: Two-Phase (cont’d) Step 7: solve the Phase I LP. Entering Variable? Leaving Variable?

Example: Two-Phase (cont’d) Step 7: solve the Phase I LP. Entering Variable? Leaving Variable? Tie!! Either is a valid choice for leaving variable.

Word of Advice…. . If there is a tie for leaving variable, always choose

Word of Advice…. . If there is a tie for leaving variable, always choose an artificial variable over another variable. n If there is more than one candidate for entering variable, avoid choosing an artifical variable. n The goal is to make all artifical variables zero, which can be achieved by making them nonbasic!!! n

Example: Two-Phase (cont’d) New dictionary:

Example: Two-Phase (cont’d) New dictionary:

Example: Two-Phase (cont’d) X X X X This dictionary represents a bfs in which

Example: Two-Phase (cont’d) X X X X This dictionary represents a bfs in which all artificial variables are nonbasic. Since both artificial variables equal zero, we can delete them from the dictionary without destroying our current solution.

Remember n Phase I is concerned only with feasibility, not optimality. n The primary

Remember n Phase I is concerned only with feasibility, not optimality. n The primary aim of Phase I is to obtain a bfs with which to start simplex. Notice that we essentially solve an LP (using simplex!) to find this bfs.

Example: Two-Phase (cont’d) Now that we have eliminated the artificial variables, we can go

Example: Two-Phase (cont’d) Now that we have eliminated the artificial variables, we can go back to our original objective, which is to maximize z!! Step 8: replace the original objective, in terms of nonbasic variables. This creates the Phase II LP. Basic variables on the right-handside!!

Example: Two-Phase (cont’d) Step 9: Optimize the Phase II LP. Since we are maximizing

Example: Two-Phase (cont’d) Step 9: Optimize the Phase II LP. Since we are maximizing z, this dictionary/bfs is optimal!! If it weren’t optimal, we could continue with simplex as usual.

One more possibility…. n What if the Phase I LP is degenerate? That is,

One more possibility…. n What if the Phase I LP is degenerate? That is, what if we reach optimality (so that all artificial variables are zero), but one of the artificial variables is basic? n Proceed with the Phase II LP, eliminating all nonbasic artificial variables. As soon as any of the remaining artificial variables becomes nonbasic, delete it.

Recap Step 1: make all right-hand-side values nonnegative. Step 2: put the LP in

Recap Step 1: make all right-hand-side values nonnegative. Step 2: put the LP in standard form. Step 3: add an artificial variable to each row without a slack. Step 4: write the initial dictionary, using slack and artificial variables as basic variables. Step 5: replace the objective with minimizing the sum of all artificial variables (call it “w” to keep it separate from the original objective).

Recap Step 6: write the new objective in terms of nonbasic variables. Step 7:

Recap Step 6: write the new objective in terms of nonbasic variables. Step 7: solve the Phase I LP. If w > 0, the original LP is infeasible. Step 8: replace the original objective, in terms of nonbasic variables. Delete all nonbasic artificial variables. This creates the Phase II LP. Step 9: Optimize the Phase II LP. As artificial variables become nonbasic, delete them.

Recap n Three outcomes when solving Phase I LP: – – Minimum w >

Recap n Three outcomes when solving Phase I LP: – – Minimum w > 0: LP infeasible Mimimum w = 0, all artificial variables nonbasic: • • • – replace objective delete artificial variables continue with Phase II Minimum w = 0, some artificial variable basic (and equal to zero): • • replace objective delete nonbasic artificial variables continue with Phase II delete each artificial variable as it becomes nonbasic.