Op 1
Op 1
Linear programming
(LP, also called linear optimization) is a method to achieve the best
outcome (such as maximum profit or lowest cost) in a mathematical model
whose requirements are represented by linear relationships.
More formally, linear programming is a technique for the optimization of
a linear objective function, subject to linear equality and linear
inequality constraints. Its feasible region is a convex polytope, which is a set
defined as the intersection of finitely many half spaces, each of which is
defined by a linear inequality. Its objective function is a real-valued affine
(linear) function defined on this polyhedron. A linear
programming algorithm finds a point in the polyhedron where this function
has the smallest (or largest) value.
1
For a problem to be a linear programming problem, the decision variables,
objective function and constraints all have to be linear functions.
2
Ex1:
Produce two products p1, p2 , Resources, Row mat MA, MB, Labors, 4
processes were used to product, weekly process.
Available resources
MB = 2 tons = 4000 lb
Price of material = MA = 3$ / lb
MB = 7$ / lb
Q: how should we use 4 processors to meet all constraints and minimize cost
of material?
Sol:-
L.P model
Variable
3
No.hr/week Process Labor (hr) MA lb MB lb P1 P2
X1 1 20 160 30 35 55
X2 2 30 100 35 45 42
X3 3 10 200 60 70 0
X4 4 25 75 80 0 90
Max 1000 8000 lb 4000 lb Min min
Price Fixed 3$ / lb 7$ / 1b 2100 1800
salary
Min. cost of material
P1 = 35 x1 + 45 x2 + 70 x3 + 0 x4 ≥ 2100 …………..….2.
P2 = 55 x1 + 42 x2 + 0 x3 + 90 x4 ≥ 1800 …………..…3
constraints :
MB/ 30 x1 + 35 x2 + 60 x3 + 80 x4 ≤ 4000…………….5
Allow over time max 200 hr / week and pay additional 30$ / hr, what’s LP
problem introduce variable
X5 # hr of overtime 0 ≤ X5 ≤ 200 hr
Z = G ∫ (x 1 , x 2 , x 3 , x 4 , x 5)
4
2. Solve Linear Programs by Graphical Method
Ex2:
Sol:
(3,4)
X Y P= 5x – 3y
(0,2)
0 2 -6 min
3 4 3 (6,2)
6 2 24 max
0 -2 6
5
Ex3:
Solve the linear programming problem. Minimize z = 11x + 6y + 7 subject
to: x ≥ 0, y ≥ 0, x + y ≥ 1
Sol:
6
Ex4:
A furniture company makes book shelves and desks, each shelf requires 2hrs
for carpentry, 1hrs for painting. Each desk requires 3hrs for carpentry , 4 hrs
for painting. Company max hrs 60hr of carpentry work, 40hr for painting
work each week. To make a profit of 15$ / shelf, 40$ / desk. How many
shelves and desks do they make/week.
Sol:
1x + 4y ≤ 40
X Y
X ≥ 0, y ≥ 0 0 20
30 0
0 10
To know the 4th point
40 0
2x + 3y = 60
1x + 4y = 40 > *-2
(0,20)
-2x – 5y = -80
0 – 5y = -20
(0,10) (24,4)
:y=4
: x = 40 – 16 = 24
(0,0 ) (30,0) (40,0)
P = 15x + 40y objective func.
At origin p = 0$
At (30, 0) p = 450 $ 30 selves no desks
At (0, 10) p = 400$
At (24, 4) = 360 + 160 = 520$ Best profit 24 selves &
4 desks / week
7
Ex5:
sol:
x # of A y # of B
Max score = 10x+15y
Constraints
3x+6y ≤ 60 (0,16)
X+y ≤ 16
3x+6y=60 X+y=16
X=0 y=12 X=0 y=16
(0,12) (0,16)
(0,12)
Y=0 x=20 Y=0 x=16
(20,0) (16,0)
For B B
3x+6y =60 (16,0) (20, 0)
8
Ex6:
Now, the company wishes to maximize its profit. How many units of A and
B should it produce respectively?
Solution:
The total profit the company makes is given by the total number of units of
A and B produced multiplied by its per unit profit Rs 6 and Rs 5
respectively.
The company will try to produce as many units of A and B to maximize the
profit. But the resources Milk and Choco are available in limited amount.
As per the above table, each unit of A and B requires 1 unit of Milk. The
total amount of Milk available is 5 units. To represent this mathematically,
9
X+Y ≤ 5
Also, each unit of A and B requires 3 units & 2 units of Choco respectively.
The total amount of Choco available is 12 units. To represent this
mathematically,
3X+2Y ≤ 12
For the company to make maximum profit, the above inequalities have to be
satisfied.
10
Ex7:
A farmer has recently acquired 110 hectares piece of land. He has decided to
grow Wheat and barley on that land. Due to the quality of the sun and the
region’s excellent climate, the entire production of Wheat and Barley can be
sold. He wants to know how to plant each variety in the 110 hectares, given
the costs, net profits and labor requirements according to the data shown
below:
Solution:
Since the production from the entire land can be sold in the market. The
farmer would want to maximize the profit for his total produce. We are given
net profit for both Wheat and Barley. The farmer earns a net profit of US$50
for each hectare of Wheat and US$120 for each Barley.
11
2. The next constraint is, the upper cap on the availability on the total
number of man-days for planning horizon. The total number of man-days
available are 1200. As per the table, we are given the man-days per hectare
for Wheat and Barley.
3. The third constraint is the total area present for plantation. The total
available area is 110 hectares. So the equation becomes,
X + Y ≤ 110
The values of X and Y will be greater than or equal to 0. This goes without
saying.
X ≥ 0, Y ≥ 0
To plot for the graph for the above equations, first I will simplify all the
equations.
Plot the 1 & 2 lines on a graph in first quadrant (like shown below)
12
X+y=100
X+3y=120
X=20, Y=60
The values for X and Y which gives the optimal solution is at (60,20).
= US$5400
13
Ex8
X+y ≤ 20
3x+4y ≤72
sol
14
Ex9:
Y=≥ 2 (5,8)
1≤x≤5
y≤ x+3 (1,4)
x=0 y=3
y=0 x=-3
at p=3X - 2Y
@ (1,2)=3*1-2*2 =-1
@ (1,4 ) =-5
@(5,8) =-1
@ (5, 2) = 11
15
Ex10:
A company builds cars and trucks between 10-20 /day were produces at least
5 of each type
Sol y=5
Y# trucks sold
X≥ 5m y≥ 5 x=5 20
X+y≤ 20
X y
0 20
20 0
5 15
15 5
F(x,y)= (2-15)x + (24-16)y
= 6x+8y
@(5,5) = 70,000 $
@(15,5)= 130,000 $
@(5,15)=150,000 $
16
Ex
John has a gift shop, he buys Christmas Trees, 80$ for real trees and 160$
fake trees. What is mini. Investment to buy.
Sol;
1- 20 ≤ X≤90
2- y≤ 100
3- X+Y ≥ 50 X+Y≤ 120
4- Y≥ ½ X or 2Y≥X
@x=100 y=50
@ x=40 y=20
As y≥ 1/2x
16 ≥ 16.5
80x+160y
A (20,100) 80*20+160*100=17,000$
B (80,40) 12,800$
17
C (33,17) 5,360$ D (20,30) 6,400$
18