Sie sind auf Seite 1von 41

Lesson 31 (KH, Section 11.

2) The Simplex Method


Math 20

December 5, 2007

Announcements
Pset 11 due December 10. Pset 12 due December 17. ML OH: Today 13 (SC 323) SS OH: Tonight 8:309:30 in Quincy dining hall HW coming Midterm II review slides online Midterm II: tomorrow 78:30pm in Hall A

Outline
Setup Illustrative Problem Slack Variables The Simplex Method, By Example The Initial Basic Feasible Solution Creating a New Tableau Recap of Steps Example

Setup
A standard linear programming problem is to maximize the quantity c1 x1 + c2 x2 + . . . cn xn = c x subject to constraints a11 x1 + a12 x2 +. . .+ a1n xn b1 a21 x1 + a22 x2 +. . .+ a2n xn b2 ... am1 x1 +am2 x2 +. . .+amn xn bm

or Ax b. We usually include the nonnegativity constraint x 0. Today we will also assume b 0.

Any vector x which saties all the inequalities is called a feasible solution to the given problem, and a feasible solution maximizing the objective function is called an optimal solution.

Outline
Setup Illustrative Problem Slack Variables The Simplex Method, By Example The Initial Basic Feasible Solution Creating a New Tableau Recap of Steps Example

Illustrative Problem

We will use the baker of before. He is trying to maximize z = 8x + 10y subject to the constraints 2x+ y 50 x+ 2y 70 x 0 y 0.

Slack Variables
We can turn the inequalities into equalities by inserting new variables, which are called slack variables. Thus the rst equation of constraint becomes 2x + y 50 = 2x + y + u = 50, and the second x + 2y 70 = x + 2y + v = 70. But u and v are nonnegative. So the new problem is to maximize 8x + 10y subject to constraints 2x+ y +u x+2y x 0 y 0 =50 +v =70 u0 v 0

In general, we insert slack variables u1 , u2 , . . . , um and the equations of constraint become Ax + u = b, along with x 0, u 0.

Denition
The vector x in Rn+m is called a basic solution if its obtained by setting n of the variables in this equation equal to zero and solving for the remaining n variables. The m variables are we solve for are called the basic variables, and the n variables set equal to zero are called the nonbasic variables. The vector x is called a basic feasible solution if it is a basic solution that also satises the inequalities x 0.

Why are basic feasible solutions necessary?

Theorem
If a LP problem has an optimal solution, then it has a basic optimal solution. This is just a restatement of the corner principle. So we only need to nd the basic feasible solutions!

Back to the Baker


y 50 40 30 20 10 (0, 0) 10 20 (0, 50)

(0, 35) (10, 30)

x+

2x +y =5 0

2y

=7

(25, 0) 30 40 50

(70, 0) 60 70 x

Back to the Baker


y 50 40 30 20 10 (0, 0) 10 20 not feasible (0, 35) (10, 30)

v= 0

u= 0
30

(25, 0) 40 50

not feasible 60 70 x

How many basic feasible solutions are there? Out of the m + n variables, we choose n to set equal to zero, and solve for the rest. This can be done n+m (n + m)! = m! n! m ways. Thats a lot! The simplex method is a way to arrive at an optimal solution by traversing the vertices of the feasible set, in each step increasing the objective function by as much as possible.

Outline
Setup Illustrative Problem Slack Variables The Simplex Method, By Example The Initial Basic Feasible Solution Creating a New Tableau Recap of Steps Example

Well work with the illustrative problem. We can start with the basic feasible solution x = 0, y = 0. Thus u = 50 and v = 70. This is our initial basic solution. Well start writing everything in a table (or tableau), so lets also write the objective function with a right-hand side of zero. Thus 8x 10y + z = 0. We put this all together, forming what is called the initial tableau: x y u 2 1 v 1 2 z 8 10 u 1 0 0 v 0 1 0 z 0 0 1 value 50 70 0

x y u 2 1 v 1 2 z 8 10

u 1 0 0

v 0 1 0

z 0 0 1

value 50 70 0

Is the solution u = 50, v = 70 (i.e., x = 0, y = 0 optimal?)

x y u 2 1 v 1 2 z 8 10

u 1 0 0

v 0 1 0

z 0 0 1

value 50 70 0

Is the solution u = 50, v = 70 (i.e., x = 0, y = 0 optimal?) No, increasing x or y would increase z.

x y u 2 1 v 1 2 z 8 10

