Professional Documents
Culture Documents
C4 - Simplex Method Jan 2021
C4 - Simplex Method Jan 2021
1
Outline chapter
q Introduction to Simplex method
q Setup a standard LP problem
q Solve LP with simplex method
q Understand sensitivity analysis with simplex
method.
q Understand special cases in LP
2
Gauss-Jordan Elimination
2 x1 + 3x2 = 7
q Solve:
4 x1 + 5 x2 = 13
3
Gauss-Jordan Elimination (cont.)
é2 3 7ù é1 3
2
7 ù2
ê ú ê ú
row1new= 1/2 * row1
é1 3
2
7
2ù é1 3
2
7 ù2
ê ú ê ú
êë0 -1 - 1úû row2new= (-1) * row2
êë0 1 1 úû
é1 0 2ù
ê ú
êë0 1 1úû Read off solution: x1 = 2, x2 = 1 4
Introduction to Simplex Method
q Developed by George Dantzig in 1947.
q The simplex method:
§ moves from one extreme point to its neighboring extreme
point, stopping when the objective function can no longer be
improved.
§ The procedure ends when the optimal solution is found or the
problem has no solution.
§ Based on the Gauss-Jordan elimination procedure.
5
The simplex algorithm
Start
Convert to LP
standard form
Optimal
End
solution Yes
No
7
The simplex algorithm
q Constraints: with the type
§ £ : add a slack variable to left side
§ ³ : subtract a surplus variable and add an Artificial variable
to left side
§ = : add an Artificial variable to left side.
q Example:
§ 3x1 + 2x2 £ 25 is converted to 3x1 + 2x2 + s = 25
q Objective function:
§ Min. Z = - Max (- Z)
§ Example: Min Z = 5x1 + 3x2 has the same solution
§ with Max (-Z) = - 5x1 - 3x2
8
The simplex algorithm
The standard LP problem
Example
Convert to:
x1 + x2 = 10
x1 + x2 + A1 = 10
2x1 + 2 x2 £5
2x1 + 2 x2 + s1 = 5
4x1 + 3 x2 ³8
4x1 + 3 x2 - s2 + A2 = 8
Where S1: Slack var.,
S2: Surplus var.
A1: Artificial var.
9
The simplex algorithm
The standard LP problem:
q Basic solutions
§ The constraints consist of m equations and n variables (with
n> m). So the basic solution gives
§ m variables different from zero and
§ (n-m) variables must be zero.
q We call:
§ m variables are basic solution and
§ (n-m) variables are non-basic variables.
10
The simplex algorithm
q The standard LP problem
After converting:
Original
Max. Z = $7x1 + $5x2+ $0s1+ $0s2
Max. Z = $7x1 + $5x2
Subject to:
Subject to: 2x1 + 1x2 + 1s1 = 100
2x1 + 1x2 £ 100 4x1 + 3x2 + 1s2 = 240
4x1 + 3x2 £ 240
11
The simplex algorithm
q Initial solution:
m = 2; n = 4
m = 2; n = 4 The final solution:
The initial solution: x1 = 30; x2 = 40
x1 = x2 = 0 :non-basic s1 = s2 = 0
s1 = 240; s2 = 100: basic m=2: basic solution
m=2: basic solution 4-2 = 2: non-basic solution
4-2 = 2: non-basic solution
12
The simplex algorithm
Start
Convert to LP
standard form
Optimal
End
solution Yes
No
14
The simplex algorithm (Max problem)
q Step 3: Compute the new value for each
remaining row:
§ Keep other number in the pivot column (¹ pivot number) to be
zero by matrix elementary transformation
15
The simplex algorithm
Start
Convert to LP
standard form
Optimal
End
solution Yes
No
x1 ≤4 x1 + s1 =4
2x2 ≤ 12 2x2 + s2 = 12
3x1 + 2x2 ≤ 18 3x1 + 2x2 + s3 = 18
x1 ≥ 0 x1≥ 0
x2 ≥ 0. x ≥ 0.
2
Optimal solution
Summary
q Convert LP problem to standard form
q Test optimality:
§ Find initial basis feasible solution(BFS)
§ Check the initial BFS, if initial BFS is an optimal solution, stop.
22
Summary
q Otherwise:
§ Determine the entering variable ( the most positive coefficient
value or the most negative coefficient in Z-eq for maximize
problem or minimize problem, respectively).
§ Determine the leaving variable (minimum ratio test).
§ The pivot number must be equal to 1 in the next iteration.
§ The rest of number in the pivot column must be equal to 0 in
the next iteration.
§ When all coefficient values in the Z-eq. are non-negative for
MAXIMIZE PROBLEM and non-positive for MINIMIZE
PROBLEM, reach optimal.
23
Big M method
q LP Standard form :
q Maximize (Minimize) Z:
q subject to:
§ functional constraints in form (≤),(≥) bi
§ nonnegativity constraints on all variables
§ bi≥0 for all i = 1, 2, . . . , m.
24
Big M method
q Artificial variables:
§ When constraints are equalities, artificial variables are used to
set up an initial solution in the first tableau.
Big M method
Step 1: Obtaining an Initial BF Solution
Maximize Z = 3x1 +5x2 +0 s1 +0 s2
Maximize Z = 3x1 +5x2
subject to
subject to
x1 + s1 = 4
x1 ≤ 4
2x2 + s2 =12
2x2 ≤ 12
3x1 +2x2 = 18
3x1 +2x2 = 18 x1 ≥ 0, x2 ≥ 0, s1 ≥ 0, s2 ≥ 0,
x1 ≥ 0, x2 ≥ 0
x1 = 0, x2 = 9
s1 = 4
No initial feasible solution s2 = -6 (violate)
x1 ≥ 0, x2 ≥ 0, s1 ≥ 0, s2 ≥ 0,
Big M method
Maximize Z = 3x1+ 5x2 +0 s1 +0 s2 – MA1
subject to
x1 + s1 = 4
2x2 + s2 =12 Initial feasible solution
Nonbasic variables:
3x1 +2x2 + A1= 18
x1 = 0, x2 = 0
x1 ≥ 0, x2 ≥ 0, s1 ≥ 0, s2 ≥ 0, A1 ≥0 Basic variables:
x3 = 4, x4=12, A1 = 18.
s1 (1) 1 0 1 0 0 4
0
s2 (2) 0 2 0 1 0 12
A1 (3) 3 2 0 0 1 18
Iteration Basic Eq. x1 x2 s1 s2 A1 RHS
varibles
Z (0) 0 -2M-5 3M+3 0 0 -6M+12
X1 (1) 1 0 1 0 0 4
1
s2 (2) 0 2 0 1 0 12
A1 (3) 0 2 -3 0 1 6
Big M method
Step 3: Applicating of the Simplex Method (cont)
Iteration Basic Eq. x1 x2 s1 s2 A1 RHS
varibles
Z (0) 0 0 -9/2 0 M+5/2 27
X1 (1) 1 0 1 0 0 4
2
s2 (2) 0 0 3 1 -1 6
X2 (3) 0 1 -3/2 0 1/2 3
Iteration Basic Eq. x1 x2 s1 s2 A1 RHS
varibles
Z (0) 0 0 0 3/2 M+1 36
x1 (1) 1 0 0 -1/3 1/3 2
3
s2 (2) 0 0 1 1/3 -1/3 2
x2 (3) 0 1 0 1/2 0 6
Phase 2:
Continue with the min Z= 0.4x1 + 0.5x2
Phase 1: basic feasible st:
min Z’ = A1+A2 0.3x1 + 0.1x2 + s1 = 2.7
st:
solution of phase 0.5x1 + 0.5x2 = 6
0.3x1 + 0.1x2 + s1=2.7 1. 0.6x1 + 0.4x2 - s2 = 6
0.5x1 + 0.5x2 + A1= 6 x1,x2,s1,s2 ≥0
0.6x1+ 0.4x2 - s2+A2 = 6
x1,x2,s1,s2,A1,A2≥0
33
Phase 1
Iter Basic Vars. Z X1 X2 S1 A1 S2 A2 RHS
0 Z -1 -1.1 -0.9 0 0 1 0 -12
S1 0 0.3 0.1 1 0 0 0 2.7
A1 0 0.5 0.5 0 1 0 0 6
A2 0 0.6 0.4 0 0 -1 1 6
Iter Basic Vars. Z X1 X2 S1 A1 S2 A2 RHS
1 Z -1 0 -16/30 11/3 0 1 0 -2.1
X1 0 1 1/3 10/3 0 0 0 9
A1 0 0 1/3 -5/3 1 0 0 1.5
A2 0 0 0.2 -2 0 -1 1 0.6
Iter Basic Vars. Z X1 X2 S1 A1 S2 A2 RHS
2 Z -1 0 0 -5/3 0 -5/3 8/3 -0.5
X1 0 1 0 20/3 0 5/3 -5/3 8
A1 0 0 0 5/3 1 5/3 -5/3 0.5
X2 0 0 1 -10 0 -5 5 3
Iter Basic Vars. Z X1 X2 S1 A1 S2 A2 RHS
2 Z -1 0 0 0 1 0 1 0
X1 0 1 0 0 -4 -5 5 6
S1 0 0 0 1 3/5 1 -1 0.3
X2 0 0 1 0 6 5 -5 6
34
Phase 2 preparation
Basic Vars. Z X1 X2 S1 A1 S2 A2 RHS
Z -1 0 0 0 1 0 1 0
Final Phase 1 X1 0 1 0 0 -4 -5 5 6
S1 0 0 0 1 3/5 1 -1 0.3
X2 0 0 1 0 6 5 -5 6
Basic Vars. Z X1 X2 S1 A1 S2 A2 RHS
Z -1 0 0 0 0 0
Drop A1, A2 X1 0 1 0 0 -5 6
S1 0 0 0 1 1 0.3
X2 0 0 1 0 5 6
36
Two phase method
This graph shows the sequence of Coner Point Feasible solutions for
phase 1 (0, 1, 2, 3) and then for phase 2 ([0] ,[1])
2/28/22 37
Four Special cases in Simplex method
1. Degeneracy
2. Alternative optimal
3. Unbounded solution
4. Infeasible solution
2/28/22 38
Four Special cases in Simplex method
q Degeneracy:
§ It is situation when the solution of the problem degenerates.
q Degenerate Solution:
§ A Solution of the problem is said to be degenerate solution if
value or values of basic variable(s) become zero
§ It occurs due to redundant constraints.
2/28/22 39
Four Special cases in Simplex method
q Degeneracy
§ This is in itself not a problem, but making simplex iterations
form a degenerate solution, give rise to cycling, meaning that
after a certain number of iterations without improvement in
objective value the method may turn back to the point where it
started.
2/28/22 40
Four Special cases in Simplex method
q Degeneracy
§ Max Z = 3x1 + 9x2
§ Subject to:
x1 + 4x2 ≤ 8
X1 + 2x2 ≤ 4
X1, x2 ≥ 0
2/28/22 41
Four Special cases in Simplex method
The solution:
Step 1: Write inequalities in equation form
Let s1 and s2 be the slack variables
x1 + 4x2 + s1= 8
x1 + 2x2 + s2= 4
x1, x2 ,s1,s2≥ 0
Let x1=0, x2=0
Z=0, s1=8, s2=4
2/28/22 42
Four Special cases in Simplex method
Basis X1 X2 S1 S2 RHS
Z 0 0 3/2 3/2 18
X2 0 1 1/2 -1/2 2
X1 1 0 -1 2 0
Same objective function no change and
improvement ( cycle)
2/28/22 45
Four Special cases in Simplex method
Feasible
Region
2/28/22 46
Four Special cases in Simplex method
q Alternative optimal:
§ Z-row value for one or more non basic variables is 0 in the
optimal tableau
§ When the objective function is parallel to a binding constraint,
objective function will assume same optimal value.
2/28/22 47
Four Special cases in Simplex method
Example:
Max Z= 2x1+ 4 x2
ST
x1 + 2x2 ≤ 5
x1 + x2 ≤ 4
x1, x2 ≥0
2/28/22 48
Four Special cases in Simplex method
The solution
Max Z=2x1+ 4x2
Let S1and S2 be the slack variables
x1 + 2x2 + s1= 5
x1 + x2 + s2 = 4
x1, x2, s1, s2 ≥0
Initial solution
Let x1 = 0, x2 = 0,
2/28/22
Z=0, s = 5, s = 4 49
Four Special cases in Simplex method
Leaving Variable
2/28/22 50
Four Special cases in Simplex method
2/28/22 51
Four Special cases in Simplex method
Z 0 0 2 0 10
X2 1/2 1 1/2 0 5/2 5
S2 1/2 0 -1/2 1 3/2 3
The coefficient of x1 =0 that x1 can enter the basic solution without changing the
value of Z.
Optimal sol. Z=10 , x1=0, x2=5/2
2/28/22 52
Four Special cases in Simplex method
2/28/22 53
Four Special cases in Simplex method
Objective Function
2/28/22 54
Four Special cases in Simplex method
q Unbounded Solution
§ When determining the leaving variable of any tableau, if there
is no positive ratio (all the entries in the pivot column are
negative and undefined), then the solution is unbounded.
2/28/22 55
Four Special cases in Simplex method
Unbounded Solution
q Example
q Max Z= 2x1+ x2
Subject to
x1 – x2 ≤10
2x1 ≤ 40
x1, x2≥0
2/28/22 56
Four Special cases in Simplex method
Unbounded Solution
Max 2x1+ x2
Let S1 and S2 be the slack variables
x1 – x2 +s1 =10
2x1+0x2 + s2 =40
x1, x2,s1,s2 ≥0
Initial Solution: x1 = 0, x2=0,
Z=0, s1 =10, s2 =40
2/28/22 57
Four Special cases in Simplex method
Unbounded Solution
58
2/28/22 58
Four Special cases in Simplex method
Unbounded Solution
59
2/28/22 59
Four Special cases in Simplex method
q Unbounded
Basis X1 X2 S1 S2 RHS Ratio
Z 0 0 -3 3/2 50
X1 1 0 0 ½ 20 -
X2 0 1 -1 1/2 10 -
60
2/28/22 60
Four Special cases in Simplex method
Unbounded Solution
Objective function
Unbounded
Solution
Space
2x1 ≤ 40
Optimal Point
2/28/22 61
Four Special cases in Simplex method
q Infeasible Solution:
§ No feasible optimal solution is available.
§ Constraints are conflicting.
§ An artificial variable still remains in the final tableau
2/28/22 62
Four Special cases in Simplex method
q Infeasible Solution:
MAX Z= 2x1 + 6x2
s. t.
4x1 + 3x2 < 12
2x1 + x2 > 8
x1, x2 >= 0
2/28/22 63
q Infeasible Solution:
Four Special cases in Simplex method
x1 x2 s1 s2 A1 RHS
Z -2-2M 6-M 0 M 0 -8M
S1 4 3 1 0 0 12
A1 2 1 0 -1 1 8
x1 x2 s1 s2 A1 RHS
Z 0 15/2+ 1/2M 1/2+1/2M M 0 6-2M
S1 1 3/4 1/4 0 0 3
A1 0 1/2 -1/2 -1 1 2
x2
2x1 + 6x2 =Z
x1
2/28/22 65