Operations Research Linear Programming
Operations Research Linear Programming
Model
Abstraction of reality Representation of a system to study the behaviour of the system
System
Model
Verification/Validation
Classification of models
Models
Schematic models
Physical models
Mathematical models
Analytic models
Simulation models
Static/Dynamic Deterministic/Stochastic
Academics or extra-curricular?
Suppose you consider academics and extra-curricular activities are the two most important aspects that have direct bearings on your prospects for placements. You estimate the ratio of the impact of devoting 1 hour to academics to the impact of devoting 1 hour to extra-curricular activities on your placement prospects to be 3:5. You decide not to spend more than 8 hours daily for these two activities. Moreover, you estimate that 1 hour of academics and 1 hour of extra-curricular activities burn, on an average, 100 and 250 calories, respectively, and you cannot afford to burn more than 1250 calories for these two activities based on your average daily calorie intake. Q. How many hours should you devote to academics and extracurricular activities daily?
Academics or extra-curricular?
Decision variables: x1: No. of hours devoted to academics daily x2: No. of hours devoted to extra-curricular activities daily Objective function: Maximize the impact on placement prospects Max z = 3x1 + 5x2 Constraints: x1 + x2 <= 8 100x1 + 250x2 <= 1250 or 2x1 + 5x2 <= 25 Non-negativity restrictions: x1, x2 >= 0
(1) (2)
Graphical solution
10
Optimal solution:
z* = 30 x1* = 5, x2* = 3
x2
(1)
C (2)
0 A 5 B x1 10 15
Assumptions in LP
Proportionality
Additivity Divisibility Certainty
Simplex algorithm
Developed by Dantzig in 1947 Convert the LP to standard form: Max z = 3x1 + 5x2 Subject to x1 + x2 + s1 =8 2x1 + 5x2 + s2 = 25 x1, x2, s1, s2 >= 0 s1 and s2 are slack variables
s2
25
x2 s2 5
Iteration 1
Basic z s1 x1 -1 3/5 x2 0 0 s1 0 1 s2 1 -1/5 Solution 25 3
x2
2/5
1/5
x1 s1 3/5
Iteration 2
Basic z x1 x1 0 1 x2 0 0 s1 5/3 5/3 s2 2/3 -1/3 Solution 30 5
x2
-2/3
1/3
Optimal solution: x1* = 5, x2* = 3, z* = 30 Upper bound on the no. of iterations = Maximum no. of basic solutions = nCm
Feasibility condition
For both the maximization and minimization problems, the leaving variable is the basic variable associated with the smallest non-negative ratio. Ties are broken arbitrarily
Simplex method
1. Determine a starting basic feasible solution
2. Select an entering variable using the optimality condition. Stop if there is no entering variable
3. Select a leaving variable using the feasibility condition 4. Determine the new basic feasible solution by using the appropriate Gauss-Jordan computations. Go back to step 2
Graphical interpretation
10
Optimal solution:
z* = 30 x1* = 5, x2* = 3
x2
(1)
C (2)
0 A 5 B x1 10 15
Example: Company X
Company X produces two products - A and B with two raw materials, V and W the maximum availabilities of which are 7000 and 6000 units, respectively. To produce one unit of A(B), 1(2) unit(s) of V and 3(1) units of W are required. If the contributions per unit of A and B are Rs. 2 and Rs. 3, respectively, determine how many units of A and B should Company X produce in order to maximize the total contribution.
Solution: A - 1000 units and B - 3000 units
Min z = x1 x2 Subject to -2x1 + x2 <= 4 (1) - x1 + 2x2 <= 4 (2) x1 >= -1.5, x2 >= 0
(2)
(-4/3, 4/3)
-4
-2
(1)
x1
Conversion to standard LP
x3 = x1 + 1.5 >= 0 & x1 = x3 - 1.5
Min z = - x2 + x3 - 1.5 Subject to x2 - 2x3 + s1 2x2 - x3 =1 + s2 = 2.5
s2
-1
2.5
x2 s1 1
Iteration 1
Basic z x2 x2 0 1 x3 1 -2 s1 -1 1 s2 0 0 Solution -2.5 1
s2
-2
0.5
x3 s2 3
Iteration 2
Basic z x2 x2 0 1 x3 0 0 s1 s2 Solution -8/3 4/3 -1/3 -1/3 -1/3 2/3
x3
-2/3 1/3
1/6
Optimal solution: x2 = 4/3, x3 = 1/6, z* = -8/3 or x1* = -4/3, x2* = 4/3, z* = -8/3
(1) (2)
(2)
(-4/3, 4/3)
-4
-2
(1)
x1
Conversion to standard LP
Write x1 = x1+ - x1- and x2 = x2+ - x2Min z = x1+ - x1- - x2+ + x2Subject to - 2x1+ + 2x1- + x2+ - x2- + s1 - x1+ + x1- + 2x2+ - 2x2=4 + s2 = 4
s2
-1
-2
x1s1 2
Iteration 1
Basic z x1x1+ 0 -1 x10 1 x2+ 1/2 1/2 x2-1/2 -1/2 s1 -1/2 1/2 s2 0 0 Solution -2 2
s2
3/2
-3/2
-1/2
x2+ s2 3/2
Iteration 2
Basic z x1x1+ 0 -1 x10 1 x2+ 0 0 x20 0 s1 s2 Solution -8/3 4/3 -1/3 -1/3 2/3 -1/3
x2+
-1
-1/3
2/3
4/3
Optimal solution: x1- = 4/3, x2+ = 4/3, z* = -8/3 or x1* = -4/3, x2* = 4/3, z* = -8/3
Max z = 3x1 + 5x2 Subject to x1 + x2 = 8 (1) 2x1 + 5x2 >= 25 (2) x1, x2 >= 0
M-method
Max z = 3x1 + 5x2 MR1 MR2 Subject to
x1 + x 2
2x1 + 5x2 - s
+ R1
= 8
+ R2 = 25
R2
-1
25
Observe that the z-row coefficients of the basic variables R1 and R2 are non-zero. To make them zero, subtract M-times the first constraint row and M-times the second constraint row from the objective row.
R2
-1
25
x2 R2 5
Iteration 1
Basic z R1 x1 -1-3/5M 3/5 x2 0 0 s -1-1/5M 1/5 R1 0 1 R2 1+6/5M -1/5 Solution 25-3M 3
x2
2/5
-1/5
1/5
x1 R1 3/5
Iteration 2
Basic z x1 x1 0 1 x2 0 0 s -2/3 1/3 R1 5/3+M 5/3 R2 2/3+M -1/3 Solution 30 5
x2
-1/3
-2/3
1/3
s x1 1/3
Iteration 3
Basic z s x1 2 3 x2 0 0 s 0 1 R1 5+M 5 R2 M -1 Solution 40 15
x2
Unbounded solutions
Infeasible solutions
Degeneracy
Suppose in the academics or extra-curricular? problem, you decide not to devote more than 5 hours daily to these two activities. Other data remaining the same, how many hours would you now devote to academics and extra-curricular activities daily?
Modified formulation: Max z = 3x1 + 5x2 Subject to x1 + x2 <= 5 (1) 2x1 + 5x2 <= 25 (2) x1, x2 >= 0
Standard form: Max z = 3x1 + 5x2 Subject to x1 + x2 + s1 = 5 2x1 + 5x2 + s2 = 25 x1, x2, s1, s2 >= 0
s2
25
x2 s2 5
Iteration 1
Basic z s1 x1 -1 3/5 x2 0 0 s1 0 1 s2 1 -1/5 Solution 25 0
x2
2/5
1/5
x1 s1 3/5
Iteration 2
Basic z x1 x1 0 1 x2 0 0 s1 5/3 5/3 s2 2/3 -1/3 Solution 25 0
x2
-2/3
1/3
Graphical interpretation
10
Optimal solution:
z* = 25 x1* = 0, x2* = 5
C
x2
5 (1)
Alternative optima
Suppose in the academics or extra-curricular? problem, you estimate that the effect of 1 hour of academics and the effect of 1 hour of extra-curricular activities on your placement prospects are the same. Other data remaining the same, how many hours would you now devote to academics and extra-curricular activities daily?
Modified formulation:
Standard form:
Max z = x1 + x2 Subject to x1 + x2 + s1 = 8 2x1 + 5x2 + s2 = 25 x1, x2, s1, s2 >= 0
(1) (2)
s2
25
x1 s1 1
Iteration 1
Basic z x1 x1 0 1 x2 0 1 s1 1 1 s2 0 0 Solution 8 8
s2
-2
x2 s2 3
Iteration 2
Basic z x1 x1 0 1 x2 0 0 s1 1 5/3 s2 0 -1/3 Solution 8 5
x2
-2/3
1/3
Graphical interpretation
10
Optimal solution:
z* = 8 x1* = 8, x2* = 0, or
x2
(1)
C (2)
x1* = 5, x2* = 3
0 A 5 B x1 10 15
Unbounded solutions
Suppose in the academics or extra-curricular? problem, you decide to devote at least 8 hours daily to these two activities. Also, you would like to burn at least 1250 calories for these two activities. Other data remaining the same, how many hours would you now devote to academics and extra-curricular activities daily?
Modified formulation:
Standard form:
Max z = 3x1 + 5x2 - MR1 - MR2 Subject to x1 + x2 - s1 + R1 = 8 2x1 + 5x2 - s2 + R2 = 25 x1, x2, s1, s2, R1, R2 >= 0
Max z = 3x1 + 5x2 Subject to x1 + x2 >= 8 (1) 2x1 + 5x2 >= 25 (2) x1, x2 >= 0
R2
-1
25
Observe that the z-row coefficients of the basic variables R1 and R2 are non-zero. To make them zero, subtract M-times the first constraint row and M-times the second constraint row from the objective row.
R2
-1
25
x2 R2 5
Iteration 1
Basic z R1 x1 -1-3/5M 3/5 x2 0 0 s1 M -1 s2 -1-1/5M 1/5 R1 0 1 R2 Solution 1+6/5M -1/5 25-3M 3
x2
2/5
-1/5
1/5
x1 R1 3/5
Iteration 2
Basic z x1 x1 0 1 x2 0 0 s1 -5/3 -5/3 s2 -2/3 1/3 R1 R2 Solution 30 5 5/3+M 2/3+M 5/3 -1/3
x2
2/3
-1/3
-2/3
1/3
s1 x2 2/3
Iteration 3
Basic z x1 x1 0 1 x2 5/2 5/2 s1 0 0 s2 -3/2 -1/2 R1 M 0 R2 Solution 3/2+M 1/2 75/2 25/2
s1
3/2
-1/2
-1
1/2
9/2
s2 ?
Graphical interpretation
10
(1)
x2 5 (2) 0 5 x1 10 15
Infeasible solutions
Suppose in the academics or extra-curricular? problem, you decide to devote at most 5 hours daily to these two activities. Also, you would like to burn at least 1500 calories for these two activities. Other data remaining the same, how many hours would you now devote to academics and extra-curricular activities daily?
Modified formulation:
Standard form:
Max z = 3x1 + 5x2 - MR Subject to x1 + x2 + s1 = 5 2x1 + 5x2 - s2 + R = 30 x1, x2, s1, s2, R >= 0
Max z = 3x1 + 5x2 Subject to x1 + x2 <= 5 (1) 2x1 + 5x2 >= 30 (2) x1, x2 >= 0
-1
30
Observe that the z-row coefficient of the basic variable R is nonzero. To make it zero, subtract M-times the second constraint row from the objective row.
-1
30
x2 s1 1
Iteration 1
Basic z x2 x1 2+3M 1 x2 0 1 s1 5+5M 1 s2 M 0 R 0 0 Solution 25-5M 5
-3
-5
-1
Graphical interpretation
10
x2
5 (1) (2)
5 x1
10
15
Duality
Consider the academics or extra-curricular? problem in modified form: Primal problem Max z = 3,00,000x1 + 5,00,000x2 Subject to x1 + x2 <= 8 100x1 + 250x2 <= 1250 x1, x2 >= 0
Worth of resources
y1: Unit worth of resource Time y2: Unit worth of resource Energy
Dual formulation
Dual problem Min w = 8y1 + 1250y2 Subject to y1 + 100y2 >= 3,00,000 y1 + 250y2 >= 5,00,000 y1, y2 >= 0
0
Unrestricted
Academics or extra-curricular?
Primal problem expressed in standard form: Max z = 3,00,000x1 + 5,00,000x2 Subject to x1 + x 2 + s1 =8 100x1 + 250x2 + s2 = 1250 x1, x2, s1, s2 >= 0
x2
-2/3
1/150
Example: Company X
Optimal primal tableau
Basic z x1 0 x2 0 s1 1.4 s2 0.20 -1/5 2/5 Solution 11,000 3000 1000
x2
x1
0
1
1
0
3/5
-1/5
x2
(1) C (2)
0 A 5
10
15