You are on page 1of 30

Simplex Method and Duality

IEDA 3010 Tutorial 05


Chen Yang
Outline
• Review
▪ Simplex Method
▪ Duality

• Example problems
▪ Tabular simplex
▪ Primal and dual problem formulation
Geometry of Simplex Method
• Adjacent Corner-Point Feasible (CPF) Solution
▪ Corner-point feasible solutions (Extreme points)
▪ Corner-point infeasible solutions

▪ Adjacent CPF solutions (“neighbors”)


▪ Optimality test: If a CPF has no better
“neighbors”, it is an optimal solution.
Simplex Method
• Terms in Simplex Method
▪ Slack variables:
e.g. 𝑥1 ≤ 4 -> 𝑥1 + 𝑥3 = 4 , where 𝑥3 is the slack variable

▪ Augmented form
▪ Augmented solution
▪ Basic solution:
augmented corner-point solution
▪ Basic feasible (BF) solution:
augmented CPF solution

▪ Non-basic variable and Basic variable


Simplex Method
• Tabular Form of Simplex Method
Tabular Form of Simplex Method
1) Initialization: convert form, select original variables as non-basic variables, and set their value to 0

2) Optimality Test:
1) If any coefficients in row (0) are negative, go to next step
2) If all coefficients in row (0) are non-negative,
the current BF solution is optimal and stop.

3) Select Entering Basic Variable:


Choose a variable with the most negative coefficient

4) Select Leaving Basic Variable:


1) Select the positive coefficient in pivot column
2) divide right side by the corresponding coefficient
3) select the row with the minimal ratio

5) Solve the new BF solution:


Divide the pivot row by pivot number. Transform other coefficients in pivot column to 0.
Back to step 2)
Problem 1
Describe graphically what the simplex method does step by step to
solve the following problem.

max 𝑍 = 2𝑥1 + 3𝑥2


s.t. −3𝑥1 + 𝑥2 ≤ 1
4𝑥1 + 2𝑥2 ≤ 20
4𝑥1 − 𝑥2 ≤ 10
−𝑥1 − 2𝑥2 ≤5
𝑥1, 𝑥2 ≥ 0
Solution
max 𝑍 = 2𝑥1 + 3𝑥2 x2 (3)
(1) (2)
s.t. −3𝑥1 + 𝑥2 ≤ 1 (1) (3,4)
(4)
4𝑥1 + 2𝑥2 ≤ 20 (2)
4𝑥1 − 𝑥2 ≤ 10 (3) (0.6,2.8)

−𝑥1 + 2𝑥2 ≤ 5 (4) (3.33,3.33)


𝑥1, 𝑥2 ≥ 0
(0,1)

(0,0) x1

(2.5,0)
Problem 2
Work through the simplex method step by step (in tabular form) to
solve the following problem.
max 𝑍 = 2𝑥1 − 𝑥2 + 𝑥3
s.t. 3𝑥1 + 𝑥2 + 𝑥3 ≤ 6
𝑥1 − 𝑥2 + 2𝑥3 ≤ 1
𝑥1 + 𝑥2 − 𝑥3 ≤ 2
𝑥1 , 𝑥2 , 𝑥3 ≥ 0
Problem 2 (solution)
max 𝑍 = 2𝑥1 − 𝑥2 + 𝑥3 Z - 2𝑥1 + 𝑥2 - 𝑥3 = 0 (0)
s.t. 3𝑥1 + 𝑥2 + 𝑥3 ≤ 6 3𝑥1 + 𝑥2 + 𝑥3 + 𝑥4 = 6 (1)
𝑥1 − 𝑥2 + 2𝑥3 ≤ 1 𝑥1 - 𝑥2 + 2𝑥3 + 𝑥5 = 1 (2)
𝑥1 + 𝑥2 − 𝑥3 ≤ 2 𝑥1 + 𝑥2 - 𝑥3 + 𝑥6 = 2
𝑥1 , 𝑥2 , 𝑥3 ≥ 0 𝑥1 , 𝑥2 , 𝑥3 , 𝑥4 , 𝑥5 , 𝑥6 ≥ 0

Basic Coefficient of Right


