0% found this document useful (0 votes)
33 views62 pages

15.053 February 22, 2007: Introduction To The Simplex Algorithm

The document provides an introduction to the simplex algorithm for linear programming. It begins with an overview of the simplex method and how it moves from corner point to corner point to find an optimal solution. It then discusses getting a linear program into standard form with equality and non-negativity constraints. The goals of the lecture are outlined as explaining how to recognize optimality and unboundedness, and how to move to the next corner point. Finally, it provides examples of linear programs and their corresponding simplex tableaus.

Uploaded by

Ehsan Spencer
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views62 pages

15.053 February 22, 2007: Introduction To The Simplex Algorithm

The document provides an introduction to the simplex algorithm for linear programming. It begins with an overview of the simplex method and how it moves from corner point to corner point to find an optimal solution. It then discusses getting a linear program into standard form with equality and non-negativity constraints. The goals of the lecture are outlined as explaining how to recognize optimality and unboundedness, and how to move to the next corner point. Finally, it provides examples of linear programs and their corresponding simplex tableaus.

Uploaded by

Ehsan Spencer
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 62

15.

053
z

February 22, 2007

Introduction to the Simplex Algorithm

Quotes for today


Give a man a fish and you feed him for a day. Teach him how to fish and you feed him for a lifetime. -- Lao Tzu

Give a man a fish dinner, and he will forget it by next week. Let a person catch the fish for himself, and hell remember it for a lifetime. -- Jim Orlin

Preview of the Simplex Method


Maximize z = 3 K + 5 S

S
5 4 3 2 1

Start at any feasible corner point. Move to an adjacent corner point with better objective value. Continue until no adjacent corner point has a better objective value.

This is a picture of the simplex algorithm in inequality form. In this form, the simplex algorithm moves from corner point to corner point. And each corner point is the intersection of two constraints. When we move to equality form, the simplex algorithm still moves from corner point to corner point. And the corner points are still found by solving a system of equations. So, there are many similarities.

The simplex algorithm (for max problems)


Start with a feasible corner point solution

find an improved corner point solution

Is it optimal?

Yes

quit with optimal solution

No

No
Is the optimum unbounded from above?

Yes

quit with proof of unboundedness


4

As you can see, this is a fairly simple structure. At the same time, it may be difficult to keep everything in ones head at the same time. That is where the two dimensional example can help out. We will assume that we start with a feasible corner point solution. That immediately raises two questions. What does a corner point solution look like? And how do you find a corner point solution to start with? Both of these issues will be addressed shortly. The next slides deal with something even more preliminary. We will be assuming that we start with a linear program with equality constraints and non-negativity constraints, and nothing else. So we need to get each linear program into the correct starting form. We will show how to do that on the next few slides.

Goals for this lecture


Major Issues of the Simplex Algorithm How does one get the LP into the correct starting form? How does one recognize optimality and unboundedness? How does one move to the next corner point solution?

1.

2.

3.

Note: we will derive the simplex algorithm in class!


5

Linear Programs in Standard Form


We say that a linear program is in standard form if the following are all true: 1. Non-negativity constraints for all variables. 2. All remaining constraints are expressed as equality constraints. 3. The right hand side vector, b, is non-negative.

An LP not in Standard Form


maximize z = 3x1 + 2x2 - x3 + x4 x1 + 2x2 + x3 - x4 5 ; -2x1 - 4x2 + x3 + x4 -1; x1 0, x2 0 not equality not equality

x3 and x4 may be negative


6

Excel Solver does not require that you write an LP in standard form because it will immediately transform it to standard form via software. We show next what linear programming solvers do with an LP that does not start in standard form.

Converting Inequalities into Equalities Plus Non-negatives


Before
x1 + 2x2 + x3 - x4 5

After

x1 + 2x2 + x3 - x4 +s1 = 5
s1 0

s1 is called a slack variable, which measures the amount of unused resource. Note that s1 = 5 - x1 - 2x2 - x3 + x4. To convert a constraint to an equality, add a slack variable.
7

So, we transform a constraint by 1. adding a slack variable 2. requiring that the slack variable is non-negative.

Converting RHS and


z z

constraints

