Linear Programming
Linear Programming
Debabrata Das
NITIE
Summary
Formulate LP Model
Solution of LP Model
1) Graphical Method: when the formulation involves only 2 variables then this
can be used.
2) Computer Method: when there are more than 2 variables it should be solved
using some analytical approaches, such as
Simplex
Karmarkar’s Method
How many Standard and Deluxe bags should Par. Inc produce to maximize the profit ?
Use graphical method to solve the model.
3
Learning through Example
Par. Inc, a manufacturer of Golf Bag, has decided to move into the market for medium-
priced (i.e. standard model) and high-priced (i.e. deluxe model) golf bags. Par’s
distributor is enthusiastic about the new product line and has agreed to buy all the golf
bags Par produces over the next three months.
After a thorough investigation of the steps involved in manufacturing a golf bag, management
determined that each golf bag produced will require the following operations:
How many Standard and Deluxe bags should Par. Inc produce to maximize the profit ?
How will you solve this? We can formulate this problem as a LP model to find the optimal
solution.
4
Model Formulation
Decision Variables
S = number of Standard bags produced.
D= number of Deluxe bags produced.
Objective
Maximize total profit i.e. 10S 9D
Constraints
Hours required for all the operations should be less than the hours available.
7 S D 630 (Cutting & Dyeing Hrs available)
10
1 S 5 D 600 (Sewing Hrs available)
2 6
S 2 D 708 (Finishing Hrs available)
3
1 S 1 D 135 (Inspection & Packaging Hrs available)
10 4
Non-negativity Constraints
S 0, D 0
5
Model Formulation
Complete LP model for Par. Inc – A Manufacturer of Golf Bag
Way Forward
Solution of developed LP : How many standard and deluxe bags to produce so that
profit is maximized ????
6
Graphical Methods
Constraint #1
Cutting and Dyeing Constraint: 7 10 S 1D 630
1200
1000
400
(900, 0)
200
7
Graphical Methods
Constraint # 2
Sewing Constraint: 1 2 S 5 6 D 600
1200
600
400
(1200, 0)
200
8
Graphical Methods
Constraint # 3
Finishing Constraint: S 2 3 D 708
D
(0, 1062)
1200
1000
800
600
400
200
(708, 0)
9
Graphical Methods
Constraint # 4
Inspection and Packaging Constraint: 110 S 1 4 D 135
1200
1000
400
(1350, 0)
200
10
Graphical Methods
Constraint # 1, 2, 3, 4 (combined)
Cons #4 400
200
11
Graphical Solution
400
(180, 0)
0 200 400 600 800
S
12
Graphical Solution
200
(An iso-
profit line 0 200 400 600 800
S
with
profit=0)
13
Graphical Solution
S=540,
D=252 An optimal
200
solution to an
LP problem can
be found at an
S extreme point
0 200 400 600 800 of the feasible
region.
14
Summary of Graphical Solution Procedure
(For Maximization Problems)
Prepare a graph of the feasible solutions for each of the constraints.
Determine the feasible region that satisfies all the constraints simultaneously.
Draw an objective function line.
Move parallel objective function lines toward larger objective function values without
entirely leaving the feasible region.
Any feasible solution on the objective function line with the largest value is an
optimal solution.
Way Forward
Solution of developed LP using Excel Solver.
15
Solution of LP
1. Graphical Method
When the formulation involves only 2 variables then this can be used.
2. Computer Method
When there are more than 2 variables it should be solved using some analytical
approaches, such as
Simplex
Karmarkar’s Method
16
Excel Solver Solution: Example
17
Excel Solver Solution: Example
18
Excel Solver Solution: Example
19
Interpretation of Output
20
Example
Original LP: with inequality constraints:
Maximize 10S 9 D
Subject to 7 S D 630
10
1 S 5 D 600
2 6
S 2 D 708
3
1 S 1 D 135
10 4
S 0, D 0
LP in Standard Form: constraints converted into equalities with addition of slack
variables, s1, s2 , s3 and s4
Maximize 10S 9 D 0s1 0s2 0s3 0s4
Subject to 7 S D s1 630
10
1 S5 D s 600
2 6 2
S2 D s3 708
3
1 S1 D s4 135
10 4
S , D, s1 , s2 , s3 , s4 0
21
Standard Form, Slack Variables and Surplus Variables
A linear program in which all the variables are nonnegative and all
the constraints are equalities is said to be in standard form.
Standard form is attained by adding slack variables to "less than or
equal to" constraints, and by subtracting surplus variables from
"greater than or equal to“ constraints.
Slack and surplus variables represent the difference between the left
and right sides of the constraints.
Slack and surplus variables have objective function coefficients equal
to 0.
22
Excel Solver Solution: Example
Special Cases
Alternate optimal solution
Infeasible solution
Unbounded solution
24
Graphical Solution
Max 10S 9D
Subject to 7 S D 630
10
D 1 S 5 D 600
2 6
S 2 D 708
600 3
Optimal Solution 1 S 1 D 135
10 4
400
S 0, D 0
S=540,
200 D=252
25
Special Case : Alternate Optimal Solution
Let us assume that the profit for the standard golf bag (S) has been
decreased to $6.30 per unit. The revised objective function becomes
6.3S+9D. What would be optimal value of S and D?
D
600
5
400
4
3
200
1 2
S
0 200 400 600 800
26
Special Case : Alternate Optimal Solution
Let us assume that the profit for the standard golf bag (S) has been
decreased to $6.30 per unit. The revised objective function becomes
6.3S+9D. What would be optimal value of S and D?
D
600
5
400
4
3
200
1 2
S
0 200 400 600 800
27
Special Case : Alternate Optimal Solution
Let us assume that the profit for the standard golf bag (S) has been
decreased to $6.30 per unit. The revised objective function becomes
6.3S+9D. What would be optimal value of S and D?
D
600
5
400
4
3
200
1 2
S
0 200 400 600 800
28
Special Case : Alternate Optimal Solution
Let us assume that the profit for the standard golf bag (S) has been
decreased to $6.30 per unit. The revised objective function becomes
6.3S+9D. What would be optimal value of S and D?
D
600
(300, 420)
5
400
4 (540, 252)
3
200
1 2
S
0 200 400 600 800
29
Special Case : Alternate Optimal Solution
Let us assume that the profit for the standard golf bag (S) has been
decreased to $6.30 per unit. The revised objective function becomes
6.3S+9D. What would be optimal value of S and D?
D
600
(300, 420)
5
400
4 (540, 252)
3
200
1 2
S
0 200 400 600 800
30
Special Case : Alternate Optimal Solution
In the graphical method, if the objective function line is parallel to a boundary
constraint in the direction of optimization, there are alternate optimal solutions, with
all points on this line segment being optimal.
Let us assume that the profit for the standard golf bag (S)
has been decreased to $6.30. The revised objective
D function becomes 6.3S+9D. Optimal solution occurs at
two extreme points: extreme point 4 i.e. (300,420) and 3
i.e. (540,252).
600
Furthermore, any point on the line connecting the two
(300, 420) optimal extreme points also provides an optimal
5 solution.
400
4 (540, 252)
A LP problem with alternative optimal
3 solutions is generally a good situation for
200 the decision maker. It means that several
combinations of the decision variables are
1 2 optimal and that the manager can select
S the most desirable optimal solution.
0 200 400 600 800
31
Special Case : Alternate Optimal Solution
While solving Linear Programming Problems, MS Excel does not consider the
presence of multiple optimal Solutions. It simply gives out one of the many optimal
solutions.
Max, z= 6.3 S + 9 D D: No of Deluxe Bags
st 7/10 S + 1 D <= 630 Cutting and Dyeing S: No of Standard Bags
1/2 S + 5/6 D <= 600 Sewing
1 S + 2/3 D <= 708 Finishing
1/10 S + 1/4 D <= 135 Inspection and Packaging
S, D >= 0
Decision S D Names
Variables 300 420 Values
Obj function 6.3 9 5670 Z Note: Objective function becomes parallel to "cutting and dyeing" constraint
600
5
400
4
3
200
1 2
S
0 200 400 600 800
33
Special Case: Infeasibility
Suppose, management specified that at least 500 of the standard bags and at
least 360 of the deluxe bags must be manufactured. Find out the feasible region
and optimal solution (if any).
D
D>=360
600
5 S>=500
400
4
3
200
1 2
S
0 200 400 600 800
34
Special Case: Infeasibility
Suppose, management specified that at least 500 of the standard bags and at
least 360 of the deluxe bags must be manufactured. Find out the feasible region
and optimal solution (if any).
D
D>=360
600
5 S>=500
400
4
3
200
1 2
S
0 200 400 600 800
35
Special Case: Infeasibility
Suppose, management specified that at least 500 of the standard bags and at
least 360 of the deluxe bags must be manufactured. Find out the feasible region
and optimal solution (if any).
D
Points satisfying
minimum
D>=360
600
production
requirement
5 S>=500
400
4
Points satisfying
departmental 3
200 constraints on
the availability
1 of time 2
S
0 200 400 600 800
36
Special Case: Infeasibility
A LP which is overconstrained so that no point satisfies all the constraints (including
non-negativity) is said to be infeasible.
600
production constraints, hence this problem has no
requirement feasible region, and no optimal solution.
S
0 200 400 600 800
37
Special Case: Infeasibility
38
Special Case: Unbounded
Max z=3X1+4X2
Subject to,
3X1+X2>=8
X1+X2>=5
x2
3X1+X2>=8
5
X1+X2>=5
x1
0 2.67 5
39
Special Case: Unbounded
Max z=3X1+4X2
Subject to,
3X1+X2>=8
X1+X2>=5
x2
3X1+X2>=8
5
X1+X2>=5
Max z=3X1+4X2
x1
0 2.67 5
40
Special Case: Unbounded
Max z=3X1+4X2
Subject to,
3X1+X2>=8
X1+X2>=5
x2
3X1+X2>=8
5
X1+X2>=5
Max z=3X1+4X2
x1
0 2.67 5
41
Special Case: Unbounded
The feasible region is unbounded and the objective function line can be moved parallel
to itself without bound so that z can be increased (for maximization problem) or
decreased (for minimization problem) infinitely.
42
Special Case: Unbounded
43
Sensitivity Analysis
44
Sensitivity Analysis
What if there is uncertainly about one or more values in the LP
model?
1. Product demand
2. Stock price
45
Sensitivity Analysis
Sensitivity analysis allows us to determine how “sensitive” the
optimal solution is to changes in data values.
46
LP Model
Complete LP model for Par. Inc – A Manufacturer of Golf Bag
47
Graphical Solution
Max 10S 9D
Subject to 7 S D 630
10
D 1 S 5 D 600
2 6
S 2 D 708
600 3
Optimal Solution 1 S 1 D 135
10 4
400
S 0, D 0
S=540,
200 D=252
48
Excel Solution
Adjustable Cells
Final Reduced Objective Allowable Allowable
Cell Name Value Cost Coefficient Increase Decrease
$C$10 S 540 0 10 3.5 3.7
$D$10 D 252 0 9 5.3 2.3
Constraints
Final Shadow Constraint Allowable Allowable
Cell Name Value Price R.H. Side Increase Decrease
$E$13 Cutting and Dyeing 630 4 630 52.36 134.40
$E$14 Sewing 480 0 600 1E+30 120
$E$15 Finishing 708 7 708 192 128
$E$16 Inspection and Packaging 117 0 135 1E+30 18
49
Range of Optimality
Question:
Suppose profit of the standard golf bag is increased to $11 per unit. Is
the above solution still optimal? What is the value of the objective
function when the unit profit is increased to $11?
50
Range of Optimality
Range of optimality for coefficients of objective function
Adjustable Cells
Final Reduced Objective Allowable Allowable
Cell Name Value Cost Coefficient Increase Decrease
$C$10 S 540 0 10 3.5 3.7
$D$10 D 252 0 9 5.3 2.3
Constraints
Final Shadow Constraint Allowable Allowable
Cell Name Value Price R.H. Side Increase Decrease
$E$13 Cutting and Dyeing 630 4 630 52.36 134.40
$E$14 Sewing 480 0 600 1E+30 120
$E$15 Finishing 708 7 708 192 128
$E$16 Inspection and Packaging 117 0 135 1E+30 18
51
Range of Optimality
Range of Optimality
Answer:
The output states that the solution remains optimal as long as the
objective function coefficient of S is between 6.3 (=10-3.7) and 13.5
(=10+3.5). Since 11 is within this range, the optimal solution will not
change.
52
Objective Function Coefficients
Let us consider how changes in the objective function coefficients might
affect the optimal solution.
The range of optimality for each coefficient provides the range of values
over which the current solution will remain optimal. [other corner point
does not become optimal]. Here values of S and D remain the same, but z
value may change].
53
Interested in knowing, what is the greatest change we can make in the objective
function coefficients , still keeping the current solution [e.g., corner point, 3]
optimal?
Clue: Graphically, the
Coincides with limits of a range of optimality
D S+ 2/3D < 708 are found by changing the slope
constraint line of the objective function line
within the limits of the slopes
600
Objective function of the binding constraint lines,
line for 10S+9D=7668 3-4 and 3-2.
400
5
4 Coincides with
3 7/10 S + D < 630
200 constraint line
1 2
0 200 400 600 800
S
54
Range of Optimality
The slope of objective function line, z = c1S+ c2D, is -c1/c2
The slope of a constraint, a1S+ a2D = b, is -a1/a2.
Note: sensitivity analysis here will consider changing just one parameter at
a time, keeping all other parameters same as that used in the original model.
Range of Optimality for c1
55
Range of Optimality
Range of Optimality for c1
Objective function assumed while solving the model, z = 10S +9D
Now we want to study effect of changing c1 [Keep all other parameter values as
original] Thus, z = c1S + 9D
The slope of the objective function line is -c1/9.
The slope of the first binding constraint, 7/10 S + D = 630, is -7/10
The slope of the second binding constraint, S+ 2/3D = 708, is -3/2.
Find the range of values for c1 (with c2 staying 9) such that the objective function
line slope lies between that of the two binding constraints:
-3/2 < -c1/9 < -7/10
Multiplying through by -9 (and reversing the inequalities):
6.3 < c1 < 13.5
56
Range of Optimality
Range of Optimality for c2
Find the range of values for c2 ( with c1 staying 10) such that the objective
function line slope lies between that of the two binding constraints:
-3/2 < -10/c2 < -7/10
57
Range of Optimality
Range of Optimality
Question:
If the unit profit of S were $6 instead of $10, would the optimal
solution change?
58
Range of Optimality
Range of optimality for coefficients of objective function
Adjustable Cells
Final Reduced Objective Allowable Allowable
Cell Name Value Cost Coefficient Increase Decrease
$C$10 S 540 0 10 3.5 3.7
$D$10 D 252 0 9 5.3 2.3
Constraints
Final Shadow Constraint Allowable Allowable
Cell Name Value Price R.H. Side Increase Decrease
$E$13 Cutting and Dyeing 630 4 630 52.36 134.40
$E$14 Sewing 480 0 600 1E+30 120
$E$15 Finishing 708 7 708 192 128
$E$16 Inspection and Packaging 117 0 135 1E+30 18
59
Range of Optimality
Range of Optimality
Answer:
The output states that the solution remains optimal as long as the objective
function coefficient of S is between 6.3 and 13.5. Because 6 is outside this
range, the optimal solution would change.
In this case, one needs to solve the LP again to find the new optimal
solution.
60
Objective Function Coefficients
Let us consider how changes in the objective function coefficients might
affect the optimal solution.
The range of optimality for each coefficient provides the range of values
over which the current solution will remain optimal. [other corner point
does not become optimal]. Here values of S and D remain the same, but z
value may change].
Managers should focus on those objective coefficients that show high
sensitivity (not robust) to the solution, i.e, have a narrow range of
optimality and coefficients near the endpoints of the range.
61
Shadow Price
In an LP, constraint may represent the usage of limited resources. For such
resources, the RHS provides the limit on its availability.
The change in the optimal objective value per unit increase in the right-hand
side (i.e., availability of resource) is called the shadow price.
62
Shadow Price Example
Constraints
Final Shadow Constraint Allowable Allowable
Cell Name Value Price R.H. Side Increase Decrease
$E$13 Cutting and Dyeing 630 4.38 630 52.36363636 134.4
$E$14 Sewing 480 0.00 600 1E+30 120
$E$15 Finishing 708 6.94 708 192 128
$E$16 Inspection and Packaging 117 0.00 135 1E+30 18
64
Shadow Price Example
Constraint 3: Change the RHS value of the third constraint to 580 and re-
solve for the optimal point determined by the last two constraints:
7/10S+D=630 and S +2/3D = 580
The solution is S=300, D=420, z=6780
Hence, the shadow price= (zNew-zOld)/ (RHSNew-RHSOld)
=(6780-7668)/(580-720)
=(-888) / (-128)
=6.9375
65
Range of feasibility
The range of feasibility for a change in the right hand side value is the range
of values for this coefficient in which the original shadow price remains
constant.
Graphically, the range of feasibility is determined by finding the values of a
right hand side such that the same two lines that determined the original
optimal solution continue to determine the optimal solution for the
problem.
Note that values of decision variables, S and D and thus the objective value
will change.
66
Range of Feasibility and Shadow Price
Constraints
Final Shadow Constraint Allowable Allowable
Cell Name Value Price R.H. Side Increase Decrease
$E$13 Cutting and Dyeing 630 4.38 630 52.36363636 134.4
$E$14 Sewing 480 0.00 600 1E+30 120
$E$15 Finishing 708 6.94 708 192 128
$E$16 Inspection and Packaging 117 0.00 135 1E+30 18
600
Optimal Solution:
S=540, D=252
Range of 5
400
Feasibility
580 to 900 4
7/10 S + D < 630
3
200
1 2
0 200 400 600 800
S
68
Reduced Cost
69
Reduced Cost of a variable
Adjustable Cells
Final Reduced Objective Allowable Allowable
Cell Name Value Cost Coefficient Increase Decrease
$C$10 S 540 0 10 3.5 3.7
$D$10 D 252 0 9 5.285714286 2.333333333
Constraints
Final Shadow Constraint Allowable Allowable
Cell Name Value Price R.H. Side Increase Decrease
$E$13 Cutting and Dyeing 630 4.38 630 52.36363636 134.4
$E$14 Sewing 480 0.00 600 1E+30 120
$E$15 Finishing 708 6.94 708 192 128
$E$16 Inspection and Packaging 117 0.00 135 1E+30 18
70
Limits Report
Target
Cell Name Value
$E$11 Obj function ¬ 7668.0
Adjustable Lower Target Upper Target
Cell Name Value Limit Result Limit Result
$C$10 S 540 0 2268 540 7668
$D$10 D 252 0 5400 252 7668
72
Simultaneous Changes
73
Simultaneous Changes
Adjustable Cells
Final Reduced Objective Allowable Allowable
Cell Name Value Cost Coefficient Increase Decrease
$C$10 S 540 0 10 3.5 3.7
$D$10 D 252 0 9 5.285714286 2.333333333
Constraints
Final Shadow Constraint Allowable Allowable
Cell Name Value Price R.H. Side Increase Decrease
$E$13 Constraints LHS¯ 630 4.38 630 52.36363636 134.4
$E$14 LHS¯ 480 0.00 600 1E+30 120
$E$15 LHS¯ 708 6.94 708 192 128
$E$16 LHS¯ 117 0.00 135 1E+30 18
74
Simultaneous Changes
Range of Optimality and 100% Rule
Question:
If simultaneously the per unit profit of S is increased to $11 and the per unit
profit of D is reduced to $8, would the current solution remain optimal?
75
Simultaneous Changes
Adjustable Cells
Final Reduced Objective Allowable Allowable
Cell Name Value Cost Coefficient Increase Decrease
$C$10 S 540 0 10 3.5 3.7
$D$10 D 252 0 9 5.285714286 2.333333333
Constraints
Final Shadow Constraint Allowable Allowable
Cell Name Value Price R.H. Side Increase Decrease
$E$13 Constraints LHS¯ 630 4.38 630 52.36363636 134.4
$E$14 LHS¯ 480 0.00 600 1E+30 120
$E$15 LHS¯ 708 6.94 708 192 128
$E$16 LHS¯ 117 0.00 135 1E+30 18
76
Simultaneous Changes
Range of Optimality and 100% Rule
Answer:
If c1 = 11, the amount c1 changed is 11-10 = 1. The maximum
allowable increase is 3.5 , so this is a 1/3.5 = 28.57% change. If c2 = 8,
the amount that c2 changed is 9 – 8 = 1. The maximum allowable
decrease is 2.33, so this is a 1/2.33 = 42.91% change. The sum of the
change percentages is 28.57% + 42.91% = 71.48%. Because this does
not exceed 100%, the optimal solution would not change.
77
Simultaneous Changes
78
Simultaneous Changes
Adjustable Cells
Final Reduced Objective Allowable Allowable
Cell Name Value Cost Coefficient Increase Decrease
$C$10 S 540 0 10 3.5 3.7
$D$10 D 252 0 9 5.285714286 2.333333333
Constraints
Final Shadow Constraint Allowable Allowable
Cell Name Value Price R.H. Side Increase Decrease
$E$13 Constraints LHS¯ 630 4.38 630 52.36363636 134.4
$E$14 LHS¯ 480 0.00 600 1E+30 120
$E$15 LHS¯ 708 6.94 708 192 128
$E$16 LHS¯ 117 0.00 135 1E+30 18
79
Example 2
Range of Feasibility and 100% Rule
Question:
If simultaneously the RHS of constraint 1 is increased to 650 and the RHS
of constraint 3 is reduced to 700, would the shadow price remain same?
80
Example 3
Range of feasibility and 100% Rule
Answer:
Change in RHS of constraint 1 = 650-630 =20
The maximum allowable increase is 52.36, so this is a 20/52.36= 38.19%
change.
81
Thank You !!!
Contact:
debabrata.das@nitie.ac.in