Linear Programming Wednesday October 28 2020 Dr G
Linear Programming Wednesday, October 28, 2020 Dr. G. Suresh Kumar@KL University 1
Introduction • Mathematical programming is used to find the best or optimal solution to a problem that requires a decision or set of decisions about how best to use a set of limited resources to achieve a state goal of objectives. • Steps involved in mathematical programming – Conversion of stated problem into a mathematical model that abstracts all the essential elements of the problem. – Exploration of different solutions of the problem. – Finding out the most suitable or optimum solution. • Linear programming requires that all the mathematical functions in the model be linear functions. Wednesday, October 28, 2020 Dr. G. Suresh Kumar@KL University 2
General LPP Max/min subject to: Z = c 1 x 1 + c 2 x 2 +. . . + cnxn a 11 x 1 + a 12 x 2 +. . . + a 1 nxn (≤, =, ≥) b 1 a 21 x 1 + a 22 x 2 +. . . + a 2 nxn (≤, =, ≥) b 2 : am 1 x 1 + am 2 x 2 +. . . + amnxn (≤, =, ≥) bm and xj ≥ 0, j = 1, 2, 3, …, n. xj = decision variables bi = constraint levels cj = objective function coefficients aij = constraint coefficients Wednesday, October 28, 2020 Dr. G. Suresh Kumar@KL University 3
Formation of LPP • A manufacturer produces two types of models M 1 and M 2. Each M 1 model requires 4 hours of grinding and 2 hours of polishing; whereas M 2 model requires 2 hours of grinding and 5 hours of polishing. The manufacturer has 2 grinders and 3 polishers. Each grinder works for 40 hours a week and each polisher works for 60 hours a week. Profit on an M 1 model is Rs. 3 and on M 2 model is Rs. 4. Whatever is produced in a week is sold in the market. How should the manufacturer allocate his production capacity to the two types of models so that he make the maximum profit in a week. Wednesday, October 28, 2020 Dr. G. Suresh Kumar@KL University 4
Solution • Let x be the number of M 1 models and y be the number of M 2 models produced in a week. • Then the weekly profit is Z = 3 x + 4 y. • The total number of grinding hours needed in a week to produce x and y is 4 x + 2 y. • The total number of polishing hours needed in a week to produce x and y is 2 x + 5 y. Wednesday, October 28, 2020 Dr. G. Suresh Kumar@KL University 5
Solution cont… • Since the number of grinding hours is not more than 80 and the number of polishing hours not more than 180, therefore 4 x + 2 y ≤ 80 2 x + 5 y ≤ 180. • Also, the negative number of models are not produced, we must have x ≥ 0 and y ≥ 0. Wednesday, October 28, 2020 Dr. G. Suresh Kumar@KL University 6
Solution cont… • Now the problem is to find x, y which Maximize Z = 3 x + 4 y Subject to 4 x + 2 y ≤ 80 2 x + 5 y ≤ 180 and x, y ≥ 0. Wednesday, October 28, 2020 Dr. G. Suresh Kumar@KL University 7
Problem#2 • An aeroplane can carry a maximum of 200 passengers. A profit of Rs. 400 is made on each first class ticket and a profit of Rs. 300 is made on each economy class ticket. The airline reserves at least 20 seats for first class. However, at least 4 times as many passengers prefer to travel by economy class than by the first class. How many tickets of each class must be sold in order to maximize profit for the airline ? Formulate the problem as L. P. model and then solve. Wednesday, October 28, 2020 Dr. G. Suresh Kumar@KL University 8
Solution • Maximize Z = 400 x + 300 y subject to x + y ≤ 200 x ≥ 20 y ≥ 4 x and x, y ≥ 0. Wednesday, October 28, 2020 Dr. G. Suresh Kumar@KL University 9
Problem#3 • Consider the following problem faced by a production planner in a soft-drink plant. He has two bottling machines A and B. A is designed for 8 -ounce bottles and B for 16 -ounce bottles. However, each can be used on both types with some loss of efficiency. The following data is available : Machine A B Wednesday, October 28, 2020 8 -ounce bottle 100/ minute 60/ minute Dr. G. Suresh Kumar@KL University 16 -ounce bottle 40/ minute 75/ minute 10
Problem#3 The machines can be run 8 hours per day, 5 days per week. Profit on 8 -ounce bottle is 15 paise and on a 16 -ounce bottle is 25 paise. Weekly production of the drink cannot exceed 300, 000 ounces and the market can absorb 25, 000 8 ounce bottles and 7, 000 16 -ounce bottles per week. The planner wishes to maximize his profit subject to all production and marketing restrictions. Formulate the problem as L. P model. Wednesday, October 28, 2020 Dr. G. Suresh Kumar@KL University 11
Solution • Maximize Z = 0. 15 x+0. 25 y subject to 2 x + 5 y ≤ 480, 000 5 x + 4 y ≤ 720, 000 8 x + 16 y ≤ 300, 000 x ≤ 25, 000 y ≤ 7, 000 and x, y ≥ 0. Wednesday, October 28, 2020 Dr. G. Suresh Kumar@KL University 12
General LPP Max/min subject to: Z = c 1 x 1 + c 2 x 2 +. . . + cnxn a 11 x 1 + a 12 x 2 +. . . + a 1 nxn (≤, =, ≥) b 1 a 21 x 1 + a 22 x 2 +. . . + a 2 nxn (≤, =, ≥) b 2 : am 1 x 1 + am 2 x 2 +. . . + amnxn (≤, =, ≥) bm xj = decision variables bi = constraint levels cj = objective function coefficients aij = constraint coefficients Wednesday, October 28, 2020 Dr. G. Suresh Kumar@KL University 13
Solutions of LPP • A set of values x 1, x 2, …, xn which satisfies the constraints of LPP is called its solution. • Any solution to a LPP which satisfies the non-negativity restrictions is called its feasible solution. • Any feasible solution which maximizes or minimizes the objective function is called its optimal solution. Wednesday, October 28, 2020 Dr. G. Suresh Kumar@KL University 14
Solutions of LPP • A solution is obtained by setting n-m variables to zero (if m equality constraints and n variables of LPP) is called a basic solution. • Basic solution of LPP is also satisfies the nonnegativity restrictions is called basic feasible solution. • Basic feasible solution which maximizes or minimizes the objective function is called its optimal solution. • A basic feasible solution in which all basic variable are non-zero is called a non-degenerate basic feasible solution otherwise it is a degenerate basic feasible Wednesday, October Dr. G. Suresh Kumar@KL 15 solution. 28, 2020 University
Problem#1 • Find all the basic solutions of the following system of equations identifying in each case the basic and non-basic variables. 2 x 1 + x 2 + 4 x 3 = 11 3 x 1 + x 2 + 5 x 3 = 14 Ans : (3, 5, 0) basic x 1, x 2 non-basic x 3. (0, 3, -1) basic x 2, x 3 non-basic x 1. (1/2, 0, 5/2) basic x 1, x 3 non-basic x 2. Wednesday, October 28, 2020 Dr. G. Suresh Kumar@KL University 16
Problem#2 • Find an optimal solution to the following LPP by computing all basic solutions and then finding one that maximizes objective function. Max. Z = 2 x 1 + 3 x 2 + 4 x 3 + 7 x 4 Subject to 2 x 1 + 3 x 2 - x 3 + 4 x 4 = 8 x 1 - 2 x 2 + 6 x 3 -7 x 4 = -3 and x 1, x 2, x 3, x 4 ≥ 0. Ans : October (0, 0, 44/17, Dr. G. Suresh 45/17) and Z=28. 9 Wednesday, Kumar@KL 17 28, 2020 University
Slack variables • If the constraints of a general LPP be ai 1 x 1 + ai 2 x 2 +. . . + ainxn ≤ bi (i = 1, 2, …), then the non-negative variables si which satisfy ai 1 x 1 + ai 2 x 2 +. . . + ainxn + si = bi (i = 1, 2, …) are called slack variables. Wednesday, October 28, 2020 Dr. G. Suresh Kumar@KL University 18
Surplus variables • If the constraints of a general LPP be ai 1 x 1 + ai 2 x 2 +. . . + ainxn ≥ bi (i = 1, 2, …), then the non-negative variables si which satisfy ai 1 x 1 + ai 2 x 2 +. . . + ainxn - si = bi (i = 1, 2, …) are called surplus variables. Wednesday, October 28, 2020 Dr. G. Suresh Kumar@KL University 19
Canonical form of LPP The canonical form of LPP has • Objective function is of maximization type. • All constraints are of ≤ type. • All variables are non-negative. Wednesday, October 28, 2020 Dr. G. Suresh Kumar@KL University 20
Standard form of LPP The standard form of LPP has • Objective function is of maximization type • All constraints are expressed as equations • Right hand side of each constraint is nonnegative • All variables are non-negative. Wednesday, October 28, 2020 Dr. G. Suresh Kumar@KL University 21
Simplex Method • Step#1: (i) Check whether the objective function is to be maximized or minimized. If minimized, then convert it into maximization using Min. Z = - Max. (-Z). (ii) Check whether all b’s are positive. If negative, then multiply by ‘-1’ both sides of the corresponding constraint. Wednesday, October 28, 2020 Dr. G. Suresh Kumar@KL University 22
Simplex Method Step#2: Express the problem in the standard form. Convert all inequalities into equations by introducing slack or surplus variables in the constraints of the LPP. Step#3 : Find an initial basic feasible solution and form the initial simplex table. Wednesday, October 28, 2020 Dr. G. Suresh Kumar@KL University 23
Initial Simplex Table cj c 1 c 2 … c n CB x. B 0 s 1 b 1 a 12 … a 1 n 0 … s 2 … b 2 …. 0 sm bm 0 0 … 0 Mini values a 1 a 2 … an an+1 an+2 … an+m ratio Zj-cj Wednesday, October 28, 2020 1 0 … 0 a 21 a 22 … a 2 n 0 … … … 1 … … … 0 … am 1 am 2 … amn 0 0 … 1 -c 2 … -cn 0 … 0 0 Dr. G. Suresh Kumar@KL University 24
Simplex Method Step#4 : Optimality test Compute Zj-cj, where Zj = ∑ c. Biaij. If all Zj-cj ≥ 0, then the current basic feasible solutions is optimal. If even one Zj-cj < 0, then the current basic feasible solution is not optimal and proceed to the next step. Wednesday, October 28, 2020 Dr. G. Suresh Kumar@KL University 25
Simplex Method Step#5: (i) identifying incoming vector Compute Zk-ck = Min. {Zj-cj/ Zj-cj < 0}, then ak is the entering(incoming) vector. If there is a tie select any one. (ii) identifying outgoing vector Compute Min. {x. Bi/aik, aik > 0} = x. Br/ark, then ar is the out going vector. The element ark is called key element. If all aik≤ 0, then the problem has an unbounded solution and we stop the process. Wednesday, October 28, 2020 Dr. G. Suresh Kumar@KL University 26
Simplex Method (iii) iterate towards an optimal solution Covert the key element to unity by dividing the key row by the key element. Then make all other elements of the key column zero by subtracting proper multiples of key row from other rows. Step#6 : Go to step#4 and repeat the procedure until either an optimal solution or an unbounded solution is obtained. Wednesday, October 28, 2020 Dr. G. Suresh Kumar@KL University 27
Problem#1 Maximize Z = 5 x 1 + 3 x 2 Subject to x 1 + x 2 ≤ 2 5 x 1 + 2 x 2 ≤ 10 3 x 1 + 8 x 2 ≤ 12 and x 1, x 2 ≥ 0. Wednesday, October 28, 2020 Dr. G. Suresh Kumar@KL University 28
Solution • In standard form Maximize Z = 5 x 1 + 3 x 2+0 s 1+0 s 2+0 s 3 Subject to x 1 + x 2 +s 1 +0 s 2 +0 s 3= 2 5 x 1 + 2 x 2 +0 s 1+s 2 +0 s 3=10 3 x 1 + 8 x 2 +0 s 1 +0 s 2+s 3= 12 and x 1, x 2 , s 1, s 2, s 3≥ 0. Wednesday, October 28, 2020 Dr. G. Suresh Kumar@KL University 29
Initial Simplex Table cj 5 3 0 0 0 Mini values a 1 a 2 a 3 a 4 a 5 ratio CB x. B 0 s 1 2 1 1 1 0 0 2 0 s 2 10 5 2 0 1 0 2 0 s 3 12 3 8 0 0 1 4 -5 -3 0 0 0 Zj-cj Wednesday, October 28, 2020 Dr. G. Suresh Kumar@KL University 30
First Simplex Table cj 5 3 0 0 0 Mini values a 1 a 2 a 3 a 4 a 5 ratio CB x. B 5 x 1 2 1 1 1 0 0 0 s 2 0 0 -3 -5 1 0 0 s 3 6 0 5 -3 0 2 5 0 Zj-cj Wednesday, October 28, 2020 0 Dr. G. Suresh Kumar@KL University 1 0 31
Solution • Since all Zj-cj ≥ 0, the current basic feasible solution is optimal. • Therefore the optimal solution to the given problem is x 1= 2, x 2 = 0 and maximum Z= 5(2)+3(0)=10. Wednesday, October 28, 2020 Dr. G. Suresh Kumar@KL University 32
Problem#2 Minimize Z = x 1 - 3 x 2 + 3 x 3 Subject to 3 x 1 - x 2+ 2 x 3 ≤ 7 2 x 1 + 4 x 2 ≥ -12 -4 x 1 + 3 x 2 + 8 x 3≤ 10 and x 1, x 2, x 3 ≥ 0. Wednesday, October 28, 2020 Dr. G. Suresh Kumar@KL University 33
Solution • In standard form Maximize Zʹ = -x 1+3 x 2 -3 x 3+0 s 1+0 s 2+0 s 3 Subject to 3 x 1 - x 2 +2 x 3+s 1 +0 s 2 +0 s 3= 7 -2 x 1 - 4 x 2+0 x 3+0 s 1+s 2 +0 s 3=12 -4 x 1 + 3 x 2+8 x 3+0 s 1 +0 s 2+s 3= 10 and x 1, x 2, x 3, s 1, s 2, s 3≥ 0. Wednesday, October 28, 2020 Dr. G. Suresh Kumar@KL University 34
Initial Simplex Table cj -1 3 -3 0 0 0 Mini values a 1 a 2 a 3 a 4 a 5 a 6 ratio CB x. B 0 s 1 7 3 -1 2 1 0 0 -- 0 s 2 12 -2 -4 0 0 1 0 -- 0 s 3 10 -4 3 8 0 0 1 10/3 Zj-cj 1 -3 0 0 0 Wednesday, October 28, 2020 3 Dr. G. Suresh Kumar@KL University 35
Improved Simplex Table-I cj -1 3 -3 0 0 0 Mini a 1 a 2 a 3 a 4 a 5 a 6 ratio 0 1/3 31/5 CB x. B values 0 s 1 31/3 5/3 0 14/3 1 0 s 2 76/3 -22/3 0 32/3 0 1 4/3 -- 3 x 2 10/3 -4/3 1 8/3 0 0 1/3 -- -3 0 11 0 0 1 Zj-cj Wednesday, October 28, 2020 Dr. G. Suresh Kumar@KL University 36
Improved Simplex Table-II cj -1 3 -3 0 0 0 Mini ratio CB x. B values a 1 a 2 a 3 a 4 a 5 a 6 -1 x 1 31/5 1 0 14/5 3/5 0 1/5 0 s 2 352/5 0 0 156/5 22/5 1 14/5 3 x 2 0 1 32/5 4/5 0 3/5 0 0 82/5 0 8/5 58/5 Zj-cj Wednesday, October 28, 2020 Dr. G. Suresh Kumar@KL University 9/5 37
Solution • Since all Zj-cj ≥ 0, the current basic feasible solution is optimal. • Therefore the optimal solution to the given problem is x 1= 31/5, x 2 = 58/5, x 3=0 and maximum Zʹ= -1(31/5)+3(58/5)-3(0)=143/5. Minimum Z = -(Max. Zʹ) = -143/5 Wednesday, October 28, 2020 Dr. G. Suresh Kumar@KL University 38
Problem#3 • A farmer has 1, 000 acres of land on which he can grow corn, wheat or soya-bean. Each acre of corn costs Rs. 100 for preparation, requires 7 man-days of work and yields a profit of Rs. 30. An acre of wheat costs Rs. 120 for preparation, requires 10 man-days of work and yields a profit of Rs. 40. An acre of soyabeans costs Rs. 70 for preparation, requires 8 mandays of work and yields a profit of Rs. 20. If the farmer has Rs. 100, 000 for preparation and can count on 8, 000 man-days of work, how many acres should be allocated to each crop to maximize profit? Wednesday, October 28, 2020 Dr. G. Suresh Kumar@KL University 39
Solution Let x, y, z be the number of acres of corn, wheat, soy-bean respectively. Then the given problem in LPP model: Maximize Z = 30 x + 40 y + 20 z Subject to 100 x +120 y+70 z ≤ 1, 000 7 x + 10 y + 8 z ≤ 8, 000 x + y + z ≤ 1000 and x, y, z ≥ 0. Ans: x = 250, y = 625, z = 0. Wednesday, October 28, 2020 Dr. G. Suresh Kumar@KL University 40
Initial Simplex Table cj CB 0 x. B values 30 40 20 0 Mini a 1 a 2 a 3 a 4 a 5 a 6 ratio s 1 10000 12 7 1 0 0 833. 3 0 s 2 8000 7 10 8 0 1 0 800 0 s 3 1000 1 1 1 0 0 1 1000 Zj-cj -30 -40 -20 0 Wednesday, October 28, 2020 Dr. G. Suresh Kumar@KL University 41
Wednesday, October 28, 2020 Dr. G. Suresh Kumar@KL University 42
Improved Initial Simplex Table cj CB x. B 30 40 20 0 Mini values a 1 a 2 a 3 a 4 a 5 a 6 ratio 1 -12 0 250 0 1142 0 s 1 4000 16 0 -26 40 x 2 800 7/10 1 8/10 0 1/10 0 s 3 200 3/10 0 1/5 0 -1/10 1 -2 0 12 Zj-cj Wednesday, October 28, 2020 Dr. G. Suresh Kumar@KL University 0 4 666. 6 0 43
Improved Initial Simplex Table cj 30 40 20 0 a 4 0 CB x. B values a 1 a 2 a 3 30 x 1 250 1 0 -13/8 1/16 40 x 2 625 0 1 31/16 -7/16 5/8 0 0 s 3 125 0 0 11/16 -3/16 1/8 1 0 0 5/2 0 Zj-cj Wednesday, October 28, 2020 Dr. G. Suresh Kumar@KL University 1/8 a 5 0 a 6 ratio -3/4 5/2 Mini 0 44
Solution • Since all Zj-cj ≥ 0, the current basic feasible solution is optimal. • Therefore the optimal solution to the given problem is x 1= 250, x 2 = 625, x 3=0 and Maximum Z= 30(250)+40(625)+20(0) = 32500 Wednesday, October 28, 2020 Dr. G. Suresh Kumar@KL University 45
Problem#4 • A firm produces three products which are processed on three machines. The relevant data is given below Machine Time per unit (Minutes) Machine capacity Product C (minute/day) Product A Product B M 1 2 3 2 440 M 2 4 -- 3 470 M 3 2 5 -- 430 Wednesday, October 28, 2020 Dr. G. Suresh Kumar@KL University 46
Problem#4 The profit per unit for product A, B and C is Rs. 4, Rs. 3 and Rs. 6 respectively. Determine the daily number of units to be manufactured for each product. Assume that all the units produced are consumed in the market. Wednesday, October 28, 2020 Dr. G. Suresh Kumar@KL University 47
Solution Let x 1, x 2, x 3 be the number of units of Products A, B, C to be produced, then the problem in LP model Maximize Z = 4 x 1 + 3 x 2 + 6 x 3 Subject to 2 x 1 + 3 x 2+ 2 x 3 ≤ 440 4 x 1 + 3 x 3 ≤ 470 2 x 1 + 5 x 2 ≤ 430 and x 1, x 2, x 3 ≥ 0. The optimal solution x 1=0, x 2=380/9, x 3=470/3 and Zmax= 1066. 67 rupees. Wednesday, October 28, 2020 Dr. G. Suresh Kumar@KL University 48
Artificial variable Techniques • Big M-Method or Method of Penalties : Step#1: Express the problem in standard form Step#2: Add non-negative variable to the left hand side of all constraints which are of (≥) or (=) type. Such new variables are called artificial variables. The penalty or cost for these variables in the objective function is –M, M>0 and large. Wednesday, October 28, 2020 Dr. G. Suresh Kumar@KL University 49
Big M-Method (Charne’s Penalty) Step#3 : solve the modified LPP by simplex method. At any iteration of the simplex method, one of the following three cases may arise: Case(i) There remains no artificial variable in the basis and the optimality condition satisfied. Then the solution is optimal solution. Wednesday, October 28, 2020 Dr. G. Suresh Kumar@KL University 50
Big M-Method Case(ii): There is at least one artificial variable in the basis at zero level and optimality is satisfied. Then the solution is degenerate optimal basic feasible solution. Case(iii) : There is at least one artificial variable in the basis at non-zero level and optimality satisfied. Then the problem has no feasible solution. Step#4: Continue simplex method until either optimal solution or unbounded solution is obtained Wednesday, October 28, 2020 Dr. G. Suresh Kumar@KL University 51
Problem#1 Maximize Z = 3 x 1 + 2 x 2 Subject to 2 x 1 + x 2 ≤ 2 3 x 1 + 4 x 2 ≥ 12 And x 1, x 2 ≥ 0. Sol: In standard form Maximize Z = 3 x 1 + 2 x 2+ 0 s 1+ 0 s 2 Subject to 2 x 1 + x 2 + s 1 + 0 s 2 = 2 3 x 1 + 4 x 2 + 0 s 1 – s 2 = 12 And x 1, x 2 , s 1, s 2 ≥ 0. Wednesday, October 28, 2020 Dr. G. Suresh Kumar@KL University 52
Solution After introducing the artificial variable, Modified LPP Maximize Z = 3 x 1 + 2 x 2+ 0 s 1+ 0 s 2+ 0 A Subject to 2 x 1 + x 2 + s 1 + 0 s 2 + 0 A= 2 3 x 1 + 4 x 2 + 0 s 1 – s 2 + A = 12 And x 1, x 2 , s 1, s 2 , A ≥ 0. Wednesday, October 28, 2020 Dr. G. Suresh Kumar@KL University 53
Initial Simplex Table cj 3 2 0 0 -M Mini values a 1 a 2 a 3 a 4 a 5 ratio 0 0 CB x. B 0 s 1 2 2 11 1 -M A 12 3 4 0 -1 1 0 M 0 Zj-cj Wednesday, October 28, 2020 -3 -3 M -2 -4 M Dr. G. Suresh Kumar@KL University 2 3 54
Improved Simplex Table cj 3 2 0 0 -M Mini values a 1 a 2 a 3 a 4 a 5 ratio 2 1 0 0 -4 -1 1 0 4 M M 0 CB x. B 2 x 2 2 -M A 4 Zj-cj Wednesday, October 28, 2020 -5 -1+5 M Dr. G. Suresh Kumar@KL University 55
Solution • Since all Zj – cj ≥ 0 and artificial variable A is presented in the basis at non zero level. Therefore, the problem has no feasible solution. Wednesday, October 28, 2020 Dr. G. Suresh Kumar@KL University 56
Problem • The following table gives the various vitamin contents of three types of food and daily requirements of vitamins along with cost per unit. Find the combination of food for minimum cost. Wednesday, October 28, 2020 Dr. G. Suresh Kumar@KL University 57
- Slides: 57