Consider the inequality -2x1 - 4x2 + x3 + x4 -1; Step 1. Eliminate the negative RHS. Multiply by -1. 2x1 + 4x2 - x3 - x4 1 Step 2. Convert to an equality 2x1 + 4x2 - x3 - x4 s2 = 1 s2 0

The variable added will be called a surplus variable. To convert a constraint to an equality, subtract a surplus variable.
8

We get rid of negative right hand sides by multiplying through by -1. We transform a constraint by 1. adding a surplus variable 2. requiring that the slack variable is non-negative. To be honest, I sometimes confuse the names slack and surplus because they are serving the exact same function, converting an inequality constraint to an equality constraint. They have different names because of their interpretations in practice. Often a constraint will model a case in which we have limited resources, and the slack represents the amount left over. Often a constraint will model a case in which we have to produce at least a specified amount. If we produce more than we need, we are said to have produced a surplus.

Converting Max to Min and Min to Max

Converting Max to Min: multiply objective by -1 Example: Minimize z = 3x1 + 2x2 subject to constraints

Has the same optimum solution(s) as Maximize v = -3x1 - 2x2 subject to constraints

Minimizing z is equivalent mathematically to maximizing z. Interestingly, practitioners often have a very strong preference. If you tell a practitioner that you are maximizing the negative of the cost, it will sound very confusing, unless you convert it somehow to maximizing profit. But mathematically, there is no important distinction.

Other transformations
See tutorial on transformations.

Why standard form?


The simplex method is designed for problems with equality constraints and non-negativity constraints.

10

The tutorial covers situations in which a variable x does not start with the constraint x 0. It is possible that in a model, some variables are constrained to be nonpositive, and possibly other variables have no constraint on sign at all. In all of these cases, the LP solver will first create an equivalent program in which all variables are constrained to be non-negative.

Review: solving a system of Equations


2x1 + 2x2 + x3 = = = 9 6 5 RHS = = = 9 6 5
11

2x1 - x2 + 2x3 x1 - x2 + 2x3 x1 Equation 1 Equation 2 Equation 3 2 2 1 x2 2 -1 -1 x3 1 2 2

The set of equations with the xs written in the top row is called a tableau. We will use tableaus to illustrate the simplex algorithm.

Equation 1 Equation 2 Equation 3

x1 2 1 2 0 1 0

x2 2 1 -1 -3 -1 -2 1 0 0

x3 1 1/2 12 2 3/2

= = = = =

RHS 9 9/2 -36 5 1/2

We want column 1 to be

Divide through equation 1 by 2. Subtract two times equation 1 from equation 2. Subtract equation 1 from equation 3.
12

For more information on solving systems of equations, see the tutorial on the website.

Equation 1 Equation 2 Equation 3

x1 1 0 0

x2 0 1 1 -3 0 -2 0 1 0

x3 5/6 1/2 -1/3 1 5/6 3/2

= = = = =

RHS 7/2 9/2 1 -3 5/2 1/2

We want column 2 to be

Divide through equation 2 by -3. Subtract equation 2 from equation 1. Add two times equation 2 to equation 3.
13

Equation 1 Equation 2 Equation 3

x1 1 0 0

x2 0 1 0 0 0 1

x3 5/6 0 -1/3 0 5/6 1

== == ==

RHS 7/2 1 1 2 5/2 3

We want column 3 to be

Divide through equation 3 by 5/6. Subtract equation 3 from equation 1. Add 1/3 times equation 3 to equation 2.
14

Equation 1 Equation 2 Equation 3

x1 1 0 0

x2 0 1 0

x3 5/6 0 -1/3 0 5/6 1

== == ==

RHS 7/2 1 1 2 5/2 3

Resulting equations

x1 = 1, x2 = 2, x3 = 3.

The solution is now obvious. The system of equations is in a very special form.

15

At the end, each column for a variable has a single 1 and two 0s. The equations themselves are the same as the solution.

1. Start with a feasible corner point solution


z

Start with a tableau in canonical form LP has equality constraints and non-negativity constraints. There is one basic variable for each equality constraint. The column for the basic variable for constraint j has a 1 in constraint j and 0s elsewhere. The remaining variables are called non-basic.

16

Standard form does not necessarily give a corner point solution. But standard form is a good place to get started. For a corner point solution,

A Tableau in canonical form.

