View
225
Download
0
Category
Preview:
Citation preview
1
Chapter 4The Simplex Algorithm
PART 2Prof. Dr. M. Arslan ÖRNEK
2
3ISE203/IE251
4ISE203/IE251
5ISE203/IE251
6ISE203/IE251
7ISE203/IE251
8ISE203/IE251
9ISE203/IE251
10ISE203/IE251
11ISE203/IE251
12ISE203/IE251
13ISE203/IE251
14ISE203/IE251
15ISE203/IE251
16ISE203/IE251
17ISE203/IE251
18ISE203/IE251
19
4.6 – The Simplex Algorithm (min LPs)
Two different ways the simplex method can be used to solve minimization problems.
min z = 2x1 – 3x2
s.t. x1 + x2 ≤ 4
x1 – x2 ≤ 6
x1, x2 ≥ 0
max -z = -2x1 + 3x2
s.t. x1 + x2 ≤ 4
x1 – x2 ≤ 6
x1, x2 ≥ 0
Method 1
20
4.6 – The Simplex Algorithm (min LPs)Use –z as the basic variable in row 0.
Initial TableauRow - z x1 x2 s1 s2 rhs BVs
0 1 2 -3 0 0 0 - z = 01 0 1 1 1 0 4 s1 =42 0 1 -1 0 1 6 s2 = 6
ero1 - z x1 x2 s1 s2 rhs0 1 2 -3 0 0 01 0 1 1 1 0 42 0 2 0 1 1 10
ero 2 - z x1 x2 s1 s2 rhs BVs0 1 5 0 3 0 12 - z = 121 0 1 1 1 0 4 x2 = 42 0 2 0 1 1 10 s2 = 10
21
4.6 – The Simplex Algorithm (min LPs)
The optimal solution (to the max problem) is -z = 12, x2 = 4, s2 = 10, x1 = s1 = 0.
Then the optimal solution to the min problem is z = -12, x2=4, s2 = 10, x1 = s2 = 0. z = 2x1-3x2 =2(0) – 3 (4) = -12.
In summary, multiply the objective function for the min problem by -1 and solve the problem as a maximization problem with the objective function –z. (optimal z-value for the min problem) = - (optimal z-value for the max problem).
22
4.6 – The Simplex Algorithm (min LPs)
Method 2
A simple modification of the simplex algorithm can be used to solve min problems directly.
Modify Step 3 of the simplex algorithm as follows:
If all nonbasic variables (NBV) in row 0 have nonpositive coefficients, the current bfs is optimal.
If any nonbasic variable has a positive coefficient, choose the variable with the “most positive” coefficient in row 0 as the entering variable.
23
4.7 – Alternative Optimal solutions
If an LP has more than one optimal solution, it has multiple optimal solutions.
If all nonbasic variables (NBV) have nonzero coefficients in row 0 of the optimal tableau, the LP has a unique optimal solution.
Otherwise, the LP may have alternative optimal solutions.
24ISE203/IE251
25
26
4.8 – Unbounded LPs
An unbounded LP occurs in a max problem if There is a nonbasic variable with a negative coefficient in row 0
and There is no constraint that limits how large we can make this
NBV.
An unbounded LP for a max problem occurs when a variable with a negative coefficient in row 0 has a nonpositive coefficient in each constraint.
27ISE203/IE251
28
Example 3: Breadco Bakeries-An Unbounded LP
29
Solution:
30
31
32
4.11 Degeneracy and the Convergence of the Simplex Algorithm
Theoretically, the simplex algorithm can fail to find an optimal solution to an LP.
The following are facts (for Max LP):– If (value of entering variable in new bfs) > 0, then (z-value for
new bfs) > (z-value for current bfs).– If (value of entering variable in new bfs) = 0, then (z-value for
new bfs) = (z-value for current bfs). Up to now, we have seen that in each of the LP’s BFS, all
basic variables are positive.
33
An LP with this property is a nondegenerate LP. An LP is degenerate if it has at least one bfs in which
a basic variable is equal to zero. Any bfs that has at least one basic variable equal to
zero is a degenerate bfs. When the same bfs is encountered twice it is called
cycling (looping).– If cycling occurs, then we will loop, or cycle, forever among
a set of basic feasible solutions and never get to an optimal solution.
34ISE203/IE251
35
4.12 The Big M Method
The simplex algorithm requires a starting (initial) bfs.
Previous problems have found starting bfs by using the slack variables as our basic variables.– If an LP have ≥ or = constraints, however, a starting bfs
cannot be found easily. In such a case, the Big M method is used to obtain a
starting bfs and solve the problem.
36
Example 4: Bevco (A Blending Problem)
Bevco manufactures an orange-flavored soft drink called Oranj by combining orange soda and orange juice. – Each oz of orange soda contains 0.5 oz of sugar and 1 mg of vitamin C. – Each oz 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 orange 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.
37
Letting x1 = number of ounces of orange soda in a bottle of Oranj
x2 = number of ounces of orange juice in a bottle of Oranj
The LP is:
min z = 2x1 + 3x2
st 0.5x1 + 0.25x2 ≤ 4 (sugar constraint)
x1 + 3x2 ≥ 20 (Vitamin C constraint)
x1 + x2 = 10 (10 oz in 1 bottle of Oranj)
x1, x2, ≥ 0
Example 4: Bevco
38
4.10 – The Big M MethodRow 0: z - 2x1 - 3x2 = 0
Row 1: 0.5x1 + 0.25x2 + s1 = 4
Row 2: x1 + 3x2 - e2 = 20
Row 3: x1 + x2 = 10
What will be the BV in row 2? Row 3?
Row 2 would violate sign restrictions
Row 3 no readily apparent basic variable.
To find a bfs, we create artificial variables. The variables will be labeled according to the row in which they are used.
Row 1: z - 2x1 - 3x2 = 0
Row 2: 0.5x1 + 0.25x2 + s1 = 4
Row 3: x1 + 3x2 - e2 + a2 = 20
Row 4: x1 + x2 + a3 = 10
39
4.10 – The Big M Method
In the optimal solution, all artificial variables must be equal to zero. To accomplish this, in a min LP, a term +Mai is added to the objective function for each ai. For a max LP, the term –Mai is added to the objective function for each ai. M represents some very large number.
The modified Bevco LP in standard form then becomes:
Row 0: z - 2x1 - 3x2 -Ma2 - Ma3 = 0
Row 1: 0.5x1 + 0.25x2 + s1 = 4
Row 2: x1 + 3x2 - e2 + a2 = 20
Row 3: x1 + x2 + a3 = 10
Modifying the objective function this way makes it extremely costly for an artificial variable to be positive. The optimal solution should force a2 = a3 =0.
40
4.10 – The Big M MethodDescription of the Big M Method:
1. Modify the constraints so that the rhs of each constraint is nonnegative.
2. Convert each inequality constraint to standard form (add a slack variable for ≤ constraints, add an excess variable for ≥ constraints).
3. For each ≥ or = constraint, add artificial variables. Add sign restriction ai ≥ 0.
4. Let M denote a very large positive number. Add (for each artificial variable) Mai to min problem objective functions or -Mai to max problem objective function.
5. Since each artificial variable will be in the starting basis, all artificial variables must be eliminated from row 0 before beginning the simplex.
41
4.10 – The Big M Method
If all artificial variables in the optimal solution equal zero, the solution is optimal. If any artificial variables are positive in the optimal solution, the problem is infeasible.
The Bevco example continued:
Initial Tableau
Row z x1 x2 s1 e2 a2 a3 rhs0 1.00 -2.00 -3.00 -M -M 0.001 0.50 0.25 1.00 4.002 1.00 3.00 -1.00 1.00 20.003 1.00 1.00 1.00 10.00
42
4.10 – The Big M MethodPivot 1 z x1 x2 s1 e2 a2 a3 rhs ratio ero
0 1,00 2m - 2 4M -3 -M 30M Row 0 + M(Row 2) + M(Row 3)
1 0,50 0,25 1,00 4,00 162 1,00 3 -1,00 1,00 20,00 6,673 1,00 1,00 1,00 10,00 10
ero 1 z x1 x2 s1 e2 a2 a3 rhs ero0 1,00 2m - 2 4M -3 -M 30M 1 0,50 0,25 1,00 4,002 0,33 1 -0,33 0,33 6,67 Row 2 divided by 33 1,00 1,00 1,00 10,00
ero 2 z x1 x2 s1 e2 a2 a3 rhs ero0 1,00 (2M-3)/3 (M-3)/3 (3-4M)/3 (60+10M)/3 Row 0 - (4M-3)*(Row 2)1 0,50 0,25 1,00 4,002 0,33 1 -0,33 0,33 6,673 1,00 1,00 1,00 10,00
ero 3 z x1 x2 s1 e2 a2 a3 rhs ero0 1,00 (2M-3)/3 (M-3)/3 (3-4M)/3 (60+10M)/3 1 0,42 1,00 0,08 -0,08 2,33 Row 1 - 0.25*(Row 2)2 0,33 1 -0,33 0,33 6,673 1,00 1,00 1,00 10,00
ero 4 z x1 x2 s1 e2 a2 a3 rhs ero0 1,00 (2M-3)/3 (M-3)/3 (3-4M)/3 (60+10M)/31 0,42 1,00 0,08 -0,08 2,332 0,33 1 -0,33 0,33 6,673 0,67 0,33 -0,33 1,00 3,33 Row 3 - Row 2
43
4.10 – The Big M Method
Pivot 2 z x1 x2 s1 e2 a2 a3 rhs ratio0 1.00 (2M-3)/3 (M-3)/3 (3-4M)/3 (60+10M)/31 0.42 1.00 0.08 -0.08 2.33 5.602 0.33 1 -0.33 0.33 6.67 20.003 0.67 0.33 -0.33 1.00 3.33 5.00
ero 1 z x1 x2 s1 e2 a2 a3 rhs ero0 1.00 (2M-3)/3 (M-3)/3 (3-4M)/3 (60+10M)/31 0.42 1.00 0.08 -0.08 2.332 0.33 1 -0.33 0.33 6.673 1.00 0.50 -0.50 1.50 5.00 (Row 3)*(3/2)
ero 2 z x1 x2 s1 e2 a2 a3 rhs ero0 1.00 -0.50 (1-2M)/2 (3-2M)/2 25.00 Row 0 + (3-2M)*(Row 3)/31 0.42 1.00 0.08 -0.08 2.332 0.33 1.00 -0.33 0.33 6.673 1.00 0.50 -0.50 1.50 5.00
ero 3 z x1 x2 s1 e2 a2 a3 rhs ero0 1.00 -0.50 (1-2M)/2 (3-2M)/2 25.001 1.00 -0.13 0.13 -0.63 0.25 Row 1 - (5/12)*Row 3)2 0.33 1.00 -0.33 0.33 6.673 1.00 0.50 -0.50 1.50 5.00
ero 4 z x1 x2 s1 e2 a2 a3 rhs ero0 1.00 -0.50 (1-2M)/2 (3-2M)/2 25.001 1.00 -0.13 0.13 -0.63 0.252 1.00 -0.50 0.50 -0.50 5.00 Row 2 -(1/3)*Row 33 1.00 0.50 -0.50 1.50 5.00
Optimal Solution
44
Wyndor Problem - modified
ISE203/IE251
45
Nonzero coefficient of x5 in the objective
function row.
We should make it zero.
ISE203/IE251
46ISE203/IE251
47ISE203/IE251
48ISE203/IE251
49ISE203/IE251
50ISE203/IE251
51ISE203/IE251
52ISE203/IE251
53ISE203/IE251
54
4.14 Unrestricted-in-Sign Variables
If some variables are allowed to be unrestricted in sign (urs), the ratio test and therefore the simplex algorithm are no longer valid.
An LP with an unrestricted-in-sign variable can be transformed into an LP in which all variables are non-negative.– For each urs variable xi, define two new variables x+
i and x-i.
– Then substitute ( x +i - x -
i ) for xi in each constraint and in the objective function.
– Also add the sign restrictions.
55
So we express xi as the difference of the two nonnegative
variables x+i and x-
i. No basic feasible solution can have both x+
i ≥ 0 and x-i ≥ 0.
x+i and x-
i will never be both basic variables. – The column of one is equal to the negative column of the other
For any basic feasible solution, each urs variable xi must fall into one of the following three cases.1. x+
i > 0 and x-i = 0
2. x+i = 0 and x-
i > 0
3. x+i = x-
i = 0
56
Example 8 (Using urs Variables):
57
Solution:
58
59
Recommended