LP, Ip

You might also like

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 38

Linear Programming

• LP is a versatile technique which can be applied to


variety of problems of Management
• Applicable to problems characterized by the
presence of number of decision variables
– Each of decision variable can assume value within
certain range and affect their decision variables
– Variables represent some physical or economic
quantities
– Governed by practical limitations or constraints ( e.g.
availability of resources)
Linear Programming
• Problem has well defined objective
– Profit / Contribution Maximization
– Cost Minimization
• Linear Programming
– Right combination of various decision variables
• Taking into account practical limitations or Constraints
– Convert
• Objective to Linear Function of Decision Variables
• Constraints in to inequalities
• Constraints can be expressed as linear
mathematical functions.
LINEAR PROGRAMMING
• FORMULATION OF LP PROBLEMS---
• The maximization case —
• Example 1 --
• A firm is engaged in producing two products, A & B.
Each unit of product A requires 2 Kg. of raw material &
4 labor hours for processing where each unit of product
B requires 3 Kg. of raw material & 3 hours of labor of
the same type. Every week , the firm has an availability
of 60 Kg. Of raw material & 96 labor hours.
• One unit of product A yields Rs. 40 & that of B yields
Rs 35 as profit. Formulate LPP for profit maximization.
LINEAR PROGRAMMING
• Soln. – It must contain the objective function , the
constraints ( Concept of inequality ) & non negative
condition. It is important to note that for each of the
constraint, inequality rather than equation has been
used. This is because the profit maximization output
might not use all the resources to the full – leaving
some unused. Hence < / = sign.
LINEAR PROGRAMMING
• Let x1 & x2 be the no. of units produced per week
of the products A & B resp. & Z be the total profit to
be maximized. ( Since the problem calls decision
about the optimal values of x1 & x2 , these value are
known as decision variables.)
• Maximize Z = 40 x1 + 35 x2 - Objective Function
Subject to
• 2 x1 + 3 x2 < / = 60 Raw Matl. Constraint
• 4 x1 + 3 x2 < / = 96 Labor Hour Constraint
• x1 , x2 > / = 0 Non negativity restriction
Linear Programming
• Example 2 –
• The organization is manufacturing two products P1
& P2. The profit per Tonne of the two products are
Rs. 50 & 60 respectively. Both the products require
processing in three types of machine.
Total available Machine Hours per Week are – m/c
1 – 300, m/c 2 – 509, m/c 3 – 812.
One Tonne of Product 1 requires 2 Hrs of m/c 1, 3
Hrs of m/c 2 and 4 Hrs of m/c 3.
Similarly One Tonne of Product 2 requires 1 Hr of
m/c 1, 4 Hrs of m/c 2 and 7 Hrs of m/c 3.
Formulate Product Mix Problem in LP form.
Linear Programming
• Solution:
• Decision variables X1 & X2 indicating amount of
P1 & P2 to be included in product mix.
• Max Z = 50 X1 + 60 X2
• Subject to
• 2 X1 + X2 </=300 – M/C 1 Constraint
• 3 X1 + 4 X2 </= 509 – M/C 2 Constraint
• 4 X1 + 7 X2 </= 812 – M/C 3 Constraint
• X1 , X2 >/= 0 – NON negative function
Graphical Solution
Sr Equation X CO-ORDINATE Y CO-ORDINATE
No.
1 2 X1 + X2 </= 300 300 / 2 = 150 300 / 1 = 300
2 3 X1 + 4 X2 </= 509 509 / 3 = 169.66 509 / 4 = 127.25
3 4 X1 + 7 X2 </= 812 812 / 4 = 203 812 / 7 = 116
4 X1, X2 >/= 0

Objective Function –
Max Z = 50 X1 + 60 X2

Calculation of Slope –
50 X1 + 60 X2 = 0
Hence, 50 X1 = - 60 X2
Therefore X1 / X2 = - 60 / 50 …. Required for drawing Objective
Function Line on Graph
Graphical Solution
Sr. Remark X &Y Objective Function –
No Co-ordinates Max Z = 50 X1 + 60 X2
1 X Axis Intersection of line 150, 0 (50* 150) + (60* 0) = 7500
2 X1 + X2 </= 300
2 Intersection of Lines Represented 63, 80 7950
by 2 & 3
Calculation by simultaneous
equations
3 Intersection of Lines Represented 138.2, 23.6 8326
by equation 1 & 2
Calculation by simultaneous
equations

4 Y Axis Intersection of Line 0, 116 6960