z 1 0 0 0 x1 0 0 0 1 x2 2 2 -1 6 x3 0 1 0 0 x4 0 0 1 0 x5 1 -1 2 3 = = = = 2 4 1 3

The non-basic variablesxare 3 for There is one basic variable, 2and 4 5 LP has equality constraints and xx. . basic variables are 1, x x and z is consideredconstraints. variable. each equality constraint. non-negativity to bethat has one 1 They have a column a basic and all other components are 0

17

If we got rid of the non-basic variables (as in erasing the columns for x2 and x5), then the resulting equations would be the same as the solution. That is, the equations would be x3 = 4, x4 = 1, x1 = 3. In reality, we dont erase the columns. We just set the non-basic variables to 0, which is mathematically equivalent.

The basic feasible solution or bfs


The basic variables are x1, x3, x4, and z The non-basic variables are x2, x5 z Set the non-basic variables to 0 1 0 0 0 x1 0 0 0 1 x2 2 2 -1 6 x3 0 1 0 0 x4 0 0 1 0 x5 1 -1 2 3 = = = 2 4 1 3

The basic feasible solution (bfs) is: x2 = x5 = 0; x1 = 3, x3 = 4, x4 = 1, z = 2

18

We will use the term basic feasible solution or bfs throughout the rest of the semester. Every bfs is also a corner point solution, in that it is not the midpoint of a line segment joining two other solutions. The simplex method will move from corner point to corner point along edges.

When is a basic feasible solution (bfs) optimal?


Together we will derive the optimality conditions An example maximize subject to z = -2x2 x5 + 2 x1 = 3, x3 = 4 ,x4 = 1 x1, x2, x3, x4, x5 0 What is an optimal solution for this problem?
19

The first example is an LP in which 1. The objective function only has terms for the nonbasic variables. 2. The coefficients of the variables in the objective function are nonpositive and only involve the nonbasic variables. 3. The only constraints on the non-basic variables are nonnegativity constraints. So, all one needs to do is to set x2 and x5 optimally, which in this case sets them both to 0.

A second example maximize subject to z = -2x2 x5 + 2 x1 = 3 6x2 3x5 x3 = 4 2x2 + x5 x4 = 1 + x2 2x5 x1, x2, x3, x4, x5 0 What is an optimal solution for this problem?

20

The second example is an LP in which 1. The objective function only has terms for the nonbasic variables. 2. The coefficients of the variables in the objective function are nonpositive and only involve the nonbasic variables. 3. Setting the nonbasic variables to 0 gives a feasible solution. In this case, setting the nonbasic variables to 0 gives a feasible solution with z = 2. And any other solution has x2 0 and x5 0, and thus z 2. So, the solution with the nonbasic variables set to 0 must be optimal. So, all one needs to do is to set x2 and x5 optimally, which in this case sets them both to 0.

When are sufficient conditions for a solution to be optimal?


maximize subject to z = -2x2 x5 + 2 x1 = 3 6x2 3x5 x3 = 4 2x2 + x5 x4 = 1 + x2 2x5 x1, x2, x3, x4, x5 0 A solution x1, x2, x3, x4, x5 is guaranteed to be optimal for an LP with non-negativity constraints whenever ..

21

The objective function has the following properties: 1. The coefficients of the nonbasic variables are nonpositive 2. The coefficients of the basic variables are 0. And the feasible solution x is obtained by setting the nonbasic variables to 0.

Recognizing an Optimal bfs: Tableau Version


The basic feasible solution (bfs) is: x2 = x5 = 0; x1 = 3, x3 = 4, x4 = 1, z = 2 z 1 0 0 0 maximize x1 0 0 0 1 x2 2 2 -1 6 x3 0 1 0 0 x4 0 0 1 0 x5 1 -1 2 3 x0
22

It is optimal!

= = = =

2 4 1 3

z = -2x2 x5 + 2 s.t.

The opt solution is z = 2.


In the tableau form, the objective is written as z + 2x2 + x5 = 2.

Optimality conditions for a bfs in tableau form: the coefficients in the z-row nonnegative for the nonbasic variables. Note that tableaus that correspond to bfss already have the following properties: 1. The coefficients of the basic variables in the objective function are 0 2. There is a feasible solution obtained by setting the nonbasic variables to 0. Thus the optimality condition stated above for a bfs in tableau form are the same as from the previous slides.

