57
Linear Programming Tuesday, June 14, 2022 1 Dr.G.Suresh Kumar@KL University

Linear Programming

Embed Size (px)

DESCRIPTION

Linear Programming. 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 - PowerPoint PPT Presentation

Citation preview

Page 1: Linear Programming

Linear Programming

Wednesday, April 19, 2023

1Dr.G.Suresh Kumar@KL University

Page 2: Linear Programming

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, April 19, 2023 2Dr.G.Suresh Kumar@KL University

Page 3: Linear Programming

General LPP

Max/min Z = c1x1 + c2x2 + ... + cnxn

subject to:a11x1 + a12x2 + ... + a1nxn (≤, =, ≥) b1

a21x1 + a22x2 + ... + a2nxn (≤, =, ≥) b2

: am1x1 + am2x2 + ... + amnxn (≤, =, ≥) bm

and xj ≥ 0, j = 1, 2, 3, …, n.xj = decision variablesbi = constraint levelscj = objective function coefficientsaij = constraint coefficients

Wednesday, April 19, 2023

3Dr.G.Suresh Kumar@KL University

Page 4: Linear Programming

Formation of LPP • A manufacturer produces two types of models M1

and M2. Each M1 model requires 4 hours of grinding and 2 hours of polishing; whereas M2 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 M1 model is Rs. 3 and on M2 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, April 19, 2023

4Dr.G.Suresh Kumar@KL University

Page 5: Linear Programming

Solution• Let x be the number of M1 models and y be the

number of M2 models produced in a week.

• Then the weekly profit is

Z = 3x + 4y.• The total number of grinding hours needed in a

week to produce x and y is

4x + 2y.• The total number of polishing hours needed in a

week to produce x and y is

2x + 5y.

Wednesday, April 19, 2023

5Dr.G.Suresh Kumar@KL University

Page 6: Linear Programming

Solution cont…

• Since the number of grinding hours is not more than 80 and the number of polishing hours not more than 180, therefore

4x + 2y ≤ 80

2x + 5y ≤ 180.

• Also, the negative number of models are not produced, we must have

x ≥ 0 and y ≥ 0.

Wednesday, April 19, 2023

6Dr.G.Suresh Kumar@KL University

Page 7: Linear Programming

Solution cont…

• Now the problem is to find x, y which

Maximize Z = 3x + 4y

Subject to 4x + 2y ≤ 80

2x + 5y ≤ 180

and x, y ≥ 0.

Wednesday, April 19, 2023

7Dr.G.Suresh Kumar@KL University

Page 8: Linear Programming

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, April 19, 2023

8Dr.G.Suresh Kumar@KL University

Page 9: Linear Programming

Solution

• Maximize Z = 400x + 300y

subject to x + y ≤ 200

x ≥ 20

y ≥ 4x

and x, y ≥ 0.

Wednesday, April 19, 2023

9Dr.G.Suresh Kumar@KL University

Page 10: Linear Programming

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 8-ounce bottle 16-ounce bottle

A 100/ minute 40/ minute

B 60/ minute 75/ minute

Wednesday, April 19, 2023

10Dr.G.Suresh Kumar@KL University

Page 11: Linear Programming

Problem#3The 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, April 19, 2023

11Dr.G.Suresh Kumar@KL University

Page 12: Linear Programming

Solution

• Maximize Z = 0.15x+0.25y

subject to 2x + 5y ≤ 480,000

5x + 4y ≤ 720,000

8x + 16y ≤ 300,000

x ≤ 25, 000

y ≤ 7,000

and x, y ≥ 0.

Wednesday, April 19, 2023

12Dr.G.Suresh Kumar@KL University

Page 13: Linear Programming

General LPP

Max/min Z = c1x1 + c2x2 + ... + cnxn

subject to:a11x1 + a12x2 + ... + a1nxn (≤, =, ≥) b1

a21x1 + a22x2 + ... + a2nxn (≤, =, ≥) b2

: am1x1 + am2x2 + ... + amnxn (≤, =, ≥) bm

xj = decision variablesbi = constraint levelscj = objective function coefficientsaij = constraint coefficients

Wednesday, April 19, 2023

13Dr.G.Suresh Kumar@KL University

Page 14: Linear Programming

Solutions of LPP

• A set of values x1, x2, …, 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, April 19, 2023

14Dr.G.Suresh Kumar@KL University

Page 15: Linear Programming

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 non-negativity 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 solution.Wednesday, April 19, 20

2315Dr.G.Suresh Kumar@KL

University

Page 16: Linear Programming

Problem#1

• Find all the basic solutions of the following system of equations identifying in each case the basic and non-basic variables.

2x1 + x2 + 4x3 = 11

3x1 + x2 + 5x3 = 14