4 X1 + 7 X2 </= 812
LINEAR PROGRAMMING
• The minimization case –
• Example 3 - An agriculture research institute has
suggested to a farmer to spread out at least 4800 Kg.
of a special phosphate fertilizer & no less than 7200
Kg. of a special nitrogen fertilizer to raise
productivity of crops in his field. There are two
sources of obtaining these – mixture A & B. Both of
these are available in bags weighing 100 kg. each &
they cost Rs. 40 & Rs. 24 resp. Mixture A contains
Phosphate & Nitrogen equivalent of 20 kg & 80 kg.
Resp. Mixture B contains these ingredients of 50 kg
each.
LINEAR PROGRAMMING
• Write this as LPP & determine how many bags of
each type should the farmer buy in order to obtain
the required fertilizer at minimum cost.
• Let x1 & x2 are no. of bags of mixture A & B resp.
• Minimize Z = 40 x1 + 24 x2 ---- Cost
• Subject to
• 20 x1 +50 x2 > / = 4800 Phosphate requirement
• 80 x1 +50 x2 > / = 7200 Nitrogen Requirement
• x1 , x2 > / = 0 Non negativity restriction
Graphical Solution
Sr Equation X CO-ORDINATE Y CO-ORDINATE
No.
1 20 X1 + 50 X2 >/= 4800 4800 / 20 = 240 4800 / 50 = 96
2 80 X1 + 50 X2 >/= 7200 7200 / 80 = 90 7200 / 50 = 144
3 X1, X2 >/= 0

Objective Function –
Min Z = 40 X1 + 24 X2

Calculation of Slope –
40 X1 + 24 X2 = 0
Hence, 40 X1 = - 24 X2
Therefore X1 / X2 = - 24 / 40 …. Required for drawing Objective
Function Line on Graph
Graphical Solution
Sr. Remark X &Y Co- Objective Function –
No ordinates Min Z = 40 X1 + 24 X2
1 X Axis Intersection of line 240, 0 (40* 240) + (24* 0) =9600
20 X1 + 50 X2 >/= 4800
2 Intersection of Lines Represented 40, 80 3520
by equation 1 & 2
Calculation by simultaneous
equations

3 Y Axis Intersection of Line 0, 144 3456


80 X1 + 50 X2 >/= 7200
Linear Programming
• Example 4 - Three nutrient components namely T,
P & I are found in a diet of two food items A & B.
Amount of each nutrient (mg / oz) is as follows –
Product A – 0.15 mg / oz of T, 0.75 mg/oz of P &
1.30 mg/oz of I.
Product B – 0.10 mg / oz of T, 1.70 mg/oz of P &
1.10 mg/oz of I.
The cost of Food items A & B are Rs 2 per oz and
Rs 1.70 per oz respectively.
The minimum daily requirements of these nutrients
are at least 1 gm of T, 7.5 mg of P & 10 mg of I.
Formulate LP.
Linear Programming
• Let X1 & X2 be no. of units (Ounces) of A & B
respectively.
• Minimize X = 2 X1 + 1.7 X2 – Objective Function
• Subject to
• 0.15 X1 + 0.10 X2 >/= 1.0 – Requirement on T
• 0.75 X1 + 1.70 X2 >/= 7.5 – Requirement on P
• 1.30 X1 + 1.1. X2 >/= 10.0 – Requirement on I
• X1, X2 > /= 0 – Non negative function
Linear Programming
• Example 5 - An oil refinery can blend three grades
of crude oil to produce quality R & quality S
Petrol. Two possible blending processes are
available. For each production run the older
process uses 5 units of crude A, 7 units of crude B
& 2 units of crude C to produce 9 units of R & 7
units of S Petrol. The newer process uses 3 units of
crude A, 9 units of crude B & 4 units of crude C to
produce 5 units of R & 9 units of S Petrol. Because
of prior contract commitments the refinery must
produce at least 500 units of R & 300 units of S
next month.
Linear Programming
• It has available 1500 units of crude A, 1900 units
of crude B & 1000 units of crude C. For each unit
of R, the refinery receives Rs. 60 and for each unit
of S it receives Rs. 90. Find out Linear
programming formulation to maximize the
revenue.
Linear Programming
• Let X1 be no of production runs of older process
and X2 of newer process
• Maximize Z = 60 (9 X1+ 5 X2)+ 90 (7 X1 + 9 X2)
• Subject To
• 9 X1 + 5 X2 >/= 500 – Commitment on R
• 7 X1 + 9 X2 > /= 300 – Commitment on S
• 5 X1 + 3 X2 < / = 1500 – Constraint on A
• 7 X1 + 9 X2 </= 1900 – Constraint on B
• 2 X1 + 4 X2 </= 1000 – Constraint on C
• X1, X2 > /= 0 – Non negativity
Graphical Solution
Sr Equation X CO-ORDINATE Y CO-ORDINATE
No.
1 9 X1 + 5 X2 >/= 500 500 / 9 = 55.55 500 / 5 = 100
2 7 X1 + 9 X2 >/= 300 300 / 7 = 42.86 300 / 9 = 33.33
3 5 X1 + 3 X2 </= 1500 1500 / 5 = 300 1500 / 3 = 500
4 7 X1 + 9 X2 </= 1900 1900 / 7 = 271.43 1900 / 9 = 211.11
5 2 X1 + 4 X2 </= 1000 1000 / 2 = 500 1000 / 4 = 250
6 X1, X2 >/= 0