Optimality Conditions
z 1 0 0 0 x1 0 0 0 1 x2 2 2 -1 6 x3 0 1 0 0 x4 0 0 1 0 x5 1 -1 2 3 = = = = 2 4 1 3 Important Fact. If there is no negative coefficient in the z row, the basic feasible solution is optimal!

maximize

z = -2x2 x5 + 2
23

Is the optimum unbounded from above?

An example maximize subject to z = -2x2 + x5 + 2

Together we will derive the conditions for unboundedness.

x1 = 3, x3 = 4 , x4 = 1 x1, x2, x3, x4, x5 0

What is an optimal solution for this problem?

24

The objective function (for a max problem) in this example satisfies the following conditions: 1. The coefficients of the basic variables in the objective are 0 2. There is a positive coefficient in the objective for a nonbasic variable 3. The only constraints on the nonbasic variables are nonnegativity constraints. In this case, we can get a sequence of increasingly better solutions by making x5 increasingly larger.

A second example maximize subject to z = -2x2 + x5 + 2 x1 = 3 6x2 + 3x5 x3 = 4 2x2 + x5 x4 = 1 + x2 + 2x5 x1, x2, x3, x4, x5 0 What is an optimal solution for this problem?

25

The objective function (for a max problem) in this example satisfies the following conditions: 1. The coefficients of the basic variables in the objective are 0 2. There is a positive coefficient in the objective for the nonbasic variable x5. 3. For any fixed choice of x5 > 0, there is a feasible solution in which the only positive variables are x5 and the current basic variables. In this case, we can get a sequence of increasingly better solutions by making x5 increasingly larger.

Directions of Unboundedness maximize subject to z = -2x2 + x5 + 2 x1 = 3 6x2 + 3x5 x3 = 4 2x2 + x5 x4 = 1 + x2 + 2x5 x1, x2, x3, x4, x5 0 Let x5 = . Let x2 = 0. Assume that 0 Then x1 = 3 + 3 x3 = 4 + x4 = 1 + 2 z =
Direction of unboundedness

3 3 0 0 x = 4 + 1 1 2 0 1

26

When the solution is unbounded from above, we often keep track of the sequence of solutions whose objective is unbounded from above. This can be done very efficiently by storing a feasible x solution and a direction of unboundedness y. Then for every value of , the solution x + y is feasible. As gets increasingly larger, the objective for x + y gets increasingly larger, and approaches infinity in the limit.

More on Directions of Unboundedness


A vector y is called a direction of unboundedness for a maximization problem if 1. For all feasible solutions x and all positive numbers , the vector x + y is feasible. 2. The objective value for y is positive.

Fact: an LP is unbounded from above if and only if there is a feasible solution and there is also a direction of unboundedness.

27

The property of direction of unboundedness is true for linear programs, but is not true for non-linear programs. For example, one could imagine a feasible region in two dimensions that is a spiral, and that the objective goes to infinity as one moves along the spiral. But there is no direction of unboundedness as defined on the slide.

Unboundedness: Tableau Version

z 1 0 0 0 x1 0 0 0 1 x2 2 2 -1 6 x3 0 1 0 0 x4 0 0 1 0 x5 -1 -1 -2 -3
= = = =

2 4 1 3

A maximization LP is unbounded from above if there is a bfs and a non-basic variable xs such that 1. The coefficient for xs is the z-row is negative, and 2. All coefficients in the column for xs are 0.
In the tableau form, the objective is written as z + 2x2 - x5 = 2. Unboundedness conditions when given a bfs in tableau form for a max problem: there is a negative coefficient in the z-row for some nonbasic variable xs. The column in the tableau for xs is nonpositive. For any specified value of xs, one can adjust the values of the current basic variables to provide a feasible solution. One shows that the objective value is unbounded from above by letting xs approach infinity.
28

Is it optimal?

No

Is the optimum unbounded from above?

No

find an improved corner point solution

An example maximize subject to z = -2x2 + x5 + 2 x1 = 3 6x2 - 1x5 x3 = 4 2x2 2x5 x4 = 1 + x2 + 2x5 x1, x2, x3, x4, x5 0

Together we will figure out how to get improved solutions. Can you find one or two solutions that are better than the bfs?
29