Ans : (3, 5, 0) basic x1, x2 non-basic x3.

(0, 3, -1) basic x2, x3 non-basic x1.

(1/2, 0, 5/2) basic x1, x3 non-basic x2. Wednesday, April 19, 2023

16Dr.G.Suresh Kumar@KL University

Page 17: Linear Programming

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 = 2x1 + 3x2 + 4x3 + 7x4

Subject to 2x1 + 3x2 - x3 + 4x4 = 8

x1 - 2x2 + 6x3 -7x4 = -3

and x1, x2, x3, x4 ≥ 0.

Ans : (0, 0, 44/17, 45/17) and Z=28.9Wednesday, April 19, 2023

17Dr.G.Suresh Kumar@KL University

Page 18: Linear Programming

Slack variables

• If the constraints of a general LPP be

ai1x1 + ai2x2 + ... + ainxn ≤ bi (i = 1, 2,…), then the non-negative variables si which satisfy

ai1x1 + ai2x2 + ... + ainxn + si = bi (i = 1, 2,…)

are called slack variables.

Wednesday, April 19, 2023

18Dr.G.Suresh Kumar@KL University

Page 19: Linear Programming

Surplus variables

• If the constraints of a general LPP be

ai1x1 + ai2x2 + ... + ainxn ≥ bi (i = 1, 2,…), then the non-negative variables si which satisfy

ai1x1 + ai2x2 + ... + ainxn - si = bi (i = 1, 2,…)

are called surplus variables.

Wednesday, April 19, 2023

19Dr.G.Suresh Kumar@KL University

Page 20: Linear Programming

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, April 19, 2023

20Dr.G.Suresh Kumar@KL University

Page 21: Linear Programming

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 non-negative

• All variables are non-negative.

Wednesday, April 19, 2023

21Dr.G.Suresh Kumar@KL University

Page 22: Linear Programming

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, April 19, 2023

22Dr.G.Suresh Kumar@KL University

Page 23: Linear Programming

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, April 19, 2023

23Dr.G.Suresh Kumar@KL University

Page 24: Linear Programming

Initial Simplex Table

cj c1 c2 … cn 0 0 … 0 Mini

CB xB values a1 a2 … an an+1 an+2 … an+m ratio

0 s1 b1 a11 a12 … a1n 1 0 … 0

0 s2 b2 a21 a22 … a2n 0 1 … 0

… … …. … … … … … … … …

0 sm bm am1 am2 … amn 0 0 … 1

Zj-cj -c1 -c2 … -cn 0 0 … 0

Wednesday, April 19, 2023

24Dr.G.Suresh Kumar@KL University

Page 25: Linear Programming

Simplex Method

Step#4 : Optimality test

Compute Zj-cj, where Zj = ∑ cBiaij.

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, April 19, 2023

25Dr.G.Suresh Kumar@KL University

Page 26: Linear Programming

Simplex MethodStep#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.{xBi/aik, aik > 0} = xBr/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, April 19, 2023

26Dr.G.Suresh Kumar@KL University

Page 27: Linear Programming

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, April 19, 2023

27Dr.G.Suresh Kumar@KL University

Page 28: Linear Programming

Problem#1

Maximize Z = 5x1 + 3x2

Subject to x1 + x2 ≤ 2

5x1 + 2x2 ≤ 10

3x1 + 8x2 ≤ 12

and x1, x2 ≥ 0.

Wednesday, April 19, 2023

Dr.G.Suresh Kumar@KL University

28

Page 29: Linear Programming

Solution

• In standard form

Maximize Z = 5x1 + 3x2+0s1+0s2+0s3

Subject to x1 + x2 +s1 +0s2 +0s3= 2

5x1 + 2x2 +0s1+s2 +0s3=10

3x1 + 8x2 +0s1 +0s2+s3= 12

and x1, x2 , s1, s2, s3≥ 0.

Wednesday, April 19, 2023

Dr.G.Suresh Kumar@KL University

29

Page 30: Linear Programming

Initial Simplex Table

cj 5 3 0 0 0 Mini

CB xB values a1 a2 a3 a4 a5 ratio

0 s1 2 1 1 1 0 0 2

0 s2 10 5 2 0 1 0 2

0 s3 12 3 8 0 0 1 4

Zj-cj -5 -3 0 0 0

Wednesday, April 19, 2023

30Dr.G.Suresh Kumar@KL University

1

Page 31: Linear Programming

First Simplex Table

cj 5 3 0 0 0 Mini

CB xB values a1 a2 a3 a4 a5 ratio

5 x1 2 1 1 1 0 0

0 s2 0 0 -3 -5 1 0

0 s3 6 0 5 -3 0 1

Zj-cj 0 2 5 0 0

Wednesday, April 19, 2023

31Dr.G.Suresh Kumar@KL University

