The Simplex Method

Linear Programming: The Simplex
Method
1© 2003 by Prentice Hall, Inc.
Upper Saddle River, NJ 07458
Introduction
 Graphical methods are fine for 2 variables.
 But most LP problems are too complex for
simple graphical procedures.
 The Simplex Method:
o examines corner points, like in graphing;
o systematically examines corner points, using
algebra, until an optimal solution is found;
o does its searching iteratively.
2© 2003 by Prentice Hall, Inc.
Upper Saddle River, NJ 07458
Introduction
Why study the Simplex Method?
 The Simplex Method:
o Provides the optimal solution to the Xi variables and the
maximum profit (or minimum cost).
o Provides important economic information.
 Understanding how the Simplex Method works is
important because
o it allows for understanding how to interpret LP computer
printouts.
3© 2003 by Prentice Hall, Inc.
Upper Saddle River, NJ 07458
Setting UP the Simplex Method
• The algebraic procedure is based on solving systems of
equations.
• The first step in setting up the simplex method is to convert
the functional inequality constraints to equivalent equality
constraints. This conversion is accomplished by
introducing slack variables.
• To illustrate, consider this constraint: X1 4
The slack variable for this constraint is defined to be
S1=4 - X1
which is the amount of slack in the left-hand side of the
inequality. Thus
X1+S1=4
4© 2003 by Prentice Hall, Inc.
Upper Saddle River, NJ 07458
Example
• Objective Function
Max. Z=3X1+5X2
• Subject to:
X1
4
2X2 12
3X1+2X2 18
X1,X2 0
 X1+S1=4
 2X2+S2=12
 3X1+2X2+S3=18
