Chapter 4. Solving Linear Programs The Simplex Method
Chapter 4. Solving Linear Programs The Simplex Method
a x
21 1
+a x 22 2
+ + a x 2n n
+ X n + 2 =b2
a x + a x + + a x
m1 1 m2 2 mn n
+ X n + m = bm
x ≥0 , x ≥0 , , x , X
1 2 n n +1
, , X n + m ≥0
x : Slack Variable.
n +i
x1 + x3 =4
2 x2 + x4 = 12
3 x1 + 2 x2 + x5 = 18
A = (B, N).
Basic Solution of Ax=b
Consider t he matrix equation Ax = b.
1 0 1 0 0 1 0 0
A = 0 2 0 1 0 . Select B = ( A•3 , A•4 , A•5 ) = 0 1 0
3 2 0 0 1 0 0 1
x 3 x1
xB = x and x N =
x .
x 4
2
5
4
−1
0
x B =B b =12 and x N =
0
.
8
■ Basic Solution: An augmented corner-point solution.
Basic variables are x1, x2 and x5
In the standard form: (4, 6)
In the augmented form: (4, 6, 0, 0, -6)
Basic Variable:
Variable
– A basic variable solution has at least n variables, original or
slack, whose value are zero. These variables are called non-
basic variables, and the others are called basic variables.
( 4, 6, 0, 0, -6)
( 0, 6, 4, 0, 6 )
– A basic solution can be obtained directly form the augmented
form by setting n ( non-basic ) variables equal to zero and
solving m equations for m ( basic ) variables
– The coefficient matrix of the m equations is called basis.
– If the values of the m basic variables are nonnegative, then it is
a basic feasible solution corresponding to a feasible corner-
point in the original form.
Adjacent Basic Solutions
( 4, 6, 0, 0, -6 ) and ( 4, 3, 0, 6, 0 )
( 4, 0, 0, 12, 6 ) and ( 4, 3, 0, 6, 0 )
Algebraic Outline of the Simplex Method
NO
Is there a ‘better’ adjacent basic feasible solution exists?
YES
The candidate for the entering basic variables are the n current
nonbasic variables. The one chosen would be changed from nonbasic
into basic, so its value would be increased from zero to some positive
number and the others would be kept at zero. Since we require an
improvement, the rate of change in the objective function must be a
positive one.
Z = 3x1 + 5x2
x1 + x3 =4
2x2 + x4 = 12
3x1 + 2x2 + x5 = 18
X3 =4
X4 = 12 - 2X2
X5 = 18 - 2X2
2. How to select the leaving basic variable?
Z = 5 X2
+ X3 =4
2X2 +X4 = 12
2X2 + X5 = 18
X3 =4
X4 = 12 - 2X2
X5 = 18 - 2X2
Z= + 30 + 3X1
X3 = 4 - X1
X2 =6
X5 = 6 - 3X1
Z= - (5/2 ) X4 - X5 + 36
X3 + ( 1/3 ) X4 - ( 1/3 ) X5 = 2
X2 + ( 1/2 ) X4 =6
X1 - ( 1/3 ) X4 + ( 1/3 ) X5 =2
Summary of the Simplex Method
1. Select a basic feasible solution
3. Goto Step 2.
The Original Simplex Method: Tabular Form
■ Gaussian Elimination
X1 + X3 = 4
X2 - X3 = 1
3X1 + 2X2 - 4X3 = -5
1 0 1 4
0 2 -1 1
3 2 -4 -5
Row 3 - 3 x Row 1:
1 0 1 4
0 2 -1 1
0 2 -7 -17
( Row 2 ) / 2:
1 0 1 4
0 1 -1/2 1/2
0 2 -7 -17
Row 3 - 2 x (Row 2):
1 0 1 4
0 1 -1/2 1/2
0 0 -6 -18
(Row 3 ) / (-6 ):
1 0 1 4
0 1 -1/2 1/2
0 0 1 3
Row 2 + ( Row 3 ) / 2:
1 0 1 4
0 1 0 2
0 0 1 3
Row 1 - Row 3:
1 0 0 1
0 1 0 2
0 0 1 3
max c x +c x
1 1 2 2
+ + cn x n
s.t.
a x +a x
11 1 12 2
+ + a1n x n + X n +1 = b1
a x +a x
21 1 22 2
+ + a 2n x n
+ X n + 2 = b2
a x + a x + + a x
m1 1 m2 2 mn n
+ X n + m = bm
x ≥0 , x ≥0 , , x
1 2 n
, X n +1 , , X n + m ≥ 0
x n +i
: Slack Variable.
max 3 x1+ 5 x2
s.t. x1 + x3 =4
2 x2 + x4 = 12
3 x1 + 2 x2 + x5 = 18
x1, x2, x3, x4, x5 >= 0
z - c x - c x - -c x
1 1 2 2 n n
=0
a x + a x + + a x + X
11 1 12 2 1n n n +1 = b1
a x + a x + + a x + X
21 1 22 2 2n n n +2
= b2
a x +a x
m1 1 m2 2
+ + a m n x n + X n + m = bm
z - 3 x1 -5 x2 =0
x1 + x3 =4
2 x2 + x4 = 12
3 x1 + 2 x2 + x5 = 18
x1, x2, x3, x4, x5 >= 0
Step 0. Initial Table
Basic Right-Hand
Var.. x x 1 2
x n +1
... x n +m Side
Z - c1 - c 2 0 0 0
x n +1 a 11 a
12
1 1 b1
x n +2 a 21 a 22
0 0 b 2
0 0
x n +m a m1 a m2
0 1 b m
Z -3 -5 0 0 0 0
3 1 0 1 0 0 4
4 0 2 0 1 0 12
5 3 2 0 0 1 18
■ Step 1. Optimality Test
The current basic feasible solution is optimal if and only if every
coefficient in Row 0 is nonnegative. If it is, stop; otherwise, go to
Step 2.
3 1 0 1 0 0 4 ∞
4 0 2 0 1 0 12 6 = 12/2
5 3 2 0 0 1 16 9 = 18/2
Step 2. ( Continued )
3. The intersection of the pivot column and pivot row is the pivot
number. Replace the leaving basic variable by the entering basic
variable in Column 0. Perform Gaussian elimination for the pivot
number. Goto Step 1.
( Row 2 ) / 2 :
Basic Variable RHS
Z -3 -5 0 0 0 0
3 1 0 1 0 0 4
4 0 1 0 1/2 0 6
5 3 2 0 0 1 18
Row 3 - 2 x Row 2
Row 0 + 5 x Row 2
2. Add every <= constraint a slack variable. If the right side of a <=
constraint is nonnegative, then the slack variable is the basic
variable for this row.
3. Multiply -1 to every constraint with the negative right side, and add
artificial variables to be the basic variables for these rows.
minimize x3
subject to x1 + x3 =4
2x2 + x4 = 12
3x1 + 2x2 + x5 = 18
x1, x2, x3, x4, x5 >= 0
5. After find a BFS, optimize the original objective function as the Phase-2 linear
program.
Tie Breaking