Page 32: Linear Programming

Solution

• Since all Zj-cj ≥ 0, the current basic feasible solution is optimal.

• Therefore the optimal solution to the given problem is

x1= 2, x2 = 0 and

maximum Z= 5(2)+3(0)=10.

Wednesday, April 19, 2023

Dr.G.Suresh Kumar@KL University

32

Page 33: Linear Programming

Problem#2

Minimize Z = x1 - 3x2 + 3x3

Subject to 3x1 - x2+ 2x3 ≤ 7

2x1 + 4x2 ≥ -12

-4x1 + 3x2 + 8x3≤ 10

and x1, x2, x3 ≥ 0.

Wednesday, April 19, 2023

Dr.G.Suresh Kumar@KL University

33

Page 34: Linear Programming

Solution

• In standard form

Maximize Zʹ = -x1+3x2 -3x3+0s1+0s2+0s3

Subject to 3x1 - x2 +2x3+s1 +0s2 +0s3= 7

-2x1 - 4x2+0x3+0s1+s2 +0s3=12

-4x1 + 3x2+8x3+0s1 +0s2+s3= 10

and x1, x2, x3, s1, s2, s3≥ 0.

Wednesday, April 19, 2023

Dr.G.Suresh Kumar@KL University

34

Page 35: Linear Programming

Initial Simplex Table

cj -1 3 -3 0 0 0 Mini

CB xB values a1 a2 a3 a4 a5 a6 ratio

0 s1 7 3 -1 2 1 0 0 --

0 s2 12 -2 -4 0 0 1 0 --

0 s3 10 -4 3 8 0 0 1 10/3

Zj-cj 1 -3 3 0 0 0

Wednesday, April 19, 2023

35Dr.G.Suresh Kumar@KL University

3

Page 36: Linear Programming

Improved Simplex Table-I

cj -1 3 -3 0 0 0 Mini

CB xB values a1 a2 a3 a4 a5 a6 ratio

0 s1 31/3 5/3 0 14/3 1 0 1/3 31/5

0 s2 76/3 -22/3 0 32/3 0 1 4/3 --

3 x2 10/3 -4/3 1 8/3 0 0 1/3 --

Zj-cj -3 0 11 0 0 1

Wednesday, April 19, 2023

36Dr.G.Suresh Kumar@KL University

5/3

Page 37: Linear Programming

Improved Simplex Table-II

cj -1 3 -3 0 0 0 Mini

CB xB values a1 a2 a3 a4 a5 a6 ratio

-1 x1 31/5 1 0 14/5 3/5 0 1/5

0 s2 352/5 0 0 156/5 22/5 1 14/5

3 x2 58/5 0 1 32/5 4/5 0 3/5

Zj-cj 0 0 82/5 9/5 0 8/5

Wednesday, April 19, 2023

37Dr.G.Suresh Kumar@KL University

Page 38: Linear Programming

Solution

• Since all Zj-cj ≥ 0, the current basic feasible solution is optimal.

• Therefore the optimal solution to the given problem is

x1= 31/5, x2 = 58/5, x3=0 and

maximum Zʹ= -1(31/5)+3(58/5)-3(0)=143/5.

Minimum Z = -(Max.Zʹ) = -143/5

Wednesday, April 19, 2023

Dr.G.Suresh Kumar@KL University

38

Page 39: Linear Programming

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 soya-beans costs Rs. 70 for preparation, requires 8 man-days 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, April 19, 2023

Dr.G.Suresh Kumar@KL University

39

Page 40: Linear Programming

SolutionLet x, y, z be the number of acres of corn,

wheat, soy-bean respectively. Then the given problem in LPP model:

Maximize Z = 30x + 40y + 20z

Subject to 100x +120y+70z ≤ 1,00,000

7x + 10y + 8z ≤ 8,000

x + y + z ≤ 1000

and x, y, z ≥ 0.

Ans: x = 250, y = 625, z = 0.Wednesday, April 19, 2023

Dr.G.Suresh Kumar@KL University

40

Page 41: Linear Programming

Initial Simplex Table

cj 30 40 20 0 0 0 Mini

CB xB values a1 a2 a3 a4 a5 a6 ratio

0 s1 10000 100 12 7 1 0 0 833.3

0 s2 8000 7 10 8 0 1 0 800

0 s3 1000 1 1 1 0 0 1 1000

Zj-cj -30 -40 -20 0 0 0

Wednesday, April 19, 2023

41Dr.G.Suresh Kumar@KL University

Page 42: Linear Programming

Wednesday, April 19, 2023

Dr.G.Suresh Kumar@KL University

42

Page 43: Linear Programming

Improved Initial Simplex Table

cj 30 40 20 0 0 0 Mini

CB xB values a1 a2 a3 a4 a5 a6 ratio

