0% found this document useful (0 votes)
72 views18 pages

Op 1

The document discusses linear programming, which is a technique for optimizing a linear objective function subject to linear equality and inequality constraints. It defines key terms like decision variables, objective function, constraints, and non-negativity restriction. It provides steps to formulate a linear programming problem, specifying the decision variables, objective function, constraints, and non-negativity restriction. Several examples of formulating and solving linear programming problems graphically and algebraically are also presented.

Uploaded by

mohammad thamer
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
72 views18 pages

Op 1

The document discusses linear programming, which is a technique for optimizing a linear objective function subject to linear equality and inequality constraints. It defines key terms like decision variables, objective function, constraints, and non-negativity restriction. It provides steps to formulate a linear programming problem, specifying the decision variables, objective function, constraints, and non-negativity restriction. Several examples of formulating and solving linear programming problems graphically and algebraically are also presented.

Uploaded by

mohammad thamer
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 18

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.

Common terminologies used in Linear Programming

Decision Variables: The decision variables are the variables which


will decide my output. They represent my ultimate solution. To solve any
problem, we first need to identify the decision variables. For the above
example, the total number of units for A and B denoted by X & Y
respectively are my decision variables.

Objective Function: It is defined as the objective of making decisions. May


be profit is the objective function.

Constraints: The constraints are the restrictions or limitations on the


decision variables. They usually limit the value of the decision variables.

Non-negativity restriction: For all linear programs, the decision variables


should always take non-negative values. Which means the values for
decision variables should be greater than or equal to 0.

Process to formulate a Linear Programming problem

Let us look at the steps of defining a Linear Programming problem


generically:

1. Identify the decision variables


2. Write the objective function
3. Mention the constraints
4. Explicitly state the non-negativity restriction

1
For a problem to be a linear programming problem, the decision variables,
objective function and constraints all have to be linear functions.

If the all the three conditions are satisfied, it is called a Linear


Programming Problem.

2
Ex1:

Produce two products p1, p2 , Resources, Row mat MA, MB, Labors, 4
processes were used to product, weekly process.

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

Production requirement: Produce at least 2100 P1, 1800 P2

Available resources

Max MA = 4 tons = 8000 lb

MB = 2 tons = 4000 lb

Labor have fixed salary

Labor = 1000 hrs work / week

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

X1, X2, X3, X4 # of hours / week of processor 1, 2, 3, 4

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

Z = f (X1, X2, X3, X4)

= (160 x1 + 100 x2 + 200 x3 + 75 x4)*3 + (30 x1 + 35 x2 + 60 x3 + 80


x4)*7

Z= 690 x1 + 545 x2 + 1020 x3 + 785x4 ……….…1

P1 = 35 x1 + 45 x2 + 70 x3 + 0 x4 ≥ 2100 …………..….2.

P2 = 55 x1 + 42 x2 + 0 x3 + 90 x4 ≥ 1800 …………..…3

constraints :

MA / 160 x1 + 100 x2 + 200 x3 + 75 x4 ≤ 8000 ………..4

MB/ 30 x1 + 35 x2 + 60 x3 + 80 x4 ≤ 4000…………….5

Labor/ 20 x1 + 30 x2 + 10 x3 + 25 x4 ≤ 1000 ……………6

And X1, X2, X3, X4 ≥ 0 …………………………………7

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

New cost function

Z = G ∫ (x 1 , x 2 , x 3 , x 4 , x 5)

= f (x1 , x2, x3, x4) + 30 X5

Sub. To p1, p2 (same)

MA, MB (same) Only labor’s hrs will be changed

4
2. Solve Linear Programs by Graphical Method

A linear program can be solved by multiple methods. In this section, we are


going to look at the Graphical method for solving a linear program. This
method is used to solve a two variable linear program. If you have only two
decision variables, you should use the graphical method to find the optimal
solution.

A graphical method involves formulating a set of linear inequalities subject


to the constraints. Then the inequalities are plotted on a X-Y plane. Once we
have plotted all the inequalities on a graph the intersecting region gives us a
feasible region. The feasible region explains what all values our model can
take. And it also gives us the optimal solution.

Ex2:

Find maximum, minimum values of function p=5x-3y , given in feasible


region graphed below

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

: min value = -6 at (0, 2)


(0,-2)
Max value = 24 at (6, 2)

5
Ex3:
Solve the linear programming problem. Minimize z = 11x + 6y + 7 subject
to: x ≥ 0, y ≥ 0, x + y ≥ 1
Sol:

Let x=0 x+y=1 y=1

Let y=0 x=1

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:

Carpentry (time) Painting (time) Profit


X # shelves 2 1 15$
Y # desk 3 4 40$
Total hrs 60 40

2x + 3y ≤ 60 to draw the points

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)