Eq.
Var Z 𝑥1 𝑥2 𝑥3 𝑥4 𝑥5 𝑥6 side
Z (0) 1 -2 1 -1 0 0 0 0
𝑥4 (1) 0 3 1 1 1 0 0 6
𝑥5 (2) 0 1 -1 2 0 1 0 1
𝑥6 (3) 0 1 1 -1 0 0 1 2
Problem 2 (solution)
Let 𝑥1 , 𝑥2 , 𝑥3 be the non-basic variables and 𝑥4 , 𝑥5 , 𝑥6 be the basic variables, where
(𝑥1 , 𝑥2 , 𝑥3 , 𝑥4 , 𝑥5 , 𝑥6 ) = (0, 0, 0, 6, 1, 2)

Optimality test: Since not all coefficients in row (0) are nonnegative, the current BF solution
is not optimal.

The coefficient of 𝑥1 is the most negative so we choose 𝑥1 as the entering basic variable.

Basic Coefficient of Right


Eq.
Var Z 𝑥1 𝑥2 𝑥3 𝑥4 𝑥5 𝑥6 side
Z (0) 1 -2 1 -1 0 0 0 0
𝑥4 (1) 0 3 1 1 1 0 0 6
𝑥5 (2) 0 1 -1 2 0 1 0 1
𝑥6 (3) 0 1 1 -1 0 0 1 2
Problem 2 (solution)
Consider the positive coefficient in pivot column. Row (2) has the minimum ratio so we
choose 𝑥5 as the leaving basic variable.

Basic Coefficient of Right


Eq.
Var Z 𝑥1 𝑥2 𝑥3 𝑥4 𝑥5 𝑥6 side
Z (0) 1 -2 1 -1 0 0 0 0
𝑥4 (1) 0 3 1 1 1 0 0 6 (2)
𝑥5 (2) 0 1 -1 2 0 1 0 1 (1)
𝑥6 (3) 0 1 1 -1 0 0 1 2 (2)
Problem 2 (solution)
Solve for the new BF solution:
1) Divide pivot row by pivot number and 2) transform other numbers in pivot column to 0.
By the elementary algebra operations: new (2) = (2)
new (0) = (0) + 2*(2)
new (1) = (1) – 3*(2)
new (3) = (3) – (2)

Basic Coefficient of Right


Eq.
Var Z 𝑥1 𝑥2 𝑥3 𝑥4 𝑥5 𝑥6 side
Z (0) 1 -2 1 -1 0 0 0 0
𝑥4 (1) 0 3 1 1 1 0 0 6
𝑥5 (2) 0 1 -1 2 0 1 0 1
𝑥6 (3) 0 1 1 -1 0 0 1 2
Z (0) 1 0 -1 3 0 2 0 2
𝑥4 (1) 0 0 4 -5 1 -3 0 3
𝑥1 (2) 0 1 -1 2 0 1 0 1
𝑥6 (3) 0 0 2 -3 0 -1 1 1
Problem 2 (solution)
Select 𝑥2 , 𝑥3 , 𝑥5 to be the non-basic variables and 𝑥1 , 𝑥4 , 𝑥6 to be the basic variables, where
(𝑥1 , 𝑥2 , 𝑥3 , 𝑥4 , 𝑥5 , 𝑥6 ) = (1, 0, 0, 3, 0, 1)

Optimality test: Since not all coefficients in row (0) are nonnegative, the current BF solution
is not optimal.

The coefficient of 𝑥2 is the most negative so we choose 𝑥2 as the entering basic variable.

Basic Coefficient of Right


Eq.
Var Z 𝑥1 𝑥2 𝑥3 𝑥4 𝑥5 𝑥6 side
Z (0) 1 0 -1 3 0 2 0 2
𝑥4 (1) 0 0 4 -5 1 -3 0 3
𝑥1 (2) 0 1 -1 2 0 1 0 1
𝑥6 (3) 0 0 2 -3 0 -1 1 1
Problem 2 (solution)
Consider the positive coefficient in pivot column. Row (3) has the minimum ratio so we
choose 𝑥6 as the leaving basic variable.

Basic Coefficient of Right