u 1 0 0

v 0 1 0

z 0 0 1

value 50 70 0

Is the solution u = 50, v = 70 (i.e., x = 0, y = 0 optimal?) No, increasing x or y would increase z.

Optimality Criterion
If the objective row of a tableau has no negative entries in the columns labeled with variables, then the indicated solution is optimal and we can stop our computation.

x y u 2 1 v 1 2 z 8 10

u 1 0 0

v 0 1 0

z 0 0 1

value 50 70 0

Move from one basic solution to another One of the zero (nonbasic) variables becomes nonzero and one of nonzero (basic) variables becomes zero Do this as eciently as possible

x y u 2 1 v 1 2 z 8 10

u 1 0 0

v 0 1 0

z 0 0 1

value 50 70 0

Move from one basic solution to another One of the zero (nonbasic) variables becomes nonzero and one of nonzero (basic) variables becomes zero Do this as eciently as possible Which of x or y would you most like to increase?

x y u 2 1 v 1 2 z 8 10

u 1 0 0

v 0 1 0

z 0 0 1

value 50 70 0

Move from one basic solution to another One of the zero (nonbasic) variables becomes nonzero and one of nonzero (basic) variables becomes zero Do this as eciently as possible Which of x or y would you most like to increase? An increase of 1 in y gives an increase of 10 in z. Lets make y > 0. y enters the set of basic variables, so its called the entering variable for this step.

How much can we increase y ? Well, since x is still zero, the equations of constraint can be written u = 50 y v = 70 2y

How much can we increase y ? Well, since x is still zero, the equations of constraint can be written u = 50 y v = 70 2y We still need u 0 and v 0, so the most we can increase y is to 35. This is the smallest of the ratios 50 = 50 and 70 = 35. So 1 2 were going to increase y to 35. This will make v = 0. We call v the departing variable.

How much can we increase y ? Well, since x is still zero, the equations of constraint can be written u = 50 y v = 70 2y We still need u 0 and v 0, so the most we can increase y is to 35. This is the smallest of the ratios 50 = 50 and 70 = 35. So 1 2 were going to increase y to 35. This will make v = 0. We call v the departing variable. The new basic solution therefore has y = 35, v = 0, u = 15, and x = 0. The new value of the objective function is z = 10y = 350.

Creating a New Tableau


We are exchanging the basic variable v for y . This means the objective row has to be replaced with one that has a zero in the y columns. We can do this by adding multiples of row 2. Since y is an entering variable, we might as well normalize row 2 to have a one. So we scale the second row to have a one in the y column.

x y u 2 1 v 1 2 z 8 10

u 1 0 0

v 0 1 0

z 0 0 1

value 50 70 0

Creating a New Tableau


Now we zero out the rest of this column by adding 10 times row 2 to row 3, and subtracting row 2 from row 1.

x y 2 1 1/2 1 8 10

u 1 0 0

v 0 1/2 0

z 0 0 1

value 50 35 0

Creating a New Tableau


The new tableau. By looking at the columns, we see y and u are the basic variables. The value of the objective function has also changed.

x u 3/2 y 1/2 z 3

y 0 1 0

u v 1 1/2 1/2 0 0 5

z 0 0 1

value 15 35 350

Rinse, Lather, Repeat


The x column in the objective row has a negative entry, so increasing x will increase z.

y u 0 y 1/2 1 z 3 0
3/2

u v 1/2 1 1/2 0 0 5

z 0 0 1

value 15 35 350

Rinse, Lather, Repeat


The x column in the objective row has a negative entry, so increasing x will increase z. How much can we increase it?

y u 0 y 1/2 1 z 3 0
3/2

u v 1/2 1 1/2 0 0 5

z 0 0 1

value 15 35 350

Rinse, Lather, Repeat


The x column in the objective row has a negative entry, so increasing x will increase z. How much can we increase it? The minimum of 35 15 the two ratios 3/2 = 10 and 1/2 = 70.

y u 0 y 1/2 1 z 3 0
3/2

u v 1/2 1 1/2 0 0 5

z 0 0 1

value 15 35 350

Rinse, Lather, Repeat


The x column in the objective row has a negative entry, so increasing x will increase z. How much can we increase it? The minimum 35 15 of the two ratios 3/2 = 10 and 1/2 = 70. So x in the entering variable and u is the departing variable.

u y z

x 3/2 1/2 3

y 0 1 0

