Programming Problems Using The Simplex Method 2
Programming Problems Using The Simplex Method 2
Programming Problems
The Simplex Method (PART 2 )
Mohammed Brahimi
ENSIA/Intelligent Systems Enginnering
Two-Phase method
Infeasibility
Unboundedness
Alternative Optima
Sensitivity Analysis
2/39
Key Takeaways from Last Lecture
• Simplex is an efficient algorithm for finding optimal solutions to LP problems by
navigating through the corner points of the feasible region.
• It iteratively moves from one Basic Feasible Solution (BFS) to a better neighborhood
BFS until the optimal BFS is reached.
• By detecting the optimal BFS, the simplex method provides the optimal values of
the decision variables and the objective function.
3/39
Questions Regarding Simplex
• How can we choose an appropriate initial BFS if the origin is not a basic feasible
solution (BFS)?
4/39
Questions Regarding Simplex
• How can we choose an appropriate initial BFS if the origin is not a basic feasible
solution (BFS)?
• What are the special cases that may arise when using Simplex?
4/39
Questions Regarding Simplex
• How can we choose an appropriate initial BFS if the origin is not a basic feasible
solution (BFS)?
• What are the special cases that may arise when using Simplex?
4/39
Artificial starting solution
• LPs where all constraints are of the form ”≤” with nonnegative right-hand sides can
be conveniently started with an all-slack basic feasible solution.
• Select ”all-slack” variables as basic variables to create an initial basic feasible
solution (BFS).
∑
n
S1 = b1 + a1i xi
i=m+1
..
.
∑
n
Sm = bm + ami xi
i=m+1
5/39
Artificial starting solution
• If LPs involves constraints of the form ”≥” or ”=” do not have this convenient
starting solution.
• This ”ill-behaved” LPs, artificial variables should be used to find an initial BFS that
we can start with.
Maximize 3x + 9 y
Subject to x+y ≤3
5x − y ≥ 3
y ≥1
6/39
Two-Phase method
Maximize c1 x1 + c2 x2 + · · · + cn xn
Subject to a11 x1 + a12 x2 + · · · + a1n xn = b1
a21 x1 + a22 x2 + · · · + a2n xn = b2
..
.
am1 x1 + am2 x2 + · · · + amn xn = bm
x1 , x2 , . . . , xn ≥0
7/39
Two-Phase method
Minimize R1 + R2 + · · · + Rm
Subject to a11 x1 + a12 x2 + · · · + a1n xn + R1 = b1
a21 x1 + a22 x2 + · · · + a2n xn + R2 = b2
..
.
am1 x1 + am2 x2 + · · · + amn xn + Rm = bm
• Feasible if the objective value reaches 0.
• All the Ri are zeros.
• I have a BFS without the Ri .
7/39
Example: The Standard form (Phase 1)
Maximize z = 3 x + 9y
Subject to x + y ≤ 3
5 x − y ≥ 3
y ≥ 1
8/39
Example: The Standard form (Phase 1)
Maximize z = 3 x + 9y
Subject to x + y + S1 = 3
5 x − y − S2 = 3
y − S3 = 1
8/39
Example: Two-Phase method (Phase 1)
Minimize z = R1 + R2 + R3
Subject to x + y + S1 + R1 = 3
5x − y − S2 + R2 = 3
y − S3 + R3 = 1
9/39
Example: Two-Phase method (Phase 1)
Basic x y S1 S2 S3 R1 R2 R3 RHS Ratio
z 0 0 0 0 0 -1 -1 -1 0
R1 1 1 1 0 0 1 0 0 3
R2 5 -1 0 -1 0 0 1 0 3
R3 0 1 0 0 -1 0 0 1 1
9/39
Example: Two-Phase method (Phase 1)
Basic x y S1 S2 S3 R1 R2 R3 RHS Ratio
z 6 1 1 -1 -1 0 0 0 7
R1 1 1 1 0 0 1 0 0 3
R2 5 -1 0 -1 0 0 1 0 3
R3 0 1 0 0 -1 0 0 1 1
9/39
Example: Two-Phase method (Phase 1)
Basic x y S1 S2 S3 R1 R2 R3 RHS Ratio
z 5 0 0 -1 -1 -1 0 0 4
S1 1 1 1 0 0 1 0 0 3 3
R2 5 -1 0 -1 0 0 1 0 3 3/5
R3 0 1 0 0 -1 0 0 1 1
9/39
Example: Two-Phase method (Phase 1)
Basic x y S1 S2 S3 R1 R2 R3 RHS Ratio
z 0 1 0 0 -1 -1 -1 0 1
S1 0 6/5 1 1/5 0 1 -1/5 0 12/5 2
x 1 -1/5 0 -1/5 0 0 1/5 0 3/5
R3 0 1 0 0 -1 0 0 1 1 1
9/39
Example: Two-Phase method (Phase 1)
Basic x y S1 S2 S3 R1 R2 R3 RHS Ratio
z 0 0 0 0 0 -1 -1 -1 0
S1 0 0 1 1/5 6/5 1 - 1/5 -6/5 6/5
x 1 0 0 -1/5 -1/5 0 1/5 1/5 4/5
y 0 1 0 0 -1 0 0 1 1
9/39
Example: Two-Phase method (Phase 2)
Maximize z = 3 x + 9 y
6 1 6
Subject to S1 = + S2 + S3
5 5 5
4 1 1
x = − S2 − S3
5 5 5
y = 1 − S3
10/39
3
x + y <= 3
5x - y >= 3
y >= 1
2
y
0
0 1 2 3
x
11/39
Example: Two-Phase method (Phase 2)
Basic x y S1 S2 S3 RHS Ratio
z -3 -9 0 0 0 0
S1 0 0 1 1/5 6/5 6/5
x 1 0 0 -1/5 -1/5 4/5
y 0 1 0 0 -1 1
12/39
Example: Two-Phase method (Phase 2)
Basic x y S1 S2 S3 RHS Ratio
z 0.00 0.00 0.00 -3/5 -48/5 57/5
S1 0.00 0.00 1.00 1/5 6/5 6/5
x 1 0 0 -1/5 -1/5 4/5
y 0 1 0 0 -1 1
12/39
Example: Two-Phase method (Phase 2)
Basic x y S1 S2 S3 RHS Ratio
z 0.00 0.00 8.00 1.00 0.00 21.00
S3 0 0 5/6 1/6 1 1
x 1 0 1/6 -1/6 0 1
y 0 1 5/6 1/6 0 2
12/39
3
x + y <= 3
5x - y >= 3
y >= 1
2
y
0
0 1 2 3
x
13/39
Simplex: Special cases
• Infeasibility: occurs when there is no feasible solution that satisfies all of the
constraints.
• Alternative Optima: occurs when several global optima with same objective value
exists.
• Degeneracy: occurs when one or more basic variables become zero during the
iteration process.
14/39
Special cases:Infeasibility
• Empty feasible region.
Maximize z = 2x1 − 3x2
• Can be detected using
S.t. x1 + x2 ≤ 2
Two-Phase method.
∑ 2x1 − 2x2 ≥ 5
• The objective function ( Ri ) in x1 , x2 ≥ 0
Phase 1 cannot be 0.
15/39
Special cases:Unboundedness
• Unbounded solutions allow for arbitrary increases in variables without violating
any constraints.
Maximize z = 2 x1 + x2
S.t x1 − x2 ≤ 10
2 x1 ≤ 40
x1 , x2 ≥ 0
16/39
Special cases:Unboundedness
Maximize z = 2 x1 + x2
S.t x1 − x2 ≤ 10
2 x1 ≤ 40
x1 , x2 ≥ 0
17/39
How to detect Unboundedness
Simplex Method indicates unbounded solutions when all Ratios values
are either infinite or negative, resulting in no leaving variable.
18/39
Special cases: Alternative Optima
• An LP problem may have infinite alternative optima when the objective function is
parallel to a constraint.
• Alternative optima provide different variable combinations with the same optimal
objective value.
Maximize z = 2 x1 + 4 x2
S.t x1 + 2 x2 ≤ 5
x1 + x2 ≤ 4
x1 , x2 ≥ 0
19/39
Special cases: Alternative Optima
Max z =2 x1 + 4x2
S.t x1 + 2x2 ≤5
x1 + x2 ≤4
x1 , x2 ≥0
20/39
Special cases: Alternative Optima
Basic x1 x2 S1 S2 RHS
z -2 -4 0 0 0
S1 1 2 1 0 5
S2 1 1 0 1 4
21/39
Special cases: Alternative Optima
Basic x1 x2 S1 S2 RHS
z 0 0 2 0 10
x2 0.5 1 0.5 0 2.5
S2 0.5 0 -0.5 1 1.5
21/39
Special cases: Degeneracy
• Feasibility condition of simplex method can have ties for minimum ratio.
• Ties can be broken arbitrarily but will result in a degenerate solution in the next
iteration
• Degeneracy can cause the algorithm to cycle indefinitely and not terminate
Maximize z = 3 x1 + 9 x2
S.t x1 + 4 x2 ≤ 8
x1 + 2 x2 ≤ 4
x1 , x2 ≥ 0
22/39
Special cases: Degeneracy
Max z =3 x1 + 9x2
S.t x1 + 4x2 ≤8
x1 + 2x2 ≤4
x1 , x2 ≥0
23/39
Special cases: Degeneracy
24/39
Special cases: Degeneracy
24/39
Special cases: Degeneracy
24/39
Degeneracy interpretation
• Dealing with degeneracy in an LP can create the impression that we are moving
from one corner to another, while keeping the objective value constant.
25/39
Degeneracy can cause cycling
• Cycling happens when the simplex algorithm loops between multiple solutions
without reaching the optimal solution due to degeneracy.
• To prevent cycling, anti-cycling rules, such as Bland’s rule, can be applied to stop
revisiting the same solution and improve the efficiency of the simplex algorithm.
• If there are multiple ratios that are minimal, choose the variable xj with the
smallest index as the entering variable.
26/39
Example of cycling
27/39
Example of cycling
Basic x1 x2 x3 x4 x5 x6 RHS
z -2.3 -2.15 13.55 0.4 0 0 0
x5 0.4 0.2 -1.4 -0.2 1 0 0
x6 -7.8 -1.4 7.8 0.4 0 1 0
28/39
Example of cycling
Basic x1 x2 x3 x4 x5 x6 RHS
z 0 -1 5.5 -0.75 5.75 0 0
x1 1 0.5 -3.5 -0.5 2.5 0 0
x6 0 2.5 -19.5 -3.5 19.5 1 0
28/39
Example of cycling
Basic x1 x2 x3 x4 x5 x6 RHS
z 0 0 -2.3 -2.15 13.55 0.4 0
x1 1 0 0.4 0.2 -1.4 -0.2 0
x2 0 1 -7.8 -1.4 7.8 0.4 0
28/39
Example of cycling
Basic x1 x2 x3 x4 x5 x6 RHS
z 5.75 0 0 -1 5.5 -0.75 0
x3 2.5 0 1 0.5 -3.5 -0.5 0
x6 19.5 1 0 2.5 -19.5 -3.5 0
28/39
Example of cycling
Basic x1 x2 x3 x4 x5 x6 RHS
z 13.55 0.4 0 0 -2.3 -2.15 0
x3 -1.4 -0.2 1 0 0.4 0.2 0
x4 7.8 0.4 0 1 -7.8 -1.4 0
28/39
Example of cycling
Basic x1 x2 x3 x4 x5 x6 RHS
z 5.5 -0.75 5.75 0 0 -1 0
x5 -3.5 -0.5 2.5 0 1 0.5 0
x4 -19.5 -3.5 19.5 1 0 2.5 0
28/39
Example of cycling
Basic x1 x2 x3 x4 x5 x6 RHS
z -2.3 -2.15 13.55 0.4 0 0 0
x5 0.4 0.2 -1.4 -0.2 1 0 0
x4 -7.8 -1.4 7.8 0.4 0 1 0
28/39
Example of cycling
Basic x1 x2 x3 x4 x5 x6 RHS
z -2.3 -2.15 13.55 0.4 0 0 0
x5 0.4 0.2 -1.4 -0.2 1 0 0
x6 -7.8 -1.4 7.8 0.4 0 1 0
Basic x1 x2 x3 x4 x5 x6 RHS
z -2.3 -2.15 13.55 0.4 0 0 0
x5 0.4 0.2 -1.4 -0.2 1 0 0
x4 -7.8 -1.4 7.8 0.4 0 1 0
29/39
Sensitivity Analysis
• Sensitivity analysis (or post-optimality analysis) determines how optimal solutions
are affected by changes within specified ranges.
– Changes in right-hand side (RHS) values.
– Changes in objective function coefficients.
30/39
Sensitivity Analysis
• Sensitivity analysis (or post-optimality analysis) determines how optimal solutions
are affected by changes within specified ranges.
– Changes in right-hand side (RHS) values.
– Changes in objective function coefficients.
30/39
Sensitivity Analysis
• Sensitivity analysis (or post-optimality analysis) determines how optimal solutions
are affected by changes within specified ranges.
– Changes in right-hand side (RHS) values.
– Changes in objective function coefficients.
• Sensitivity analysis is important for managers to ask ”what-if” questions about the
problem.
30/39
Graphical sensitivity Analysis
• We consider two cases:
1. Sensitivity of the optimum solution to changes in the availability of the resources
(right-hand side of the constraints)
2. Sensitivity of the optimum solution to changes in unit profit or unit cost (coefficients of the
objective function)
31/39
Changes in the Right-Hand side
• JOBCO manufactures two products on two machines.
• Processing times and revenues per unit are given as follows:
– Product 1: 2 hrs on machine 1, 1 hr on machine 2, $30 revenue per unit.
32/39
Changes in the Right-Hand side
• JOBCO manufactures two products on two machines.
• Processing times and revenues per unit are given as follows:
– Product 1: 2 hrs on machine 1, 1 hr on machine 2, $30 revenue per unit.
– Product 2: 1 hr on machine 1, 3 hrs on machine 2, $20 revenue per unit
32/39
Changes in the Right-Hand side
• JOBCO manufactures two products on two machines.
• Processing times and revenues per unit are given as follows:
– Product 1: 2 hrs on machine 1, 1 hr on machine 2, $30 revenue per unit.
– Product 2: 1 hr on machine 1, 3 hrs on machine 2, $20 revenue per unit
32/39
Changes in the Right-Hand side
• JOBCO manufactures two products on two machines.
• Processing times and revenues per unit are given as follows:
– Product 1: 2 hrs on machine 1, 1 hr on machine 2, $30 revenue per unit.
– Product 2: 1 hr on machine 1, 3 hrs on machine 2, $20 revenue per unit
Maximize z = 30 x1 + 20 x2
S.t 2 x1 + x2 ≤ 8
x1 + 3 x2 ≤ 8
x1 , x2 ≥ 0
32/39
Changes in the Right-Hand side
$142−$128
• 9−8 = $14 \hour
33/39
Dual Prices
• The dual price is the rate of change of the objective function per unit change of a
resource.
• The dual price of $14/hr remains valid for changes in machine 1 capacity that move
its constraint parallel to itself to any point on the line segment BF.
• The dual price is only valid in the feasibility range (2.67 hr ≤ Machine 1 capacity ≤
16 hr), as calculated at points B and F.
• Changes outside this range produce a different dual price (worth per unit).
34/39
Changes in the RHS questions
• Question 1: If JOBCO can increase the capacity of both machines, which machine
should receive priority?
35/39
Changes in the RHS questions
• Question 1: If JOBCO can increase the capacity of both machines, which machine
should receive priority?
35/39
Changes in the RHS questions
• Question 1: If JOBCO can increase the capacity of both machines, which machine
should receive priority?
35/39
Changes in the RHS questions
• Question 1: If JOBCO can increase the capacity of both machines, which machine
should receive priority?
35/39
Changes in the RHS questions
• Question 3: If the capacity of machine 1 is increased from 8 to 13 hrs, how will this
increase impact the optimum revenue?
36/39
Changes in the RHS questions
• Question 3: If the capacity of machine 1 is increased from 8 to 13 hrs, how will this
increase impact the optimum revenue?
• Response: The proposed increase falls within the feasibility range for machine 1
and will result in a $14(13 - 8) =$70 increase in revenue, from $128 to $198 ( =$128
+ $70).
36/39
Changes in the RHS questions
• Question 3: If the capacity of machine 1 is increased from 8 to 13 hrs, how will this
increase impact the optimum revenue?
• Response: The proposed increase falls within the feasibility range for machine 1
and will result in a $14(13 - 8) =$70 increase in revenue, from $128 to $198 ( =$128
+ $70).
• Question 4: Suppose that the capacity of machine 1 is increased to 20 hrs, how will
this increase affect the optimum revenue?
36/39
Changes in the RHS questions
• Question 3: If the capacity of machine 1 is increased from 8 to 13 hrs, how will this
increase impact the optimum revenue?
• Response: The proposed increase falls within the feasibility range for machine 1
and will result in a $14(13 - 8) =$70 increase in revenue, from $128 to $198 ( =$128
+ $70).
• Question 4: Suppose that the capacity of machine 1 is increased to 20 hrs, how will
this increase affect the optimum revenue?
• Response: The proposed increase falls outside the feasibility range, and further
calculations are needed to determine the impact on optimum revenue.
36/39
Objective Coefficient Change
• Maximize z = c1 x1 + c2 x2 .
• How the optimum changes when we
change c1 and c2 .
37/39
Objective Coefficient Change
• Maximize z = c1 x1 + c2 x2 .
• How the optimum changes when we
change c1 and c2 .
• Changes in objective coefficients change
the slope of the isoprofit.
37/39
Objective Coefficient Change
• Maximize z = c1 x1 + c2 x2 .
• How the optimum changes when we
change c1 and c2 .
• Changes in objective coefficients change
the slope of the isoprofit.
• Optimum at C remains if objective
function is between BF and DE.
37/39
Objective Coefficient Change
• Maximize z = c1 x1 + c2 x2 .
• How the optimum changes when we
change c1 and c2 .
• Changes in objective coefficients change
the slope of the isoprofit.
• Optimum at C remains if objective
function is between BF and DE.
• Optimality range for coefficients
keeping optimum at C: 31 ≤ cc1 ≤ 21 .
2
37/39
Objective Coefficient Change questions
• Question 1: If unit revenues for Products 1 and 2 are changed to $35 and $25,
respectively, will the current optimum remain the same?
c1 35
• The solution at C will remain optimal because c2
= 25 = 1.4 remains within the
optimality range ( 13 , 2).
• Question 2: If the unit revenue of Product 2 is fixed at its current value c2 = $20,
what is the associated optimality range for the unit revenue for Product 1, c1 , that
will keep the optimum unchanged?
38/39
Conclusion
To sum up, we have covered the following key points:
• The two-phase method provides a viable approach for finding an initial feasible
solution for the Simplex method.
• While executing Simplex, one must consider its numerous special cases such as
degeneracy, unboundedness, and infeasibility to prevent potential issues.
39/39