Objective Function –
Max Z = 60 (9 X1+ 5 X2)+ 90 (7 X1 + 9 X2) = 1170 X1 + 1110 X2
Calculation of Slope –
1170 X1 + 1110 X2 = 0
Hence, 1170 X1 = - 1110 X2
Therefore X1 / X2 = - 1110 / 1170 …. Required for drawing Objective
Function Line on Graph
Graphical Solution
Sr. Remark X &Y Objective Function –
No Co-ordinates Max Z = 1170 X1 + 1110 X2
1 X Axis Intersection of line 55.55, 0 64993.5
represented by equation 1
9 X + 5 X2 >/= 500
2 Y Axis Intersection of line 0, 100 111000
represented by equation 1
9 X + 5 X2 >/= 500

3 X Axis Intersection of line 271.43, 0 317573.1


represented by equation 4
7 X1 + 9 X2 </= 1900
4 Y Axis Intersection of line 0, 211.11 234332.1
represented by equation 4
7 X1 + 9 X2 </= 1900
Integer Programming (I P)
• Linear Program with decision variables restricted
to Integer Values is called linear Integer Program.
• Simply stated, an integer programming problem
(IP) is an LP in which some or all of the variables
are required to be non-negative integers.
• Integer variables, specifically those, which can take
value of zero or one , have been used in many
problem situations to provide modelling
capabilities beyond those available in L.P.
Integer Programming (I P)
• An IP in which all variables are required to be
integers is called a pure integer programming
problem. For example, max z = 3x1 + 2x2
s.t. x1 + x2 </= 6 , x1, x2 >/= 0, x1& x2 integer

• An IP in which only some of the variables are


required to be integers is called a mixed integer
programming problem. For example,
max z = 3x1 + 2x2,
s.t. x1 + x2 </= 6 , x1, x2 >/= 0, x1 integer
Integer Programming (I P)
• An integer programming problem in which all the
variables must equal 0 or 1 is called a ‘0–1’ IP
max z = x1 - x2
s.t. x1 + 2x2 </= 2
2x1 - x2 </= 1
x1, x2 = 0 or 1
• The LP obtained by omitting all integer or 0–1
constraints on variables is called the LP relaxation
of the IP
Integer Programming (I P)
• Any IP may be viewed as the LP relaxation plus
additional constraints (the constraints that state
which variables must be integers or be 0 or 1)
• Hence, the LP relaxation is a less constrained, or
more relaxed, version of the IP.
• This means that the feasible region for any IP must
be contained in the feasible region for the
corresponding LP relaxation.
• For any IP with a max problem, this implies that
Optimal z-value for LP relaxation >/= optimal z-
value for IP
Integer Programming (I P)
• A company is considering four investments.
Investment 1 will yield a net present value (NPV)
of Rs16,000; investment 2, an NPV of 22,000;
investment 3, an NPV of 12,000; and investment 4,
an NPV of 8,000. Each investment requires a
certain cash outflow at the present time: investment
1, Rs 5,000; investment 2, 7,000; investment 3,
4,000; and investment 4, 3,000. Currently,
Rs14,000 is available for investment. Formulate an
IP to maximize the NPV obtained from investments
Integer Programming (I P)
• As a formulations, we begin by defining a variable
for each decision that must be made. This leads us
to define a 0–1 variable:
• xj ( j 1, 2, 3, 4) = 1, if investment ‘j’ is made &
= 0, otherwise
• For example, x2 = 1 if investment 2 is made, and
x2 = 0 if investment 2 is not made
• max z = 16x1+ 22x2 + 12x3 + 8x4
• s.t. 5x1 + 7x2 + 4x3 + 3x4 </= 14
• xj = 0 or 1 ( j = 1, 2, 3, 4)
• IP with one constraint is called ‘Knapsack Problem’
Integer Programming (I P)
Modify the earlier formulation to account for each of
the following requirements:
• Company can invest in at most two investments.
• If it invests in investment 2, they must also invest
in investment 1.
• If company invests in investment 2, they cannot
invest in investment 4.
Integer Programming (I P)
• x1 + x2 + x3 + x4 </= 2
• x2 </= x1 or x2 - x1 </= 0
• x2 + x4 </= 1
Optimizing Problems with Integer
Variables
• The main difference between LP and IP models is that
LP models allow fractional values, such as 0.137 and
5.3246, in the changing cells, whereas IP models
allow only integer values in integer-constrained
changing cells
• In fact, if changing cells are constrained to be binary,
then the only allowable values are 0 and 1
• This suggests that IP models should be easier to solve
– After all, there are many fewer integer values in a given
region than there are continuous values, so searching
through the integers should be quicker—especially if their
only possible values are 0 and 1.
Optimizing Problems with Integer
Variables
• However, IP models are actually much more difficult to solve than LP
models, primarily because we cannot rely on the simplex method