u v 1/2 1 1/2 0 0 5

z 0 0 1

value 15 35 350

Rinse, Lather, Repeat


The x column in the objective row has a negative entry, so increasing x will increase z. How much can we increase it? The minimum 35 15 of the two ratios 3/2 = 10 and 1/2 = 70. So x in the entering variable and u is the departing variable. We scale row one by 2/3 to make it one in the basic column.

y u 0 y 1/2 1 z 3 0
3/2

u v 1/2 1 1/2 0 0 5

z 0 0 1

value 15 35 350

Rinse, Lather, Repeat


The x column in the objective row has a negative entry, so increasing x will increase z. How much can we increase it? The minimum 35 15 of the two ratios 3/2 = 10 and 1/2 = 70. So x in the entering variable and u is the departing variable. We scale row one by 2/3 to make it one in the basic column. And we zero out the rest of the column by subtracting half of row 1 from row 2, and adding 3 times row 1 to row 3.

u y

x 1 1/2 3

y 0 1 0

u
2/3

1/3

0 0

z 0 1/2 0 5 1

value 10 35 350

Rinse, Lather, Repeat


The x column in the objective row has a negative entry, so increasing x will increase z. How much can we increase it? The minimum 35 15 of the two ratios 3/2 = 10 and 1/2 = 70. So x in the entering variable and u is the departing variable. We scale row one by 2/3 to make it one in the basic column. And we zero out the rest of the column by subtracting half of row 1 from row 2, and adding 3 times row 1 to row 3.

u y

x 1 1/2 3

y 0 1 0

u
2/3

1/3

0 0

z 0 1/2 0 5 1

value 10 35 350

Rinse, Lather, Repeat


The x column in the objective row has a negative entry, so increasing x will increase z. How much can we increase it? The minimum 35 15 of the two ratios 3/2 = 10 and 1/2 = 70. So x in the entering variable and u is the departing variable. We scale row one by 2/3 to make it one in the basic column. And we zero out the rest of the column by subtracting half of row 1 from row 2, and adding 3 times row 1 to row 3.

x y

x 1 0 0

y u v 2/3 1/3 0 2/3 1 1/3 0 2 4

z 0 0 1

value 10 30 380

x y

x 1 0 0

y u v 2/3 1/3 0 2/3 1 1/3 0 2 4

z 0 0 1

value 10 30 380

Now any increase in the decision variables or slack variables would result in a decrease of z. We are done!

Outline
Setup Illustrative Problem Slack Variables The Simplex Method, By Example The Initial Basic Feasible Solution Creating a New Tableau Recap of Steps Example

Recap of Steps
1. Set up the initial tableau. 2. Apply the optimality test. If the objective row has no negative entries in the columns labeled with variables, then the indicated solution is optimal; we can stop. 3. Choose a pivotal column by determining the column with the most negative entry in the objective row. If there are several candidates for a pivotal column, choose any one. 4. Choose a pivotal row. Form the ratios of the entries above the objective row in the rightmost column by the corresponding entries of the pivotal column for those entries in the pivotal column which are positive. The pivotal row is the row for which the smallest of these ratios occurs. If there is a tie, choose any one of the qualifying rows. If none of the entries in the pivotal column above the objective row is positive, the problem has no nite optimum. We stop. 5. Perform pivotal elimination to construct a new tableau and return to Step 2.

Outline
Setup Illustrative Problem Slack Variables The Simplex Method, By Example The Initial Basic Feasible Solution Creating a New Tableau Recap of Steps Example

Another Example
Example
Maximize z = 3x1 x2 + 6x3 subject to the constraints 2x1 +4x2 + x3 4 2x1 +2x2 3x3 4 2x1 + x2 x3 8 x1 0 x2 0 x3 0. Negating row two puts this problem into standard form.

Another Example
Example
Maximize z = 3x1 x2 + 6x3 subject to the constraints 2x1 +4x2 + x3 4 2x1 +2x2 3x3 4 2x1 + x2 x3 8 x1 0 x2 0 x3 0. Negating row two puts this problem into standard form.

Answer.
x1 = 0, x2 = 4/7, x3 = 12/7, z = 687.

We insert slack variables u1 , u2 , and u3 . The equations of constraint become 2x1 +4x2 + x3 +u1 2x1 2x2 +3x3 2x1 + x2 x3 +u2 4 4 +u3 8

with all variables nonnegative.

Das könnte Ihnen auch gefallen