0 s1 4000 16 0 -26 1 -12 0 250

40 x2 800 7/10 1 8/10 0 1/10 0 1142

0 s3 200 3/10 0 1/5 0 -1/10 1 666.6

Zj-cj -2 0 12 0 4 0

Wednesday, April 19, 2023

43Dr.G.Suresh Kumar@KL University

Page 44: Linear Programming

Improved Initial Simplex Table

cj 30 40 20 0 0 0 Mini

CB xB values a1 a2 a3 a4 a5 a6 ratio

30 x1 250 1 0 -13/8 1/16 -3/4 0

40 x2 625 0 1 31/16 -7/16 5/8 0

0 s3 125 0 0 11/16 -3/16 1/8 1

Zj-cj 0 0 5/2 1/8 5/2 0

Wednesday, April 19, 2023

44Dr.G.Suresh Kumar@KL University

Page 45: Linear Programming

Solution

• Since all Zj-cj ≥ 0, the current basic feasible solution is optimal.

• Therefore the optimal solution to the given problem is

x1= 250, x2 = 625, x3=0 and

Maximum Z= 30(250)+40(625)+20(0)

= 32500Wednesday, April 19, 2023

Dr.G.Suresh Kumar@KL University

45

Page 46: Linear Programming

Problem#4

• A firm produces three products which are processed on three machines. The relevant data is given below

Wednesday, April 19, 2023

Dr.G.Suresh Kumar@KL University

46

Machine Time per unit (Minutes) Machine capacity

(minute/day)Product A Product B Product C

M1 2 3 2 440

M2 4 -- 3 470

M3 2 5 -- 430

Page 47: Linear Programming

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, April 19, 2023

Dr.G.Suresh Kumar@KL University

47

Page 48: Linear Programming

SolutionLet x1, x2, x3 be the number of units of Products A, B, C to be

produced, then the problem in LP model

Maximize Z = 4x1 + 3x2 + 6x3

Subject to 2x1 + 3x2+ 2x3 ≤ 440

4x1 + 3x3 ≤ 470

2x1 + 5x2 ≤ 430

and x1, x2, x3 ≥ 0.

The optimal solution x1=0, x2=380/9, x3=470/3

and Zmax= 1066.67 rupees.

Wednesday, April 19, 2023

Dr.G.Suresh Kumar@KL University

48

Page 49: Linear Programming

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, April 19, 2023

Dr.G.Suresh Kumar@KL University

49

Page 50: Linear Programming

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, April 19, 2023

Dr.G.Suresh Kumar@KL University

50

Page 51: Linear Programming

Big M-MethodCase(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, April 19, 2023

Dr.G.Suresh Kumar@KL University

51

Page 52: Linear Programming

Problem#1Maximize Z = 3x1 + 2x2

Subject to 2x1 + x2 ≤ 2

3x1 + 4x2 ≥ 12

And x1, x2 ≥ 0.

Sol: In standard form

Maximize Z = 3x1 + 2x2+ 0s1+ 0s2

Subject to 2x1 + x2 + s1 + 0s2 = 2

3x1 + 4x2 + 0s1 – s2 = 12

And x1, x2 , s1, s2 ≥ 0.

Wednesday, April 19, 2023

Dr.G.Suresh Kumar@KL University

52

Page 53: Linear Programming

Solution After introducing the artificial variable, Modified

LPP

Maximize Z = 3x1 + 2x2+ 0s1+ 0s2+ 0A

Subject to 2x1 + x2 + s1 + 0s2 + 0A= 2

3x1 + 4x2 + 0s1 – s2 + A = 12

And x1, x2 , s1, s2 , A ≥ 0.

Wednesday, April 19, 2023

Dr.G.Suresh Kumar@KL University

53

Page 54: Linear Programming

Initial Simplex Table

cj 3 2 0 0 -M Mini

CB xB values a1 a2 a3 a4 a5 ratio

0 s1 2 2 1 1 0 0 2

-M A 12 3 4 0 -1 1 3

Zj-cj -3-3M -2-4M 0 M 0

Wednesday, April 19, 2023

54Dr.G.Suresh Kumar@KL University

1

Page 55: Linear Programming

Improved Simplex Table

cj 3 2 0 0 -M Mini

CB xB values a1 a2 a3 a4 a5 ratio

2 x2 2 2 1 0 0 0

-M A 4 -5 0 -4 -1 1

Zj-cj -1+5M 0 4M M 0

Wednesday, April 19, 2023

55Dr.G.Suresh Kumar@KL University

Page 56: Linear Programming

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, April 19, 2023

Dr.G.Suresh Kumar@KL University

56

Page 57: Linear Programming

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, April 19, 2023

Dr.G.Suresh Kumar@KL University

57