5© 2003 by Prentice Hall, Inc.
Upper Saddle River, NJ 07458
The Standard Form of the
Model
Z-3X1-5X2=0
..………(0)
X1+S1=4
...……...(1)
2X2+S2=12
..………(2)
3X1+2X2+X5=18
………...(3)
6© 2003 by Prentice Hall, Inc.
Upper Saddle River, NJ 07458
The Simplex Method in
Tabular Form
Tabular form
Eq.
Basic
variable
Coefficient of:
Z
X1
X2
S1
S2
S3
(0)
Z
1
-3
-5
0
0
0
0
(1)
S1
0
1
0
1
0
0
4
(2)
S2
0
0
2
0
1
0
12
(3)
S3
0
3
2
0
0
1
18
7© 2003 by Prentice Hall, Inc.
Upper Saddle River, NJ 07458
Right
side
Summary of the Simplex
Method
• Initialization: Introduce slack variables, then constructing
the initial simplex tableau.
• Optimality Test: The current basic feasible solution is
optimal if and only if every coefficient in row (0) is
nonegative (0). If it is, stop; otherwise, go to an iteration
to obtain the next basic feasible solution.
• Iteration:
Step1
Determine the entering basic variable by selecting the
variable with negative coefficient having the largest
absolute value (i,e., the “most negative” coefficient) in Eq.
(0). Put a box around the column below this coefficient,
and call this the pivot column.
8© 2003 by Prentice Hall, Inc.
Upper Saddle River, NJ 07458
Summary of the Simplex
Method/ continued
Step 2
Determine the leaving basic variable by applying the minimum ratio
test.
Minimum Ratio Test
1.
Pick out each coefficient in the pivot column that is strictly
positive (>0).
2. Divide each of these coefficients into the right side entry for
the same row.
3. Identify the row that has the smallest of these ratios.
4. The basic variable for that row is the leaving basic variable,
so replace that variable by the entering basic variable in the
basic variable column of the next simplex tableau.
Put a box around this row and call it the pivot row. Also call the
number that is in both boxes the pivot number.
9© 2003 by Prentice Hall, Inc.
Upper Saddle River, NJ 07458
Summary of the Simplex
Method/ continued
Step 3
Solve for the new basic feasible solution by using elementary row
operations (by applying Gauss-jordan method), The method effects
a change in basis by using two types of computations:
1. Type 1 (pivot equation):
new pivot Eq.=old pivot Eq. ÷ pivot number
2. Type 2 (all other eqautions, including Z):
new Eq. = old Eq. – (its entering column coefficient) X (new pivot
Eq.)
10© 2003 by Prentice Hall, Inc.
Upper Saddle River, NJ 07458
Example
• Solve this model using the simplex method:
• Objective Function
Max. Z=3X1+5X2
• Subject to:
4
2X2 12
3X1+2X2 18
X1,X2 0
X1
11© 2003 by Prentice Hall, Inc.
Upper Saddle River, NJ 07458
Solution
• First, the Standard Form of the model:
• Z-3X1-5X2=0
..……….(0)
• X1+S1=4
• 2X2+S2=12
• 3X1+2X2+X5=18
...……....(1)
..…….…(2)
………...(3)
12© 2003 by Prentice Hall, Inc.
Upper Saddle River, NJ 07458
The Simplex Method in
Tabular Form
Tabular form
Eq.
Basic
variable
Coefficient of:
Z
X1
X2
S1
S2
S3
(0)
Z
1
-3
-5
0
0
0
0
(1)
S1
0
1
0
1
0
0
4
(2)
S2
0
0
2
0
1
0
12
(3)
S3
0
3
2
0
0
1
18
13© 2003 by Prentice Hall, Inc.
Upper Saddle River, NJ 07458
Right
side
# (0) Iteration
Tabular form
Eq.
Basic
variable
Coefficient of:
Z
X1
X2
S1
S2
S3
Right
side
(0)
Z
1
-3
-5
0
0
0
0
(1)
S1
0
1
0
1
0
0
4
(2)
S2
0
0
2
0
1
0
12
(3)
S3
0
3
2
0
0
1
18
14© 2003 by Prentice Hall, Inc.
Upper Saddle River, NJ 07458
# (1) Iteration
Tabular form
Eq.
Basic
variable
Coefficient of:
Z
X1
X2
S1
S2
S3
Right
side
(0)
Z
1
-3
0
0
5\2
0
30
(1)
S1
0
1
0
1
0
0
4
(2)
X2
0
0
1
0
1\2
0
6
(3)
S3
0
3
0
0
-1
1
6
15© 2003 by Prentice Hall, Inc.
Upper Saddle River, NJ 07458
# (2) Iteration
Tabular form
Eq.
Basic
variable
Coefficient of:
Z
X1
X2
S1
S2
S3
1
Right
side
(0)
Z
1
0
0
0
3\2
(1)
S1
0
0
0
1
1\3 -1\3
2
(2)
X2
0
0
1
0
1\2
6
(3)
X1
0
1
0
0
-1\3 1\3
0
16© 2003 by Prentice Hall, Inc.
Upper Saddle River, NJ 07458
36
2
•Going to the optimality test, we find that this solution is optimal
because none of the coefficients in row (0) is negative, so the
algorithm is finished.
•Consequently, the optimal solution for this problem is X1=2,
X2=6.
17© 2003 by Prentice Hall, Inc.
Upper Saddle River, NJ 07458
Special Cases in Simplex
Method Application
•
1.
2.
3.
4.
We will consider special cases that can arise in the
application of the simplex method, which include:
Degeneracy.
Alternative optima (more than one optimum solution).
Unbounded solutions.
Nonexisting (or infeasible) solutions.
18© 2003 by Prentice Hall, Inc.
Upper Saddle River, NJ 07458
Degeneracy
• In the application of the feasibility condition, a tie for the
minimum ratio may be broken for the purpose of determining
the leaving variable. When this happens, however, one or more
of the basic variables will necessarily equal zero in the next
iteration.
• In this case, we say that the new solution is degenerate. (In all
LP examples we have solved so far, the basic variables always
assumed strictly positive values).
• The degeneracy has two implications: The first deals with the
phenomenon of cycling or circling (If you look at iterations 1
and 2 in the next example you will find that the objective value
has not improved (Z=18)), in general, the simplex procedure
would repeat the same sequence of iterations, never improving
the objective value and never terminating19©
the
computations.
2003 by Prentice Hall, Inc.
Upper Saddle River, NJ 07458
Degeneracy
• The second theoretical point arises in the examination of
iterations 1 and 2. Both iterations, although differing in
classifying the variables as basic and nonbasic, yield identical
values of all variables and objective.
• An argument thus arises as to the possibility of stopping the
computations at iteration 1 (when degeneracy first appears),
even though it is not optimum. This argument is not valid
because, in general, a solution may be temporarily
degenerate.
20© 2003 by Prentice Hall, Inc.
Upper Saddle River, NJ 07458
Degeneracy/example
Max. Z=3X1+9X2
ST
X1+4X2  8
X1+2X2  4
X1,X2  0
21© 2003 by Prentice Hall, Inc.
Upper Saddle River, NJ 07458
Degeneracy/example
Iteration
Basic
X1
X2
S1
S2
R.S.
0
(starting)
X2 enters
S1 leaves
Z
-3
-9
0
0
0
S1
1
4
1
0
8
S2
1
2
0
1
4
Z
-4/3
0
4/9
0
18
X2
4/1
1
4/1
0
2
S2
2/1
0
-2/1
1
0
Z
0
0
2/3
2/3
18
X2
0
1
2/1
-2/1
2
X1
1
0
-1
2
0
1
X1 enters
S2 leaves
2
(optimum)
22© 2003 by Prentice Hall, Inc.
Upper Saddle River, NJ 07458
Alternative Optima
• When the objective function is parallel to a binding constraint,
the objective function will assume the same optimal value at
more than one solution point. For this reason they are called
alternative optima.
• Algebraically, after the simplex method finds one optimal basic
feasible (BF) solution, you can detect if there any others and, if
so, find them as follows:
Whenever a problem has more than one optimal BF solution, at
least one of the nonbasic variables has a coefficient of zero in the
final row (0), so increasing any such variable will not change the
value of Z. Therefore, these other optimal BF solutions can be
identified (if desired) by performing additional iterations of the
simplex method, each time choosing a nonbasic variable with a
zero coefficient as the entering basic variable.
23© 2003 by Prentice Hall, Inc.
Upper Saddle River, NJ 07458
Alternative Optima/example
Max. Z=2X1+4X2
ST
X1+2X2  5
X1+ X2  4
X1,X2  0
24© 2003 by Prentice Hall, Inc.
Upper Saddle River, NJ 07458
Alternative Optima/example
Iteration
Basic
X1
X2
S1
S2
R.S.
0
(starting)
X2 enters
S1 leaves
Z
-2
-4
0
0
0
S1
1
2
1
0
5
S2
1
1
0
1
4
Z
0
0
2
0
10
X2
2/1
1
2/1
0
2/5
S2
2/1
0
-2/1
1
2/3
Z
0
0
2
0
10
X2
0
1
1
-1
1
X1
1
0
-1
2
3
1
(optimum)
X1 enters
S2 leaves
2
( alternate
optimum)
25© 2003 by Prentice Hall, Inc.
Upper Saddle River, NJ 07458
(2, 6)
Every point on this darker line segment
is optimal, each with z = 18.
(4, 3)
As in this case, any problem having multiple optimal solutions will
have an infinite number of them, each with the same optimal value of
26© 2003 by Prentice Hall, Inc.
the objective function.
Upper Saddle River, NJ 07458
Unbounded Solution
• In some LP models, the values of the variables may be
increased indefinitely without violating any of the
constraints, meaning that the solution space is unbounded
in at least one direction.
• Unboundedness in a model can point to one thing only.
The model is poor constructed.
• The general rule for recognizing unboundedness is as
follows:
If at any iteration the constraint coefficients of a nonbasic
variable are nonpositive, then the solution space is
unbounded in that direction.
27© 2003 by Prentice Hall, Inc.
Upper Saddle River, NJ 07458
Unbounded Solution/example
Max. Z=2X1+X2
ST
X1-X2  10
2X1
 40
