Operations Research: Simplex Method
Operations Research: Simplex Method
Operations Research: Simplex Method
Simplex Method
http://www.solver.com/xlspremsolv4.htm 2
The Use of Simplex Method
How to Convert an LP to
Standard Form
Transforming the LP on the previous slide to standard form yields:
If NBV = {x2} and BV = {x1, x3} are chosen instead, the basic solution
becomes x1 = 3, x2 = 0, and x3 = -1.
13
Theorem 2 For any LP, there is a unique extreme point of the LPs
feasible region corresponding to each basic feasible solution. Also,
there is at least one bfs corresponding to each extreme point in the
feasible region.
14
Preview of the Simplex
Algorithm
The relationship between X2
extreme points and basic D
60
feasible solutions outlined in
Theorem 2, is seen in the
50
Leather Limited problem. The
Labor Constraint
LP (with slack variables) was:
B
40
max z = 4x1 + 3x2
Feasible Region
s.t. x1 + x2 + s1 = 40
30
2x1 + x2 + s2 = 60
Leather Constraint
x1, x2, s1, s2 0 E
20
Both inequalities are satisfied in
10
the shaded area. The extreme
points are of the feasible region C A
are B, C, E, and F. F 10 20 30 40 50 X1
15
For any LP with m constraints, two basic feasible solutions are said
to be adjacent if their sets of basic variables have m 1 basic
variables in common.
Intuitively, two basic feasible solutions are adjacent if they both lie
on the same edge of the boundary of the feasible region.
17
Step 1 Find a bfs to the LP. We will call this bfs the initial bfs. In
general, the most recent bfs will be called the current bfs, so at
the beginning of the problem, the initial bfs is the current bfs.
Step 3 Return to Step 2, using the new bfs as the current bfs.
18
The Simplex Algorithm (max LPs)
The Simplex Algorithm Procedure for maximization LPs
Step 1 Convert the LP to standard form
Step 2 Obtain a bfs (if possible) from the standard form
Step 3 Determine whether the current bfs is optimal
Step 4 If the current bfs is not optimal, determine which nonbasic
variable should become a basic variable and which basic
variable should become a nonbasic variable to find a bfs
with a better objective function value.
Step 5 Use Elementary Row Operations (EROs) to find a new bfs
with a better objective function value. Go back to Step 3.
20
The Simplex Algorithm (max LPs)
At present, 48 board feet of lumber, 20 finishing hours, 8
carpentry hours are available. A desk sells for $60, a table for
$30, and a chair for $ 20.
21
Row 4 x2 + s4 =5 s4 = 5
If we set x1 = x2 = x3 = 0, we can solve for the values s1, s2, s3, s4. Thus, BV =
{s1, s2, s3, s4} and NBV = {x1, x2, x3 }. Since each constraint is then in canonical
form (BVs have a coefficient = 1 in one row and zeros in all other rows) with a
nonnegative right hand side (rhs), a bfs can be obtained by inspection.
23
For this initial bfs, z = 0, s1= 48, s2= 20, s3 = 8, s4 =5, x1= x2 = x3 = 0.
As this example indicates, a slack variable can be used as a basic
variable if the right hand side (rhs) of the constraint is nonnegative.
24
The Simplex Algorithm (max LPs)
Step 3 Determine if the Current BFS is Optimal
Once we have obtained a bfs, we need to determine whether it is
optimal. To do this, we try to determine if there is any way z can be
increased by increasing some nonbasic variable from its current value
of zero while holding all other nonbasic variables at their current
values of zero. Solving for z in row 0 yields:
RATIO
From row 1 we see that s1 = 48 8x1. Since s1 0, x1 48 / 8 = 6
From row 2, we see that s2 = 20 4x1. Since s2 0, x1 20 / 4 = 5
From row 3, we see that s3 = 8 2x1. Since s3 0, x1 8 / 2 =4
From row 4, we see that s4 = 5. For any x1, s4 will always be 0
This means to keep all the basic variables nonnegative, the largest
we can make x1 is min {6, 5, 4} = 4.
26
The Simplex Algorithm (max LPs)
The Ratio Test
27
28
The Simplex Algorithm (max LPs)
ero 1 z x1 x2 x3 s1 s2 s3 s4 rhs ero
0 1 -60 -30 -20
1 8 6 1 1 48
2 4 2 1,5 1 20
3 1 0,75 0,25 0,5 4 row 3 multiplied by 1/2
4 1 1 5
ero 2 z x1 x2 x3 s1 s2 s3 s4 rhs
0 1 15 -5 30 240 60 times row 3 added to row 0
1 8 6 1 1 48
2 4 2 1,5 1 20
3 1 0,75 0,25 0,5 4
4 1 1 5
ero 3 z x1 x2 x3 s1 s2 s3 s4 rhs
0 1 15 -5 30 240
1 -1 1 -4 16 - 8 times row 3 added to row 1
2 4 2 1,5 1 20
3 1 0,75 0,25 0,5 4
4 1 1 5
ero 4 z x1 x2 x3 s1 s2 s3 s4 rhs
0 1 15 -5 30 240
1 -1 1 -4 16
2 -1 0,5 1 -2 4 - 4 times row 3 added to row 2
3 1 0,75 0,25 0,5 4
4 1 1 5
29
Row 1 - x3 + s1 - 4s3 = 16 s1 = 16
Row 2 - x2 + 0.5 x3 + s2 - 2 s3 =4 s2 = 4
Row 3 x1 + 0.75x2 + 0.25x3 + 0.5s3 =4 x1 = 4
Row 4 x2 + s4 =5 s4 = 5
In canonical form 1, BV = {z, s1, s2, x1, s4} and NBV = {s3, x2, x3 }.
yielding the bfs z = 240, s1 = 16, s2 = 4, x1 = 4, s4 = 5, s3 = x2 = x3 = 0.
The procedure from going to one bfs to a better adjacent bfs is
called an iteration (or sometime pivot) of the simplex algorithm.
30
The Simplex Algorithm (max LPs)
Returning to Step 3, we attempt to determine if the current bfs is optimal.
31
33
In Canonical Form 2, BV = {z, s1, x3, x1, s4} and NBV = {s3, s2, x2 },
yielding the bfs z = 280, s1 = 24, x3 = 8, x1 = 2, s4 = 5, s2 = s3 = x2 = 0.
34
The Simplex Algorithm (max LPs)
Solving for z in row 0 yields: Z = 280 - 5x2 - 10s2 -10s3
We can see that increasing x2, s2, or s3 (while holding the other
NBVs to zero) will not cause the value of z to decrease. The
solution at the end of iteration 2 is therefore optimal. The
following rule can be applied to determine whether a canonical
forms bfs is optimal:
35
39
Iteration 0
The most negative coefficient
Itera- BV Coefficient of:
RHS
tion Eq. Z x1 x2 s1 s2 s3
z (0) 1 -3 -5 0 0 0 0
s1 (1) 0 1 0 1 0 0 4
0 s2 (2) 0 0 2 0 1 0 12
s3 (3) 0 3 2 0 0 1 18
12 18
=6 =9
minimum 2 2
40
Iteration 1
The most negative coefficient
Itera- BV Coefficient of:
RHS
tion Eq. Z x1 x2 s1 s2 s3
z (0) 1 -3 0 0 5/2 0 30
s1 (1) 0 1 0 1 0 0 4
1 s2 (2) 0 0 1 0 0 6
s3 (3) 0 3 0 0 -1 1 6
4 6
=4 =2
minimum 1 3
41
Iteration 2
None of the coefficient is negative
Itera- BV Coefficient of:
RHS
tion Eq. Z x1 x2 s1 s2 s3
z (0) 1 0 0 0 3/2 1 36
s1 (1) 0 0 0 1 1/3 -1/3 2
2 s2 (2) 0 0 1 0 0 6
s3 (3) 0 1 0 0 -1/3 1/3 2
44
The Simplex Algorithm (min LPs)
In solving this modified LP, use z as the basic variable in row 0. After
adding slack variables s1 and s2 to the constraints we obtain the
initial tableau.
Initial Tableau
Row -z x1 x2 s1 s2 rhs BVs
0 1 2 -3 0 0 0 -z=0
1 0 1 1 1 0 4 s1 =4
2 0 1 -1 0 1 6 s2 = 6
ero1 -z x1 x2 s1 s2 rhs
0 1 2 -3 0 0 0
1 0 1 1 1 0 4
2 0 2 0 1 1 10
ero 2 -z x1 x2 s1 s2 rhs BVs
0 1 5 0 3 0 12 - z = 12
1 0 1 1 1 0 4 x2 = 4
2 0 2 0 1 1 10 s2 = 10
45
46
The Simplex Algorithm (min LPs)
Method 2
47
48
Unbounded LPs
For some LPs, there exist points in the feasible region for
which z assumes arbitrarily large (in max problems) or
arbitrarily small (in min problems) values. When this
occurs, we say the LP is unbounded.
An unbounded LP occurs in a max problem if there is a
nonbasic variable with a negative coefficient in row 0
and there is no constraint that limits how large we can
make this NBV.
49
51
52
References
Operations Research: Applications and Algorithms,
Wayne L. Winston
Introduction to Operations Research, Hillier & Lieberman,
McGraw-Hill Int.
Operations Research An Introduction, Hamdy A. Taha,
Maxwell Macmillan Int. Edition.
53