The basic feasible solution (bfs) is: x2 = x5 = 0; x1 = 3, x3 = 4, x4 = 1, z = 2

In this example, one of the basic variables x5 has a positive coefficient in the objective function. But the unboundedness conditions are not satisfied. If we make x5 a little larger than 0, we can adjust the current basic variables to give a feasible solution and this feasible solution will have a larger objective value than the current bfs. The larger that x5 is, the larger will be the objective value. So, we want to make x5 as large as possible so long as the other basic variables remain non-negative.

Finding improved solutions


max z = -2x2 + x5 + 2 st x1 = 3 6x2 - 1x5 x3 = 4 2x2 2x5 x4 = 1 + x2 + 2x5 x1, x2, x3, x4, x5 0

30

We copied the equations so that there would be space to write the improved solutions.

Improving Solutions: Tableau Version


z 1 0 0 0 x1 0 0 0 1 x2 2 2 -1 6 x3 0 1 0 0 x4 0 0 1 0 x5 -1 2 -2 1
= = = =

2 4 1 3

=+ z + 2x2 2x5 = 0 x1 = 3 - 1 x2 = 0 x3 = 4 2 x4 = 1 + 2 x5 =

Find a non-basic variable with a negative coefficient in the z-row. Set that variable to , and keep all other nonbasic variables at 0.

Choose maximum

31

We could look for improved solutions by just guessing the value of x5. But to do it systematically, we set it to . As you can see, I am fond of using as a parameter. Once we set it to , we can see how the current basic variables vary as a linear function of . We then choose as high as possible so that all of the current basic variables are nonnegative. In this case, we can let be as large as 2. If it were any larger, than x3 would be negative.

Mira and Marnies M&M Adventure


Mira and Marnie, two MIT undergraduates known as the M&M sisters, recently received a gift from their parents of 2000 pounds of gray M&Ms and 6000 pounds of red M&Ms, the MIT colors. So, they decided to go into business selling large bags of MIT M&Ms for frat parties. They can sell a bag with 3 pounds of red M&Ms and 2 pounds of gray M&Ms for $20. They can purchase bags of 3 pounds of red M&Ms and 4 pounds of gray M&Ms for $30. How many bags should Mira & Marnie buy and sell to maximize their profit.
32

M&Ms really can be bought in very large packages with quantity discounts, and you can choose the colors. You can even have custom printing (e.g., I love 15.053). See http://www.mymms.com for more details.

Formulation as a linear program


z

Let x1 be the number of 7 pound bags purchased (in thousands) Let x2 be the number of 5 pound bags sold (in thousands) Measure the profit in $10,000s.

33

A 2-variable LP

maximize subject to z= -3x1 + 2x2 -3x1 + 3x2 -4x1 + 2x2 x1 0, x2 0 -3x1 + 2x2 -3x1 + 3x2 +x3 + x4 -4x1 + 2x2 x1, x2, x3, x4 x1 3 -3 -4 x2 -2 3 2 x3 0 1 0 x4 0 0 1
= = =

6 2

maximize subject to

z=

=6 =2 0

z 1 0 0

0 6 2
34

We first add slack variables x3 and x4.


We then express the equations in tableau form.
Note that the initial tableau is in canonical form, and there is a corresponding bfs.

The two dimensional geometry


-3x1 + 3x2 + x3 = 6 -4x1 + 2x2 + x4 = 2

4 3
number sold

2 1

2 3 4 number bought

35

For this particular LP, the feasible region is unbounded, but there will be an optimal solution.

The two dimensional geometry


-3x1 + 3x2 + x3 = 6 -4x1 + 2x2 + x4 = 2 -3x1 + 2x2 = -5

4 3 2 1

4
36

The optimal solution will be x1 = 1 and x2 = 3. The slack variables will both be 0.

LP canonical form
The initial tableau is already in canonical form.

z 1 0 0

x1 3 -3 -4

x2 -2 3 2

x3 0 1 0

x4 0 0 1
= = =

0 6 2

The basic variables are z, x3 and x4. The non-basic variables are x1 and x2. The basic feasible solution (bfs) for this basis is z = 0, x1 = 0, x2 = 0, x3 = 6, x4 = 2
37