Eq.
Var Z 𝑥1 𝑥2 𝑥3 𝑥4 𝑥5 𝑥6 side
Z (0) 1 0 -1 3 0 2 0 2
𝑥4 (1) 0 0 4 -5 1 -3 0 3 (0.75)
𝑥1 (2) 0 1 -1 2 0 1 0 1
𝑥6 (3) 0 0 2 -3 0 -1 1 1 (0.5)
Problem 2 (solution)
Solve for the new BF solution:
1) Divide pivot row by pivot number and 2) transform other numbers in pivot column to 0.
By the elementary algebra operations: new (3) = 0.5*(3)
new (0) = (0) + 0.5*(3)
new (1) = (1) – 2*(3)
new (2) = (2) + 0.5*(3)

Basic Coefficient of Right


Eq.
Var Z 𝑥1 𝑥2 𝑥3 𝑥4 𝑥5 𝑥6 side
Z (0) 1 0 -1 3 0 2 0 2
𝑥4 (1) 0 0 4 -5 1 -3 0 3
𝑥1 (2) 0 1 -1 2 0 1 0 1
𝑥6 (3) 0 0 2 -3 0 -1 1 1
Z (0) 1 0 0 1.5 0 1.5 0.5 2.5
𝑥4 (1) 0 0 0 1 1 -1 -2 1
𝑥1 (2) 0 1 0 0.5 0 0.5 0.5 1.5
𝑥2 (3) 0 0 1 -1.5 0 -0.5 0.5 0.5
Problem 2 (solution)
Select 𝑥3 , 𝑥5 , 𝑥6 to be the non-basic variables and 𝑥1 , 𝑥2 , 𝑥4 to be the basic variables, where
(𝑥1 , 𝑥2 , 𝑥3 , 𝑥4 , 𝑥5 , 𝑥6 ) = (1.5, 0.5, 0, 1, 0, 0)

Optimality test: Since all coefficients in row (0) are nonnegative, the current BF solution is
optimal.

(𝑥1∗ , 𝑥2∗ , 𝑥3∗ ) = (1.5, 0.5, 0) , 𝑍 ∗ = 2.5

Basic Coefficient of Right


Eq.
Var Z 𝑥1 𝑥2 𝑥3 𝑥4 𝑥5 𝑥6 side
Z (0) 1 0 0 1.5 0 1.5 0.5 2.5
𝑥4 (1) 0 0 0 1 1 -1 -2 1
𝑥1 (2) 0 1 0 0.5 0 0.5 0.5 1.5
𝑥2 (3) 0 0 1 -1.5 0 -0.5 0.5 0.5
Dual Problem Review
• Primal-Dual Formulation
Dual Problem Review
• Primal-Dual Relationships
▪ Weak duality:
If x is a feasible solution in the primal problem; y is a feasible solution in the dual problem, then
𝑛 𝑚

𝑐𝑥 ≤ 𝑦𝑏 , 𝑖. 𝑒. ෍ 𝑐𝑗 𝑥𝑗 ≤ ෍ 𝑏𝑖 𝑦𝑖
𝑗=1 𝑖=1

▪ Strong duality:
If x* is an optimal solution in the primal problem;𝑛y* is an optimal
𝑚
solution in the dual problem, then
𝑐𝑥 ∗ = 𝑦 ∗ 𝑏 , 𝑖. 𝑒. ෍ 𝑐𝑗 𝑥𝑗∗ = ෍ 𝑏𝑖 𝑦𝑖∗
𝑗=1 𝑖=1

▪ Duality theorem:
o One has feasible solution + bounded objective function -> the other also have
o One has feasible solution + unbounded objective function -> the other has no feasible solution
o One has no feasible solution -> the other has no feasible solution/unbounded objective function
Dual Problem Review

One is feasible and bounded, so is the other.


One is infeasible; the other is infeasible or unbounded.
One is unbounded; the other is infeasible.
Dual Problem Review
• Economic Interpretation
▪ The optimal solution for dual problem is called shadow prices, i.e. the
marginal value of the resources.

▪ The non-binding constraints always have 0 optimal value for the


corresponding dual variable because they have 0 shadow price.
Write the Dual
Write dual from primal
• Represent the dual variables
• Exchange 𝑏 and 𝑐 Relations of sign of primal and dual

• Determine the sign


• Transpose 𝑎
Write the Dual
Example 3
Consider the following LP problem:

