Professional Documents
Culture Documents
Example:
Convert this LP to
Standard Form
HOW TO CONVERT AN LP TO STANDARD FORM
Solution:
: slack variable
: excess variable
BASIC AND NONBASIC VARIABLES
A set of points S is a convex set if the line segment joining any pair of points in
S is wholly contained in S.
For any convex set S, a point P in S is an extreme point if P is an endpoint of all
line segents containing P and contained in S.
The feasible region of an LP is a convex set, and an extreme point is actually a
corner point of the feasible region.
Extreme points are important because if an LP has an optimal solution, it has an
optimal extreme point suffices
It is sufficient to focus on extreme points to find the optimal solution.
WHY IS BFS IMPORTANT?
A point in the feasible region of an LP is an extreme point if and only if it is a basic
feasible solution to the LP.
Consider the following example:
𝑀𝑎𝑥𝑧=4𝑥1+3𝑥2 Convert to
Standart Form
𝑀𝑎𝑥𝑧=4𝑥 1+3𝑥 2
Nonbasic
Basic Var BFS Corner Point
Var
x1,x2 s1,s2 s1=s2=0, x1=x2=20 E
x1,s1 x2,s2 x2=s2=0, x1=30, s1=10 C
x1,s2 x2,s1 x2=s1=0, x1=40, s2=-20 not a bfs
x2,s1 x1,s2 x1=s2=0, x2=60, s1=-20 not a bfs
x2,s2 x1,s1 x1=s1=0, x2=40, s2=20 B
s1,s2 x1,x2 x1=x2=0, s1=40, s2=60 F
WHY IS BFS IMPORTANT?
In performing the simplex algorithm, write the objective function in row 0 version
DAKOTA FURNITURE COMPANY
• Decision variables:
number of desks produced
number of tables produced
number of chairs produced
• The resulting model is
CONVERT THE LP TO STANDARD FORM
Row
0 =0
1 =48
2 =20
3 =8
4 =5
OBTAIN THE CANONICAL FORM AND FIND A
BFS
z x1 x2 x3 s1 s2 s3 s4 rhs
1 -60 -30 -20 0 0 0 0 0
0 8 6 1 1 0 0 0 48
0 4 2 1.5 0 1 0 0 20
0 2 1.5 0.5 0 0 1 0 8
0 0 1 0 0 0 0 1 5
OBTAIN THE CANONICAL FORM AND FIND A
BFS
• When all constraints are and their right-hand sides are nonnegative,
obtaining the canonical form and finding an initial bfs is easy.
• Note that we need a basic variable for each row. The variables having
unit vectors in their columns can be used.
NBV={}, BV={}
• In the previous slide we applied ratio test and the winner was row 3.
Row 3 will determine the maximum value of .
• Apply ratio test for the rows where the coefficient of the entering
variable is strictly positive. The row having the minimum ratio is the
winner.
• will enter the basis in row 3 and, therefore, will leave the basis and
become nonbasic variable.
• Divide row 3 by 2.
z x1 x2 x3 s1 s2 s3 s4 rhs Basic var.
1 -60 -30 -20 0 0 0 0 0
0 8 6 1 1 0 0 0 48
0 4 2 1.5 0 1 0 0 20
0 1 0.75 0.25 0 0 0.5 0 4
0 0 1 0 0 0 0 1 5
FIND A NEW BFS - 2
• will enter the basis in row 3. Therefore, in row 3, its coefficient will be
zero, and in the other rows, its coefficients will be 0.
• By applying elementary row operations obtain the bfs.
• NBV={}, BV={}
0 0 1 0 0 0 0 1 5
FIND A NEW BFS - 3
• will enter the basis in row 3. Therefore, in row 3, its coefficient will be
zero, and in the other rows, its coefficients will be 0.
• By applying elementary row operations obtain the bfs.
• NBV={}, BV={}
0 0 1 0 0 0 0 1 5
FIND A NEW BFS - 4
• will enter the basis in row 3. Therefore, in row 3, its coefficient will be
zero, and in the other rows, its coefficients will be 0.
• By applying elementary row operations obtain the bfs.
• NBV={}, BV={}
0 0 1 0 0 0 0 1 5
FIND A NEW BFS - 5
• will enter the basis in row 3. Therefore, in row 3, its coefficient will be
zero, and in the other rows, its coefficients will be 0.
• By applying elementary row operations obtain the bfs.
• NBV={}, BV={}
0 0 1 0 0 0 0 1 5 s4=5
FIND A NEW BFS - 6
• Now, we have a new bfs and a new canonical table.
• Again, check the optimality of this bfs. Since we have a negative
coefficient in row 0, this solution is not optimal. Therefore, repeat all
steps to find a better bfs...
0 0 1 0 0 0 0 1 5 s4=5
NEXT ITERATION
0 0 1 0 0 0 0 1 5 s4=5
NEXT ITERATION
• We have a new bfs and a new canonical table.
• Check the optimality.
• Since all coefficients in row 0 are nonnegative, this bfs is optimal.
A canonical form is optimal (for a max problem) if each nonbasic variable has
a nonnegative coefficient in the canonical form’s row 0.
0 0 1 0 0 0 0 1 5 s4=5
RESULT
• The optimal solution to the problem
• .
• The maximum value of the profit is 280.
0 0 1 0 0 0 0 1 5 s4=5
SUMMARY OF THE SIMPLEX ALGORITHM FOR
A MAX PROBLEM
• Step 1 Convert the LP to standard form.
• Step 2 Find a basic feasible solution. This is easy if all the constraints are ≤ with
nonnegative right-hand sides. Then the slack variable may be used as the basic
variable for row . If no bfs is readily apparent, how you can find a bfs will be
discussed later.
• Step 3 If all nonbasic variables have nonnegative coefficients in row 0, then the
current bfs is optimal. If any variables in row 0 have negative coefficients, then
choose the variable with the most negative coefficient in row 0 to enter the
basis.
• Step 4 Use EROs to make the entering variable the basic variable in any row
that wins the ratio test (ties may be broken arbitrarily). After the EROs have
been used to create a new canonical form, return to step 3, using the current
canonical form.
ALTERNATIVE OPTIMAL SOLUTIONS
• Consider the Dacota example assuming that tables sell for $35 instead of
$30.
Initial table
Next table
Let’s find the alternative optima solution by doing one more iteration for to
enter the basis.
It is known that any point on the line segment joining two optimal solutions
is also optimal. Therefore, is optimal for any . Verify this!
Initial table
Standard Form
• Example:
Standard Form
Initial table
Standard Form
Breadco Bakeries bakes two kinds of bread: French and sourdough. Each
loaf of French bread can be sold for 36¢, and each loaf of sourdough bread
for 30¢. A loaf of French bread requires 1 yeast packet and 6 oz of flour;
sourdough requires 1 yeast packet and 5 oz of flour. At present, Breadco has
5 yeast packets and 10 oz of flour. Additional yeast packets can be
purchased at 3¢ each, and additional flour at 4¢/oz. Formulate and solve an
LP that can be used to maximize Breadco’s profits ( revenues - costs).
UNBOUNDED LP
Decision variables:
number of loaves of French bread baked
number of loaves of sourdough bread baked
number of packets of yeast purchased
number of ounces of flour baked
The model is
UNBOUNDED LP
Initial table
Next table
1 0 0 3 -2 0 6 60 z=60
0 0 1/6 -1 1/6 1 -1/6 20/6 s1=20/6
0 1 5/6 0 -1/6 0 1/6 10/6 x1=10/6
UNBOUNDED LP
The model in standard form is
1 0 2 -9 0 12 4 100 z=100
0 0 1 -6 1 6 -1 20 x4=20
0 1 1 -1 0 1 0 5 x1=5
UNBOUNDED LP
can be increased as much as we like. Since increasing by 1 will increase z
by 9, we can increase as much as we like. Therefore, this LP is unbounded.
Can we make equal to 1000?
must be 100. Then will be ; will be
Please check that is feasible and has an objective function value of 1000.
1 0 2 -9 0 12 4 100 z=100
0 0 1 -6 1 6 -1 20 x4=20
0 1 1 -1 0 1 0 5 x1=5
UNBOUNDED LP
RULE: an unbounded LP for a max problem occurs when a variable
with a strictly negative coefficient in row 0 has a nonpositive
coefficient in each constraint.
DEGENERACY AND THE CONVERGENCE
OF THE SIMPLEX ALGORITHM
• Theoretically, the simplex algorithm may fail to find the optimal
solution.
• However, LPs arising from actual applications seldom exhibit this un-
pleasant behavior.
• We now discuss the situation in which the simplex can fail.
• Our discussion depends crucially on the following relationship (for a
max problem):
• z-value for new bfs=z-value of current bfs-(value of entering
variable in new bfs)(coefficient of entering variable in row 0 of
current bfs)
• The facts:
• Fact 1: If (value of entering variable in new bfs)>0, then (z-value for
new bfs)>(z-value for current bfs).
• Fact 2: If (value of entering variable in new bfs)=0, then (z-value for
new bfs)=(z-value for current bfs).
DEGENERACY AND THE CONVERGENCE
OF THE SIMPLEX ALGORITHM
• If in each of the LP’s basic feasible solutions, all of the basic variables
are strictly positive, then this LP is called nondegenerate.
• The simplex algorithm can solve nondegenerate LPs in a finite number
of iterations.
• Fact 1 implies that in every iteration of the simplex method, z will
increase. Therefore, the simplex algorithm cannot visit the same bfs
twice.
• Since an LP always has always finite bfs, the simplex algorithm will
terminate after a finite number of iterations.
• If a nondegenerate LP has 10 variables and 4 constraints, then it has at
most bfs.
• Since we will never repeat a bfs, the simplex method solve this LP
after at most 210 iterations.
DEGENERACY AND THE CONVERGENCE
OF THE SIMPLEX ALGORITHM
• However, the simplex may fail for a degenerate LP.
• An LP is degenerate if it has at least one bfs in which a basic variable is
equal to zero.
• Consider the following LP:
Initial table:
-z x1 x2 s1 s2 rhs
1 -5 -2 0 0 0
0 1 1 1 0 6
0 1 -1 0 1 0 Degenerate bfs.
DEGENERACY AND THE CONVERGENCE OF THE
SIMPLEX ALGORITHM
• However, the simplex may fail for a degenerate LP.
• An LP is degenerate if it has at least one bfs in which a basic variable is
equal to zero.
• Consider the following LP:
-z x1 x2 s1 s2 rhs
1 0 -7 0 5 0
Degenerate bfs.
0 0 2 1 -1 6
z did not change.
0 1 -1 0 1 0
DEGENERACY AND THE CONVERGENCE OF THE
SIMPLEX ALGORITHM
• However, the simplex may fail for a degenerate LP.
• An LP is degenerate if it has at least one bfs in which a basic variable is
equal to zero.
• Consider the following LP:
-z x1 x2 s1 s2 rhs
1 0 0 7/2 3/2 21
0 0 1 1/2 -1/2 3 The optimal solution
0 1 0 1/2 1/2 3 has been reached.
DEGENERACY AND THE CONVERGENCE OF THE
SIMPLEX ALGORITHM
• In the previous example, the simplex method has achieved to find the
optimal solution (since the third bfs is not degenerate). However, we
have observed that in a degenerate LP, an iteration of the simplex method
may leave the value of z unchanged.
• The following sequence is possible:
Z X1 X2 X3 X4 S1 S2 S3 RHS
1 3 -1 6 0 0 0 0 0 Initial table
0 9 1 -9 -2 1 0 0 0
0 1 1/3 -2 -1/3 0 1 0 0
0 -9 -1 9 2 0 0 1 1
Z X1 X2 X3 X4 S1 S2 S3 RHS
1 12 0 -3 -2 1 0 0 0
Table 1
0 9 1 -9 -2 1 0 0 0
0 -2 0 1 1/3 -1/3 1 0 0
0 0 0 0 0 1 0 1 1
We now enter X3 into the basis in Row 2.
DEGENERACY AND THE CONVERGENCE OF THE
SIMPLEX ALGORITHM
• Consider the following model: (standart Siplex method, in ratio test,
break ties in favor of lower-numbered rows)
Z X1 X2 X3 X4 S1 S2 S3 RHS
1 6 0 0 -1 0 3 0 0
Table 2
0 -9 1 0 1 -2 9 0 0
0 -2 0 1 1/3 -1/3 1 0 0
0 0 0 0 0 1 0 1 1
Z X1 X2 X3 X4 S1 S2 S3 RHS
1 -3 1 0 0 -2 12 0 0
Table 3
0 -9 1 0 1 -2 9 0 0
0 1 -1/3 1 0 1/3 -2 0 0
0 0 0 0 0 1 0 1 1
X1 now enters basis in Row 2.
DEGENERACY AND THE CONVERGENCE
OF THE SIMPLEX ALGORITHM
• Consider the following model: (standart Siplex method, in ratio test,
break ties in favor of lower-numbered rows)
Z X1 X2 X3 X4 S1 S2 S3 RHS
1 0 0 3 0 -1 6 0 0
0 0 -2 9 1 1 -9 0 0
Table 4
0 1 -1/3 1 0 1/3 -2 0 0
0 0 0 0 0 1 0 1 1
Z X1 X2 X3 X4 S1 S2 S3 RHS
1 0 -2 12 1 0 -3 0 0 Table 5
0 0 -2 9 1 1 -9 0 0
0 1 1/3 -2 -1/3 0 1 0 0
0 0 2 -9 -1 0 9 1 1
S2 would now enter basis in Row 2.
This will bring us back to initial tableau, so cycling has
occurred.
DEGENERACY AND THE CONVERGENCE OF
THE SIMPLEX ALGORITHM
• Consider the following model: (standart Siplex method, in ratio test,
break ties in favor of lower-numbered rows)
Z X1 X2 X3 X4 S1 S2 S3 RHS
1 3 -1 6 0 0 0 0 0
0 9 1 -9 -2 1 0 0 0
0 1 1/3 -2 -1/3 0 1 0 0
0 -9 -1 9 2 0 0 1 1
• When a bfs is not readily apparent, the Big M method or the two-phase
simplex method may be used to solve the problem.
THE BIG M METHOD
• Example: Bevco manufactures an orange-flavored soft drink called
Oranj by combining orange soda and orange juice. Each ounce of orange
soda contains 0.5 oz of sugar and 1 mg of vitamin C. Each ounce of
orange juice contains 0.25 oz of sugar and 3 mg of vitamin C. It costs
Bevco 2¢ to produce an ounce of orange soda and 3¢ to produce an
ounce of or- ange juice. Bevco’s marketing department has decided that
each 10-oz bottle of Oranj must contain at least 20 mg of vitamin C and
at most 4 oz of sugar. Use linear programming to determine how Bevco
can meet the marketing department’s requirements at minimum cost.
THE BIG M METHOD
• Decision variables:
• : number of ounces of orange soda in a bottle of Oranj
• : number of ounces of orange juice in a bottle of Oranj
THE BIG M METHOD
• The model in standard form is the following:
• With this modified objective function, the optimal solution will have .
• If all artificial variables are equal to zero in the optimal solution, then we have found the
optimal solution to the original problem.
• If any artificial variables are positive in the optimal solution, then the original problem is
infeasible.
• If the final table indicates the LP is unbounded and all artificial variables in this tableau
equal zero, then the original LP is unbounded.
• If the final table indicates that the LP is unbounded and at least one artificial variable is
strictly positive, then the original LP is infeasible.
THE BIG M METHOD
• We have already applied first 4 steps. Now, continue with Step 5.
z rhs
Note that this table
1 -2 -3 0 0 -M -M 0 is not in canonical
0 1/2 1/4 1 0 0 0 4 form.
0 1 3 0 -1 1 0 20
0 1 1 0 0 0 1 10
THE BIG M METHOD
• Now, we have the canonical form. Apply simplex method
z rhs
1 -2+2M -3+4M 0 -M 0 0 30M
0 1/2 1/4 1 0 0 0 4
0 1 3 0 -1 1 0 20
0 1 1 0 0 0 1 10
z rhs
1 (2M-3)/3 0 0 (M-3)/3 (3-4M)/3 0 (10M+60)/3
0 5/12 0 1 1/12 -1/12 0 7/3
0 1/3 1 0 -1/3 1/3 0 20/3
0 2/3 0 0 1/3 -1/3 1 10/3
THE BIG M METHOD
• Now, we have the canonical form. Apply simplex method
z rhs
1 0 0 0 -1/2 (1-2M)/2 (3-2M)/2 25
0 0 0 1 -1/8 1/8 -5/8 1/4
0 0 1 0 -1/2 1/2 -1/2 5
0 1 0 0 1/2 -1/2 3/2 5
Optimal solution: .
THE BIG M METHOD
• Example 2:
z rhs
1 -2 -3 0 0 -M -M 0
0 1/2 1/4 1 0 0 0 4
0 1 3 0 -1 1 0 36
0 1 1 0 0 0 1 10
THE BIG M METHOD
• Now, we have the canonical form. Apply simplex method
z rhs
1 -2+2M -3+4M 0 -M 0 0 46M
0 1/2 1/4 1 0 0 0 4
0 1 3 0 -1 1 0 36
0 1 1 0 0 0 1 10
• For each urs variable , we begin by defining two new variables and .
Then substitute for in each constraint and in the objective function.
Also add the sign restrictions and .
Now, we can apply the simplex algorithm. Note that when we convert the
model to the standard form, the initial bfs is readily available.
UNRESTRICTED-IN-SIGN VARIABLES
z rhs
1 -30 4 -4 0 0 0
0 5 -1 1 1 0 30
0 1 0 0 0 1 5
UNRESTRICTED-IN-SIGN VARIABLES
z rhs
1 0 4 -4 0 30 150
0 0 -1 1 1 -5 5
0 1 0 0 0 1 5
No matter how many pivots we make, the column will always be the negative of the
column. Therefore, (in a max problem) if one of these variables will enter the basis
(negative row 0 coefficient), the other one cannot since its row 0 coeficient will be
positive.
THE TWO-PHASE SIMPLEX METHOD
• When a basic feasible solution is not readily available, the two-phase
simplex method may be used as an alternative to the Big M method.
• Then we find a bfs to the original LP by solving the Phase-1 LP. In the
Phase-1 LP, the objective function is to minimize the sum of all artificial
variables.
• Case 1: The optimal value of w is strictly greater than zero. In this case,
the original LP is infeasible.
w rhs
1 0 0 0 0 -1 -1 0 Bfs is ok, but we
must obtain canonical
0 1/2 1/4 1 0 0 0 4
form.
0 1 3 0 -1 1 0 20
0 1 1 0 0 0 1 10
THE TWO-PHASE SIMPLEX METHOD
• Example 1: Apply step 4: Solve the following Phase-1 LP
w rhs
1 2 4 0 -1 0 0 30 Bfs and canonical
form are ok.
0 1/2 1/4 1 0 0 0 4
Table 1
0 1 3 0 -1 1 0 20
0 1 1 0 0 0 1 10
THE TWO-PHASE SIMPLEX METHOD
• Example 1: Apply step 4: Solve the following Phase-1 LP
w rhs
1 2/3 0 0 1/3 -4/3 0 10/3 Table 2
0 5/12 0 1 1/12 -1/12 0 7/3
0 1/3 1 0 -1/3 1/3 0 20/3
0 2/3 0 0 1/3 -1/3 1 10/3
THE TWO-PHASE SIMPLEX METHOD
• Example 1: Apply step 4: Solve the following Phase-1 LP
w rhs Table 3
Optimal table
1 0 0 0 0 -1 -1 0 Case 2
0 0 0 1 -1/8 1/8 -5/8 1/4 Remove artificial
0 0 1 0 -1/2 1/2 -1/2 5 variables and get
back to the original
0 1 0 0 1/2 -1/2 3/2 5 row 0.
THE TWO-PHASE SIMPLEX METHOD
• Example 1: Solve Phase-2 LP, remember it was minimization.
w rhs
1 0 0 0 0 -1 -1 0 Bfs is ok, but we
must obtain canonical
0 1/2 1/4 1 0 0 0 4 form.
0 1 3 0 -1 1 0 36
0 1 1 0 0 0 1 10
THE TWO-PHASE SIMPLEX METHOD
• Example 2: Apply step 4: Solve the following Phase-1 LP
0 1 3 0 -1 1 0 36
0 1 1 0 0 0 1 10
THE TWO-PHASE SIMPLEX METHOD
• Example 2: Apply step 4: Solve the following Phase-1 LP
w rhs
1 0 0 0 0 0 -1 -1 -1 0 0
Bfs is ok but we
0 1 -1 0 2 0 1 0 0 0 0 must obtain
0 -2 1 0 -2 0 0 1 0 0 0 canonical form.
0 1 0 1 1 -1 0 0 1 0 3
0 0 2 1 2 1 0 0 0 1 4
THE TWO-PHASE SIMPLEX METHOD
• Example 3: Apply step 4
w rhs
1 0 0 1 1 -1 0 0 0 0 3 Bfs and canonical
0 1 -1 0 2 0 1 0 0 0 0 form are ok.
0 -2 1 0 -2 0 0 1 0 0 0 Table 1
0 1 0 1 1 -1 0 0 1 0 3
0 0 2 1 2 1 0 0 0 1 4
THE TWO-PHASE SIMPLEX METHOD
• Example 3: Apply step 4
w rhs
1 -1 0 0 0 0 0 0 -1 0 0
0 1 -1 0 2 0 1 0 0 0 0
0 -2 1 0 -2 0 0 1 0 0 0
0 1 0 1 1 -1 0 0 1 0 3
0 -1 2 0 1 2 0 0 -1 1 1
Table 2
This table is optimal. Note that but and are in the basis.
Case 3
First, I will remove from the basis. I choose to enter the basis.
THE TWO-PHASE SIMPLEX METHOD
• Example 3: Apply step 4
w rhs
1 -1 0 0 0 0 0 0 -1 0 0
0 -1 1 0 -2 0 -1 0 0 0 0
0 -1 0 0 0 0 1 1 0 0 0
0 1 0 1 1 -1 0 0 1 0 3
0 1 0 0 5 2 2 0 -1 1 1
Table 3
This table is optimal. Note that but is in the basis.
Case 3
Now, I will remove from the basis. The only original variable having a nonzero coefficient
in the row corresponding is . That is why I choose .
THE TWO-PHASE SIMPLEX METHOD
• Example 3: Apply step 4
w rhs
1 0 0 0 0 0 -1 -1 -1 0 0
0 0 1 0 -2 0 -2 -1 0 0 0
0 1 0 0 0 0 -1 -1 0 0 0
0 0 0 1 1 -1 1 1 1 0 3
0 0 0 0 5 2 3 1 -1 1 1
Table 4
This table is optimal. Note that and all artificial variables are out of the basis.
Case 2
Get back to the original row 0, Phase-2 LP.
THE TWO-PHASE SIMPLEX METHOD
z rhs
1 -40 -10 0 -7 -14 0 0
0 0 1 0 -2 0 0 0
0 1 0 0 0 0 0 0
0 0 0 1 1 -1 0 3
0 0 0 0 5 2 1 1
z rhs
1 0 0 0 -27 -14 0 0
0 0 1 0 -2 0 0 0
0 1 0 0 0 0 0 0
0 0 0 1 1 -1 0 3
0 0 0 0 5 2 1 1
THE TWO-PHASE SIMPLEX METHOD
• Example 3: Phase-2 LP – Table 3
z rhs
1 0 0 0 0 -16/5 27/5 27/5
0 0 1 0 0 4/5 2/5 2/5
0 1 0 0 0 0 0 0
0 0 0 1 0 -7/5 -1/5 14/5
0 0 0 0 1 2/5 1/5 1/5
THE TWO-PHASE SIMPLEX METHOD
• Example 3: Phase-2 LP – Table 4
z rhs
1 0 4 0 0 0 7 7
0 0 5/4 0 0 1 1/2 1/2
0 1 0 0 0 0 0 0
0 0 7/4 1 0 0 1/2 7/2
0 0 -1/2 0 1 0 0 0