LP Canonical Form and the bfs.


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

0 6 2

The text treats z as a basic variable.

The simplex method starts with a tableau in LP canonical form (or it creates canonical form at a preprocess step.) The first solution is the bfs for that tableau.
38

We will discuss next lecture what to do if there is no obvious way of getting a tableau in canonical form.

For each constraint there is a basic variable


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

0 6 2

Objective function. Constraint 1 Constraint 2 bfs x1 = 0; x2 = 0; x3 = 6; x4 = 2; z=0


39

One basic variable is z Constraint 1: basic variable is x3 Constraint 2: basic variable is x4

The simplex algorithm (for max problems)


Start with a feasible corner point solution

Is it optimal?

Yes

No We were lucky to be able to start with a feasible bfs. We now move on to the rest of the algorithm. Next lecture: how to find a starting bfs
40

On the Optimality Conditions


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

0 6 2 If x1 = 0, and x2 = 1, then z = 2.

The cost-coefficient of x2 is -2. z + 3x1 - 2x2 = 0

The current bfs can be improved if we can increase x2 and hold x1 at 0.


z + 3x1 -2x2 = 0.

41

We can find a better solution by increasing x2 above 0 and adjusting the current basic variables to get a feasible solution.

z 1 0 0

x1 -3 3 -3 -4

x2 -2 2 3 2

x3 0 1 0

x4 0 0 1 = = = 0 6 2 If increasing x2 improves the objective function, lets make it as large as we can!

But wont we lose feasibility if we increase x2?


Tim, the turkey Cleaver, and MIT Beaver 42

Cleaver and Tim come right to the key issues.

The Simplex Pivot


z 1 0 0 x1 -3 3 -3 -4 -4 x2 -2 2 3 2 x3 0 1 0 x4 0 0 1 = = = 0 6 2 The way to do it is to increase x2 while simultaneously modifying basic variables to maintain feasibility, Its simple, but very clever.

Cleaver 43

I like Cleavers enthusiasm for this material.

But how do we know how much we can increase x2 by?

We dont know. So, well set x2 to be some unknown parameter . Well figure out the other variables in terms of . And then well make as large as we can.

Tim

Cleaver

44

Tim is always asking good questions, even if he doesnt know many of the answers.

The current basic feasible solution (bfs) is not optimal! x =


2

z 1 0 0

x1 -3 3 -3 -4

x2 -2 2 3 2

x3 0 1 0

x4 0 0 1
= = =

0 6 2

x1 = 0, because we dont change any other nonbasic variable. z = 2 . x3 = 6 - 3 . x4 = 2 - 2 .

Choose as large as it can be so that all variables remain non-negative. That is, the solution stays feasible. =1

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

45

Can you show me a picture of this. Im having trouble seeing what is going on.

Sure. Well show it in 2 dimensions.

Tim

46

Occasionally, I put myself into the lectures as well.

-3x1 + 3x2

-4x1 + 2x2

max s.t

2
z= -3x1 + 2x2 -3x1 + 3x2 6 -4x1 + 2x2 2 x1 0, x2 0 Our initial solution was to do nothing. the simplex method then realized it could do better by selling bags. But it could sell at most 1.

4
Bags sold

3 2 1
m&m

2 3 4 Bags bought

47

Note that the solution x1 = 0 and x2 = 1 is a corner point. It turns out that it is also a basic feasible solution.

Ollie,
the computationally
wise owl.
48

All bfss correspond to corner point solutions. Ollie knew that, but decided to only tell you about a specific solution.

Pivoting to obtain the bfs


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

Non-basic variable x2 becomes basic. 0 6 2 Choose column 2. Basic variable x4 becomes non-basic. 0 0 1
49

z = 2, x1 = 0, x2 = 1, x3 = 3, x4 = 0. Next iteration, we want the column of x2 to be

Since x2 replaces x4, the column for x2 after the iteration (pivot) will be the same as the column for x4 before the iteration (pivot). In that way, we will still have canonical form after the pivot.

Pivoting to obtain a better solution


New Solution: basic variables z, x2 and x3. Nonbasics: x1 and x4.
= = =

-z z 1 0 0

x1 -1 3 -3 3 -2 -4

x2 -2 0 0 3 1 2

x3 0 1 0

