Professional Documents
Culture Documents
programming modeling.
1. Introduction models.
• Advertising
• Agriculture
EE 477 Dr. Mohamed Zribi 3 EE 477 Dr. Mohamed Zribi 4
Linear Programming Linear Programming Problems
A linear programming problem is made up of a linear objective
-In mathematics, linear programming (LP) is a technique function and a system of constraints.
for optimization of a linear objective function, subject to
The objective function is an algebraic expression in two or more
linear equality and linear inequality constraints. variables describing a quantity that must be maximized or
minimized.
-Linear programming determines the way to achieve the best
The system of constraints are made up of a system of linear
outcome (such as maximum profit or lowest cost) in a inequalities. In applications, the variables are also limited to
positive values.
given mathematical model and given some list of
requirements represented as linear equations. The solution to the linear programming problem, if it exists, will
occur at the vertices (corner points) of the solution region
obtained from the system of constraints.
EE 477 Dr. Mohamed Zribi 5 EE 477 Dr. Mohamed Zribi 6
Linear programming methods make it possible to choose the best Linear programming (LP) problems are optimization problems
solution from many possible solutions. where the objective function and the constraints of the
problem are all linear.
where the bi 's, ci 's and aij 's are fixed real constants, and the xi 's
are real numbers to be determined.
EE 477 Dr. Mohamed Zribi 9 EE 477 Dr. Mohamed Zribi 10
Objective
Function Maximize (Minimize): Z cT x
Maximize (Minimize): Z c1 x1 c2 x2 c3 x3 ... cn xn
Subject to:
Ax b
Subject to: where,
a11 x1 a12 x2 ... a1n xn b1 x 0
a21 x1 a22 x2 ... a2 n xn b2 b 0 c [c1 c2 . . . cn ]T
Constraint
. . Set
a11 a12 . . . a1n b1 x1
. .
a21 a22 . . . a2 n b2 x2
am1 x1 am 2 x2 ... amn xn bm A b x
Non-negative
x1 0, x2 0,..., xn 0 . . . .
Right-hand side Non-negative
Constants
b1 0, b2 0,..., bm 0 Variables am1 am 2 . . . amn bm xn
EE 477 Dr. Mohamed Zribi Constraint11 EE 477 Dr. Mohamed Zribi
12
Standard Form of an LP Problem Slack Variables
An LP model may include constraints of all types ( , , ). Also the When we transform the equation
variables may be nonnegative or unrestricted in sign. To have a model in
2x1 + 3x2 ≤ 5 to 2x1 + 3x2 + s1 = 5
the standard form, we need to convert the inequalities into equalities.
If the left-hand side (LHS) (2x1 + 3x2) is less than the right-hand
Example 1:
1) Consider the following constraint side (RHS) (5), then s1 will take a positive value to make the
equality true. The nearer the value of the LHS is to the RHS,
This constraint can be written as the smaller the value of s1 is.
x1 2 x2 5
s1 is referred to as slack variable. If the LHS is equal to the RHS, s1 = 0. s1 cannot be negative
because the LHS cannot be greater than the RHS.
x1 2 x2 s1 5 s1 0
EE 477 Dr. Mohamed Zribi 13 EE 477 Dr. Mohamed Zribi 14
The nonnegative numbers s1, s2, and s3 are called For example, the slack at the optimal solution (3, 6):
2(3) + 6 + s1 = 16
slack variables because they represent the “slackness” s1 = 4
in each inequality
Example 4:
Consider:
x1 2 x2 s2 5 s2 0
x
x ≥ 0 [1]
y ≥ 0 [2]
x + y≥ 0
If a linear program is given in standard form except that The maximization of a function is equivalent to the
one (or more) of the variable is not required to be minimization of the negative of the same function,
nonnegative (unrestricted) then the unrestricted and vice versa.
variable can be expressed in terms of two
nonnegative variables using the substitution
max z(x) min -z(x)
x1 x1 x1 x1 , x1 0
1 1 0 0 EE 477 3
Dr. Mohamed Zribi
25
EE 477 Dr. Mohamed Zribi
26
Solution: Example 9:
27 28
EE 477 Dr. Mohamed Zribi EE 477 Dr. Mohamed Zribi
The problem now can be written:
minimize: zb = –x1 – x2
subject to: 2x1 + 3x2 + x3 =6
x1 + 7x2 – x4 = 4 2. Fundamentals of Linear
x 1 + x2 =3
x1 ≥ 0, x2 ≥ 0, x3 ≥ 0, x4 ≥ 0 Programming
2 3 1 0 6 T
b 4 c 1 1 0 0
A 1 7 0 1
1 1 0 0 3
29
EE 477 Dr. Mohamed Zribi EE 477 Dr. Mohamed Zribi 30
Corner point feasible solution (C.P.F.): A corner point Binding: A constraint is binding if the left-hand side and
feasible solution is a solution that lies at the corner of the right-hand side of the constraint are equal when
the optimal values of the decision variables are
the feasible region.
substituted into the constraint.
Relation between optimal solution and corner point
solution :
Unbinding: A constraint is unbinding if the left-hand
– The best C.P.F. solution is a optimal solution.
side and the right-hand side of the constraint are
– If more than one optimal solution, at least two are
unequal when the optimal values of the decision
C.P.F. solutions.
variables are substituted into the constraint.
EE 477 Dr. Mohamed Zribi 33 EE 477 Dr. Mohamed Zribi 34
Good news: We only need to search for the best feasible corner Convex Set Non-Convex Set
point
Bad news: A problem with 50 variables, 100 constraints =>
Good news: We can use some of the properties to guide our S is a convex set if and only if for any two points, x and y,
searching of S, their convex combination, x + (1- )y, for all real
values 0 <= <= 1, is also in S.
EE 477 Dr. Mohamed Zribi 37
37 EE 477 Dr. Mohamed Zribi 38
If we start on a line, we can move along that line in the A basic feasible solution (BFS) is a basic solution where
direction of the objective function until we get to a every x is non-negative
corner A BFS satisfies all of the constraints of the optimization
In fact, for any c vector, the optimum point will always problem
be on a corner
EE 477 Dr. Mohamed Zribi 43 EE 477 Dr. Mohamed Zribi 44
Basic Feasible Solutions Theorem (Equivalence of extreme points
In a n-dimensional space, a BFS is formed by the and basic solutions)
intersection of n equations.
In 2-D:
Let A be an m n matrix of rank m and b an m-vector.
Basic Feasible
Solution Let K be the convex polytope consists of all n-vectors
Constraint 1 x satisfying
Constraint 2
Ax = b
x 0
But, we just saw that an extreme point is also a corner A vector is an extreme point iff x is a basic feasible solution.
point. So, a BFS corresponds to an EP.
xi 0 i 1, 2, ,r
consider basic feasible solutions when seeking an optimal
solution to a linear program because the optimal value is
A local minimum is a global minimum.
always achieved at such a solution. The minimum must lie at the intersection
of several constraints, but not in the interior
EE 477 Dr. Mohamed Zribi 47 of the convex
EE 477region.
Dr. Mohamed Zribi 48
Puting it Together Simplex Method Introduction
We just saw that a basic feasible solution corresponds to an
The simplex method is the most common method for
extreme point.
solving LP problems.
Optimization Equations
Theorem: Remark:
A basic feasible solution is a vertex or corner of the A vertex of a feasible region X is called an extreme point of X.
Formally, xϵX is an extreme point of X if and only if there
feasible region. Conversely, a vertex of a feasible
are no points x1 and x2 in X such that x lies in the line
region is a basic feasible solution.
segment joining x1 and x2.
– Dantzig (1963).
2 x3 x4 3
when the nonbasic variables are x1 and x2, hence the equations
x1 + x 4 + x 5 - x 6 = 5
become x 2 + 2x 4 - 3x 5 + x 6 = 3
x3 2 x4 3
x 3 - x 4 + 2x 5 - x 6 = -1
2 x3 x4 6
Products
4. Motivation of the Resource Regular Premium Resource
Availability
Production
7 m3/ton
10 hr/ton
11 m3/ton
8 hr/ton
77 m3/week
80 hr/week
time
78
EE 477 Dr. Mohamed Zribi 77 EE 477 Dr. Mohamed Zribi
Adding slack variables results in an augmented system of linear To solve an augmented system with
equations which is under specified (has more unknowns than – 6 unknowns (= 2 original variables + 4 slack variables)
equations). – 4 equations
– 6 unknowns (= 2 original variables + 4 slack variables) We need to set 2 of the variables constants before we can solve
– 4 equations the system of equations.
If a point is on the line 7x1 + 11x2 = 77 (line labeled "1"), what's the
For example, let s1=0, s2=0. Then the system becomes
value of s1?
7x 1 11x 2 77
10x 1 8x 2 80
If a point is on the line 10x1 + 8x2 = 80 (line labeled "2"), which
x1 s3 9
variable has the value zero?
x2 s4 6
At the corner point D, which variables have the value zero? The value of x1 and x2 of this system is the coordinate of the
corner point C (the point where line "1" and line "2" intersect.)
EE 477 Dr. Mohamed Zribi 91 EE 477 Dr. Mohamed Zribi 92
Maximize Z 150x 1 175x 2
Finding Corner Points Algebraically
subject to
7x 1 11x 2 s1 77
F
We now know how to find the corner points. 10x 1 8x 2 s2 80
x1 s3 9
x2 s4 6
Next x 1 , x 2 , s1 , s 2 , s 3 , s 4 0
How to find an adjacent corner point? E D 4
1
How to decide which adjacent corner point to move to?
C
5 3
A 6 B
EE 477 Dr. Mohamed Zribi 93 94 EE 477 Dr. Mohamed Zribi 94
How do we make sure the following conditions are All three conditions from the previous slide can be satisfied if the
satisfied? following steps are taken:
– The corner points are feasible. on a positive value. Move this variable from the non-basic set to
the basic set.
– The new corner point gives better value for the
objective function than the current corner point. Finding the leaving basic variable – a basic variable that is forced
to a value zero first after allowing the entering basic variable to
increase. Move the variable that is forced to zero from the basic
set to the non-basic set.
EE 477 Dr. Mohamed Zribi 97 EE 477 Dr. Mohamed Zribi 98
1500
=> must be a corner point
EE 477 Dr. Mohamed Zribi 105 EE 477 Dr. Mohamed Zribi 106
Important Property 2: If multiple optimum solutions Important Property 3: If a corner point is better than
=> must include 2 adjacent corner points all its adjacent corners, it is optimal !
y
1500
y
1500 1000
1000 500
Feasible
region
500
Feasible (0,0) 500 1000 1500 x
region
x x1
(0,0) 500 1000 1500 (0,0) 500 1000 1500
x1 + x2 = 1200
x1 = 500
Note: Corner point => intersection of some constraint boundaries (lines)
2x1+x2 = 1500
Max Max
z = 15 x1 + 10x2 z = 15 x1 + 10x2
S.T. S.T.
2x1 + x2 + x3 = 1500 2x1 + x2 + x3 = 1500
x1 + x2 + x4 = 1200 x1 + x2 + x4 = 1200
x1 + x5 = 500 x1 + x5 = 500
xi ≥ 0 for all i. xi ≥ 0 for all i. Corner Defining eqns Basic solution non-basic
Feasible variables
x2 solution
Corner Defining eqns Basic non-basic Initial basic variables: (x3, x4 , x5)
infeasible infeasible variables 500
Solution solution
x2
x1
(750, 0) x2 = 0 (750, 0, 0, 450, -250) x2, x3 (0,0) 500 1000 1500
2x1+ x2 = 1500 x1 + x2 = 1200
1500 x1 = 500
(1200, 0) x2 = 0 (1200, 0, -900, 0, -700) x2, x4 2x1+x2 = 1500
1000 x1 + x2 = 1200
Max z= 15 x1 +10 x2
500
S.t. 2 x1 + x2 + x3 = 1500
(500, 700) x1 + x2 = 1200 (500, 700, -200, 0, 0) x4, x5 x1 + x2 + x4 = 1200
x1 = 500 x1 + x5 = 500
x1
(0,0) 500 1000 1500 xi ≥ 0 for all i.
x1 + x2 = 1200 (0, 1500) x1 = 0 (0, 1500, 0, -300, 500) x1, x3 Initial BFS: (0, 0, 1500, 1200, 500)
x1 = 500 2x1+ x2 = 1500
2x1+x2 = 1500 EE 477 Dr. Mohamed Zribi 113 EE 477 Dr. Mohamed Zribi 114
x2 x2
1500 1500
1000 1000
Entering variable:
500 500
z = 15 x1 + 10x2
x1 x1
(0,0) 500 1000 1500 (0,0) 500 1000 1500
x1 + x2 = 1200 x1 + x2 = 1200
EE 477 Dr. Mohamed Zribi 115 EE 477 Dr. Mohamed Zribi 116
After row operations:
Z +5 x3 + 5x4 = 13,500
x2 - x3 + 2x4 = 900
- x3 + x4 + x5 = 200
x1 + x3 - x4 = 300
x2 x2
1500 1500
1000 1000
Basic Feasible Solution:
500 500
x2
minimize:
z = -2x1 - 3x2
subject to: An intersection
x1 – 2x2 ≤ 4 z = -2x1 – 3x2 of 5 half-spaces
2x1 + x2 ≤ 18
x2 ≤ 10
x1, x2 ≥ 0
x1
EE 477 Dr. Mohamed Zribi 119 EE 477 Dr. Mohamed Zribi 120
Corner Corner
EE 477 Dr. Mohamed Zribi 121 EE 477 Dr. Mohamed Zribi 122
Corner Corner
1 0 0 1 -2 4 1 0 0 .2 .4 8
x5 0 1 0 -2 5 10 x5 0 1 0 -.4 .2 2
0 0 1 0 1 10 0 0 1 .4 -.2 8
x1 x4 0 0 0 2 -7 8 x1 x4 0 0 0 -.8 1.4 22
x3 x1 x4 x5 x3 x2 x3 x1 x2 x5 x3 x4
x2 x2
EE 477 Dr. Mohamed Zribi 123 EE 477 Dr. Mohamed Zribi 124
Corner Remark: The Simplex Tableau
EE 477 Dr. Mohamed Zribi 125 EE 477 Dr. Mohamed Zribi 126
x1 x2 x3 x4 x5
minimize:
1 -2 1 0 0 4 x1 – 2x2 + x3 = 4
z = -2x1 - 3x2
2 1 0 1 0 18 2x1 + x2 + x4 = 18
subject to: 0 1 0 0 1 10 x2 + x5 = 10
x1 – 2x2 ≤ 4 -2 -3 0 0 0 0 z = -2x1 – 3x2
2x1 + x2 ≤ 18
x5
x2 ≤ 10
x1, x2 ≥ 0 x1 x4
Solution: (x1 , x2 ) = (0, 0)
x3
x2
x1 = x2 = 0 (start)
EE 477 Dr. Mohamed Zribi 127 EE 477 Dr. Mohamed Zribi 128
18
x1 = 4,
1 0 1 0 0 24 10 x2 = 10
18 0 0 1 -.5 2.5 20 x5
2 0 0 1 -1 8
0 1 0 0 1 10 1 0 0 .5 -.5 4 x1 x4
x1 = 0, x2 = 10
-2 0 0 0 3 30 10 0 1 0 0 1 10 x3
x5 x2
0 0 0 1 2 38
x1 x4 -2
x3
x2
Solution: (x1 , x2 ) = (0, 10) Solution: (x1 , x2 ) = (4 10)
-2
Solution is optimal
EE 477 Dr. Mohamed Zribi 129 EE 477 Dr. Mohamed Zribi 130
x3 4, x4 14, x5 3, z 0
EE 477 Dr. Mohamed Zribi 133 EE 477 Dr. Mohamed Zribi 134
Step 4: select new basic and non-basic variables Which one of x3, x4, x5 should be selected as the new non-basic
variables?
z 3x1 2x2 0
new basic variable The limiting value for x1 can be calculated analytically
Examine the coefficients in z to determine which variable for each equation by bi /ai1 , i.e. - 4, 14 / 3 and 3.
(x1 or x2 ) decreases the value of the objective function when
The limiting constraint is the one for which the ratio
the variable is increased from zero. As a general rule, it
is positive and has the smallest value.
is advantageous to select as a new basic variable which has
the largest positive coefficient in the objective function. Thus,
x2 remains at zero
x1 increases from zero to a positive number
EE 477 Dr. Mohamed Zribi 135 EE 477 Dr. Mohamed Zribi 136
Step 5: Transformation of the Equations
Original System: -1 2 1 0 0 4
x1 3 2 0 1 0 14
-1 2 1 0 0 x2 4 1 1 0 0 1 3 Step 4: Pivot Row
Select the smallest positive ratio
3 2 0 1 0 x3 14
3 2 0 0 0 0 bi/ai
1 1 0 0 1 x4 3
Step4: Pivot Column
3 2 0 0 0 x5 0 Select the largest positive element in the objective function.
Pivot element
EE 477 Dr. Mohamed Zribi 139 EE 477 Dr. Mohamed Zribi 140
By elementary row operation
Repeat Iteration
0 1 1 0 1 7
0 5 0 1 3 5 x1 x2 x3 x4 x5 b
1 -1 0 0 1 3 x3 0 0 1 -1/5 8/5 6
0 5 0 0 3 9 x2 0 1 0 1/ 5 3/5 1
x1 1 0 0 1/ 5 2/5 4
To do a better job in book-keeping,
0 0 0 1 0 14
a "tableau" can be used
An increase in x4 or x5 does not reduce f
x1 x2 x3 x4 x5 b
x3 0 1 1 0 1 7 x1* 4, x2* 1, x3* 6, z * 14
Basic variables x4 0 5 0 1 3 5
x1 1 -1 0 0 1 3 Note that the coefficient of x5 is zero.
0 5 0Dr. Mohamed
EE 477
0 3Zribi 9 141 EE 477 Dr. Mohamed Zribi 142
Remark
x1 x 2 x3 x4 x5 b
x5 0 0 5/8 -1/8 1 15/4
x2 0 1 3 / 8 1/ 8 0 13 / 4
x1 1 0 1/ 4 1/ 4 0 5/ 2
0 0 0 1 0 14 5. The Simplex Algorithm
x 1* 5 / 2, x 2* 13 / 4, x 5* 15 / 4, z * 14
Alternative solution! EE 477 Dr. Mohamed Zribi 143 EE 477 Dr. Mohamed Zribi 144
The Simplex Method The Simplex Method
The simplex method is an iterative computational When decision variables are more than 2, it is always advisable to
procedure used to determine the optimum solution of use the Simplex Method to avoid lengthy graphical procedure.
an LP problem.
The simplex method is not used to examine all the feasible
EE 477 Dr. Mohamed Zribi 145 EE 477 Dr. Mohamed Zribi 146
EE 477 Dr. Mohamed Zribi 147 EE 477 Dr. Mohamed Zribi 148
Geometric View of Canonical Form Geometric View of Canonical Form
x2
minimize: A polytope in n-dimensional space
x2 ≤ 10
z = -2x1 - 3x2 Each inequality corresponds to a half-space.
Feasible
subject to: Set The “feasible set” is the intersection of the half-spaces.
x1 – 2x2 ≤ 4
Direction
Corners This corresponds to a polytope
2x1 + x2 ≤ 18 of “Goodness”
Find a corner of the feasible region 1. Locate an extreme point of the feasible region.
Repeat 2. Examine each boundary edge intersecting at this point
A. For each of the n hyperplanes intersecting at the to see whether movement along any edge increases the
corner, calculate its reduced cost value of the objective function.
B. If they are all non-negative, then done 3. If the value of the objective function increases along
C. Else, pick the most negative reduced cost any edge, move along this edge to the adjacent extreme
This is called the entering plane point. If several edges indicate improvement, the edge
D. Move along corresponding edge (i.e. leave that providing the greatest rate of increase is selected.
hyperplane) until we reach the next corner (i.e. reach 4. Repeat steps 2 and 3 until movement along any edge no
another hyperplane) longer increases the value of the objective function.
The new plane is called the departing plane
EE 477 Dr. Mohamed Zribi 151 EE 477 Dr. Mohamed Zribi 152
The Simplex Algorithm Simplex Method Steps
Step 1 Convert the LP to standard form.
Step 1: Using slack/surplus variables, convert the LP
Step 2 Obtain a BFS (if possible) from the standard form. problem to a system of linear equations.
Step 2: Set up the initial tableau.
Step 3 Determine whether the current BFS is optimal.
Step 3: Select the pivot column.
Step 4 If the current BFS is not optimal, then determine which Step 4: Select the pivot in the pivot column.
nonbasic variable should become a basic variable and which
basic variable should become a nonbasic variable to find a new Step 5: Use the pivot to clear the pivot column in the normal
BFS with a better objective function value. (pivot operation) manner. This gives the next tableau.
Step 5 Use Elementary Row Operations to find the new BFS Repeat Steps 3-5 until there are no more negative numbers in
with the better objective function value. Go back to step 3. the bottom row (with the possible exception of the Answer
column).
EE 477 Dr. Mohamed Zribi 153 EE 477 Dr. Mohamed Zribi 154
Method
Step 5: Select the pivot
Step 4: Are there any Yes element and perform the
positive elements in the pivot operation.
pivot column above the
dashed line?
No
Stop. The linear programming problem has no
optimal solution.
EE 477 Dr. Mohamed Zribi 155 EE 477 Dr. Mohamed Zribi 156
The first thing we need to do is to set up the initial simplex tableau
Example 22:
x1 x2 s1 s 2 s3 s 4 b
Find a solution for the following problem using the simplex 1 2 1 0 0 0 6
method. 2 1 0 1 0 0 8
-1 1 0 0 1 0 1
0 1 0 0 0 1 2
maximize z = 3x1 + 2x 2 -3 -2 0 0 0 0 0
Subject to: The initial tableau correspond to the starting basic solution of the
x1 + 2x 2 6
model. The basic feasible solution can be easily read from the
2x1 + x 2 8 tableau as x=(0,0,6,8,1,2).
x 2 - x1 1
x2 2 The corresponding value of the objective function is
x1 0 and x 2 0 z=3*0+2*0+0*6+0*8+0*1+0*2=0.
EE 477 Dr. Mohamed Zribi 157 EE 477 Dr. Mohamed Zribi 158
Note that the last row of the simplex tableau contains the If some of the cost coefficients are negative, then an
coefficients of the objective function = relative cost improvement can be made.
coefficients ( r1, r2,…, rn) and the value of the objective
function.
When more than one of the relative cost coefficients is
EE 477 Dr. Mohamed Zribi 159 EE 477 Dr. Mohamed Zribi 160
x1 x2 s1 s 2 s3 s 4 b Thus the final tableau is
1 2 1 0 0 0 6
2 1 0 1 0 0 8 x1 x2 s1 s2 s3 s4 b
0 1 2 1 0 0 4
-1 1 0 0 1 0 1 3 3 3
1 0 1
3
2
3 0 0 10
3
0 1 0 0 0 1 2
0 0 -1 1 1 0 3
-3 -2 0 0 0 0 0
0 0 2
3
1
3 0 1 2
3
The new tableau is such, 0 0 1
3
4
3 0 0 38
3
We will solve the following problem The first step is to rewrite the system without the inequality
using the Simplex Method. We wish to Max z 5x 1 10x 2
symbols and to introduce slack variables.
8x 1 8x 2 160
maximize the profit function subject to
4x 1 12x 2 180
the constraints below. The method 8x 1 8x 2 s1 160
x1 0; x 2 0
introduced here can be used to solve 4x 1 12x 2 s 2 180
larger systems that are more 5x 1 10x 2 z 0
complicated. x 1 , x 2 , s1 , s 2 0
EE 477 Dr. Mohamed Zribi 163 EE 477 Dr. Mohamed Zribi 164
Step 2: Set up the Initial Simplex Tableau x1 x2 s1 s 2
s1 8 8 1 0 160
A simplex tableau is essentially the same as an augmented s2 4 12 0 1 180
matrix. The manipulations on a tableau are also the same as z 5 10 0 0 0
in the Gauss-Jordan method.
The variables s1, s2 on the left are the basic variables. A basic
s1 8 8 1 0 160 off is value directly from the rightmost column. x1 and x2 are 0
EE 477 Dr. Mohamed Zribi 165 EE 477 Dr. Mohamed Zribi 166
The most negative element in the last row is -10. Therefore, the x2-column Step 1: Divide row s2 by 12, to get a 1 in pivot position.
containing -10 is the pivot column.
x1 x2 s1 s 2 x1 x2 s1 s 2
To determine the pivot row, we divide the coefficients above the -10 into the s1 8 8 1 0 160
s1 8 8 1 0 160
numbers in the rightmost column and determine the smallest quotient. That 1 1
s2 4 12 0 1 180 x2 1 0 15
happens in the second row, labeled s2. 3 12
z 5 10 0 0 0 z 5 10 0 0 0
x2 is the entering variable, and s2 is the exiting variable.
x2 will become a basic variable,EEand s will become non-basic.
477 2Dr. Mohamed Zribi
167
EE 477 Dr. Mohamed Zribi 168
The Pivot Step
Find the Next Pivot Element
column, and pick the smallest value. The pivot row is row s1. result to row 3.
pivot position.
Multiply row 1 by -1/3 and add result
The entering variable is x1, the exiting variable is s1.
to row 2.
x1 x2 s1 s 2
x1 x 2 s1 s 2 3 1
x1 1 0 7.5 x 1 x 2 s1 s 2 b
16 2 16 8
s1 0 1 40 40/(16/3) = 7.5
3 3 1 1 x1 1 0 3 1 7.5
x2 1 0 15 16 8
1 1 3 12 x2 0 1 1 1 12.5
x2 1 0 15 15/(1/3) = 45 5 5
16 8
3 12 z 0 0 150 z 0 0 5
16
5
8 162.5
3 6
5 5
z 0 0 150
3 6
171 172
EE 477 Dr. Mohamed Zribi EE 477 Dr. Mohamed Zribi
Read off the Solution Interpreting the Simplex Process Geometrically
z 0 0 5
16
5
8 1 162.5 7.5 12.5 0 0 162.50 (7,5, 12.5)
173 174
EE 477 Dr. Mohamed Zribi EE 477 Dr. Mohamed Zribi
Example 24:
Looking at the table on the A farmer owns a 100-acre farm and plans to plant at most three
previous slide, we see that the crops. The seed for crops A, B and C costs $40, $20, and $30
simplex process started at the
per acre, respectively. A maximum of $3,200 can be spent on
origin, moved to the adjacent 2 3
seed. Crops A, B, and C require 1, 2, and 1 work days per acre,
corner point (0, 15) and then to
the optimal solution (7.5, 12.5). respectively, and there are a maximum of 160 work days
This is typical of the simplex 1 available. If the farmer can make a profit of $100 per acre on
process. crop A, $300 per acre on crop B, and $200 per acre on crop C,
how many acres of each crop should be planted to maximize
profit?
EE 477 Dr. Mohamed Zribi 175 EE 477 Dr. Mohamed Zribi 176
Solution:
The farmer is constrained by the number of acres available for
The farmer must decide on the number of acres of each crop that
planting, the money available for seed, the the available work
should be planted. Thus, the decision variables are
days. These lead to the following constraints:
x1 = number of acres of crop A
x1 + x2 + x3 < 100 Acreage constraint
x2 = number of acres of crop B
40x1 + 20x2 + 30x3 < 3,200 Monetary constraint
x3 = number of acres of crop C
x1 + 2x2 + x3 < 160 Labor constraint
The farmer’s objective is to maximize profit:
EE 477 Dr. Mohamed Zribi 177 EE 477 Dr. Mohamed Zribi 178
Adding the nonnegative constraints, we have the following model Next, we introduce slack variables and form the initial system:
for a linear programming problem:
x1 + x2 + x3 + s1 = 100
Maximize z = 100x1 + 300x2 + 200x3
40x1 + 20x2 + 30x3 + s2 = 3200
Subject to
x1 + 2x2 + x3 + s3 = 160
x1 + x2 + x3 < 100
-100x1 - 300x2 -200x3 +z=0
40x1 + 20x2 + 30x3 < 3,200
x1, x2, x3, s1 , s2, s3 > 0
x1 + 2x2 + x3 < 160
The initial system has 7 - 4 = 3 nonbasic variables and 4 basic
x1, x2, x3 > 0 variables.
EE 477 Dr. Mohamed Zribi 179 EE 477 Dr. Mohamed Zribi 180
x1 x2 x3 s1 s2 s2 b
1 1 1 1 0 0 100
Now we form the simplex tableau and solve by the simplex 40 20 30 0 1 0 3200
method: 0.5 1 0.5 0 0 0.5 80
-100 -300 200 0 0 0 0
Enter
x1 x2 x3 s1 s2 s3 x1 x2 x3 s1 s2 s2 b
s1
1 1 1 1 0 0 0 100 0.5 0 0.5 1 0 0.5 20
s2
40 20 30 0 1 0 0 3, 200 30 0 20 0 1 -10 1600
s3
Exit 1 2 1 0 0 1 0 160 0.5R3 -> R3 0.5 1 0.5 0 0 0.5 80
z
100 300 200 0 0 0 1 0
50 0 50 0 0 150 24000
x1 x2 x3 s1 s2 s2 b
1 0 1 2 0 1 40
30 0 20 0 1 -10 1600 Thus, if the farmer plants 60 acres in crop B, 40 acres in crop
0.5 1 0.5 0 0 0.5 80 C and no crop A, the maximum profit of $26,000 will be
50 0 50 0 0 150 24000
realized. The fact that s2 = 800 tells us that this max profit is
x1 x2 x3 s1 s2 s2 b
1 0 1 2 0 1 40 reached by using only $2400 of the $3200 available for seed;
10 0 0 40 1 10 800 that is, we have a slack of $800 that can be used for some other
0 1 0 -1 0 1 60
purpose.
100 0 0 100 0 100 26000
the optimal solution: x1 = 0, x2 = 60, x3 = 40, s1 = 0, s2 =
800, s3 = 0, P = $26,000EE 477 Dr. Mohamed Zribi 183 EE 477 Dr. Mohamed Zribi 184
Example 25:
Note: For this initial simplex tableau, the basic
z 4 x1 6 x2 objective function
x1 x2 s1 11 variables are s1, s2, and s3, and the nonbasic
x1 x2 s2 27 constraints
variables are x1 and x2, i.e., x1 = x2 = 0.
2 x1 5 x2 s3 90
EE 477 Dr. Mohamed Zribi 185 EE 477 Dr. Mohamed Zribi 186
Optimality check: Observing the bottom row of the tableau, Because the objective function is z
=- 4x1 -6x2, a unit decrease in x2
if any of these entries (except the current z-value) are produce a decrease of 6 in z,
whereas a unit decrease in x1
negative, the current solution is not optimal (so the produces a decrease of only 4 in
z. Thus, adjusting x2 brings
initial values for (x1, x2, s1, s2, s3) are not optimal) larger improvement for finding
a smaller z-value
EE 477 Dr. Mohamed Zribi 187 EE 477 Dr. Mohamed Zribi 188
To find the departing variable, identify the row with the smallest
nonnegative bi /aij for the entering variables column, i.e., for j = 2 G.-J. E. for
the 2nd column
and examine b1/a12, b2/a22, and b3/a32
The improved solution is not yet optimal because the bottom row
still has a negative entry So, the new tableau is as follows
Since –10 is the smallest number in the bottom row, we choose
(x1, x2, s1, s2, s3) =
x1 as the entering variable (5, 16, 0, 6, 0) with a z-
Moreover, the smallest nonnegative ratio among 11/(–1) = –11, value of -4x1 - 6x2 =
-4(5) - 6(16) =-116
16/2 = 8, and 35/7 = 5 is 5, so s3 is the departing variable and
a31 is the pivot entry
Following the same rule, we can identify s1 to be the entering variable and s2
to be the departing variable
pivot entry
EE 477 Dr. Mohamed Zribi 191 EE 477 Dr. Mohamed Zribi 192
By performing one more iteration of the simplex method, you Note: Because the LP problem in the Example involves only two variables,
can obtain the following tableau you could use a graphical solution technique also
In this tableau, there are no negative elements in the bottom Note that each iteration in the simplex method corresponds to moving from a given
vertex to an adjacent vertex with an improved z-value
row. So, the optimal solution is determined to be
(0, 0) (0,11) (5,16) (15,12)
(x1, x2, s1, s2, s3) = (15, 12, 14, 0, 0)
z 0 z 66 z 116 z 132
with In addition, why we choose (x1, x2, s1, s2, s3) = (0, 0, b1, b2, b3) = (0, 0, 11, 27, 90) as
z = -4x1 - 6x2 = -4(15) - 6(12) = -132 the initial basic solution is that (x1, x2) = (0, 0) must be a vertex of the feasible
solution region because all xi 0 in the standard form of maximization problems
EE 477 Dr. Mohamed Zribi 193 EE 477 Dr. Mohamed Zribi 194
2
x1 2 x2 x3 12000
3
2 2
x1 x2 x3 4600
3 3
1 1 1
x1 x2 x3 2400
2 3 2
How many dozen of each type of fixture should be produced to obtain a where x1 0, x2 0, and x3 0
maximum profit?
EE 477 Dr. Mohamed Zribi 199 EE 477 Dr. Mohamed Zribi 200
Apply the simplex method with the initial basic solution (x1, x2, x3, s1, s2, s3)
= (0, 0, 0, 12000, 4600, 2400)
So the optimal solution is (x1, x2, x3, s1, s2, s3) = (600, 5100,
EE 477 Dr. Mohamed Zribi 201 800, 0, 0, 0) with the maximum profit
EE 477 Dr. Mohamed Zribi to be $100,200 202
Example 28:
Moreover, in order to balance the advertising among the
The advertising alternatives for a company include television, three types of media, no more than half of the total number
radio, and newspaper advertisements. The costs and estimates
of advertisements should occur on the radio, no more than
of audience coverage are provided as follows
10 advertisements should occur on the newspaper, and at
least 10% should occur on the television. The weekly
advertising budget is $18,200. How many advertisements
should be run in each media to maximize the total
audience?
EE 477 Dr. Mohamed Zribi 203 EE 477 Dr. Mohamed Zribi 204
Solution:
Apply the simplex method with the initial basic solution (x1, x2, x3, s1, s2, s3,
Let x1, x2, x3 represent the numbers of advertisements in television, s4) = (0, 0, 0, 182, 10, 0, 0)
newspaper, and radio, respectively. The objective function is expressed as
Max z = 100000x1 + 40000x2 + 18000x3,
where x1 0, x2 0, and x3 0, and subject to the constraints
20 x1 6 x2 3 x3 182
x2 10
x1 x2 x3 0
9 x1EE 477 x 2
Dr. Mohamed
x
Zribi 3
0 205 EE 477 Dr. Mohamed Zribi 206
Example 29:
Maximize z 8 x1 9 x2
Subject to
2 x1 3x2 50
2 x1 6 x2 80
3x1 3x2 70
x1 , x2 0
So the optimal solution is (x1, x2, x3, s1, s2, s3, s4) = (4, 10, 14, 0,
0, 0, 12) with the maximum
EE 477 weekly audience
Dr. Mohamed Zribi to be 1,052,000 207 EE 477 Dr. Mohamed Zribi 208
Simplex tableau (Starting tableau):
Introducing slack variables, the LPP can be written as:
Basic z x1 x2 s1 s2 s3 Solution
Maximize z 8 x1 9 x2 0 s1 0s2 0s3
s1 0 2 3 1 0 0 50
Subject to
s2 0 2 6 0 1 0 80
2 x1 3 x2 s1 50
2 x1 6 x2 s2 80 (*) s3 0 3 3 0 0 1 70
3 x1 3 x2 s3 70 z 1 -8 -9 0 0 0 0
x1 , x 2 , s1 , s 2 , s 3 0
EE 477 Dr. Mohamed Zribi 209 EE 477 Dr. Mohamed Zribi 210
Simplex tableau (Starting tableau) Performing the elementary Row operations, we get the new
Enters Simplex tableau below
s1 0 2 3 1 0 0 50 Basic z x1 x2 s1 s2 s3 Solution
s1 0 1 0 1 -1/2 0 10
s2 0 2 6 0 1 0 80
x2 0 1/3 1 0 1/6 0 40/3
s3 0 3 3 0 0 1 70
s3 0 2 0 0 -1/2 1 30
z 1 -8 -9 0 0 0 0
z 1 -5 0 0 3/2 0 120
Leaves
Pivot element Pivot element
Leaves
EE 477 Dr. Mohamed Zribi 211 EE 477 Dr. Mohamed Zribi 212
Performing the elementary Row operations, we get the new Performing the elementary Row operations, we get the new
Simplex tableau below Simplex tableau below.
Basic z x1 x2 s1 s2 s3 Solution
Basic z x1 x2 s1 s2 s3 Solution
x1 0 1 0 1 -1/2 0 10
x1 0 1 0 -1 0 0 20
x2 0 0 1 -1/3 1/3 0 10
x2 0 0 1 1 0 0 10/3
s3 0 0 0 -2 1/2 1 10
s2 0 0 0 -4 1 2 20
z 1 0 0 5 -1 0 170
z 1 0 0 5 0 0 190
Leaves Pivot element
Optimum value = 190 at x1=20, x2=10/3
EE 477 Dr. Mohamed Zribi 213 EE 477 Dr. Mohamed Zribi 214
Maximize z 2 x1 x2 3 x3 5 x4
(10,10) Subject to
(0,40/3)
Optimal at Direction of
(20,10/3) increasing z x1 2 x2 2 x3 4 x 4 40
2 x1 x2 x3 2 x 4 8
4 x1 2 x2 x3 x4 10
(0,0)
x1 , x2 , x3 , x4 0
(70/3,0)
EE 477 Dr. Mohamed Zribi 215 EE 477 Dr. Mohamed Zribi 216
Basic z x1 x2 x3 x4 s1 s2 s3 Sol.
Introducing slack variables, the LPP becomes
S1 0 1 2 -2 4 1 0 0 40
Minimize
s2 0 2 -1 1 2 0 1 0 8
2 x1 x2 3 x3 5 x4 0 s1 0s2 0 s3 s3 0 4 -2 1 -1 0 0 1 10
z 1 -2 -1 3 -5 0 0 0 0
Subject to
s1 0 -3 4 -4 0 1 -2 0 24
x1 2 x2 2 x3 4 x4 s1 40 x4 0 1 -1/2 1/2 1 0 1/2 0 4
s3 0 5 -5/2 3/2 0 0 1/2 1 14
2 x1 x2 x3 2 x4 s2 8 z 1 3 -7/2 11/2 0 0 5/2 0 20
4 x1 2 x2 x3 x4 s3 10 x2 0 -3/4 1 -1 0 1/4 -1/2 0 6
x4 0 5/8 0 0 1 1/8 1/4 0 7
x1 , x2 , x3 , x4 , s1 , s2 , s3 0
s3 0 25/8 0 -1 0 5/8 -3/4 1 29
EE 477 Dr. Mohamed Zribi 217
z 1 3/8 0 2
EE 477
0
Dr. Mohamed Zribi
7/8 3/4 0 41
218
The last tableau is the optimal tableau as all entries in the Example 31:
objective function row are ≥ 0 and the LPP is a maximization Maximize z x1 2 x2 4 x3
problem.
Subject to
Optimal Solution is 3 x1 x2 5 x3 10
x1 = 0, x2 = 6, x3 = 0, x4 = 7
x1 4 x2 x3 8
And the Optimal z (= Maximum z) = 41
2 x1 2 x3 7
x1 , x 2 , x 3 0
EE 477 Dr. Mohamed Zribi 219 EE 477 Dr. Mohamed Zribi 220
Basic z x1 x2 x3 s1 s2 s3 Sol.
Introducing slack variables, the LPP becomes
s1 0 3 1 5 1 0 0 10
Maximize
s2 0 1 4 1 0 1 0 8
s3 0 2 0 2 0 0 1 7
z x1 2 x2 4 x3 0 s1 0 s2 0 s3 z 1 -1 -2 -4 0 0 0 0
Subject to
x3 0 3/5 1/5 1 1/5 0 0 2
3 x1 x2 5 x3 s1 10 s2 0 2/5 19/5 0 -1/5 1 0 6
s3 0 4/5 -2/5 0 -2/5 0 1 3
x1 4 x2 x3 s2 8 z 1 7/5 -6/5 0 4/5 0 0 8
Example 32:
The last tableau is the optimal tableau as all entries in the
Shale Oil, has a capacity of 600,000 barrels of crude oil per day.
objective function row are ≥ 0 and the LPP is a maximization
The final products from the refinery include two types of unleaded
problem.
gasoline: regular and premium. The refining process encompasses
three stages: (1) a distillation tower that produces feedstock, (2) a
Optimal Solution is cracker unit that produces gasoline stock by using a portion of the
x1 = 0, x2 = 30/19, x3 = 32/19 feedstock produced from the distillation tower, and (3) a blender
And the Optimal z (= Maximum z) = 188/19 unit that blends the gasoline stock from the cracker unit and the
feedstock from the distillation tower.
Both regular and premium gasoline can be blended from either the
the feedstock or the gasoline stock at different production costs.
EE 477 Dr. Mohamed Zribi 223 EE 477 Dr. Mohamed Zribi 224
The company estimates that the net profit per barrel of regular
Develop a model for determining the optimum production
gasoline is $7.70 and $5.20, depending on whether it is blended
schedule for the refinery.
from feedstock or from gasoline stock. The corresponding profit
values for the premium grade are $10.40 and $12.30.
Let x1 units from feedstock be used to blend (=make) regular Thus we have to maximize the profit
gasoline
z 7.70 x1 10.40 x2 5.20 x3 12.30 x4
Let x2 units from feedstock be used to blend (=make) premium
gasoline Subject to
Let x3 units from gasoline stock be used to blend (=make) regular x1 x2 x3 x4 120,000
gasoline
x3 x4 40, 000
Let x4 units from gasoline stock be used to blend (=make)
premium gasoline x1 x3 80, 000
x2 x4 50, 000
x1 , x2 , x3 , x4 0
EE 477 Dr. Mohamed Zribi 227 EE 477 Dr. Mohamed Zribi 228
Optimum Solution Example 33:
x1 70,000 Maximize P under the constraints:
x2 10,000
Max P 12 y 1 16 y 2
x3 0
y 1 2 y 2 16
x4 40,000
y1 y2 9
3y 1 y2 21
Maximum z = 1135000 y 1, y 2 0
EE 477 Dr. Mohamed Zribi 229 EE 477 Dr. Mohamed Zribi 230
Solution:
Form the Simplex Tableau for the Dual Problem
Perform row operations to get zeros in the column containing the pivot
The first pivot element is 2 (in red) because it is located in the column element. Result is shown below.
with the smallest negative number at the bottom (-16), and when divided Identify the next pivot element (0.5) (in red)
into the rightmost constants yields the smallest quotient (16/2=8)
y1 y2 x1 x2 x3 P
y1 y2 x1 x2 x3 P
y2 .5 1 .5 0 0 8
x1 1 2 1 0 0 16
x2 1 1 0 1 0 9
New pivot
element x2 .5 0 .5 1 0 1
x3 3 1 0 0 1 21 Pivot element
x3 2.5 0 .5 0 1 13
located in this
P 12 16 0 0 0 0 column because of P 4 0 8 0 0 128
negative indicator
EE 477 Dr. Mohamed Zribi 231 EE 477 Dr. Mohamed Zribi 232
Get zeros in the column containing the new pivot
element.
7. The Two-Phase
y1 y2 x1 x x P We have now obtained
2 3
the optimal solution
y2 0 1 1 1 0 8 since none of the
bottom row indicators Simplex Method
y1 1 0 1 2 0 2 are negative.
x3 0 0 2 5 1 8
Minimum of P is 136
P 0 0 4 8 0 136
EE 477 Dr. Mohamed Zribi 233 EE 477 Dr. Mohamed Zribi 234
Until now, we have only considered LPs with “≤” constraints, Obviously, these assumptions do not hold for every LP. What do
nonnegative variables, and nonnegative right-hand-side values. we do when they don’t?
Why?
– Remember that simplex needs a place to start – it must start This is where Two-Phase Simplex comes in. It involves two
from a BFS then move to another BFS to improve the phases (thus the name!):
objective value.
– Phase I: Works to achieve feasibility.
– With these assumptions, we can obtain an initial BFS by
letting all slack variables be basic, all original variables be – Phase II: Works to achieve optimality.
non-basic.
EE 477 Dr. Mohamed Zribi 235 EE 477 Dr. Mohamed Zribi 236
Artificial Variables
Two Phase Method
For problems with constraints of the form
We now look at the Two-Phase method. As the name suggests, the
Ax b
method consists of two phases: In phase I, we minimize the sum of
x 0
all the artificial variables subject to the same constraint equations.
with b 0 , a basic feasible solution to the corresponding
If the original problem had a feasible solution this new problem will
standard form of the problem is provided by the slack
give a solution with all artificial variables zero. Taking this as a
variables. This provides us with the starting point for the
starting BFS, we solve the original problem. simplex method.
This technique of solving the problem is called the two phase the same constraints. Then we find a BFS to the original LP by
technique. solving the Phase I LP.
In the Phase I, the objective function is to minimize the sum of all
Phase 1: Augment the artificial variables as necessary to secure a
starting solution. artificial variables.
At the completion of Phase I, we reintroduce the original LP’s
Phase 2: Use the optimum basic solution of phase 1 as a starting objective function and determine the optimal solution to the
solution for the original problem.
original LP.
EE 477 Dr. Mohamed Zribi 239 EE 477 Dr. Mohamed Zribi 240
Example 34:
Consider the constraints: We can see that we cannot get an identity matrix in the
x1 + 2x2 ≥ 4 coefficients and positive numbers on the right-hand
-3x1 + 4x2 ≥ 5 side. We need to add artificial variables:
2x1 + x2 ≤ 6 x1, x2 ≥ 0
x1 + 2x2 – x3 + a1 =4
Introduce the slack variables:
x1 + 2x2 – x3 =4 -3x1 + 4x2 – x4 + a2 =5
-3x1 + 4x2 – x4 =5
2x1 + x2 + x5 =6 2x1 + x2 + x5 =6
EE 477 Dr. Mohamed Zribi 241 EE 477 Dr. Mohamed Zribi 242
Example 35:
Now we have an identity matrix, made up of the Consider the constraints:
x1 + 2x2 – 5x3 ≥ -4
coefficient columns of a1, a2, & x5.
3x1 – x2 + 3x3 ≤ 2
-x1 + x2 + x3 = -1 x1, x2, x3 ≥ 0
We would solve the problem with the objective of
minimizing a1 + a2 to get rid of the artificial variables, Introduce the slack variables:
x1 + 2x2 – 5x3 – x4 = -4
then use whatever basis we had and continue solving,
3x1 – x2 + 3x3 + x5 =2
using the original objective function. -x1 + x2 + x3 = -1
EE 477 Dr. Mohamed Zribi 243 EE 477 Dr. Mohamed Zribi 244
Example 36: Motivation of the two phase method
We don’t have to add an artificial variable to the 1st constraint if max z 3x 1 x 2
we multiply it by -1. s.t. x1 x2 1
2x 1 x 2 4
x1 x 2 3
When we multiply the last constraint by -1 and add an artificial
x 1, x 2 0
variable, we have:
Step 1: Make all right-hand-side values nonnegative.
-x1 – 2x2 + 5x3 + x4 =4 max z 3x 1 x 2
3x1 – x2 + 3x3 + x5 =2 s.t. x1 x2 1
x1 – x2 – x3 + a1 =1 2x 1 x 2 4
x1 x 2 3
x1, x2, x3, x4, x5, a1 ≥ 0 x 1, x 2 0
EE 477 Dr. Mohamed Zribi 245 EE 477 Dr. Mohamed Zribi 246
max z 3x 1 x 2
When we had a slack variable in each constraint, it was easy to
s.t. x1 x 2 s1 1 find an initial BFS to initiate simplex.
2x 1 x 2 s2 4
When there are rows without slack variables, it isn’t so obvious
x1 x 2 3
how to begin simplex.
x 1, x 2 0
To deal with the problem, we will use artificial variables.
EE 477 Dr. Mohamed Zribi 247 EE 477 Dr. Mohamed Zribi 248
max z 3x 1 x 2 A Problem
s.t. x1 x 2 s1 1
2x 1 x 2 s2 4 We have essentially made up extra variables to make our
x1 x 2 3
lives easier. Is this a valid thing to do?
x 1, x 2 0
How do we use them? Starting with our dictionary that To force all artificial variables to be zero, we minimize the
uses artificial variables, we use simplex to find a BFS sum of all artificial variables.
in which all artificial variables are equal to zero. – If the minimum is zero, then all artificial variables
Then they don’t affect the real solution. equal zero (this is what we want!!)
EE 477 Dr. Mohamed Zribi 253 EE 477 Dr. Mohamed Zribi 254
Step 1: Make all right-hand-side values nonnegative Step 7: Solve the Phase I LP. If r > 0, the original LP is
Step 3: Add an artificial variable to each row without a slack. Step 8: Replace the original objective, in terms of non-basic
Step 4: Write the initial tableau, using slack and artificial variables. Delete all non-basic artificial variables. This creates
Step 5: Replace the objective with minimizing the sum of all Step 9: Optimize the Phase II LP. As artificial variables become
artificial variables (call it “r” to keep it separate from the non-basic, delete them.
original objective).
.
EE 477 Dr. Mohamed Zribi 257 EE 477 Dr. Mohamed Zribi 258
Minimize z 2 x1 x2 Minimize r a1 a2
Subject to Subject to
3 x1 x2 s1 a1 9 3x 1 x 2 s1 a1 9
x1 x2 s2 a2 6 x1 x 2 s2 a2 6
x1 , x 2 , s1 , s 2 , a 1 , a 2 0 x 1 , x 2 , s 1 , s 2 , a1 , a 2 0
We now solve it by Simplex method.
EE 477 Dr. Mohamed Zribi 261 EE 477 Dr. Mohamed Zribi 262
Write the initial Tableau. Since a1 and a2 are basic variables, we need to make sure that
their r coefficients are zero.
a1 0 3 1 -1 0 1 0 9 a1 0 3 1 -1 0 1 0 9
a2 0 1 1 0 -1 0 1 6 a2 0 1 1 0 -1 0 1 6
r 1 0 0 0 0 1 1 0 r 1 -4 -2 1 1 0 0 -15
EE 477 Dr. Mohamed Zribi 263 EE 477 Dr. Mohamed Zribi 264
Basic r x1 x2 s1 s2 a1 a2 Sol. Basic r x1 x2 s1 s2 a1 a2 Sol.
x1 0 1 0 ½ ½ ½ ½ 3/2
x1 0 1 1/3 -1/3 0 1/3 0 3
EE 477 Dr. Mohamed Zribi 265 EE 477 Dr. Mohamed Zribi 266
Note that the starting Simplex tableau is the same as the last x2 0 0 1 1/2 -3/2 9/2
tableau except for the first row which is our z-Row. Since a1,
a2 have served their purpose (of giving a starting BFS), we
suppress their columns. z 1 2 1 0 0 0
3 9
x1 , x2
2 2
EE 477 Dr. Mohamed Zribi 267 EE 477 Dr. Mohamed Zribi 268
Since x1 and x2 are basic variables, we need to make sure that Therefore, for the problem
their z coefficients are zero.
Minimize z 2 x1 x2
Basic z x1 x2 s1 s2 Sol.
Subject to
EE 477 Dr. Mohamed Zribi 269 EE 477 Dr. Mohamed Zribi 270
x1 x2 18 3x 1 4x 2 s 2 a2 60
x 1 x 2 s3 a3 18
x1 , x 2 0 x 1, x , s 1 , s 2 , s 3 , a1 , a 2 , a 3 0
2
a1 0 2 3 -1 0 0 1 0 0 42 a1 0 2 3 -1 0 0 1 0 0 42
a2 0 3 4 0 -1 0 0 1 0 60 a2 0 3 4 0 -1 0 0 1 0 60
a3 0 1 1 0 0 -1 0 0 1 18 a3 0 1 1 0 0 -1 0 0 1 18
r 1 0 0 0 0 0 1 1 1 0
r 1 -6 -8 1 1 1 0 0 0 -120
EE 477 Dr. Mohamed Zribi 273 EE 477 Dr. Mohamed Zribi 274
EE 477 Dr. Mohamed Zribi 275 EE 477 Dr. Mohamed Zribi 276
This is the optimal tableau. Thus Phase I has ended and we now
start Phase II with the starting BFS as the optimal solution of
Basic r x1 x2 s1 s2 s3 a1 a2 a3 Sol
Phase I.
x2 0 0 1 0 -1 3 0 1 -3 6
s1 0 0 0 1 -1 1 -1 1 -1 0 Phase II:
Minimize z 5 x1 7 x2
x1 0 1 0 0 1 -4 0 -1 4 12
EE 477 Dr. Mohamed Zribi 277 EE 477 Dr. Mohamed Zribi 278
x2 0 0 1 0 -1 3 6 x2 0 0 1 0 -1 3 6
s1 0 0 0 1 -1 1 0 s1 0 0 0 1 -1 1 0
x1 0 1 0 0 1 -4 12 x1 0 1 0 0 1 -4 12
z 1 5 7 0 0 0 0 z 1 0 0 0 2 -1 -102
EE 477 Dr. Mohamed Zribi 279 EE 477 Dr. Mohamed Zribi 280
This is the optimal tableau.
Basic r x1 x2 s1 s2 s3 Sol
Optimal solution: x1 = 12, x2 = 6
s1 0 0 0 1 -1 1 0
x1 0 1 0 4 -3 0 12
z 1 0 0 1 1 0 -102
EE 477 Dr. Mohamed Zribi 281 EE 477 Dr. Mohamed Zribi 282
x1 2 x2 x3 20 x1 2x x3 s1 a1 20
2
2 x1 4 x2 x3 50
2x1 4x 2 x3 a2 50
x1 , x 2 , x 3 0
x 1 , x 2 , x 3 , s 1 , a1 , a 2 0
EE 477 Dr. Mohamed Zribi 283 EE 477 Dr. Mohamed Zribi 284
Basic r x1 x2 x3 s1 a1 a2 Sol Basic r x1 x2 x3 s1 a1 a2 Sol
a1 0 1 -2 1 -1 1 0 20 x1 0 1 -2 1 -1 1 0 20
a2 0 2 4 1 0 0 1 50
r2 0 0 8 -1 2 -2 1 10
-3 -2 -2 1 0 0 -70
r 1 0 0 0 0 1 1 0 r 1 0 -8 1 -2 3 0 - 10
r 1 0 -8 1 -2 3 0 - 10 r 1 0 0 0 0 1 1 0
EE 477 Dr. Mohamed Zribi 285 EE 477 Dr. Mohamed Zribi 286
Basic z x1 x2 x3 s1 a1 a2 Sol
This is optimal tableau. Thus Phase I has ended and we now start
Phase II with the starting BFS as the optimal solution of Phase I. x1 0 1 0 3/4 -1/2 45/2
x2 0 0 1 -1/8 1/4 5/4
0 0 17/8 -1/4 -205/4
z 1 2 5 3 0 0
x1 0 1 2 1/2 0 25
Phase II:
s1 0 0 4 -1/2 1 5
Minimize
z 2 x1 5x2 3x3
z 1 0 1 2 0 - 50
subject to the same constraints as given in the original
problem. Thus the optimal solution is : x1 = 25, x2 = 0, x3 = 0
And the optimal z = Min z = 50.
EE 477 Dr. Mohamed Zribi 287 EE 477 Dr. Mohamed Zribi 288
Adding surplus and slack variables, the problem becomes:
Example 40:
Consider the LPP
Subject to Subject to
5 x1 6 x2 2 x3 5 5 x1 6 x2 2 x3 s1 5
x1 3 x2 5 x3 8 x1 3 x2 5 x3 s2 8
2 x1 5 x2 4 x3 9 2 x1 5 x2 4 x3 s3 9
x1 , x 2 , x 3 0 x 1 , x 2 , x 3 , s1 , s 2 , s 3 0
EE 477 Dr. Mohamed Zribi 289 EE 477 Dr. Mohamed Zribi 290
EE 477 Dr. Mohamed Zribi 293 EE 477 Dr. Mohamed Zribi 294
Basic r x1 x2 x3 s1 s2 a2 s3 Sol.
Initial Tableau is such that:
s1 0 -6 9 3 1 -1 0 0 3
Basic r x1 x2 x3 s1 s2 a2 s3 Sol.
a2 0 -1 3 5 0 -1 1 0 8
s3 0 2 5 -4 0 0 0 1 9
s1 0 -6 9 3 1 -1 0 0 3
r 1 1 -3 -5 0 1 0 0 -8
a2 0 -1 3 5 0 -1 1 0 8
x3 0 -2 3 1 1/3 -1/3 0 0 1
s3 0 2 5 -4 0 0 0 1 9 a2 0 9 -12 0 -5/3 2/3 1 0 3
r 1 0 0 0 0 0 1 0 0 s3 0 -6 17 0 4/3 -4/3 0 -1 13
r 1 -9 12 0 5/3 -2/3 0 0 -3
EE 477 Dr. Mohamed Zribi 295 EE 477 Dr. Mohamed Zribi 296
Phase I has ended. And we now start Phase II with the
Basic r x1 x2 x3 s1 s2 a2 s3 Sol.
starting BFS obtained in the optimal tableau of Phase I.
x3 0 0 1/3 1 -1/27 -5/27 2/9 0 5/3
Also we do not carry the a2 column as it has served its
r 1 0 0 0 0 0 1 0 0
EE 477 Dr. Mohamed Zribi 297 EE 477 Dr. Mohamed Zribi 298
Phase II:
Minimize z 2x1 4x2 3x3
Basic r x1 x2 x3 s1 s2 s3 Sol.
Subject to
x1 , x 2 , x 3 , s1 , s 2 , s 3 0
s3 0 0 9 0 2/9 -8/9 -1 15
r 1 2 -4 3 0 0 0 0
EE 477 Dr. Mohamed Zribi 299 EE 477 Dr. Mohamed Zribi 300
More work is needed to obtain the optimal tableau.
Basic r x1 x2 x3 s1 s2 s3 Sol.
And the optimal solution is
23 15 10
x3 0 0 1/3 1 -1/27 -5/27 0 5/3
x1 , x2 , x3
9 9 9
x1 0 1 -4/3 0 -5/27 2/27 0 1/3
16
Optimum z = Minimum z = .
s3 0 0 9 0 2/9 -8/9 -1 15 9
r 1 0 -7/3 0 13/27 11/27 0 -17/3 It is clear that the same procedure can be applied to
more than two ≥ constraints.
EE 477 Dr. Mohamed Zribi 301 EE 477 Dr. Mohamed Zribi 302
x1 x2 x3 x4 x5 a1 a2 a3 b
x1 x2 x3 x4 x5 a1 a2 a3 b
1.5 1 0.5 0 0 0.5 0 0 0.5
1.5 1 0.5 0 0 0.5 0 0 0.5 3.5 0 0.5 1 0 0.5 1 0 2.5
3.5 0 0.5 1 0 0.5 1 0 2.5 5.5 0 1.5 0 1 2.5 0 1 1.5
5.5 0 1.5 0 1 2.5 0 1 1.5 0 0 0 0 0 1 1 1 0
2 0 1 1 1 4 0 0 4
305 306
EE 477 Dr. Mohamed Zribi EE 477 Dr. Mohamed Zribi
x1 x2 x3 x4 x5 b
1.5 1 0.5 0 0 0.5 We now can enter the Phase II of the two-phase simplex algorithm.
3.5 0 0.5 1 0 2.5
5.5 0 1.5 0 1 1.5 However, we are now already in optimum.
1 1 1 1 1 0
x1 x2 x3 x4 x5 b
x1 = 0
1.5 1 0.5 0 0 0.5
x1 x2 x3 x4 x5 b x2 = 0.5
3.5 0 0.5 1 0 2.5
1.5 1 0.5 0 0 0.5 x3 = 0
5.5 0 1.5 0 1 1.5
3.5 0 0.5 1 0 2.5 x4 = 2.5
5.5 0 1.5 0 1 1.5 1.5 0 1.5 0 0 4.5
x5 = 1.5
1.5 0 1.5 0 0 4.5
R4 R1 R2 R3 EE 477 Dr. Mohamed Zribi
307
EE 477 Dr. Mohamed Zribi
308
Example 42: The simplex method with equality constraints
Use the simplex method to find the maximum value of
z = 3x1 + 2x2 + x3,
Subject to
4 x1 x2 x3 30
2 x1 3 x2 x3 60
x1 2 x2 3 x3 40
where x1 0, x2 0, and x3 0
Solution:
The initial basic solution is (x1, x2, x3, s1, s2, s3)
= (0, 0, 0, 30, 60, 40)
Example 43:
Minimize z 2x1 3x2 x3
Subject to
x1 4 x2 2 x3 8
3 x1 2 x2 6
So the optimal solution is
(x1, x2, x3, s1, s2, s3) = (3, 18, 0, 0, 0, 1) x1 , x 2 , x3 0
with
z = 3x1 + 2x2 + x3 = 3(3) + 2(18) + 1(0) = 45
Note: Since s1 is not a basic variable and thus s1 = 0 in the optimal Ans.: Optimal Solution: x1 = 4/5, x2 = 9/5, x3 = 0
solution, this solution satisfies the first constraints (4(3) + 1(18) Optimal value: z = 7
+ 1(0) = 30)
EE 477 Dr. Mohamed Zribi 311 EE 477 Dr. Mohamed Zribi 312
Example 44: Solution:
• For the first inequality, it does involve inequalities, so we
Find the maximum value of z = x1 + x2 + 2x3,
add a slack variable to form the equation as before
2 x1 x2 x3 s1 50
subject to the constraints
• For the last two inequalities, a surplus variable, is
introduced as follows
2 x1 x2 x3 50
2 x1 x2 s2 36
2 x1 x2 36
x1 x3 s3 = 10
x1 x3 10
EE 477 Dr. Mohamed Zribi 313 EE 477 Dr. Mohamed Zribi 314
The initial simplex tableau can be formed as follows After some work, you can obtain the following simplex tableau
Note: The initial basic solution is (x1, x2, x3, s1, s2, s3) =
(0, 0, 0, 50, –36, –10), which is not a feasible solution because the Note that it is the final tableau because it represents a feasible
values of the two surplus variables are negative solution and there are no negative entries in the bottom row
In other words, the point (x1, x2, x3) = (0, 0, 0) is not an vertex of the So, you can conclude that the maximum value of z = 64 and this
feasible solution region (in fact, (0, 0, 0) is not even in the feasible occur when (x1, x2, x3, s1, s2, s3)= (0, 36, 14, 0, 0, 4)
solution region)
So, we cannot apply the simplex method directly from this initial basic
solution
EE 477 Dr. Mohamed Zribi 315 EE 477 Dr. Mohamed Zribi 316
Special Cases
Usually an LPP will have a unique optimal solution.
But there are problems where there may be no solution,
EE 477 Dr. Mohamed Zribi 317 EE 477 Dr. Mohamed Zribi 318
Usually you are supposed to give all Optimal Solutions. optimal solutions as the following example illustrates.
EE 477 Dr. Mohamed Zribi 321 EE 477 Dr. Mohamed Zribi 322
Example 45: Alternative optimal solutions The initial tableau is such that:
Maximize z x1 x2 x1 x2 s1 s2 Sol.
Subject to:
x1 x2 6 1 1 1 0 6
x1 2 x2 10
x1 , x 2 0 1 2 0 1 10
EE 477 Dr. Mohamed Zribi 323 EE 477 Dr. Mohamed Zribi 324
x1 x2 s1 s2 Sol. x1 x2 s1 s2 Sol.
1 1 1 0 6 1 0 2 -1 2
0 1 -1 1 4 0 1 -1 1 4
0 0 1 0 6 0 0 1 0 6
This is the optimal tableau. Optimal Solution is x1=6, x2=0 and z=6 Note that we have got an alternative optimal solution.
However,
The optimal solution is x1=2, x2=4 and z = 6.
Since coefficient of the nonbasic variable x2=0, alt. opt. soln. exists.
EE 477 Dr. Mohamed Zribi 325 EE 477 Dr. Mohamed Zribi 326
x1 x2 s1 s2 Sol.
1 -1 1 0 10
0 1 -2 1 20
1 -1 1 0 10
0 -1 2 0 20
2 -1 0 1 40
This is the optimal tableau. Optimal Solution is x1=6, x2=0 and z=6
However,
-2 1 0 0 0
Since coefficient of the nonbasic variable x2=0, alt. opt. soln. exists.
EE 477 Dr. Mohamed Zribi 329 EE 477 Dr. Mohamed Zribi 330
Answer:
0 0 0 1 40
EE 477 Dr. Mohamed Zribi 331 EE 477 Dr. Mohamed Zribi 332
Example 47: Alternative optimal solutions
(30,20)
Maximize z 10 x1 5 x2
All points on this line from (30,20)
onwards are Optimal non-basic Subject to: x1 150
solutions.
x2 200
2 x1 x2 400
x1 , x2 0
EE 477 Dr. Mohamed Zribi 333 EE 477 Dr. Mohamed Zribi 334
Graphical solution
x2
Maximize z=10x1+5x2 Thus we see that the objective function z is maximum at the corner
Subject to: (150, 200) and also has an alternative optimum solution at the
2x1+x2 400 corner (100, 200). It may also be noted that z is maximum at each
point of the line segment joining them. Thus the problem has an
(100,200)
x1 150
infinite number of (finite) optimum solutions. This happens when
0,200)
z maximum x2 200
=2000 at
the objective function is “parallel” to one of the constraint
z=600 z=1500 x1,x2 0 equations.
(150,100)
z=2000 Solution is such that:
z=1000
EE 477 Dr. Mohamed Zribi 337 EE 477 Dr. Mohamed Zribi 338
Maximize z = 5x1 + 7 x2
If an LP is in the standard form with slack variables Subject to
only, then the problem has solution (s). 2 x1 - x2 ≤ -1
- x1 + 2 x2 ≤ -1
If a LP uses artificial variables, and the solution of the
x1, x2 ≥ 0
Phase I LP is such that r > 0, the original LP is infeasible.
No feasible solution
x1
EE 477 Dr. Mohamed Zribi 339 EE 477 Dr. Mohamed Zribi 340
Example 51: No feasible solution
Using the Simplex method, show that the following problem is infeasible
Max z = 3x1 5x2
x2
s.t.
x1 7 Min 2 x1 3 x2
2 x2 12 s.t. 3 x1 4 x2 12
3 x1 2 x2 18 7 x1 6 x2 42
x1 0, x2 0 x1 , x2 0
x1
infeasible No optimal solution!
EE 477 Dr. Mohamed Zribi 341 EE 477 Dr. Mohamed Zribi 342
Solution:
x1 x2 s1 s2 a1 b x1 x2 s1 s2 a1 b
minz=2x1 3x2
3 4 1 0 0 12 3 4 1 0 0 12
subject to 3 x1 4 x2 s1 12
7 6 0 1 1 42 7 6 0 1 1 42
7 x1 62 s2 42
0 0 0 0 1 0 7 6 0 1 0 42
x1 0 x2 0 s1 0 s2 0
Phase I x1 x2 s1 s2 a1 b x1 x2 s1 s2 a1 b
1 4 1 0 0 4 1 4 1 0 0 4
min r=a1 3 3 3 3
7 6 0 1 1 42 0 10 7 1 1 14
subject to 3 x1 4 x2 s1 12 3 3
7 6 0 1 0 42 0 10 7 1 0 14
7 x1 62 s2 a1 42 3 3
x1 0 x2 0 s1 0 s2 0
Minimum r =14 > 0 => the LP is infeasible
EE 477 Dr. Mohamed Zribi 343 EE 477 Dr. Mohamed Zribi 344
Special Case 3: Unbounded Solutions
From the graph, it is clear that the LP has No feasible solution
EE 477 Dr. Mohamed Zribi 345 EE 477 Dr. Mohamed Zribi 346
Maximize z = x1 + x2 z=70
Max 2 x1 3 x2
Subject to
s.t. x1 4 x2 8
- x1 + 3 x2 ≥ 30 - 3 x1 + x2 ≤ 2 x1 x2 4 Feasible region
30 z=50
x1 , x2 0 is unbounded
x1, x2 ≥ 0 Feasible region
is unbounded
z=30
z=20
unbounded solution x1
EE 477 Dr. Mohamed Zribi 349 EE 477 Dr. Mohamed Zribi 350
EE 477 Dr. Mohamed Zribi 351 EE 477 Dr. Mohamed Zribi 352
Example 57: Unbounded Solutions Thus the variable x2 can be increased indefinitely without
Maximize violating any of the constraints and thus the solution space
z 20 x1 10 x 2 x3
and the objective function are both unbounded.
Subject to:
3 x1 3 x2 5 x3 50
x1 x3 10 (You can form the Simplex tableau and verify that in x2
EE 477 Dr. Mohamed Zribi 353 EE 477 Dr. Mohamed Zribi 354
Example 58: Unbounded solution Solution: Introducing the slack variables x3 ≥ 0 and x4 ≥ 0,
the given system of equations can be written in canonical
form as:
Minimize z = -3x1- 2x2 x1 x2 x3 1
3x1 2 x2 x4 6
3x1 2 x2 z 0
subject to: x1 x2 1
The basic feasible solution corresponding to this canonical
3 x1 2 x2 6 form is given by:
x1 0, x2 0
x3 1, x4 6 (basic variables)
x1 x2 0 (nonbasic variables)
z 0
EE 477 Dr. Mohamed Zribi 355 EE 477 Dr. Mohamed Zribi 356
Variables Variables
Basic x1 x2 x3 x4 -f bi” b1”/ ais” for Basic x1 x2 x3 x4 -f bi” b1”/ ais” for
variables ais”>0 variables ais”>0
x3 1 -1 1 0 0 1 1 Smaller value x1 1 -1 1 0 0 1
1 (x3 leaves the
basis) Smaller value
x4 3 -2 0 1 0 6 2 x4 0 11 -3 1 0 3 3 (x4 leaves the
basis)
-f -3 -2 0 0 1 0 -f 0 -5 3 0 1 3
Most negative ci (x1 enters the next basis) Most negative ci (x2 enters the next basis)
EE 477 Dr. Mohamed Zribi 357 EE 477 Dr. Mohamed Zribi 358
Basic
variables
x1 x2 x3 x4 -f bi” b1”/ ais” for
However, since all the coefficients ai3” are negative, the value of
ais”>0
z can be decreased indefinitely without violating any of the
x1 1 0 -2 1 0 4
Both ais” are negative constraints if we bring x3 into the basis. Hence the problem has
(i.e. No variable leaves
x2 0 1 -3 1 0 3
the basis
no bounded solution.
-f 0 0 -12 5 1 18
Solution: Solution:
x1 x2 s1 s2 s3 b
x1 x2 s1 s2 s3 b
4 -1 1 0 0 8 1 -1/4 1/4 0 0 2
4 3 0 1 0 12 0 4 -1 1 0 4
4 1 0 0 1 8 0 2 -1 0 1 0
-3 -2 0 0 0 0 0 -11/4 3/4 0 0 6
EE 477 Dr. Mohamed Zribi 363 EE 477 Dr. Mohamed Zribi 364
Special Case 5: Cycling
x1 x2 s1 s2 s3 b
It is possible that the simplex method could go through several
1 0 1/8 0 1/8 2 iterations, each time encountering a BFS with the same z-value, and
0 0 1 1 -2 4 return to a BFS it has seen before!!
0 1 -0.5 0 0.5 0
0 0 -5/8 0 11/8 6
This is called cycling.
x1 x2 s1 s2 s3 b This is the optimal Once the simplex method encounters the first repeated BFS, it will
1 0 0 -1/8 3/8 3/2 tableau. Note that continue to cycle through the same pivots, effectively becoming
0 0 1 1 -2 4
the optimal BFS stuck!
0 1 0 1/2 -3/2 2
0 0 0 5/8 1/8 17/2 obtained is NOT
degenerate.
EE 477 Dr. Mohamed Zribi 365 EE 477 Dr. Mohamed Zribi 366
Cycling Cycling
Is it possible that the simplex procedure we described will never
In practice, cycling is extremely rare stop?
The answer is Yes!
Reason: If there is a change in the basis but not in the value of the
Simplex can be modified so that cycling cannot occur because
objective function, i.e. a basic variable whose value is zero leaves
there are simple remedies to prevent cycles, for example the the basis, we can cycle indefinitely between the two solutions.
Bland’s Rule. A basis with one or more of the basic variables equal zero is called
degenerate.
EE 477 Dr. Mohamed Zribi 367 EE 477 Dr. Mohamed Zribi 368
Example 60: Cycling
Exceptional cases Identified from the Simplex
tableau Table 1
BV Eq. # x1 x2 x3 x4 x5 x6 x7 RHS
* Tie for leaving variable - Degeneracy x5 1 1/2 11/2 5/2 9 1 0 0 0
x6 2 1/2 3/2 1/2 1 0 1 0 0
If in a Simplex iteration, there is a tie for leaving variable, x7 3 1 0 0 0 0 0 1 1
Z Z -10 57 9 24 0 0 0 0
then the resulting BFS will be degenerate, in the sense Table 2
that one of the basic variables will also be zero. This may BV Eq. # x1 x2 x3 x4 x5 x6 x7 RHS
x1 1 1 11 5 18 2 0 0 0
result in getting a new BFS without improving z. And in x6 2 0 4 2 8 1 1 0 0
some cases this may lead to “cycling.” x7 3 0 11 5 18 2 0 1 1
Z Z 0 53 41 204 20 0 0 0
EE 477 Dr. Mohamed Zribi 369 EE 477 Dr. Mohamed Zribi 370
Table 3 Table 5
BV Eq. # x1 x2 x3 x4 x5 x6 x7 RHS
BV Eq. # x1 x2 x3 x4 x5 x6 x7 RHS x3 1 2 4 1 0 1/2 9/2 0 0
x1 1 1 0 1/2 4 3/4 11/4 0 0 x4 2 1/2 1/2 0 1 1/4 5/4 0 0
x2 2 0 1 1/2 2 1/4 1/4 0 0 x7 3 1 0 0 0 0 0 1 1
x7 3 0 0 1/2 4 3/4 11/4 1 1 Z Z 20 9 0 0 21/2 141/2 0 0
Z Z 0 0 29/2 98 27/4 53/4 0 0
Table 6
Table 4
EE 477 Dr. Mohamed Zribi 371 EE 477 Dr. Mohamed Zribi 372
Table 7 = Table 1 Example 61: Cycling happens in this example
x1 x2 x3 x4 x5 x6
BV Eq. # x7 RHS
3 1
x5 1 1/2 11/2 5/2 9 1 0 0 0 Maximize z x1 20 x2 x3 6 x4
x6 2 1/2 3/2 1/2 1 0 1 0 0 4 2
x7 3 1 0 0 0 0 0 1 1
Z Z 10 57 9 24 0 0 0 0 Subject to:
1
Remark: x1 8 x2 x3 9 x4 0
4
In practice this is not an issue because there are simple 1 1
remedies to prevent cycles, eg. Bland’s Rule.
x1 12 x2 x3 3 x4 0
2 2
x3 1
x1 , x2 , x3 , x4 0
EE 477 Dr. Mohamed Zribi 373 EE 477 Dr. Mohamed Zribi 374
x1 x2 x3 x4 x5 x6 x7 b
x1 x2 x3 x4 x5 x6 x7 Ans
1
4 8 1 9 1 0 0 0
1 0 8 84 12 8 0 0
1 1
2 12 2 3 0 1 0 0 0 1 3
8
15
4
1
2
1
4 0 0
0 0 1 0 0 0 1 1 0 0 1 0 0 0 1 1
3 1
4 20 2 6 0 0 0 3 0 0 2 18 1 1 0 3
x1 x2 x3 x4 x5 x6 x7 b x1 x2 x3 x4 x5 x6 x7 Ans
1 32 4 36 4 0 0 0 1 32 4 36 4 0 0 0
3 3
0 4 2 15 2 1 0 0 0 4 2 15 2 1 0 0
0 0 1 0 0 0 1 1 0 0 1 0 0 0 1 1
7 7
0 4 2 33 3 0 0 3 0 4 2 33 3 0 0 3
375 376
EE 477 Dr. Mohamed Zribi EE 477 Dr. Mohamed Zribi
Cycling Cycling
x1 x2 x3 x4 x5 x6 x7 Ans x1 x2 x3 x4 x5 x6 x7 Ans
5
1 0 8 84 12 8 0 0 2 56 1 0 2 6 0 0
3 15 1 1 1 16 1 2
0 1 8 4 2 4 0 0 4 3 0 1 3 3 0 0
5
0 0 1 0 0 0 1 1 2 56 0 0 2 6 1 1
0 0 2 18 1 1 0 3 1
2 16 0 0 1 1 0 3
x1 x2 x3 x4 x5 x6 x7 Ans x1 x2 x3 x4 x5 x6 x7 Ans
1 11 3 1 11 3
8 0 1 2 2 1 0 0 8 0 1 2 2 1 0 0
3 3 1 1 3 3 1 1
64 1 0 16 16 8 0 0 64 1 0 16 16 8 0 0
1 11 3 1 11 3
8 0 0 2 2 1 1 1 8 0 0 2 2 1 1 1
1
4 0 0 3 2 3 0 3 1
4 0 0 3 2 3 0 3
377 378
EE 477 Dr. Mohamed Zribi EE 477 Dr. Mohamed Zribi
Cycling Cycling
x1 x2 x3 x4 x5 x6 x7 Ans x1 x2 x3 x4 x5 x6 x7 Ans
5 1
2 56 1 0 2 6 0 0 4 8 1 9 1 0 0 0
1 16 1 2 1 1
4 3 0 1 3 3 0 0 2 12 2 3 0 1 0 0
5
2 56 0 0 2 6 1 1 0 0 1 0 0 0 1 1
3 1
1
2 16 0 0 1 1 0 3 4 20 2 6 0 0 0 3
x1 x2 x3 x4 x5 x6 x7 Ans x1 x2 x3 x4 x5 x6 x7 Ans
5 1 5 1
4 28 2 0 1 3 0 0 4 28 2 0 1 3 0 0
1 1 1 1 1 1
6 4 6 1 0 3 0 0 6 4 6 1 0 3 0 0
0 0 1 0 0 0 1 1 0 0 1 0 0 0 1 1
7 1 7 1
4 44 2 0 0 2 0 3 4 44 2 0 0 2 0 3
379 380
EE 477 Dr. Mohamed Zribi EE 477 Dr. Mohamed Zribi
Duality Theory
The notion of duality within linear programming asserts Associated with every linear programming problem is a
that every linear program has associated with it a corresponding dual linear programming problem. If
related linear program called its dual. The original
one of these problems is one of minimization the
problem in relation to its dual is termed the primal.
other one is of maximization, and the optimal values
of the corresponding objective functions are equal.
It is the relationship between the primal and its dual,
both on a mathematical and economic level, that is
truly the essence of duality theory.
EE 477 Dr. Mohamed Zribi 383 EE 477 Dr. Mohamed Zribi 384
Symmetric Duals
Duality
The original Problem (Primal) is:
n
max becomes min max Z cjxj
x variables go
away x j 1
subject to
EE 477 Dr. Mohamed Zribi 385 EE 477 Dr. Mohamed Zribi 386
Dual m
minimize bi yi
i 1
a1n y1 a2 n y2 amn y m cn m Dual
subject to a ij y i cj for j 1, 2, ..., n
y1 , y 2 , , ym 0 i 1
yi 0 for i 1, 2, ..., m.
EE 477 Dr. Mohamed Zribi 387 EE 477 Dr. Mohamed Zribi 388
Definition: Symmetric Duals Symmetric Duals
Primal Problem Dual Problem Primal Problem Dual Problem
n m
Max Z cjxj, Min W bi yi , Maximize Z cT x, Minimize W y T b,
j 1 i 1
s.t. n s.t. m subject to subject to
aij x j bi , aij yi c j, Ax b AT y c
j 1 i 1
for i 1,2, , m. for j 1,2, , n. x 0. y 0.
xj 0, for j 1,2, , n. yi 0, for i 1,2, , m.
The dual problem uses exactly the same parameters b is not assumed to be non-negative
as the primal problem, but in different location.
EE 477 Dr. Mohamed Zribi 389 EE 477 Dr. Mohamed Zribi 390
Objective Function
y 1 a11 b1
Coefficient
a12 a1n
subject to: Dual Problem
Coefficients for
subject to
y 2 a21
(Minimize)
a22 a2 n b2
of:
T T
Ax b y A c
y m am1 am 2 amn bm
x 0 y 0
Right
Side ≥ ≥ ≥
c1 c2 cn
Coefficients for
Objective Function
EE 477 Dr. Mohamed Zribi 391 (Maximize)
EE 477 Dr. Mohamed Zribi 392
Relationships between Primal and Dual Problems General Rules for Constructing Duals
1. The number of variables in the dual problem is equal to the
One Problem Other Problem
number of constraints in the original (primal) problem. The
Constraint i Variable i
number of constraints in the dual problem is equal to the
Objective function Right sides number of variables in the original problem.
EE 477
Unrestricted
Dr. Mohamed Zribi 393
problem is the max problem.
EE 477 Dr. Mohamed Zribi 394
4. The coefficient of the first constraint function for the dual problem are the 8. The ith variable in the dual is unrestricted in sigh if and only if
coefficients of the first variable in the constraints for the original the ith constraint in the original problem is an equality.
problem, and the similarly for other constraints.
9. If the original problem is max (min) model, then after
5. The right-hand sides of the dual constraints come from the objective applying Rule 8, assign to the remaining variables in the dual
function coefficients in the original problem. a sense opposite to (the same as) the corresponding
constraints in the original problem.
6. The sense of the ith constraint in the dual is = if and only if the ith
variable in the original problem is unrestricted in sign. Max model Min model
xi ≥ 0 <=> ith constraint ≥
xi ≤ 0 <=> ith constraint ≤
7. If the original problem is max (min ) model, then after applying Rule 6, xi free <=> ith constraint =
assign to the remaining constraints in the dual a sense the same as ith const ≤ <=> yi ≥ 0
(opposite to ) the corresponding variables in the original problem. ith const ≥ <=> yi ≤ 0
ith const = <=> yi free
EE 477 Dr. Mohamed Zribi 395 EE 477 Dr. Mohamed Zribi 396
Example 63: Example 64:
The Primal
maximize 3x1 x 2 2x 3
Primal subject to x1 x 2 3x 3 30
2 x1 2x 2 5x 3 24
4 x1 x2 2x 3 36
x1 , x 2 , x 3 0
The dual
minimize 30y1 24y 2 36y 3
subject to y1 2y 2 4y 3 3
Dual
y1 2y 2 y3 1
3y1 5y 2 2y 3 2
y1 , y 2 , y 3 0
EE 477 Dr. Mohamed Zribi 397 EE 477 Dr. Mohamed Zribi 398
x1 , x2 , x3 , x4 0
EE 477 Dr. Mohamed Zribi 399 EE 477 Dr. Mohamed Zribi 400
Solution: Example 67:
The Dual Problem is
Primal Problem Dual Problem
min w 2000 y1 8000 y2 5000 y3
s.t.
Max Z 3 x1 5 x2 , Min W 4 y1 12 y2 18 y3 ,
1.5 y1 y 2 1.5 y3 5.24 s.t.
s.t.
y1 5 y2 + 3.0 y3 7.30 x1 4
2 x2 12 y1 3 y3 3
2.4y1 y2 3.5 y3 8.34
y1 3.5 y2 y3 4.18 3 x1 2 x2 18 2 y2 2 y3 5
x1 0, x 2 0 y1 0, y2 0, y3 0
y1 , y2 , y3 0
EE 477 Dr. Mohamed Zribi 401 EE 477 Dr. Mohamed Zribi 402
1 0 4 1 0 Objective coefficients
x
0 2 1 , 12 y1 , y2 , y3 0 2 3,5
x Columns into constraints and
3 2 2 18 3 2 constraints into columns
x1 0
. y1 , y2 , y3 0,0,0 .
x2 0
EE 477 Dr. Mohamed Zribi 403 EE 477 Dr. Mohamed Zribi 404
Solution: Example 69:
EE 477 Dr. Mohamed Zribi 405 EE 477 Dr. Mohamed Zribi 406
Solution:
Dual:
Primal:
An individual has a choice of two types of food to eat, meat and Primal:
potatoes, each offering varying degrees of nutritional benefit.
He has been warned by his doctor that he must receive at least
min Z 10x1 2x2
400 units of protein, 200 units of carbohydrates and 100 units x
of fat from his daily diet. Given that a kg of steak costs $10 and
Subject to: 8 0 x1 40 x2 400
provides 80 units of protein, 20 units of carbohydrates and 30
units of fat, and that a kg of potatoes costs $2 and provides 40 2 0 x1 50 x2 200
units of protein, 50 units of carbohydrates and 20 units of fat, he 3 0 x1 20 x2 100
would like to find the minimum cost diet which satisfies his x1 , x 2 0
nutritional requirements
EE 477 Dr. Mohamed Zribi 409 EE 477 Dr. Mohamed Zribi 410
Example 71:
Dual:
max w 400 y 1 200 y 2 100 y 3 Primal Dual
y
min 7 x1 x2 5 x3 max 10 y1 6 y2
Subject to :
s.t. x1 x2 3 x3 10 s.t. y1 5 y2 7
80 y 1 20 y 2 30 y 3 10 5 x1 2 x2 x3 6 y1 2 y2 1
x1 , x2 , x3 0 3 y1 y2 5
40 y 1 50 y 2 20 y 3 2
y1 , y2 0
y1 , y 2 , y 3 0
EE 477 Dr. Mohamed Zribi 411 EE 477 Dr. Mohamed Zribi 412
Example 72: Dual
m in w 20 y1 30 y 2
y
Primal
3 y1 18 y 2 5
max Z 5x1 3x2 8x3 0 x4 12 x5
x 8 y1 5 y2 3
Subject to: 8 y2 8
3x1 8x2 9 x4 15x5 20 9 y1 4 y2 0
18x1 5x2 8x3 4 x4 12 x5 30 15 y1 12 y 2 12
x1 ,x2 ,x3 ,x4 ,x5 0 y1 , y 2 0
EE 477 Dr. Mohamed Zribi 413 EE 477 Dr. Mohamed Zribi 414
max Z 4 x1 10 x 2 9 x3
x
x1 0 x2 0 xn 0 w=
Subject to :
y1 0 a11 a12 a1n b1
y2 0 a21 a22 a2n b2
5 x1 18 x 2 5 x3 15
Dual
(min w) ... ... ... ... ... 8 x1 12 x 2 8 x3 8
ym 0 am1 am2 amn bn 12 x1 4 x2 8 x3 10
2 x1 5 x3 5
Z= c1 c2 cn
x1 , x 2 , x 3 0
EE 477 Dr. Mohamed Zribi 415 EE 477 Dr. Mohamed Zribi 416
Dual
x1 0 x2 0 x3 0 w=
min w 15 y1 8 y2 10 y3 5 y4
y1 0 5 18 5 15
y
y2 0 8 12 -8 8
Dual
y3 0 12 4 8 10
(min w)
y4 0 2 0 5 5
Z= 4 10 9
5 y1 8 y2 12 y 3 2 y4 4
18 y1 12 x 2 4 y3 10
5 y1 8 y3 5 y4 9
y1 , y 2 , y 3 , x 4 0
EE 477 Dr. Mohamed Zribi 417 EE 477 Dr. Mohamed Zribi 418
Primal:
Reversed
Constraint constants
Objective coefficients
EE 477 Dr. Mohamed Zribi 419 EE 477 Dr. Mohamed Zribi 420
Un-symmetric Duals (Maximize)
Given the primal problem (in standard form)
Maximize
z c1 x1 c2 x2 ... cn xn
subject to a11 x1 a12 x 2 ... a1 n x n b1
10. Un-Symmetric Duals
a 21 x1 a 22 x 2 ... a 2 n x n b2
.
.
a m 1 x1 a m 2 x2 ... a mn x n bm
x1 , x 2 , ..., x n 0, b1 , b2 , ..., bm 0
EE 477 Dr. Mohamed Zribi 421
421 EE 477 Dr. Mohamed Zribi 422
EE 477 Dr. Mohamed Zribi 423 EE 477 Dr. Mohamed Zribi 424
Un-symmetric Duals (Minimize) Then the dual problem is the LPP
If the primal problem (in standard form) is
Minimize z c1 x1 c2 x2 ... c n x n Maximize w b1 y1 b2 y 2 ... bm y m
subject to
subject to
a11 x1 a12 x2 ... a1n xn b1
a11 y1 a 21 y 2 ... a m 1 y m c1
a21 x1 a22 x2 ... a2 n xn b2
a12 y1 a 22 y 2 ... a m 2 y m c2
. .
. .
am1 x1 am 2 x2 ... amn xn bm a1 n y1 a2 n y2 ... a mn y m cn
x1 , x2 ,..., xn
EE 477
0, b1 , b2 ,..., bm
Dr. Mohamed Zribi
0 425
y1 , y 2 , ..., y n unrestricted in sign
EE 477 Dr. Mohamed Zribi 426
Un-symmetric Duals
Example 75:
EE 477 Dr. Mohamed Zribi 427 EE 477 Dr. Mohamed Zribi 428
Thus the primal in the standard form is: Hence the dual is:
subject to: 6 x1 3 x2 x3 x4 2
6 x1 3 x2 x3 2
3 x1 4 x2 x3 x5 5
3 x1 4 x2 x3 5
x1 , x2 , x3 , x4 , x5 0
x1 , x2 , x3 0
EE 477 Dr. Mohamed Zribi 431 EE 477 Dr. Mohamed Zribi 432
Hence the dual is:
Example 77:
subject to:
Maximize z x1 x2
6 y1 3 y2 6
3 y1 4 y2 3 subject to
y1 y2 0
2 x1 x2 5
y1 0 3 x1 x2 6
y1 , y2 0
y2 0 x1 , x2 unrestricted in sign
y1 , y 2 u n r e s t r i c t e d i n s i g n
EE 477 Dr. Mohamed Zribi 433 EE 477 Dr. Mohamed Zribi 434
Thus the primal in the standard form is: Hence the dual is:
Maximize z x1 x1 x2 x2 Minimize w 5 y1 6 y 2
subject to:
subject to:
2 x1 2 x1 x2 x2 5 2 y1 3 y2 1
2 y1 3 y2 1 2 y1 3y2 1
3 x1 3 x1 x2 x2 6 y1 y2 1
y1 y2 1
x1 , x1 , x2 , x2 0 y1 y2 1
y 1 , y 2 u n r e s tr ic te d in s ig n
EE 477 Dr.435
Mohamed Zribi 435 EE 477 Dr.436
Mohamed Zribi 436
Finding the Dual of Nonstandard Linear
Conversion of Equality Constraints
Programs
k
d ixi e
We handle “=“ constraints by writing them as “<=“ i 1
constraints. k
k
d i xi e d i xi e
This is possible here because we do not require here i 1 i 1
k
k
d i xi e d i xi e
that the RHS is non-negative. i 1
i 1
Standard form!
EE 477 Dr. Mohamed Zribi 437 EE 477 Dr. Mohamed Zribi 438
Subject to:
2 x2 x3, x3,, 4 y2 y3 y4 1
, ,,
x1 3 x2 4x 3 4x 3 5 2 y1 3 y2 3 y3 2 y4 1
x1 3 x2 4 x3, 4 x3,, 5 y1 4 y2 4 y3 1
x1 2 x2 3 y1 4 y2 4 y3 1
x1 , x2 , x3, , x3,, 0 y1 , y 2 , y 3 , y 4 0
EE 477 Dr. Mohamed Zribi 441 EE 477 Dr. Mohamed Zribi 442
EE 477 Dr. Mohamed Zribi 443 EE 477 Dr. Mohamed Zribi 444
Hence, Example 79:
Consider the following primal problem:
min w 4 y1' 5 y'2 3y3'
y '2 y3' 1
2 y1' 3 y '2 2 y3' 1
y1' 4 y '2 1
The first inequality requires no modification.
' ' '
y ,y
1 3 0, , y 2 urs
EE 477 Dr. Mohamed Zribi 445 EE 477 Dr. Mohamed Zribi 446
EE 477 Dr. Mohamed Zribi 447 EE 477 Dr. Mohamed Zribi 448
Hence, the dual problem is such that: Example 80:
The dual of this problem can now be obtained as follows:
Write the dual of the LPP
Maximize z 5 x1 4 x2
subject to 3 x1 8 x2 6
x1 6 x2 5
8 x1 10
x2 0, x1 unrestricted in sign
EE 477 Dr. Mohamed Zribi 449 EE 477 Dr. Mohamed Zribi 450
Solution:
Maximize z 5 x1 4 x2 Minimize W 6 y1 5 y2 10 y3
subject to 3 x1 8 x2 6 subject to
3 y1 y2 8 y3 5
x1 6 x2 5 8 y1 6 y2 4
8 x1 10
x2 0, x1 unrestricted in sign y1 0, y2 , y3 unrestricted in sign
EE 477 Dr. Mohamed Zribi 451 EE 477 Dr. Mohamed Zribi 452
Example 81: The equivalent form is such that:
max Z 6 x1 4 x2 max Z 6 x1 4 x2
x x
EE 477 Dr. Mohamed Zribi 453 EE 477 Dr. Mohamed Zribi 454
Property 1 Proof :
For any feasible solution to the primal problem and any Am nxn 1 bm 1
feasible solution to the dual problem, the value of
y1T m A m n x n 1 y1T m b m 1
the primal objective function being maximized is
always equal to or less than the value of the dual
objective function being minimized. A Tn m y m 1 c n 1 or y1T m A m n c1T n
y1T m A m n x n 1 c1T n x n 1
y1T m b m 1 c1T n x n 1
EE 477 Dr. Mohamed Zribi 459 EE 477 Dr. Mohamed Zribi 460
Property 2 Proof:
If x* is a feasible solution to the primal problem According to the previous property, no feasible x
*
and y is a feasible solution to the dual problem can make cT x larger than bT y. Since x* achieves this value,
such that n m
it is optimal (maximum).
*
T
c x *
b yT * cjx j bi yi*
j 1 i 1
* Similarly, no feasible y can bring by below the number
then x is an optimal solution to the primal problem
* cT x, and any y * that achieves this minimum must be optimal.
and y is an optimal solution to the dual problem.
EE 477 Dr. Mohamed Zribi 461 EE 477 Dr. Mohamed Zribi 462
m
c jx * j a ijy*i x * j
minimize bi yi j 1 j 1 i 1
i 1 m n
subject to
m
a ij y i cj for j 1, 2, ..., n
a ijx * j y*i
i 1 j 1
i 1
yi 0 for i 1, 2, ..., m. m
b i y *i
i 1
EE 477 Dr. Mohamed Zribi 465 EE 477 Dr. Mohamed Zribi 466
Primal Dual
Any pair of primal and dual problems can be
min 7 x1 x2 5 x3 max 10 y1 6 y2
s.t. x1 x2 3 x3 10 s.t. y1 5 y2 7 converted to each other.
5 x1 2 x2 x3 6 y1 2 y2 1
3 y1 y2 5 The dual of a dual problem always is the primal
x1 , x2 , x3 0
y1 , y2 0 problem.
x=(7/4,0,11/4) and y=(2,1) are feasible solutions
7*7/4 + 0 + 5*11/4 = 10*2 + 6*1 = 26
Thus, x and y are optimal
EE 477 Dr. Mohamed Zribi 467 EE 477 Dr. Mohamed Zribi 468
Remark: Relations between Primal and Dual
1. The dual of the dual problem is again the primal problem.
The feasible solutions for a dual problem are
2. Either of the two problems has an optimal solution if and
those that satisfy the condition of optimality for only if the other does; if one problem is feasible but
its primal problem. unbounded, then the other is infeasible; if one is
infeasible, then the other is either infeasible or
feasible/unbounded.
A maximum value of z in a primal problem
equals the minimum value of w in the dual 3. Weak Duality Theorem: The objective function value of
the primal (dual) to be maximized evaluated at any
problem. primal (dual) feasible solution cannot exceed the dual
(primal) objective function value evaluated at a dual
(primal) feasible solution.
EE 477 Dr. Mohamed Zribi 469 cTx >= bTy (in theDr.standard
EE 477 Mohamed Zribi equality form) 470
Duality of LP
4. Strong Duality Theorem: When there is an optimal
solution, the optimal objective value of the primal is
the same as the optimal objective value of the dual. Every linear programming problem has an associated
cTx* = bTy* linear program called its dual such that a solution to
the original linear program also gives a solution to its
5. Complementary Slackness Theorem: Consider an
inequality constraint in any LP problem. If that dual
constraint is inactive for an optimal solution to the
problem, the corresponding dual variable will be zero
in any optimal solution to the dual of that problem.
Solve one, get one free!!
x*j (c-ATy*)j = 0, j=1,…,n.
EE 477 Dr. Mohamed Zribi 471 EE 477 Dr. Mohamed Zribi 472
Solution of a Minimization Problem
EE 477 Dr. Mohamed Zribi 475 EE 477 Dr. Mohamed Zribi 476
Apply the simplex method with the initial basic solution (y1, y2,
y3, s1, s2)= (0, 0, 0, 0.12, 0.15)
So the optimal solution is (y1, y2, y3, s1, s2) = (7/4000, 0, 3/2000, 0, 0) with the
maximum value to be 300(7/4000)+36(0)+90(3/2000) = 33/50 = 0.66
※ The optimal values of xi’s for the original minimization can be obtained
from the entries in the bottom row corresponding to slack variable columns,
i.e., x1=3 and x2=2
※ So the minimum value for the original objective function is 0.12(3)+0.15(2)
= 0.66, which is exactly the maximum value for the dual maximization
problem.
EE 477 Dr. Mohamed Zribi 477 EE 477 Dr. Mohamed Zribi 478
Example 85: Solving a minimization problem 2. Derive the matrix corresponding to the dual maximization
Find the minimum value of w = 3x1 + 2x2, subject to the constraints
problem by taking transpose
2 x1 x2 6
x1 x2 4
where x1 0 and x2 0
EE 477 Dr. Mohamed Zribi 481 EE 477 Dr. Mohamed Zribi 482
where y1 0, y2 0, and y3 0
Solution:
First, transpose the augmented matrix The initial simplex tableau
transpose
EE 477 Dr. Mohamed Zribi 483 EE 477 Dr. Mohamed Zribi 484
Example 87:
A small petroleum company owns two refineries. Refinery 1 costs
$20,000 per day to operate, and it can produce 400 barrels of high-
grade oil, 300 barrels of medium-grade oil, and 200 barrels of low-
grade oil each day. Refinery 2 is newer and more modern. It costs
$25,000 per day to operate, and it can produce $300 barrels of high-
grade oil, 400 barrels of medium-grade oil, and 500 barrels of low-
grade oil each day
The company has orders totaling 25,000 barrels of high-grade
oil, 27,000 barrels of medium-grade oil, and 30,000 barrels of low-
grade oil. How many days should this petroleum company run each
From the last row of this final simplex tableau, you can see the refinery to minimize its costs and still refine enough oil to meet its
maximum value of z is 36. So the solution of the original minimization orders?
problem is w =36, and thisEEoccurs
477 Dr.when
Mohamed (x
Zribi, x , x ) = (2, 0, 4)
1 2 2
485 EE 477 Dr. Mohamed Zribi 486
Solution:
Now apply the simplex method to the dual problem
Let x1 and x2 represent the numbers of days on which the two
refineries are operated. Then the total cost is represented by
C = 20,000x1 + 25,000x2,
and the constraints are
400 x1 300 x2 25, 000 (high-grade oil)
300 x1 400 x2 27, 000 (medium-grade oil)
200 x1 500 x2 30, 000 (low-grade oil)
where x1 0 and x2 0
transpose
EE 477 Dr. Mohamed Zribi 487 EE 477 Dr. Mohamed Zribi 488
Example 88:
max x1 4 x2 3 x3
s.t.
PRIMAL
2 x1 2 x2 x3 4
x1 2 x2 2 x3 6
x1 , x2 , x3 0
From this final simplex tableau, you can see the
solution for the original minimization problem is C = min 4 y1 6 y2
s.t.
$ 1,750,000 and this occurs when x1 = 25 and x2 = DUAL
2 y1 y2 1
50, i.e., the two refineries should be operated for 25 2 y1 2 y2 4
y1 2 y2 3
and 50 days, respectively
y1 , y2 0
EE 477 Dr. Mohamed Zribi 489 EE 477 Dr. Mohamed Zribi 490
x1 x2 x3 x4 x5
x4 2 2 1 1 0 4 Example 89:
x5 1 2 2 0 1 6 Dual:
Primal:
1 4 3 0 0 0
maximize: minimize:
z = 2x1 + 3x2 z = 4y1 + 18y2 + 10y3
x1 x2 x3 x4 x5
x2 1 1 1/ 2 1/ 2 0 2
x1 0 subject to:
subject to:
x5 1 0 1 1 1 2 x2 1 x1 – ≤ 4
2x2 y1 + 2y2 ≥2
3 0 1 2 0 8 x3 2
2x1 + ≤ 18 ≥3
-2y1 + Y2 + Y3
x1 x2 x3 x4 x5 B 1 x2
y1 1 x2 ≤ 10 y1 , y 2 , y 3 ≥ 0
x2 3/ 2 1 0 1 1/ 2 1
x3 1 0 1 1 1 2 y2 1 x1 , x 2 ≥ 0
2 0 0 1 EE 477 1Dr. Mohamed
10Zribi T 1
Solution to both is 38 (x1=4, x2=10), (y1=0, y2=1, y3=2).
c BB 491 EE 477 Dr. Mohamed Zribi 492
Example 90: The dual is the LPP
Consider the LPP Minimize w y1 5 y2 6 y3
Maximize z 50 x1 30 x2 10 x3 subject to
2 y1 4 y3 50
y1 2 y2 30
subject to 2 x1 x2 1 y3 10
2 x2 5 y1 , y2 , y3 unrestricted in sign
4 x1 x3 6
x1 , x2 , x3 0
Show that the given primal problem is infeasible and its dual is y1 5, y3 10, y2 any number 15
unbounded.
The primal is infeasible as 2nd constraint violates x2 0 is a feasible solution of the dual. Hence the dual is unbounded.
EE 477 Dr. Mohamed Zribi 493 EE 477 Dr. Mohamed Zribi 494
y1 y2 1 y1
y1 , y2 0 Dual
EE 477 Dr. Mohamed Zribi 495 EE 477 Dr. Mohamed Zribi 496
Sensitivity Analysis
EE 477 Dr. Mohamed Zribi 497 EE 477 Dr. Mohamed Zribi 498
EE 477 Dr. Mohamed Zribi 499 EE 477 Dr. Mohamed Zribi 500
Duality Theory Rules for converting Primal to Dual
Every LP problem (called the ‘Primal’) has associated with
If the Primal is to maximize, the dual is to minimize.
another problem called the ‘Dual’.
If the Primal is to minimize, the dual is to maximize.
The ‘Dual’ problem is an LP defined directly and systematically
For every constraint in the primal, there is a dual variable.
from the original (or Primal) LP model.
For every variable in the primal, there is a constraint in the dual.
The optimal solution of one problem yields the optimal solution
to the other.
EE 477 Dr. Mohamed Zribi 501 EE 477 Dr. Mohamed Zribi 502
Primal Dual
EE 477 Dr. Mohamed Zribi 505 EE 477 Dr. Mohamed Zribi 506
Example Solution
EE 477 Dr. Mohamed Zribi 509 EE 477 Dr. Mohamed Zribi 510
Example Solution:
Primal Primal in standard form :
Min.. Z = 2x2 + 5x3 Max.. Z = -2x2 - 5x3
EE 477 Dr. Mohamed Zribi 511 EE 477 Dr. Mohamed Zribi 512
Dual
Min. Z’ = -2y1 + 6y2 + 4y3 – 4y4
Subject to constraints:
EE 477 Dr. Mohamed Zribi 513 EE 477 Dr. Mohamed Zribi 514
EE 477 Dr. Mohamed Zribi 515 EE 477 Dr. Mohamed Zribi 516
Example Solution:
Min. Z = 3x1 + 2x2 Step I: The first two inequalities are multiplied by –1 to convert
Subject to constraints:
them to < constraints and convert the objective function into
3x1 + x2 > 3 maximization function.
4x1 + 3x2 > 6 Max. Z’ = -3x1 - 2x2 where Z’= -Z
x1 + x2 < 3 Subject to constraints:
-3x1 - x2 < -3
x1 , x 2 > 0
-4x1 - 3x2 < -6
x1 + x2 < 3
x1, x2 > 0
EE 477 Dr. Mohamed Zribi 517 EE 477 Dr. Mohamed Zribi 518
Therefore, S1 is the departing variable and x1 is the Optimal Solution is : x1= 3/5, x2= 6/5, Z= 21/5
entering variable.
EE 477 Dr. Mohamed Zribi 521 EE 477 Dr. Mohamed Zribi 522
Example Solution:
Let S1, S2 , S3 be three slack variables
Max. Z = -x1 - x2
Subject to constraints:
Model can rewritten as:
Z + x 1 + x2 = 0
x1 + x2 < 8 x1 + x2 + S1 = 8
x2 > 3 -x2 + S2 = -3
-x1 + x2 < 2 -x1 + x2 + S3 = 2
x 1, x 2 > 0 x1 , x2 > 0
Therefore, S2 is the departing variable and x2 is the Therefore, S3 is the departing variable and x1 is the
entering variable. entering variable.
EE 477 Dr. Mohamed Zribi 525 EE 477 Dr. Mohamed Zribi 526
EE 477 Dr. Mohamed Zribi 527 EE 477 Dr. Mohamed Zribi 528
Matrix Standard Form of an LP Model To help you distinguish Tabular Standard Form of an LP Model
between matrices, vectors,
and scalars, we use
BOLDFACE CAPITAL
letters to represent matrices,
bold lowercase letters to
represent vectors, and
italicized letters in ordinary
print to represent scalars.
Transforming Any LP Model into the Transforming Any LP Model into the Standard Form
Standard Form
(1) Minimizing rather than maximizing the objective (4) Deleting the nonnegativity constraints for some decision variables
Maximize Z΄ = – Z
(2) Some functional constraints with a less-than-or-equal-to inequality
Example 1
Introduce the concept of slack variables.
To illustrate, use the first functional constraint, x1 ≤ 4, in the Wyndor Glass Original Model Standard Form
Co. problem as an example. x1 ≤ 4 is equivalent to x1 + x2=4 where x2 ≥ 0.
The variable x2 is called a slack variable.
(3) Some functional constraints with a greater-than-or-equal-to inequality
Simplex Method
functional constraints.
D intersection of n constraint
The five points A, B, C, D and E are
the corner-point feasible solutions boundaries.
(CPF solutions).
A E F Constraint boundaries and corner-point
The points F, G and H are called
solutions for the Wyndor Glass Co.
corner-point infeasible solutions.EE 477 Constraint boundaries and corner-point
Dr. Mohamed Zribi EE 477
Problem
Dr. Mohamed Zribi
solutions for the Wyndor Glass Co. Problem
Geometric Concepts of Simplex Method
Adjacent CPF Soluionts
Z=0 at point A
B C Z=30 at point B
Z=36 at point C
D Z=27 at point D
A E EE 477
Z=12 at point E
Dr. Mohamed Zribi EE 477 Dr. Mohamed Zribi
The Key Solution Concepts
The Key Solution Concepts
B C
D
EE 477 Dr. Mohamed Zribi
A
EE 477
E
Dr. Mohamed Zribi
B C
D
A
EE 477 E
Dr. Mohamed Zribi EE 477 Dr. Mohamed Zribi
Augmented Form of the Model
D
H(3,2)
EE 477 Dr. Mohamed Zribi EE 477
A
Dr. Mohamed Zribi
E F
B C
D
A E
EE 477 Dr. Mohamed Zribi EE 477 Dr. Mohamed Zribi
Optimality Test Iteration1 Step1: Determining the Direction of Movement
Geometric interpretation Algebraic interpretation Geometric interpretation Algebraic interpretation
B C
D
A E
EE 477 Dr. Mohamed Zribi EE 477 Dr. Mohamed Zribi
Initial BF
Solution
Iteration1 Step3: Solving for the New BF Solution (0) Nonbasic variables: x1= 0
Geometric interpretation Algebraic interpretation (1) x 2= 0
B C (3) x2 =6
Nonbasic variables
Basic variables: x3= 4 x5= ?
D
Basic variables x2 =6
A E
EE 477 Dr. Mohamed Zribi
x5= 6 EE 477 Dr. Mohamed Zribi
Iteration2
Optimality Test
Geometric interpretation Algebraic interpretation Step1: Determining the Direction of Movement
Choose x1 to be the entering basic variable
Step2: Where to Stop
B(0,6) is not optimal,
The objective function: The minimum ratio test
because moving from
indicates that x5 is the
B to C increases Z. leaving basic variable
The rate of improvement of Z by the
nonbasic variable x1 is 3
The rate of improvement of Z by the Step3: Solving for the New BF Solution
B C nonbasic variable x4 is -5/2
(0)
(1) New BF Solution
D
A E Conclusion: The BF solution (2) Nonbasic variables: x1= 0, x4= 0
EE 477
(0,6,4,0,6) is not optimal.
Dr. Mohamed Zribi (3) EE 477 Basic
Dr. Mohamed Zribivariables: x3= 2, x2 =6, x1= 2
Optimality Test
The objective function: