Professional Documents
Culture Documents
CH - 2 Linear Programming
CH - 2 Linear Programming
Chapter Two
Linear Programming
Mob. 0924464113
1
By Fanta T
Introduction
2
By Fanta T
Meaning of LP
3
By Fanta T
….
Optimization
4
By Fanta T
5
By Fanta T
Main elements LP
Decision variables –value of unknown variables
Goal- to find values of the variable that provide a best value of the objective function
6
By Fanta T
• Decision variables
X1 , X2 , X3 , … , Xn
e.g. the quantities of different products
Index n = the number of product types
• Constraints
• a less than or equal to constraint : f(X1 , X2 , X3 , … , Xn)
<b
• a greater than or equal to constraint : f(X1 , X2 , X3 , … , Xn) >
b
• an equal to constraint : f(X1 , X2 , X3 , … , Xn) =
b
• Objective
• MAX(or MIN) Z : f(X1 , X2 , X3, …, Xn) 7
By Fanta T
Subject to:
f(X1 , X2 , X3 , … , Xn) < b1
f(X1 , X2 , X3 , … , Xn) = bm
8
By Fanta T
9
By Fanta T
Example
• An electronic firm is undecided at the most profitable mix
for its products. The products manufactured are
transistors, resistors and carbon tubes with a profit of
(per 100 units) $ 10, $6 and $4 respectively. To produce
a shipment of transistors containing 100 units requires 1
hour of engineering, 10 hours of direct labor and 2 hours
of administrative service. To produce 100 units of
resistors requires 1 hour, 4 hours and 2 hours of
engineering, direct labor and administrative time
respectively. For 100 unit of carbon tubes it needs 1
hour, 6 hours and 5 hours of engineering, direct labor
and administrative time respectively. There are 100
hours of engineering time, 600 hours of direct labor and
300 hours of administrative time available. Formulate the
corresponding LPP.
10
By Fanta T
Solution
• Let X1- 100 units of transistors
• X2- 100 units of resistors
• X3- 100 units of carbon tubes
Z= 10X1+6X2+4X3
each product will requires
X1+X2+X3
10X1+4X2+6X3
2X1+2X2+5X3
But the total time available for engineering, direct labour
and administrative services is 100, 600 and 300 hours
respectively.
11
By Fanta T
formulated LPP is
12
By Fanta T
Class Work
doors sells for $27, uses $10 of raw materials and takes $14 of
labor& overhead costs. Each chairs sells for $21, uses $9 of raw
materials, and takes $10 of overhead costs. Each doors needs 2
hours finishing and 1 hour carpentry; each chairs needs 1 hour
finishing and 1 hour carpentry. Raw materials are unlimited, but
only 100 hours of finishing and 80 hours of carpentry are available
each week. Demand for chairs is unlimited; but at most 40 doors
can be sold each week. How many of each should be made each
week to maximize profits.
13
By Fanta T
Chemical contribution
Brand Nitrogen (lb/bag) Phosphate (lb/bag)
super-gro 2 4
Crop-quick 4 3
The farmer's field requires at least 16 pounds of nitrogen and 24 pounds of
phosphate. Super-gro costs $6 per bag, and Crop-quick costs $3. The farmer
wants to know how many bags of each brand to purchase in order to minimize
14
the total cost of fertilizing.
By Fanta T
Cont’d
• Decision Variables
x1 = bags of Super-gro
x2 = bags of Crop-quick
The Objective Function
minimize Z = $6x1 + 3x2
where
$6x1 = cost of bags of Super-gro
$3x2 = cost of bags of Crop-quick
15
By Fanta T
Cont’d
16
By Fanta T
Class work
• A Farmer is mixing two types of food, Brand X
and Brand Y, for his cattle. If each serving is
required to have 60 grams of protein and 30
grams of fat, where Brand X has 15 grams of
protein and 10 grams of fat and costs 80
cents per unit, and Brand Y contains 20 grams
of protein and 5 grams of fat and costs 50
cents per unit. Formulate LPM
17
By Fanta T
LP Solutions
18
By Fanta T
19
By Fanta T
A. GRAPHICAL METHOD
decision variables.
graphed at all.
20
By Fanta T
Step II.
Convert the inequalities in to equalities to obtain graphical form of the constraints.
(Draw the line of each constraint, first putting x1=0 to find the value of x2 and then putting
x2=0 to find the value of x1. Then draw the line for the values of x1 and x2 which
represents the particular constraint. Once the lines are drawn for all the constraints,
identify the feasible polygon (area) by shading the area below the line for the constraint <
and shading above the line for the constraint > type).
21
By Fanta T
Cont’d
Step III.
Identify the extreme points of the feasible polygon and name the Corners.
Step IV.
Evaluate the objective function Z or C for all points of feasible region.
Step V.
In case of maximizing objective function Z, the corner point of feasible region giving the maximum
value of Z becomes the value of decision variables. Similarly in minimizing case, the point of
minimum value of C gives the answer.
22
By Fanta T
A. Maximization Problem
23
By Fanta T
Maximization Problem…
Resources used per unit
Constraints Model A Model B Maximum Available hrs.
(X1) (X2)
Labor hr. 2 1 40
Machine hr. 1 3 45
Marketing hr. 1 0 12
Profit $300 $250
Solution
1. Formulation of mathematical modeling of LPP
Max Z=300X1 +250X2
St:
2X1 +X2< 40
LPP Model
X1 +3X2< 45
X1 < 12
X1, X2 > 0
24
By Fanta T
Maximization Problem…
2. Convert constraints inequalities into equalities
2X1 +X2 = 40
X1 +3X2= 45
X1 = 12
3. Draw the graph by intercepts
2X1 +X2 = 40 ==> (0, 40) and (20, 0)
X1 +3X2= 45==> (0, 15) and (45, 0)
X1 = 12==> (12, 0)
X1, X2 =0
X2
X1=0
40 X1=12
15
B
25
By Fanta T
Maximization Problem…
4. Identify the feasible area of the solution which satisfies all constrains.
5. Identify the corner points in the feasible region
A (0, 0), B (0, 15), C (12, 11) and D (12, 0)
6. Identify the optimal point
7. Interpret the result
Interpretation:
12 units of product A and 11 units of product B should be produced so that the total profit will be $6350.
26
By Fanta T
Answer
• The manufacturer should produce and sale 20 REGULAR
tents and 6 SUPERS tents to get a maximum weekly profit
of $1480.
28
By Fanta T
B. Minimization Problem
Minimize C= 50x1 + 20x2
Subject to
2x1 – x2> 0
x1 + 4x2 > 80
0.9x1 + 0.8x2 >40
x1 ,x2 > 0
29
By Fanta T
Solution:
x1 =1, x2=2
• We draw the line with these coordinates and get line I drawn in the
graph passing through origin.
• Now, convert constraint (ii) in equality
x1 + 4x2 = 80
When x1 =0, x2=20
X2 =0, x1=80
• We draw the line II (80, 20) as shown in graph.
• Now, convert constraint (iii) in equality
0.9x1 + 0.8x2 =40
• When x1 =0, x2=50
X2 =0, x1=44.4
• We draw line III (44.4, 50) as shown in graph.
31
By Fanta T
Cont’d
32
By Fanta T
Cont’d
Cont’d
• Now we have to find out different values of Z at different
Class Work
• A Farmer is mixing two types of food, Brand X
and Brand Y, for his cattle. If each serving is
required to have 60 grams of protein and 30
grams of fat, where Brand X has 15 grams of
protein and 10 grams of fat and costs 80
cents per unit, and Brand Y contains 20 grams
of protein and 5 grams of fat and costs 50
cents per unit.
• Find the solution using graphical method.
35
By Fanta T
B. Simplex
Algorithm
36
By Fanta T
problem constraints?
37
Cont’d….
By Fanta T
38
By Fanta T
40
By Fanta T
Example
• Max Z = 6X1 + 8X2
• S.t 5X1 + 10X2 ≤ 60
4X1 + 4X2 ≤ 40
X1, X2 >= 0
43
By Fanta T
Interpretation
44
By Fanta T
..cont
• Cj - Zj = Index Row: The row containing net profit or loss
resulting from introducing one unit of the variable in that
column in the solution. A positive number in the index row
would indicate an algebraic reduction or increment in the
objective function if one unit of the variable of that column is
introduced in the basis
• Pivot -Column: The column with the largest positive number
in Cj - Zj row in a maximization problem or the smallest
number in a minimization problem is called Pivot column.
This indicates the variable entering the solution in the next
iteration by replacing an appropriate variable.
45
By Fanta T
…cont
• Pivot Row: it is the ratio of quantities divided by of
the Pivot column which indicates the outgoing variable
to be replaced by the entering variable. This would be
the one with the smallest positive value of the ratio
column
46
By Fanta T
A. Simplex Algorithm - Maximization problem
Example:
47
By Fanta T
• Subject to:
•2T + 1C + 1S1 + 0S2 = 100
•4T + 3C + 0S1 + 1S2 = 240
•T, C, S1, S2 ≥ 0
48
By Fanta T
49
By Fanta T
50
By Fanta T
Cj - Zj
• The Cj – Zj number in each column represents the net
profit that will result from introducing 1 unit of each
DV
• It is computed by subtracting the Zj total for each
column from the Cj value at the very top of that
variable's column
• Obviously with a profit of $0, the initial solution is not
optimal
• By examining the numbers in the Cj – Zj row in the
table, we can see that the total profits can be increased
by $70 for each unit of T and $50 for each unit of C
• A negative number in Cj – Zj row would tell us that the
profits would decrease if the corresponding variables
were added to the solution mix 51
By Fanta T
53
By Fanta T
…cont
2 1 1 0 100
Divide all the pivot row by the pivot number i,e,. By 2
1 0.5 0.5 0 50
Apply row operation to change the pivot column elements to be zero,
keeping that the pivot number to be one
The operation is applicable to all of the row elements
Row operation: -4R1 + R2 = R2
-4 -2 -2 0 -200
4 3 0 1 240
When you sum up the above two rows using the operation the resulting
R2 value will be:
0 1 -2 1 40
54
By Fanta T
55
By Fanta T
56
By Fanta T
…continued
• The substitutions:
• In column C, if 1 unit of C is added to the current solution,
0.5 unit of T and 1 unit of S2 must be given up
• Because these are marginal rate of substitution, so only 1
more unit of S2 is needed to produce 1 chair
• In column S1, the substitution rates means that if 1 hour of
slack painting time is added to produce a chair, 0.5 less of
a table will be produced
• Cj – Zj row is important for two reasons:
• First, it indicates whether the current solution is optimal –
when there are no positive values in the bottom row, an
optimal solution to a maximization LP has been reached
• Second, we use it to determine which variable will enter
the solution mix
57
By Fanta T
58
By Fanta T
59
By Fanta T
Optimal solution
• Therefore, optimal solution is reach now
because all the elements in the last row is zero
and negative and hence:
• T = 30units
• C= 40 units and
• Max Profit = $4100
• S1 = 0 and S2 = 0
60
By Fanta T
Exercise
61
By Fanta T
62
By Fanta T
Select the leaving variable as the one that has the smallest nonnegative
ratio of quantity divided by substitution rate.
63
By Fanta T
64
By Fanta T
65
By Fanta T
66
By Fanta T
Class work
• Maximize Z = 30x1 + 40x2
Subject to, 60x1 + 120x2 < 12,000
8x1 + 5x2 < 600
3x1 + 4x2 < 500
x1, x2 > 0
Answer
X1= 200/11
X2=1000/11
Profit= 46,000/11
67
By Fanta T
Simplex Algorithm-
Minimization problem
68
By Fanta T
method.
become non-basic.
Cont’d…
70
By Fanta T
Cont’d…
• Big M-Method
71
By Fanta T
Cont’d…
• The Big M-method for solving LP problem can be
adopted as follows:
Cont’d…
Step 3: Initial basic feasible solution is obtained in the
form of the simplex table as above and then values of ∆j
= Cj - Zj are calculated.
73
By Fanta T
Cont’d…
74
By Fanta T
Cont’d…
• Step 5: Repeat steps 3 and 4 to ensure optimal
• A tie for the pivot row is broken arbitrarily and can lead
to degeneracy.
75
By Fanta T
Cont’d…
76
By Fanta T
Example
• Food A contains 20 units of vitamin X and 40 units of
77
By Fanta T
Solution:
78
By Fanta T
Cont’d…
79
By Fanta T
simplex table I
Zj Cj 60 80 0 0 M M Ratio
BV Q x1 x2 s1 s2 A1 A2
M A1 900 20 30 -1 0 1 0 45
M A2 1200 40 30 0 -1 0 1 30
Simplex table II
Zj Cj 60 80 0 0 M Ratio
BV Q x1 x2 s1 s2 A1 Q/aij
M A1 300 0 15 -1 1/2 1 20
60 X1 30 1 3/4 0 -1/40 0 40
Zj Cj 60 80 0 0
BV Q x1 x2 s1 s2
80 X2 20 0 1 -1/15 1/30
60 X1 15 1 0 1/20 -1/20
Class Work
By Fanta T
Solution
84
By Fanta T
Initial Tableau
Second Tableau
Third Tableau
Mixed constraints
88
By Fanta T
Mixed constraints
89
By Fanta T
simplex table I
Zj Cj 4 2 0 0 M M Ratio
BV Q x1 x2 s1 s2 A1 A2
M A1 3 3 1 0 0 1 0 1
M A2 6 4 3 -1 0 0 1 6/4
0 S2 3 1 2 0 1 0 0 3
Zj 9M 7M 4M -M 0 M M
Cj-Zj 4-7M 2-4M M 0 0 0
90
Cont’d…
By Fanta T
• X1= Q X1 X2 S1 S2 A2
3 3 1 0 0 0
3/3 3/3 1/3 0/3 0/3 0/3
new row= 1 1 1/3 0 0 0
• New row= old row – corresponding coefficient new tableau
in pivot column X row value
91
By Fanta T
Zj Cj 4 2 0 0 M Ratio
BV Q x1 x2 s1 s2 A2
4 X1 1 1 1/3 0 0 0 3
M A2 2 0 5/3 -1 0 1 6/5
0 S2 2 0 5/3 0 1 0 6/5
Zj 4+2M 4 4/3+5/3M -M 0 M
Cj-Zj 0 2-5M/3 M 0 0
Select near to
the top
92
Cont’d…
By Fanta T
• X2= Q X1 X2 S1 S2
2 0 5/3 -1 0
2/5/3 0/5/3 5/3/5/3 -1/5/3 0/5/3
new row= 6/5 0 1 -3/5 0
• New row= old row – corresponding coefficient new tableau
in pivot column X row value
93
By Fanta T
40
Profit @ corner B
30
A and C is equal
20
(1200)
10
B
FR
C
10 20 30 40 50 96
By Fanta T
An infeasible solution
97
By Fanta T
Cont’d…
The three constraints do not overlap to form a feasible solution area.
Because no point satisfies all three constraints simultaneously, there
is no solution to the problem.
X1= 4
8
X2=6 C
6
B
4
4X1+2X2=8
2
A
C
2 4 6 8 10 98
By Fanta T
An unbounded problem
99
By Fanta T
An unbounded solution
But unlimited profits are
not possible in the real
world; unbounded
solution, like an infeasible
solution, atypically reflects
an error in defining the
problem or in formulating
10
the model
8
• Sensitivity analysis
• Duality
Sensitivity analysis
tableau)
102
By Fanta T
103
By Fanta T
Max Z: 60x1+50x2
Subject to:
x1, x2≥0
104
By Fanta T
Cont’d…
Basis Cj 60 50 0 0 0 Quantit
X1 X2 S1 S2 S3 y
S1 0 0 0 1 6 -16/3 24
X1 60 1 0 0 1 -1/3 9
X2 50 0 1 0 -1 2/3 4
Z 60 50 0 10 40/3 740
Cj-Z 0 0 0 10 -40/3
Shadow price
105
By Fanta T
• From the above tableau; the shadow prices are $ 0 for S1,
107
By Fanta T
Range of feasibility
108
By Fanta T
Steps
Step 1. compute the ratio (feasibility ratio) quantity
Step 2. identify the smallest +ve ratio and –ve ratio closest to
zero
Step 3. find the upper limit or allowable increase and lower limit
Closest to zero
or allowable decrease (range of feasibility)
Upper
Forlimit= the original
both max value - negative ratio
and min problems
109
By Fanta T
Cj 60 50 0 0 0
Zj Bv Q X1 X2 S1 S2 S3
0 S1 24 0 0 1 6 -16/3
60 X1 9 1 0 0 -1 -1/3
50 X2 4 0 1 0 -1 2/3
Zj 740 60 50 0 10 40/3
Cj-Zj 0 0 0 -10 -40/3
110
By Fanta T
Solution
1. Recall the original value of the resources
Original value constraints S1 S2 S3
100 S1 1 6 -16/3
22 S2 0 -1 -1/3
39 S3 0 -1 2/3
2. ratio = Q/respective slack values
S1= 24/1= 24 S2= 24/6= 4 S3= 24/-16/3=
-4.5
9/0= undefined 9/-1= -9 9/-1/3=
-27
4/0= undefined 4/-1= -4 4/2/3=
6 111
By Fanta T
Interpretation
First constraint:
Each hour decrease in assembly time will decrease the current profit by Birr 0 (i.e no
effect-indicated by shadow price) as long as the decrease is up to 24 hours. But if the
assembly time decreases by more than 24 hours (or if the total available assembly time is
lower than 76 hours), the current shadow price will no longer be valid. That is, the profit
will be affected. But available assembly time can increase indefinitely (=allowable
increase is ∞ ) without affecting the current profit level.
Second constraint:
Similarly, Each hour increase or decrease in inspection time will increase or decrease the
current profit by $10, respectively as long as the total inspection time is between 18 and
26 hours. Out side the range of feasibility, the current shadow price ($10) will not be valid.
Third constraint:
Each cubic feet increase or decrease in storage space results in an increase or
decrease, respectively, of profit by $13.33 (i.e 40/3) as long as the total storage space is
between 33 and 43.5 cubic feet.
113
By Fanta T
Range of optimality
114
By Fanta T
115
By Fanta T
Example
Cj 60 50
Zj BV Q X1 X2 S1 S2 S3
0 S1 24 0 0 1 6 -16/3
60 X1 9 1 0 0 1 -1/3
50 X2 4 0 1 0 -1 2/3
Zj 740 60 50 0 10 40/3
Cj-Zj 0 0 0 -10 -40/3
116
By Fanta T
Solution
0 1 0 -1 2/3
∞ ∞ ∞ -10 40
117
By Fanta T
EXERCISE:
Solve the following LPP using simplex method. A firm that
manufactures both lawn mowers and snow blowers:
X1 =the number of lawn mowers
X2 =the number of snow blowers
Max.Z=$30x1+$80x2
Subject to:
2 x1+4x2 < 1000 Labor hours available
6x1 + 2x2 < 1,200 pound of steel available
x2 < 20 snow blower engine available
x 1, x 2 > 0
a. What is the best product mix? What is the optimal profit?
Answer:
x1=193.33 , x2=20 and profit =$7399.9 118
By Fanta T
b. What are the shadow prices? When the optimal solution has
been reached, which resource has the highest marginal value?
Answer:
The shadow price for 1 additional labor=$0
The shadow price for 1 additional pound of steel=$5.01
The shadow price for 1 additional snow blowers engine made
available =$70.01
Thus, snow blower engine have the highest marginal value at
the optimal solution.
119
By Fanta T
Duality
• The mirror image of LPP
121
By Fanta T
DUALITY
Every LPP has another LPP associated with it,
which is called its dual.
The first way of starting a linear problem is called
the primal of the problem.
The second way of starting the same problem is
called the dual.
The optimal solutions for the primal and the dual
are equivalent, but they are derived through
alternative procedures.
122
By Fanta T
Primal-Dual Relationship
Primal Dual
Objective is minimization Objective is maximization and vice versa
No of columns No of rows
No of rows No of columns
Duality Advantage
1. The dual form provides an alternative form
2. The dual reduces the computational difficulties associated with some formulation
3. The dual provides an important economic interpretation concerning the value of
scars resources used. 123
Example: 1 By Fanta T
x1, xu 2 > 0 2
1 3 < 3000
u2 5 7 < 1000
u3 1 1 < 500
MaxZ 5 6
By referring the above table, dual for this can
be stated as: 124
By Fanta T
126
By Fanta T
Let u1, u2 , u3, and u4 be the dual variables corresponding to the four
constraints in given order, then the dual of the given primal problem can
be formulated as follows:
MaxZ*=-160 u1+30 u2-30 u3+10 u4
St:
-2u1+ u2- u3+ u4 < 1
-4u1- u2+ u3 <2
u1, u2 , u3, u4 >0
Let u= u2-u3, then the above dual problem reduces to the form:
MaxZ*=-160 u1+30 u2-30 u3+10
St:
-2u1+ u+ u4 < 1
-4u1-u <2
u1, u4 > 0, u unrestricted in sign
Here it may be noted that the second constraint in the primal is
equality. Therefore, the corresponding dual u2 should be unrestricted in
sign.
128
By Fanta T
Example: 2
• The doctor advises a patient visited him that the patient is weak
cost of ETB 3 per unit of A and ETB 2.50 per unit of B. The
129
patient has to fulfill the need of vitamin by consuming A and B
By Fanta T
Cont’d…
The END!
132