x4 1 0 -1.5 0 .5 1

2 0 3 6 1 2

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

50

Note that the bfs after the pivot is exactly what we wanted. By letting x2 = and increasing from 0 to 1, we were moving along an edge of the feasible region. At the end of the edge is another corner point.

Summary of Simplex Algorithm


z

Start in canonical form with a basic feasible solution Check for optimality conditions If not optimal, determine a non-basic variable that should be made positive Increase that non-basic variable, and perform a pivot, obtaining a new bfs Continue until optimal (or unbounded).

1. 2.

3.

4.

51

z 1 0 0 0

x1 a b c d

x2 0 0 1 0

x3 0 1 0 0

x4 0 0 0 1
= = = =

3 6 3 5

To do with your partner (2 minutes)

The values a, b, c, and d are unknown

1. What are the basic variables? What is the current bfs? 2. Under what condition is the current bfs optimal?

52

z 1 0 0 0

x1 a b c d

x2 0 0 1 0

x3 0 1 0 0

x4 0 0 0 1
= =
=
=

3 6 3 5

To do with your partner (3 minutes)

1. If we set x1 to , what are x2, x3, and x4, all expressed in terms of . 2. Assume that b > 0 and d < 0. Under what condition we will set = 3/c? 3. If = 3/c, what coefficient do we pivot on next?
53

Recognizing Unboundedness
If the non-cost coefficients in the entering column are 0, then the solution is unbounded z 1 0 0 x1 -1 -3 -2 x2 0 0 1 x3 0 1 0 x4 1 -1.5 .5
= = =

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

can grow to , and then z goes to .


54

Next: two more iterations.

z 1 0 0

x1 -1 3 -2

x2 0 0 1

x3 0 1 0

x4 1 -1.5 .5
= = =

2 3 1

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

The cost coefficient of x1 in the z-row is negative. Set x1 = and x4 = 0. Then = 3/3.
55

Another pivot
z 1 0 0 x1 -1 0 1 3 -2 0 x2 x3 x4
= = =

0 +1/3 +1/2 0 1 0 1 1/3 -1.5 1 -1/2 2/3 -1/2 0 .5

3 2 1 3 3 1

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

The largest value of is 3/3. Variable x1 becomes basic, x3 becomes nonbasic. So, x1 becomes the basic variable for constraint 1. Pivot on the coefficient with a 3.
56

Check for optimality z + x3/3 + x4/2 = 3


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

0 +1/3 +1/2 0 1 1/3 -1/2 2/3 1/2

3 1 3

z x1== 3 D x2 = 1 + 2D 1 x3 = 3 - 3D. 2 x4 = 0 3 x z 4== 2 + D 0

There is no negative coefficient in the z-row. The current basic feasible solution is optimal!
57

Two views of the simplex method


z

Improvement by moving along an edge.


Increase , and increase z. An approach used in other algorithms, and that shows what is going on.

Improvement by moving to an adjacent corner point


Move to an adjacent corner point and increase z It can be viewed as a shortcut

58

Summary of Simplex Algorithm Again


z 1.

Start in canonical form with a basic feasible solution Check for optimality conditions z Is there a negative coefficient in the cost row? If not optimal, determine a non-basic variable that should be made positive z Choose a variable with a negative coef. in the cost row. Increase that non-basic variable, and perform a pivot, obtaining a new bfs (or unboundedness) z We will review this step, and show a shortcut Continue until optimal (or unbounded).

2.

3.

4.

59

The Minimum Ratio Rule for determining the leaving variable. z - 3x1 = 3
z x1 -3 3 -2 2 x2 0 1 0 0 x3 0 0 1 0 x4 0 0 0 1 1 0 0 0
= = = =

3 6 1 5 z = 3 + 2 x1 = x2 = 6 - 3 x3 = 1 + 2 x4 = 5 - 2

= min (6/3, 5/2). At next iteration, pivot on the 3. ratio: RHS coefficient/ entering column coefficient s.t. entering column coefficient is positive
60

More on performing a pivot


z

To determine the column to pivot on, select a variable with a negative cost coefficient To determine a row to pivot on, select a coefficient according to a minimum ratio rule Carry out a pivot as one does in solving a system of equations.

61

Next Lecture: More on the Simplex Algorithm

62

You might also like