• Although several solution methods have been suggested by researchers—


and new methods for specialized problems are still being developed—the
solution procedure used by Solver is called branch and bound

• Consider a model with 100 changing cells, all constrained to be binary.


Because there are only two values for each binary variable—0 and 1—
there are potentially 2 raised to100 (2*2*2…100 times) feasible solutions,
although many of these might not satisfy all the constraints. Unfortunately,
this is an extremely large number, so it would take even a very fast
computer a long time to check each one of them
Optimizing Problems with Integer
Variables
• Therefore, the naive method of complete
enumeration of all possible solutions—look at
each solution and select the best—is usually
impractical

• However, implicit enumeration is often very


practical.
– This approach examines only a fraction of all potential
solutions, hopefully a very small fraction, and in doing
so, it guarantees that solutions not examined have no
chance of being optimal
Optimizing Problems with Integer
Variables
• Branch & Bound Example –
• Consider an equation –
• Max Z = 4 X1 + 3 X2 + X3
• S.T. 3 X1 + 2 X2 + 2 X3 < / = 11
• X1, X2 & X3 are non negative Integers
Decide upon as to which variable will give Max Profit ( Individually)
Optimizing Problems with Integer
Variables
• Branch & Bound Example –
Solution –
To do this, solve by the method –

a) X2 & X3 =0 , Therefore X1 = 11/3 (3.66) ; hence Z Max = (11/3) *


4= 44/3 =14.66

b) X1 & X3 =0, Therefore X2 = 11/2 (5.5); hence Z Max = (11/2)* 3 =


33/2 = 16.5

c) X1 & X2 =0, Therefore, X3 = 11/2 (5.5); hence Z Max = (11/2)* 1 =


11/2 = 5.5
Optimizing Problems with Integer
Variables
• Branch & Bound Example – Contd…
• Therefore it gives us two equations with constraints
• Max Z = 4 X1 + 3 X2 + X3
• S.T. 3 X1 + 2 X2 + 2 X3 < / = 11
• X2 < / = 5
• X1, X2 & X3 are non negative Integers
And
• Max Z = 4 X1 + 3 X2 + X3
• S.T. 3 X1 + 2 X2 + 2 X3 < / = 11
• X2 > / = 6
• X1, X2 & X3 are non negative Integers
Optimizing Problems with Integer
Variables
• Branch & Bound Example – Contd…
• Option of X2 =6, constraint equation does not get qualified
• Hence Substituting X2 =5 in the constraint equation, we get X1 =
0.33 and Z = 16.32

• Now we have another set of equations with either X1 < /= 0 & X1


is > /= 1
• Max Z = 4 X1 + 3 X2 + X3
• S.T. 3 X1 + 2 X2 + 2 X3 < / = 11
• X2 < / = 5, X1 < / = 0, X1, X2 & X3 are non negative Integers
And
• Max Z = 4 X1 + 3 X2 + X3
• S.T. 3 X1 + 2 X2 + 2 X3 < / = 11
• X2 < / = 5, X1 > /= 1,X1, X2 & X3 are non negative Integers
Optimizing Problems with Integer
Variables
• Branch & Bound Example – Contd…
• Next iteration – X2 = 5 & X1 =0, X2 = 4, X1 =1
• Substituting, when X2 = 5, X1 =0, Z = 15
• When X2 = 4, X1 = 1, Z = 16 ( Optimal Solution)
Optimizing Problems with Integer
Variables
• Branch & Bound Example – Pictorial View
P(0), X2 = 5.5, Z = 16.5

P(1), X2 = 5, X1 = 0.33 P(0), X2 = 6, Infeasible


Z = 16.5 as Constraint equation
does not get qualified

P(0), X1 = 5, X1 = 0, Z = P(0), X2 = 4, X1 =1, Z = 16


15
Integer Programming (I P)

You might also like