Professional Documents
Culture Documents
MANAGEMENT SCIENCE
Lecture 2:
Linear Programming
Bounded Unbounded
Feasible Region Feasible Region
x1 x1
1
The Simplex Method (Cont’d)
The idea:
Exploit the property of an LP: If there is a solution to an LP,
then it is always at a corner point solution or more precisely, the
solution always contains a vertex.
Apply partial enumeration of feasible solutions.
Start at an initial feasible solution.
Keep searching adjacent vertices (solutions) until no
improvement of the objective function can be obtained.
Example Problem
A new company Wyndor Glass Company has:
3 plants
making 2 products.
8' glass door : product 1
Products =
4 6' window : product 2
Resources : Production Capacities in 3 plants are as follows:
1 1 0 4
2 0 2 12
3 3 2 18
2
Graphical Solution
Consider the region formed by the constraints in form of
inequalities
x2
x1 = 4
(2,6)
(0,6) 2x2 = 12
(4,3)
3x1 + 2x2 = 18
x1
(4,0)
Canonical Form:
Max. Z = 3x1 + 5x2 Max. 3x1 + 5x2 + 0s1 + 0s2 + 0s3 = Z
s.t. 1x1 + 0x2 4 s.t. 1x1 + 0x2 + 1s1 + 0s2 + 0s3 = 4
0x1 + 2x2 12 0x1 + 2x2 + 0s1 + 1s2 + 0s3 = 12
3x1 + 2x2 18 3x1 + 2x2 + 0s1 + 0s2 + 1s3 = 18
x1 0; x2 0 x1, x2, s1, s2, and s3 0
3
The Simplex Method Example (cont.)
x1 x2 s1 s2 s3 Z
1 0 0 4 12 18 0
Max. 3x1 + 5x2 + 0s1 + 0s2 + 0s3 = Z
2 0 - 0 - - Infeasible
3 0 6 4 0 6 I s.t. 1x1 + 0x2 + 1s1 + 0s2 + 0s3 = 4
4 0 9 4 -6 0 Infeasible
0x1 + 2x2 + 0s1 + 1s2 + 0s3 = 12
5 4 0 0 12 6 II
6 - 0 - 0 - Infeasible
3x1 + 2x2 + 0s1 + 0s2 + 1s3 = 18
7 6 0 -2 12 0 Infeasible x1, x2, s1, s2, and s3 0
8 4 6 0 0 -6 Infeasible
9 4 3 0 6 0 III
10 2 6 2 0 0 IV
10
10
4
Back to the Wyndor Example…
Algebraic Form (Solution)
Max. 3x1 + 5x2 + 0s1 + 0s2 + 0s3 = Z Initial BFS: x = (0, 0, 4, 12, 18)
s.t. 1x1 + 0x2 + 1s1 + 0s2 + 0s3 = 4 s1 = 4 – x1
0x1 + 2x2 + 0s1 + 1s2 + 0s3 = 12 s2 = 12 - 2x2
3x1 + 2x2 + 0s1 + 0s2 + 1s3 = 18 s3 = 18 - 3x1 - 2x2
x1, x2, s1, s2 and s3 0 Z = 3x1 + 5x2
x2 is the most logical (since it increases the Objective Function faster, 5 > 3)
11
11
s1 = 4 – x1
x2 = (12 – s2)/2
s3 = 18 - 3x1 - 2x2
Z = 3x1 + 5x2 = 3x1 + 5(12 – s2)/2 = 3x1 + 30 – 2.5s2
12
5
The Simplex Method Example (cont.)
How big can x1 get?
Criterion for selecting the leaving variable.
s1 0 then 4 - x1 0 => x1 4
s3 0 then 18 – 3x1 - 2x2 0 => x1 2 (since x2 = 6)
Thus x1 = 2 and s3 is the leaving variable.
13
14
14
6
The Simplex Method – Tableau Form
Steps:
1. Initialization:
a. transform all the constraints to equality by introducing
slack, surplus, and artificial variables as follows:
≤ + slack (s)
≥ - Surplus (s)
= + Artificial (A)
15
15
16
16
7
To convert the ith ≥ constraint to an equality constraint,
define an excess variable (sometimes called a surplus
variable) ei (ei will always be the excess variable for the ith
≥ constraint.
We define ei to be the amount by which ith constraint is
over satisfied.
Subtracting the excess variable ei from the ith constraint
and adding the sign restriction ei ≥ 0 will convert the
constraint.
If an LP has both ≤ and ≥ constraints, apply the previous
procedures to the individual constraints.
17
17
X1 + S1 = 4
2 X2 + S2 = 12
3X1 +2X2 + S3 = 18
X 1 , X 2, S 1, S 2 , S 3 0
18
18
8
The Simplex Method – Tableau Form
b. Construct the initial simplex tableau
Basic RHS X1 … Xn S1 …... Sn
variable
A bm
19
19
20
20
9
The Simplex Method – Tableau Form
21
21
22
22
10
The Simplex Method – Tableau Form
23
Pivoting:
(0”) = (3’) + (0’)
(1”) = (3’) * (1/3)*(-1) + (1’) or (3”)*(-1) + (1’)
(2”) = (2’)
(3”) = (3’) *(1/ 3)
24
24
11
The Simplex Method – Tableau Form
Reached Optimal!
x = (2, 6, 2, 0, 0) Z* = 36
25
25
Simplex Algorithm
(Maximization Problem)
Step 0.
Convert LP to Standard Form.
Step 1.
Find initial Basic Feasible Solution (BFS).
Step 2.
If all non-basic variables have non-negative coefficients in row 0,
the current BFS is optimal. Stop.
If any non-basic variable in row 0 has a negative coefficient, choose
the variable with the most negative coefficient to enter the basis.
(Why most negative?) We call this variable an entering variable.
26
26
12
Simplex Algorithm
(Maximization Problem)
Step 3.
Determine the leaving basic variable by the minimum ratio test.
𝑅𝑒𝑑𝑢𝑐𝑒𝑑 𝑅𝐻𝑆
Ratio =
𝑎
Issues:
1. Ties! (equal minimal ratio values in two or more rows)
Ties may be broken arbitrary
2. Non-positive coefficient in each constraint 𝑎 < 0
Unbounded solution
3. Degeneracy! (a basic variable equal to zero)
Simplex may not work (cycling)! Need to be modified.
27
27
Simplex Algorithm
(Maximization Problem)
Step 4.
Determine the new BFS by pivoting. (This will result in +1 in one
row, zeros elsewhere in the column of +1).
Go to Step 2.
28
28
13
Simplex Algorithm
(Maximization Problem)
29
29
30
14
Solution
Step 1: standard form
Min Z,
s.t.
Z – 2 X1 – 3 X2 =0
½ X1 + ¼ X2 + s1 =4
X1 + 3X2 - e2 = 20
X1 + X2 = 10
X1, X2 ,s1, e2 0
31
31
Big M method
M, a very large number, is used to ensure that the values of a1 and a2, …, and an will be zero in the final
(optimal) tableau as follows:
1. If the objective function is Minimization, then a1, a2, …, and an must be added to the RHS of the
objective function multiplied by a very large number (M).
Example: if the objective function is Min Z = X1+2X2, then the obj. function should be
2. If the objective function is Maximization, then a1, a2, …, and an must be subtracted from the RHS of the
objective function multiplied by a very large number (M).
Example: if the objective function is Max Z = X1+2X2, then the obj. function should be
32
15
Big M method
Solution
Step 1: standard form
Min Z,
s.t.
Z – 2 X1 – 3 X2 - M a1 -M a2 =0
½ X1 + ¼ X2 + s1 =4
X1 + 3X2 - e2 + a2 = 20
X1 + X2 + a3 = 10
X1, X2 ,s1, s2, a1, a2 0
Where: M is a very large number
33
Big M method
Step 2: Initial tableau
Basic X1 X2 s1 e2 a2 a3 RHS
variables
Z -2 -3 0 0 -M -M 0
S1 ½ ¼ 1 0 0 0 4
a1 1 3 0 -1 1 0 20
a2 1 1 0 0 0 1 10
Note that one of the simplex rules is violated, which is the basic variables a2, and a3
have a non zero value in the z row; therefore, this violation must be corrected before
proceeding in the simplex algorithm as follows.
34
16
Big M method
To correct this violation before starting the simplex algorithm, the
elementary row operations are used as follows:
New (Z row) = old (z row) ± M (a1 row) ± M (a2 row)
In our case, it will be positive since M is negative in the Z row, as
following:
Old (Z row): -2 -3 0 0 -M -M 0
M (row 2): M 3M 0 -M M 0 20M
M (row 3): M M 0 0 0 M 10M
New (Z row):2M-2 4M-3 0 -M 0 0 30M
35
Big M method
The initial tableau will be:
Basic X1 X2 S1 e2 a2 a3 RHS
variables
Z 2M-2 4M-3 0 -M 0 0 30M
S1 1/2 1/4 1 0 0 0 4
a2 1 3 0 -1 1 0 20
a3 A2 1 0 0 0 1 10
• Since there is a positive value in the z row, this solution is not optimal
• The entering variable is X2 (it has the most positive value in the last row)
• The leaving variable is a2 (it has the smallest ratio)
36
17
Big M method
First iteration
Basic X1 X2 S1 S2 a2 a3 RHS
variables
• Since there is a positive value in the 0 row, this solution is not optimal
• The entering variable is X1 (it has the most positive value in the last row)
• The leaving variable is a3 (it has the smallest ratio)
37
Big M method
Second iteration
Basic X1 X2 S1 S2 A1 A2 RHS
variables
This solution is optimal, since there is no positive value in the last row. The optimal
solution is:
X1 = 5, X2 = 5, S1 = ¼
a2 = a3 = 0 and Z = 25
38
18
Note for the Big M method
In the final tableau, if one or more artificial variables (a1, a2,
…) still basic and has a nonzero value, then the problem has
an infeasible solution.
All other notes are still valid in the Big M method.
39
LINDO Software
Model Input
MAX 3X1+5X2
SUBJECT TO
X1<=4
2X2<=12
3X1+2X2<=18 The symbol is used to tell
LINDO compiler to ignore
END the text that follows behind
the exclamation sign.
40
40
19
LINDO Software Output (Results)
LP OPTIMUM FOUND AT STEP 2
1) 36.00000
NO. ITERATIONS= 2
41
LINDO Example
Winco Products
- Winco sells four types of products
- The resources needed to produce one unit of each and the sales prices are given in
Table 1.
Table 1.
- Currently, 4600 units of raw material and 5000 labor hours are available
- To meet the customer demand, exactly 950 total units must be produced
- Customers also demand that at least 400 units of product 4 be produced.
- Objective is to maximize Winco’s sales revenue.
42
42
20
LINDO Example (cont’d)
Solution:
Let xi be the number of units of product i produced by Winco.
43
43
MAX 4x1+6x2+7x3+8x4
SUBJECT TO
x1+x2+x3+x4=950
x4>=400
2x1+3x2+4x3+7x4<=4600
3x1+4x2+5x3+6x4<=5000
END
44
44
21
LINDO Example (cont’d)
LP OPTIMUM FOUND AT STEP 4
1) 6650.000
NO. ITERATIONS= 4
45
45
46
46
22
LINDO Example (cont’d)
Q: Suppose Winco raises the price of product 2 by 50 cents. What is the new optimal
solution to the LP?
A: Because the AI for c2 is $0.66667, and we are increasing c2 by only $0.5 the current
basis remains optimal. The optimal values remain unchanged.
New optimal z-value = 4(0) 6.5(400) 7(150) 8(400) $6850
Another way to see optimal z-value is:
Each unit of product 2 brings in 50 cents more in revenue. This, total revenue should
increase by 400(0.5) = $200
New z-value=original z-value + $200=$6850
Q: Suppose the sales price of product 1 is increased by 60 cents per unit. What is the new
optimal solution to the LP?
A: The AI for c1 is 1, so the current basis remains optimal, and the optimal value of the
decision variable remain unchanged. Because the value of x1 in the optimal solution is 0,
the change in the sales price for product 1 will not change the optimal z-value.
47
47
48
48
23
Production Planning Example
49
49
50
50
24
LINDO Output for the Production
Planning Example (handouts)
LP OPTIMUM FOUND AT STEP 3
1) 6186.461
NO. ITERATIONS= 3
51
51
52
25
Questions Raised at the Meeting
1. The sales manager believes that it would be possible to increase the profitability of
product C from $6 to $8 per unit. What happens to the optimal solution?
2. The purchase manager can acquire an extra 100 units of raw material from another
supplier. However, the quoted price of this supplier is $1.50 per unit higher than the
unit price of the current supplier. It is not possible to obtain any more of raw material
from the current source. What is your advice?
3. The customer to which a given supply of 100 units of product A has been agreed is
willing to cancel the order against a compensation of $575. What is your advice to
the sales manager?
4. The production manager thinks that 14 production hours can be diverted from
finishing to assembly. The cost of the diversion is $140. What is your comment?
5. The marketing manager suggests making a new product, E. The profit contribution of
this product is $7 per unit. Each unit of the new product requires 0.40 hour for
processing, 0.50 hour for finishing, and 0.20 hour for packaging, and 2 units of raw
material. What is your comment?
53
53
54
54
26
Answers to the Questions (cont’d)
3. The minimum requirement constraint xA ≥ 100 is binding at the optimal solution
and has a shadow price of -5.52. Hence the optimal objective value will increase
when this constraint is loosened. The right-hand-side range of the constraint 5 tells
you that the shadow price of -5.52 remains valid for decreases in the constraint's
right-hand side of up to 100–0 = 100 units. Consequently, the optimal objective
value would increase by 100×$5.52 = $552 when the order of 100 units of product
A would be canceled. However, the canceling cost is higher than the increase in
profit. Your advice is not to cancel the order.
55
55
56
56
27
Unrestricted in Sign Variables
Baking (Bread) example:
A loaf of bread requires 5oz of flour and 1 package of yeast;
it sells for 30 cents.
30 oz of flour available; 5 packages of yeast.
The baker can purchase additional (or sell leftover) flour at
4cents/oz.
57
57
58
28
Unrestricted in Sign Variables (cont.)
Substitute (x2’– x2”) for x2;
The problem becomes:
x1 ≤ 5
59
59
60
60
29
LINDO Bread Problem Result
LP OPTIMUM FOUND AT STEP 0
1) 170.0000
NO. ITERATIONS= 0
61
Goal Programming
A decision maker faces multiple objectives
62
62
30
Goal Programming
Leo Burnitt Ad Agency
Budget $600K
63
63
Let:
64
64
31
Goal Programming (cont.)
Leo Burnitt Ad Agency
65
65
66
66
32
Goal Programming (cont.)
Leo Burnitt Ad Agency
67
67
Goal Programming
Leo Burnitt Ad Agency – LINDO Formulation
68
33
Goal Programming
Leo Burnitt Ad Agency – LINDO Output (Solution)
LP OPTIMUM FOUND AT STEP 5
1) 250.0000
69
Goal Programming
Leo Burnitt Ad Agency – LINDO Formulation w/ Budget
Restriction
70
34
Goal Programming
Leo Burnitt Ad Agency – LINDO Formulation w/ Budget
Restriction
LP OPTIMUM FOUND AT STEP 2
NO. ITERATIONS= 2
71
71
P1 >> P2 >> P3
72
72
35