Lesson27_-_Simplex_Method_handout
Lesson27_-_Simplex_Method_handout
1 Setup
A standard linear programming problem is to maximize the quantity
c1 x1 + c2 x2 + . . . cn xn = cT 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 satifies all the inequalities is called a feasible solution to the
given problem, and a feasible solution maximizing the objection function is called an
optimal solution.
2 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.
1
3 Slack Variables
We can turn the inequalities into equalities by inserting new variables, which are called
slack variables. Thus the first equation of constraint becomes
2x + y + u = 50,
x ≥ 0, y ≥ 0, u ≥ 0, v ≥ 0.
Theorem. If a LP problem has an optimal solution, then it has a basic optimal solution.
So we only need to find the basic feasible solutions!
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.1 . This can be done
n+m (n + m)!
=
m m!n!
could be eliminated
2
4 The Simplex Method, By Example
4.1 The Initial Basic Feasible Solution
We’ll work with the illustrative problem. We can start with the basic feasible solution
x = 0, y = 0. This means u = 50 and v = 70.
We’ll start writing everything in a table (or tableau), so let’s 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 v z value
u 2 1 1 0 0 50
v 1 2 0 1 0 70
−8 −10 0 0 1 0
Looking at the last row, we can see that this is not the optimal solution. Increasing
x or y would result in an increase in z to balance out. The idea in general is the:
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.
The idea is this: We’re going to move from one basic solution to another. That
is, we need to make one of the nonzero (basic) variables zero and one of the zero
(nonbasic) variables nonzero. We want to do this as efficiently as possible.
Look at the last row. The −10 in the y column indicates that an increase in y would
have to be balanced by a tenfold increase in z. This multiplier is the biggest one. So
we choose to make this variable nonzero (basic). Since it’s entering the set of basic
variables, it’s called the entering 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 70
1 = 50 and 2 = 35. So we’re 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.
3
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 v z value
2 1 1 0 0 50
1 1
2 1 0 2 0 35
−8 −10 0 0 1 0
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 u v z value
3 1
u 2 0 1 − 2 0 15
1 1
y 2 1 0 2 0 35
−3 0 0 5 1 350
Now we can repeat the process! 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
15 35
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 23 to make it one in the basic column:
x y u v z value
2
u 1 0 3 − 310 10
1 1
y 2 1 0 2 0 35
−3 0 0 5 1 350
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 u v z value
2 1
u 1 0 3 − 3 0 10
1 2
y 0 1 −3 3 0 30
0 0 2 4 1 380
Now any increase in the decision variables or slack variables would result in a
decrease of z. We are done!
5 Recap of Steps
1. Set up the initial problem.
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.
4
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. For some reason, these
ratios are called θ-ratios (theta). The pivotal row is the row for which the smallest
of these ratios occurs. If there is a tie, so that the smallest ratio occurs at more
than one row, 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 finite
optimum. We stop.
5. Perform pivotal elimination to construct a new tableau and return to Step 2.
6 Example
Let’s 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.
x1 x2 x3 u1 u2 u3 z value
u1 2 4 1 1 0 0 0 4
u2 3 −2 3 0 1 0 0 4
u3 2 1 −1 0 0 1 0 8
z −3 1 −6 0 0 0 1 0
5
The entering variable is the one with the largest negative coefficient in the objective
row, that is, x3 . The departing variable is the row where the last column divided by the
third column has its minimum positive value. These θ-ratios are 43 and 41 . Apparently,
then u2 is the departing variable. We scale row 2 by 13 , and use row operations to zero
out the rest of the column. We get
x1 x2 x3 u1 u2 u3 z value
u1 1 14
3 0 1 − 13 0 0 8
3
2 1 4
x3 1 −3 1 0 3 0 0 3
1 1 28
u3 3 3 0 0 3 1 0 3
z 3 −3 0 0 2 0 1 8
8/3 3
=
14/3 14
28/3
= 28.
1/3
3
So the departing variable is u1 . We scale row 1 by 14 and use row operations to zero
out the rest. We get
x1 x2 x3 u1 u2 u3 z value
3 3 1 4
x2 14 1 0 14 − 14 0 0 7
8 1 2 12
x3 7 0 1 7 7 0 0 7
41 1 5 64
u3 14 0 0 − 14 14 1 0 7
51 9 25 68
z 14 0 0 14 14 0 1 7
68
Now there is nothing else to increase; we have reached the optimum value 7 at
x1 = 0, x2 = 47 , and x3 = 12
7 .