max 𝑍 = 𝑥1 + 2𝑥2
s.t. −𝑥1 + 𝑥2 ≤ −2
4𝑥1 + 𝑥2 ≤ 4
𝑥1, 𝑥2 ≥ 0

a) Demonstrate graphically that this problem has no feasible solutions.


b) Construct the dual problem.
c) Demonstrate graphically that the dual problem has an unbounded objective function.
Solution
x2

max 𝑍 = 𝑥1 + 2𝑥2
s.t. −𝑥1 + 𝑥2 ≤ −2 (1) (1)

4𝑥1 + 𝑥2 ≤ 4 (2)
𝑥1, 𝑥2 ≥ 0 x1

(2)
a) Since there is no feasible region from the
constraint, there is no feasible solutions
for this problem.
Solution
b) The corresponding dual problem.

max 𝑍 = 𝑥1 + 2𝑥2 min 𝑊 = −2𝑦1 + 4𝑦2


s.t. −𝑥1 + 𝑥2 ≤ −2 s.t. −𝑦1 + 4𝑦2 ≥ 1
4𝑥1 + 𝑥2 ≤ 4 𝑦1 + 𝑦2 ≥ 2
𝑥1, 𝑥2 ≥ 0 𝑦1, 𝑦2 ≥ 0
Solution 𝑦2

min 𝑊 = −2𝑦1 + 4𝑦2


(2)
s.t. −𝑦1 + 4𝑦2 ≥ 1 (1)
𝑦1 + 𝑦2 ≥ 2 (2)
(1)
𝑦1, 𝑦2 ≥ 0
𝑦1

c) When we drag the objective line right,


the objective value decreases. We can
drag as right as possible, so the objective
function value is unbounded. Duality theorem: If one problem
has no feasible solutions, then
the other problem has either no
feasible solutions or an
unbounded objective function.
Example 4
Consider the following problem
max 𝑍 = 2𝑥1 + 𝑥2 + 𝑥3
s.t. 3𝑥1 + 𝑥2 + 𝑥3 ≤ 6
𝑥1 − 𝑥2 + 2𝑥3 ≤ 1
𝑥1 + 𝑥2 − 𝑥3 ≤ 2
𝑥1 , 𝑥2 , 𝑥3 ≤ 0

(a) What is the dual problem.


(b) What is the dual of the dual problem. Is it the same as the primal?
Solution
(a)

max 𝑍 = 2𝑥1 + 𝑥2 + 𝑥3 min 𝑊 = 6𝑦1 + 𝑦2 + 2𝑦3


s.t. 3𝑥1 + 𝑥2 + 𝑥3 ≤ 6 s.t. 3𝑦1 + 𝑦2 + 𝑦3 ≤ 2
𝑥1 − 𝑥2 + 2𝑥3 ≤ 1 𝑦1 − 𝑦2 + 𝑦3 ≤ 1
𝑥1 + 𝑥2 − 𝑥3 ≤ 2 𝑦1 + 2𝑦2 − 𝑦3 ≤ 1
𝑥1 , 𝑥2 , 𝑥3 ≤ 0 𝑦1 , 𝑦2 , 𝑦3 ≥ 0
max 𝑍 = 2𝑥1 + 𝑥2 + 𝑥3
s.t. 3𝑥1 + 𝑥2 + 𝑥3 ≤ 6
Solution 𝑥1 − 𝑥2 + 2𝑥3 ≤ 1
𝑥1 + 𝑥2 − 𝑥3 ≤ 2
(b)
𝑥1 , 𝑥2 , 𝑥3 ≤ 0

min 𝑊 = 6𝑦1 + 𝑦2 + 2𝑦3 max 2𝑧1 + 𝑧2 + 𝑧3


s.t. 3𝑦1 + 𝑦2 + 𝑦3 ≤ 2 s.t. 3𝑧1 + 𝑧2 + 𝑧3 ≤ 6
𝑦1 − 𝑦2 + 𝑦3 ≤ 1 𝑧1 − 𝑧2 + 2𝑧3 ≤ 1
𝑦1 + 2𝑦2 − 𝑦3 ≤ 1 𝑧1 + 𝑧2 − 𝑧3 ≤ 2
𝑦1 , 𝑦2 , 𝑦3 ≥ 0 𝑧1 , 𝑧2 , 𝑧3 ≤ 0

You might also like