X1,X2  0
28© 2003 by Prentice Hall, Inc.
Upper Saddle River, NJ 07458
Unbounded Solution/example
Basic
X1
X2
S1
S2
R.S.
Z
-2
-1
0
0
0
S1
1
-1
1
0
10
S2
2
0
0
1
40
29© 2003 by Prentice Hall, Inc.
Upper Saddle River, NJ 07458
Infeasible Solution
• If the constraints cannot be satisfied, the model is said to
have no feasible solution. This situation can never occur if
all the constraints are of the type  (assuming nonegative
right-side constants), since the slack variable always
provides a feasible solution.
• However, when we employ the other types of constraints,
we resort to the use of artificial variables which may do not
provide a feasible solution to the original model.
• Although provisions are made to force the artificial
variables to zero at the optimum, this can occur only if the
model has a feasible space. If it does not, at least one
artificial variable will be positive in the optimum iteration.
• See the next example, the artificial variable R is positive
(=4) in the optimal solution.
30© 2003 by Prentice Hall, Inc.
Upper Saddle River, NJ 07458
Infeasible Solution/example
Max. Z=3X1+2X2
ST
2X1+X2  2
3X1 +4X2  12
X1,X2  0
31© 2003 by Prentice Hall, Inc.
Upper Saddle River, NJ 07458
Infeasible Solution/example
Iteration
Basic
X1
X2
S1
A1
R
R.S.
0
(starting)
X2 enters
S1 leaves
Z
-3-3M
-2-4M
0
M
0
0
S1
2
1
1
0
0
2
R
3
4
0
-1
1
12
Z
1+5M
0
2+4M
M
0
4-4M
X2
2
1
1
0
0
2
R
-5
0
-4
-1
1
4
1
(optimum)
X1 enters
S2 leaves
32© 2003 by Prentice Hall, Inc.
Upper Saddle River, NJ 07458