X+y =16 *-3


Y=4 x=12
Max score = 10x+15y
B(12,4) B=10*12+15*4=180 point
A(0,10) at A =10*0+15*10=150 points
C(16,0) C=10*16+0=160 points
Should answer 12A, 4B

8
Ex6:

 Consider a chocolate manufacturing company which produces only two


types of chocolate – A and B. Both the chocolates require Milk and Choco
only.  To manufacture each unit of A and B, following quantities are
required:

 Each unit of A requires 1 unit of Milk and 3 units of Choco


 Each unit of B requires 1 unit of Milk and 2 units of Choco

The company kitchen has a total of 5 units of Milk and 12 units of Choco.


On each sale, the company makes a profit of

 Rs 6 per unit A sold


 Rs 5 per unit B sold.

Now, the company wishes to maximize its profit. How many units of A and
B should it produce respectively?

Solution:

Milk Choco Profit per unit


A 1 3  Rs 6
B 1 2  Rs 5
Total 5 12

Let the total number of units produced of A be = X

Let the total number of units produced of B be = Y

Now, the total profit is represented by Z

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.

Profit: Max Z = 6X+5Y

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

Also, the values for units of A can only be integers.

So we have two more constraints, X ≥ 0  &  Y ≥ 0

For the company to make maximum profit, the above inequalities have to be
satisfied.

This is called formulating a real-world problem into a mathematical


model.

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:

Variety Cost (Price/Hec)  Net Profit (Price/Hec)  Man-days/Hec


Wheat 100  50  10
Barley 200  120  30

The farmer has a budget of US$10,000 and an availability of 1,200 man-days


during the planning horizon. Find the optimal solution and the optimal value.

Solution: 

Formulation of Linear Problem

Step 1: Identify the decision variables

The total area for growing Wheat = X (in hectares)

The total area for growing Barley  = Y (in hectares)

X and Y are my decision variables.

 Step 2: Write the objective function

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.

Our objective function (given by Z) is, Max Z = 50X + 120Y

 Step 3: Writing the constraints 

1. It is given that the farmer has a total budget of US$10,000. The cost of


producing Wheat and Barley per hectare is also given to us. We have an
upper cap on the total cost spent by the farmer. So our equation becomes:

100X + 200Y ≤ 10,000 

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.

10X + 30Y ≤ 1200

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

 Step 4: The non-negativity restriction

The values of X and Y will be greater than or equal to 0. This goes without
saying.

X ≥ 0, Y ≥ 0

Solving a LP through Graphical method

Since we know that X, Y ≥ 0. We will consider only the first quadrant.

To plot for the graph for the above equations, first I will simplify all the
equations.

100X + 200Y ≤ 10,000 /100

X + 2Y ≤ 100 ………….1

10X + 30Y ≤ 1200 /10

X + 3Y ≤ 120 …………..2

X + Y ≤ 110. …………..3

Plot the 1 & 2 lines on a graph in first quadrant (like shown below)

The optimal feasible solution is achieved at the point of intersection where


the budget & man-days constraints are active. This means the point at which
the equations X + 2Y ≤ 100 and X + 3Y ≤ 120 intersect gives us the optimal
solution.

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).

To maximize profit the farmer should produce Wheat and Barley in 60


hectares and 20 hectares of land respectively.

The maximum profit the company will gain is,

Max Z = 50 * (60) + 120 * (20)

=  US$5400

13
Ex8

X+y ≤ 20

3x+4y ≤72

Tabulate and Max Z=4x+5y graphically

sol

14
Ex9:

Y=≥ 2 (5,8)

1≤x≤5

y≤ x+3 (1,4)

f(x,y)= profit = 3x-2y y=3

sol; Y=2 (1,2) (5,2 )

at X=1, X=5, Y=2

@ y=x+3 X=1 X=5

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

Car cost 15k$ sell= 21k$ 20

Trucks = 16k$ sell=24k$

How much is the max. profit/day (5,15)

Sol y=5

X # cars sold (5,5) (15,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.

1- Real trees between 20-90


2- He can buy fake trees 100
3- Supplier gives 50-120 trees
4- No. of fake trees at least half real one.

Sol;

X # real trees y# fake trees

Min. objective function = min cost = 80x+160y

1- 20 ≤ X≤90
2- y≤ 100
3- X+Y ≥ 50 X+Y≤ 120
4- Y≥ ½ X or 2Y≥X

X=20 , X=90, y=100

X+Y=50, X+Y = 120 Y=1/2 X

@x=100 y=50

@ x=40 y=20

X+y=x+1/2x=3/2x=50 x=50 x=120

X=100/3, y=50/3 not acceptable

Let values less & larger than these values (33.3,16.6)

(33,16) (33,17) (34,17) (34,16) for point c

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

You might also like