Dual
Dual
Method
Eng. Shimaa Abouelenein
Agenda
2
Solving a Minimization Problem by Simplex Method (1/6)
Example (All constrains are <=)
Solve the following problem using the simplex method,
Minimize :
Z = 2X1 - 2X2 - 6X
Subject to:
- 8X1 + 4X2 - 2X3 <= 4
4X1 - 2X2 - 2X3 <= 2
6X1 + 2X3 <= 10
X1, X2, X3 >= 0
3
Solving a Minimization Problem by Simplex Method (2/6)
Solution:
Adding slack variables, the problem becomes:
Minimize :
Z - 2X1 + 2X2 + 6X3 = 0
Subject to:
- 8X1 + 4X2 - 2X3 + S1 =4
4X1 - 2X2 - 2X3 + S2 =2
6X1 + 2X3 + S3 = 10
X1, X2, X3, S1, S2, S3 >= 0
4
Solving a Minimization Problem by Simplex Method (3/6)
Solution:
Initialization (Initial Table)
Entering
variable
Basic X1 X2 X3 S1 S2 S3 RHS
Variables
Z -2 2 6 0 0 0 0
S1 -8 4 -2 1 0 0 4
S2 4 -2 -2 0 1 0 2
Pivot row
S3 6 0 2 0 0 1 10
Leaving
variable Pivot value
Pivot column
5
Solving a Minimization Problem by Simplex Method (4/6)
Note that:
• Pivot row: the most positive value in Z-row.
• Pivot column: divide the solution column values by the corresponding pivot
column values then determine the row which has the smallest value greater
than zero.
• By investigating the first row (Z-row) of the initial table, we find that there are
some positive values. Therefore, the current solution is not optimal.
6
Solving a Minimization Problem by Simplex Method (5/6)
Solution:
The solution is not optimal, since there is a positive values in the Z-row (2).
Basic X1 X2 X3 S1 S2 S3 RHS
Variables
Z -20 2 0 0 0 -3 -30
S1 -2 4 0 1 0 1 14
S2 10 -2 0 0 0 1 12
X3 3 0 1 0 0 1/2 5
Note that X3 becomes in the The most positive value is 2; The smallest ratio is 14/4
basic variables list instead of therefore, X2 is the entering = 3.5; therefore, S1 is the
S3 variable leaving variable
7
Solving a Minimization Problem by Simplex Method (6/6)
Solution:
Apply the same rules, we will obtain this solution:
Basic X1 X2 X3 X4 S1 S2 RHS
Variables
Z -19 0 0 -1/2 0 -7/2 -37
X2 -1/2 1 0 1/4 0 1 7/2
S2 9 0 0 1/2 0 1/2 19
X3 3 0 1 0 0 1/2 5
This solution is optimal; since there is no positive values in the first row (Z-row).
Basic variables are X1 = 0, X2 = 7/2, and X3 = 5
Z = -37
8
Definition of Duality
• The initial problem is known as PRIMAL, and the transpose problem obtained by
transposing row with columns but having the same optimal solution is known as
DUAL.
• Every linear programming model has two forms: the primal and the dual.
• The original form of a linear programming model is called the primal.
• The dual is an alternative model form derived completely form the primal.
• As the dual problem has lesser number of constraints than the primal (ex. 2
instead of 4), it requires lesser work and effort to solve it.
9
Rules of Constructing Duality (1/3)
• For every primal constraint, there is a dual variable.
• For every primal variable, there is a dual constraint.
• The constraint coefficients of primal variable form the left-hand side coefficients of
the corresponding dual constrain and its objective function coefficient of the same
variable becomes the right-hand side of the dual constraints.
• If the primal objective function is maximize (minimize), then the dual problem is
minimize (maximize).
• If the primal problem is maximize (minimize), then the dual constraints must be
>= (<=).
10
Rules of Constructing Duality (2/3)
The rules summarized in the following table (if the objective is max):
Primal Dual
Constraints >= <= Variables
<= >=
= Unrestricted
Variables >= >= Constraints
<= <=
unrestricted =
Objective Function Max Min
11
Rules of Constructing Duality (3/3)
The rules summarized in the following table (if the objective is min):
Primal Dual
Constraints >= >= Variables
<= <=
= Unrestricted
Variables >= <= Constraints
<= >=
unrestricted =
Objective Function Min Max
12
Examples (1/11)
Ex.1:
Find dual from primal conversion,
Minimize:
Z = 3x1 - 2x2 + 4x3
subject to:
3x1 + 5x2 + 4x3 >= 7
6x1 + x2 + 3x3 >= 4
7x1 - 2x2 - x3 <= 10
x1 - 2x2 + 5x3 >= 3
4x1 + 7x2 - 2x3 >= 2
and x1,x2,x3 >= 0
13
Examples (2/11)
Solution (Ex.1)(1/3) :
Since objective function is minimizing, all ≤ constraints can be converted to ≥ type by
multiplying both sides by -1
Minimize:
Z = 3x1 - 2x2 + 4x3
subject to:
3x1 + 5x2 + 4x3 >= 7 , x1 - 2x2 + 5x3 >= 3 ,
6x1 + x2 + 3x3 >= 4 , 4x1 + 7x2 - 2x3 >= 2 ,
-7x1 + 2x2 + x3 >= -10 , and x1,x2,x3 >= 0.
14
Examples (3/11)
Solution (Ex.1)(2/3) :
• In primal, There are 3 variables and 5 constraints, so in dual there must
be 3 constraints and 5 variables.
• In primal, The coefficient of objective function c1 = 3, c2 = -2, c3 = 4 becomes right
hand side constants in dual.
• In primal, The right-hand side constants b1 = 7, b2 = 4, b3 = -10, b4 = 3, b5 = 2
becomes coefficient of objective function in dual.
• In primal, objective function is minimizing, so in dual objective function must be
maximizing.
• Let y1,y2,y3,y4,y5 be the dual variables.
15
Examples (4/11)
Solution (Ex.1)(3/3) :
Dual is:
Maximize:
Z = 7y1 + 4y2 - 10y3 + 3y4 + 2y5
subject to:
3y1 + 6y2 - 7y3 + y4 + 4y5 <= 3
5y1 + y2 + 2y3 - 2y4 + 7y5 <=-2
4y1 + 3y2 + y3 + 5y4 - 2y5 <= 4
and y1, y2, y3, y4, y5 >= 0
16
Examples (5/11)
Ex.2:
Find dual from primal conversion,
Maximize:
Z = x1 - x2 + 3x3
Subject to:
x1 + x2 + x3 <= 10,
2x1 - x2 - x3 <= 2,
2x1 - 2x2 - 3x3 <= 6,
and x1,x2,x3 >= 0
17
Examples (6/11)
Solution (Ex.2)(1/2) :
• In primal, There are 3 variables and 3 constraints, so in dual there must
be 3 constraints and 3 variables.
• In primal, The coefficient of objective function c1=1,c2=-1,c3=3 becomes right
hand side constants in dual.
• In primal, The right-hand side constants b1=10,b2=2,b3=6 becomes coefficient of
objective function in dual.
• In primal, objective function is maximizing, so in dual objective function must be
minimizing.
• Let y1,y2,y3 be the dual variables.
18
Examples (7/11)
Solution (Ex.2)(2/2):
Dual is:
Minimize:
Z = 10y1 + 2y2 + 6y3
subject to:
y1 + 2y2 + 2y3 >= 1
y1 - y2 - 2y3 >= -1
y1 - y2 - 3y3 >= 3
and y1, y2, y3>= 0
19
Examples (8/11)
Ex.3:
Find dual from primal conversion,
Minimize:
Z = x1 + 2x2
Subject to:
2x1 + 4x2 <= 160,
x1 - x2 = 30,
x1 >= 6,
and x1,x2 >= 0
20
Examples (9/11)
Solution (Ex.1)(1/3):
Since objective function is minimizing, all ≤ constraints (1) can be converted
to ≥ type by multiplying both sides by -1
Minimize:
Z = x1 + 2x2
subject to:
-2x1 - 4x2 >= -160
x1 - x2 = 30
x1 >= 10
and x1, x2 >= 0
21
Examples (10/11)
Solution (Ex.3)(2/3) :
• In primal, There are 2 variables and 3 constraints, so in dual there must
be 2 constraints and 3 variables.
• In primal, The coefficient of objective function c1 = 1, c2 = 2 becomes right-hand
side constants in dual.
• In primal, The right-hand side constants b1 = -160, b2 = 30, b3 = 10 becomes
coefficient of objective function in dual.
• In primal, objective function is minimizing, so in dual objective function must be
maximizing.
• Let y1,y2,y3 be the dual variables.
22
Examples (11/11)
Solution (Ex.3)(3/3):
Dual is:
Maximize:
Z = - 160y1 + 30y2 + 10y3
subject to:
- 2y1 + y2 + y3 <= 1
- 4y1 - y2 <= 2
and y1, y3>=0; y2 unrestricted in sign.
23
Dual Simplex Method (1/10)
Example1:
Solve the following problem using the dual simplex method,
Maximize :
Z = X1 + 4X2 + 3X4
Subject to:
X1 + 2X2 – X3 + X4 >= 3
–2X1 – X2 + 4X3 + X4 >= 2
X1, X2, X3, X4 >= 0
24
Dual Simplex Method (2/10)
Solution:
Putting it in the form (all constrains of the type <=) and adding slack variables, the
problem becomes:
Maximize :
Z - X1 - 4X2 - 3X4 = 0
Subject to:
– X1 – 2X2 + X3 – X4 + S1 = – 3
2X1 + X2 – 4X3 – X4 + S2 = – 2
X1, X2, X3, X4, S1, S2>= 0
25
Dual Simplex Method (3/10)
Solution:
1. Initialization (Initial Table)
Entering
variable
Basic X1 X2 X3 X4 S1 S2 RHS
Variables
Z -1 -4 0 -3 0 0 0
S1 -1 -2 1 -1 1 0 -3
S2 2 1 -4 -1 0 1 -2
27
Dual Simplex Method (5/10)
Solution:
2. Iteration
▪ Determine the entering variable by selecting the smallest absolute value in ratio-row,
therefore, the smallest absolute value is 1. Consequently, X1 is the entering variable.
▪ Determine the leaving variable by selecting the most negative value in the RHS:
Basic X1 X2 X3 X4 S1 S2 RHS
variable (entering var )
Z (1) -1 -4 0 -3 0 0 0
S1 (2) -1 -2 1 -1 1 0 -3
(leaving var)
S2 2 1 -4 -1 0 1 -2
Ratio(1)/(2) 1 2 ignore 3 ignore ignore
28
Dual Simplex Method (6/10)
Solution:
2. Iteration
▪ Solving for new solutions by using the eliminatory row operation as following:
1. New pivot row = Old pivot row / Pivot value
Basic X1 X2 X3 X4 S1 S2 RHS
Variables
Z
X1 1 2 -1 1 -1 0 3
S2
30
Dual Simplex Method (8/10)
Solution:
2. Iteration
▪ For the other row apply this rule:
2. New row = Old row - (the coefficient of the row in the pivot column * (new pivot row)).
For Z:
-1 -4 0 -3 0 0 0
- (-1) 1 2 -1 1 -1 0 3
___________________________
0 -2 -1 -2 -1 0 3
31
Dual Simplex Method (9/10)
Solution:
The solution is not optimal, since there is a negative values in the RHS column (-8).
Basic X1 X2 X3 X4 S1 S2 RHS
Variables
Z 0 -2 -1 -2 -1 0 3
X1 1 2 -1 1 -1 0 3
S2 0 -3 -2 -3 2 1 -8
32
Dual Simplex Method (10/10)
Solution:
Apply the same rules, we will obtain this solution:
Basic X1 X2 X3 X4 S1 S2 RHS
Variables
Z 0 -1/2 0 -1/2 -2 -1/2 7
X1 1 7/2 0 5/2 -2 -1/2 7
X3 0 3/2 1 3/2 -1 -1/2 4
This solution is optimal; since there is no negative value in the last column.
Basic variables are X1 = 7, X2 = 0, X3 = 4 and X4 = 0
Z=7
33
Difference Between Simplex and Dual Simplex
34