You are on page 1of 39

Linear Programming Formulations

Formulation 1 – Product mix problem

A shop can make two types of sweets (A and B). They use two resources –
flour and sugar. To make one packet of A, they need 3 kg of flour and 3 kg
of sugar. To make one packet of B, they need 2 kg of flour and 4 kg of sugar.
They have 27 kg of flour and 32 kg of sugar. These sweets are sold at Rs 500
and 600 per packet respectively. Find the number of packets of the sweets
to be made to maximize the revenue.
Formulation 1 – Product mix problem
A shop can make two types of sweets (A and B). They use two resources – flour and sugar. To
make one packet of A, they need 3 kg of flour and 2 kg of sugar. To make one packet of B, they
need 3 kg of flour and 4 kg of sugar. They have 27 kg of flour and 32 kg of sugar. These sweets
are sold at Rs 500 and 600 per packet respectively. Find the best product mix to maximize the
revenue.

Let X1 be the number of packets of sweet A made


Let X2 be the number of packets of sweet B made
Maximize 500X1 + 600X2
3X1 + 3X2 ≤ 27
2X1 + 4X2 ≤ 32
X1 , X 2 ≥ 0
Notations
Let X1 be the number of packets of sweet A made Decision
Let X2 be the number of packets of sweet B made variable

Maximize 500X1 + 600X2 Objective function


3X1 + 3X2 ≤ 27 Constraints
2X1 + 4X2 ≤ 32

X1, X2 ≥ 0 Non negativity restriction


Assumptions
1. Proportionality
2. Linearity
3. Deterministic
Things to note
• Objective function should have at least one decision variable

• Every constraint should have at least one decision variable

• Every decision variable should be present in at least one


constraint

• Should capture relationship among decision variables


Formulation 2 – Manpower requirement
The daily requirement of nurses in a private nursing home is given in the
following table
Time of the day Requirement
8 am – 12 noon 12
12 noon – 4 pm 15
4 pm to 8 pm 10
8 pm to 12 midnight 8
12 midnight to 4 am 6
4 am to 8 am 10

The nurses start work at the beginning of the shift (8 am, 12 noon etc) and
work for 8 continuous hours. What is the minimum number of nurses
required to meet the daily demand?
Let X1 to X6 be the number of nurses who start work at 8 am,
12noon, 4 pm, 8 pm, 12 midnight and 4 am respectively

Minimize = X1 + X2 + X3 + X4 + X5 + X6

X1 + X2 ≥ 15
X2 + X3 ≥ 10 Requirement of
period 2
X3 + X4 ≥ 8
12 noon to 4 pm
X4 + X5 ≥ 6
X5 + X6 ≥ 10
X6 + X1 ≥ 12
X1, X2, X3, X4, X5, X6 ≥ 0
Formulation 3 – Production Planning
The demands for 2 weeks for a product are 800 and 1000. In a week the
company can produce up to 700 units in regular time at Rs 100/product. It
can employ overtime and produce up to an extra 300 units in a week at Rs
120/product. The cost of carrying a product from one week to the next is Rs
15/product/week. How should they produce to meet the demand at
minimum cost?

Let X1 be the number of products made using regular time in week 1.


Let X2 be the number of products made using regular time in week 2.
Let Y1 be the number of products made using overtime in week 1.
Let Y2 be the number of products made using overtime in week 2.
Let Z1 be the number of products carried from week 1 to week 2
Formulation 3 – Production Planning
Minimize 100X1 + 100X2 Minimize 100X1 + 100X2 + 120Y1 +
+ 120Y1 + 120Y2 + 15Z1 120Y2 + 15( X1 + Y1 – 800)
subject to Minimize 115X1 + 100X2 + 135Y1 +
X1 + Y1 = 800 + Z1; 120Y2 - 12000
X1 + Y1 - Z1 = 800 subject to
Z1 + X2 + Y2 = 1000 X1 + Y1 ≥ 800
X1 + X2 + Y1+ Y2 ≥ 1800
X1 ≤ 700
X1 ≤ 700
X2 ≤ 700 X2 ≤ 700
Y1 ≤ 300 Y1 ≤ 300
Y2 ≤ 300 Y2 ≤ 300
Formulation 3 – Production Planning
The demands for 2 weeks for a product are 1000 and 800. In a week the
company can produce up to 600 units in regular time at Rs 100/product. It
can employ overtime and produce up to an extra 300 units in a week at Rs
120/product. The cost of carrying a product from one week to the next is Rs
15/product/week. How should they produce to meet the demand at
minimum cost?
The company can outsource the product at Rs 130 and maximum of 200
can be outsourced

Leads to what is called Aggregate Production Planning in Operations


Management
Formulation 4 – Bicycle problem
Three friends (A, B and C) start from P towards Q which is 5 km
away. They have one cycle and only one person rides a cycle at
a time. A, B and C walk at speeds 4, 5 and 6 km/hour and can
ride the cycle at 7, 8 and 10 km/hour. How do they travel such
that all three reach Q at the earliest time?
Let X1 be the distance cycled by A in km
Let X2 be the distance cycled by B in km
Let X3 be the distance cycled by C in km
Time taken by A = Minimize u

Time taken by B = Subject to


Time taken by C =

All three reach when the last


person reaches. We minimize X1, X2, X3, u ≥ 0
the maximum of the three times
Formulation 5 – Napkins problem
The requirement of napkins on five consecutive days of dinner is 100, 60, 80, 90, 70.
New napkins cost Rs 60. Napkins sent to laundry at the end of any day can be used from
The second day onwards. The laundry cost is Rs 20/napkin. Find a solution to napkins
problem that minimizes total cost?

Let X1 to X5 represent the number of new napkins bought that day.

Let Y1 to Y3 represent the number of napkins sent to laundry at the end of that day
Formulation 5 – Napkins problem
Day 1 demand X1 ≥ 100

Day 2 demand – We can buy more than 100 on day 1 and X1 -100 + X2 ≥ 60
Use some of the extra napkins on day 2 X1 + X2 ≥ 160

Day 3 demand – extra napkins from day 2 + X1 + X2 – 160 + X3 + Y1 ≥ 80


new napkins bought on day 3
+ napkins received from laundry on day 3 (sent on day 1) X1 + X2 + X3 + Y1 ≥ 240

Day 4 demand – extra napkins from day 3 + X1 + X2 + X3 + Y1 – 240 + X4 + Y2 ≥ 90


new napkins bought on day 4
X1 + X2 + X3 + Y1 + X4 + Y2 ≥ 330
+ napkins received from laundry on day 4 (sent on day 2)
Formulation 5 – Napkins problem
Day 5 demand – extra napkins X1 + X2 + X3 + Y1 + X4 + Y2 – 330 + X5 + Y3 ≥ 70
from day 4 + new napkins bought on day 5
+ napkins received from laundry on day 5 X1 + X2 + X3 + X4 + X5 + Y1 + Y2 + Y3 ≥ 400
(sent on day 3)

Limit on napkins sent to laundry Y1 ≤ 100, Y2 ≤ 60, Y3 ≤ 80

Objective function Minimize 60 (X1 + X2 + X3 + X4 + X5) + 20 (Y1 + Y2 + Y3)

Non negativity X1, X2, X3, X4, X5, Y1, Y2,Y3 ≥ 0


Formulation 5 – Napkins problem
(General formulation)
Let the number of new napkins bought on day i be X i. Let the number of napkins
sent to laundry at the end of day i be Yi

Minimize c = cost of new napkin


a = laundry cost
d = demand
p = laundry days

Yi  di
Xi, Yi,  0.
Formulation 6 – Buying and Selling

A person is in the business of buying and selling items. He has 10 units in stock and plans
for the next three periods. He can buy the item at the rate of Rs 50, 55 and 58 at the
beginning of periods 1, 2 and 3 and can sell them at Rs 60, 64 and 66 at the end of the
three periods. He can use the money earned by selling at the end of the period to buy
items at the beginning of the next period. He can buy a maximum of 200 per period. He
can borrow money at the rate of 2% per period at the beginning of each period. He can
borrow a maximum of Rs 8000 per period and he cannot borrow more than Rs 20000 in
total. He has to pay back all the loans with interest at the end of the third period.
Formulate (do not solve it) by writing the decision variables, objective function and all
applicable constraints and restrictions?
Let X1, X2, X3 be the amount of product bought
Let Y1, Y2, Y3 be the amount of product sold
Let Z1, Z2, Z3 be the amount of money borrowed

Maximize 60Y1 + 64Y2 + 66Y3 – 50X1 – 55X2 – 58X3 – 0.06Z1 – 0.04Z2 – 0.02Z3
Y1 ≤ X1 + 10 Z1 ≤ 8000
Y1 + Y2 ≤ X1 + X2 + 10 Z2 ≤ 8000
Y1 + Y2 + Y3 ≤ X1 + X2 + X3 + 10 Z3 ≤ 8000
Z1 + Z2 + Z3 ≤ 20000
50X1 ≤ Z1 X1 ≤ 200
50X1 + 55X2 ≤ Z1 + Z2 + 60Y1 X2 ≤ 200
50X1 + 55X2 + 58X3 ≤ Z1 + Z2 + Z3 + 60Y1 + 64Y2 X3 ≤ 200 X j, Y j, Z j ≥ 0
7. Capital Investment problem

Project 1 2 3 4 5 6
NPV of 14 30 17 15 40 6
revenue
Outlay 1 12 54 6 6 30 6
2 3 10 6 2 35 10
3 5 4 6 5 10 4

Capital that can be invested in three years is 35, 20, 20


Maximize 14X1 + 30X2 + 17X3 + 15X4 +40X5 + 6X6

12X1 + 54X2 + 6X3 + 6X4 +30X5 + 6X6 ≤ 35


3X1 + 10X2 + 6X3 + 2X4 +35X5 + 10X6 ≤ 20
5X1 + 4X2 + 6X3 + 5X4 +10X5 + 4X6 ≤ 20

0 ≤ Xj ≤ 1
Capital Investment with external finances

Project 1 2 3 4 5 6
Terminal 44 70 35 35 88 35
value
Outlay 1 12 54 6 6 30 6
2 3 10 6 2 35 10
3 5 4 6 5 10 4

Capital that can be invested in three years is 35, 20, 20

Borrowing and lending allowed but have to be renewed


annually.
Maximize 44X1 + 70X2 + 35X3 + 35X4 + 88X5 + 35X6 + l3 – b3
12X1 + 54X2 + 6X3 + 6X4 +30X5 + 6X6 + l1 – b1 ≤ 35
3X1 + 10X2 + 6X3 + 2X4 +35X5 + 10X6 – 1.05l1 +1.05b1 + l2 – b2 ≤ 20
5X1 + 4X2 + 6X3 + 5X4 +10X5 + 4X6 – 1.05l2 +1.05b2 + l3 – b3 ≤ 20
0 ≤ Xj ≤ 1

Solution: X1 = X3 = X4 = X5 = X6 = 1; b1 = 25, b2 = 62.25, b3 = 75.36


and Z = 161.63

Dual solution is Y1 = 1.102, Y2 = 1.05, Y3 = 1, u1 = 22.62, u3 = 16.08,


u4 = 21.28, u5 = 8.17 u6 = 13.88 with W = 161.63
Capital Investment with external finances

Project 1 2 3 4 5 6
Terminal 44 70 35 35 88 35
value
Outlay 1 12 54 6 6 30 6
2 3 10 6 2 35 10
3 5 4 6 5 10 4

Capital that can be invested in three years is 35, 20, 20

Borrowing and lending allowed but have to be renewed


Annually and borrowing ≤ 25 each year
Maximize 44X1 + 70X2 + 35X3 + 35X4 + 88X5 + 35X6 + l3 – b3
12X1 + 54X2 + 6X3 + 6X4 +30X5 + 6X6 + l1 – b1 ≤ 35
3X1 + 10X2 + 6X3 + 2X4 +35X5 + 10X6 – 1.05l1 +1.05b1 + l2 – b2 ≤ 20
5X1 + 4X2 + 6X3 + 5X4 +10X5 + 4X6 – 1.05l2 +1.05b2 + l3 – b3 ≤ 20
b ≤ 25; 0 ≤ Xj ≤ 1

Solution: X1 = X3 = X4 = X6 = 1; X5 = 0.37, b1 = 6.07, b2 = 20.29, b3 =


25 and Z = 156.47

Dual solution is Y1 = 1.215, Y2 = 1.157, Y3 = 1.102, u1 = 20.43, u3 =


14.147, u4 = 19.88, u6 = 11.72, v3 = 0.102 with W = 156.47
The borrowing constraint is tight only in year 3. The RHS of
  constraints 1 and 2 have made the borrowing 6.07 and 20.29
because any amount borrowed has to be paid back at end of year.

Due to this, though we do not borrow to the limit in years 1 and 2,


there is a marginal value for the capital in years 1 and 2 (1.215 and
1.157). Unit increase of RHS in year 1 can increase revenue by
1.215 but cannot be borrowed because of RHS. If it is to be
borrowed, it can be borrowed at a rate r such that from which r ≤
6.71%. For year 2 it is 7.55%. The simple interest rates are 2.15/3
= 7.166% and 7.85%.

Also we can check that


and
8. Two person zero sum game

Strategy for Stone paper Scissor


Player A
Stone 0 -2 3
paper 3 0 -2
Scissor -2 4 0
Let p1, p2, p3 be the proportion of times A plays the three strategies. If B consistently
plays stone, A’s profit will be 3p2 - 2p3. If B consistently plays paper, A’s profit will be -2p1
+ 4p3. If B consistently plays scissor, A’s profit will be 3p1 - 2p3. Since A and B are
“rational”, A will play in such a way to Maximize A’s minimum profit (because B would
allow minimum profit). A plays what is called “maximin’ strategy.
Maximize u
u ≤ 3p2 - 2p3;
u ≤ -2p1 + 4p3;
u ≤ 3p1 - 2p2;

p1 + p2 + p3 = 1.
p1, p2, p3 ≥ 0. u unrestricted in sign
Let q1, q2, q3 be the proportion of times B plays the three strategies. If A consistently
plays stone, B’s loss will be -2q2 + 3q3. If A consistently plays paper, B’s loss will be 3q1 –
2q2. If A consistently plays scissor, B’s loss will be -2q1 + 4q2. Since A and B are “rational”,
B will play in such a way to Minimize B’s maximum loss (because A would like to give
maximum loss to B). B plays what is called “minimax’ strategy.
Minimize v
v ≥ -2q2 + 3q3;
v ≥ 3q1 – 2q3;
v ≥ -2q1 + 4q2;

q1 + q2 + q3 = 1.
q1, q2, q3 ≥ 0. v unrestricted in sign
Ideal Product problem
  Taste Nutrition Let (x, y) be the ideal chocolate. If A
Chocolate A 6 8.5 is preferred to B, the distance
between A and the ideal chocolate is
≤ distance between B and the ideal
Chocolate B 5.5 9 chocolate

Chocolate C 5 8

(A, B), (B, C), (C, A)


Ideal Product problem
  Taste Nutrition Let (x, y) be the ideal chocolate. If A
is preferred to B, the distance
Chocolate A 6 8.5 between A and the ideal chocolate is
Chocolate B 5.5 9 ≤ distance between B and the ideal
chocolate
Chocolate C 5 8
(A, B), (B, C), (C, A)

2 2 2 2
 ( 𝑥 − 6 ) + ( 𝑦 − 8.5 ) ≤ ( 𝑥 − 5.5 ) + ( 𝑦 − 9 )

(  𝑥 −5.5 )2+ ( 𝑦 −9 )2 ≤ ( 𝑥 −5 )2 + ( 𝑦 − 8 )2
(  𝑥 −5 )2+ ( 𝑦 −8 )2 ≤ ( 𝑥 −6 )2 + ( 𝑦 −8 .5 )2
Ideal Product problem
2 2 2 2
 ( 𝑥 − 6 ) + ( 𝑦 − 8.5 ) ≤ ( 𝑥 − 5.5 ) + ( 𝑦 − 9 )
(  𝑥 −5.5 )2+ ( 𝑦 −9 )2 ≤ ( 𝑥 −5 )2 + ( 𝑦 − 8 )2
(  𝑥 −5 )2+ ( 𝑦 −8 )2 ≤ ( 𝑥 −6 )2 + ( 𝑦 −8 .5 )2

−12 𝑥 −17 𝑦 +36+72.25 ≤− 11 𝑥 −18 𝑦 +30.25+81


1 1 𝑥 −1 8 𝑦 +3 0.25+81 ≤− 10 𝑥 −1 6 𝑦+25+ 64
 
72.25

 − 𝑥+ 𝑦≤3

  𝑥 − 2 𝑦 ≤ −22.25
 2 𝑥 + 𝑦 ≤ 19.25
Ideal Product problem
 − 𝑥+ 𝑦≤3 −
  𝑥 + 𝑦+ 𝑝 1 − 𝑞1 ≤3

  𝑥 − 2 𝑦 ≤ −22.25 −
  𝑥 − 2 𝑦 + 𝑝2 −𝑞 2 ≤ − 22.25

 2 𝑥 + 𝑦 ≤ 19.25 2  𝑥 + 𝑦 + 𝑝3 −𝑞 3 ≤ 19.25

 𝑀𝑖𝑛𝑖𝑚𝑖𝑧𝑒 𝑞1 +𝑞 2 +𝑞 3

𝑥  , 𝑦 , 𝑝 𝑖 , 𝑞 𝑖 ≥ 0
Goal Programming
A company makes 2 products which is sold at Rs 800 and Rs 900. Two resources
are required and 200 and 210 units are available per week. The requirements for
the products are 4 and 6 of the first resource and 5 and 3 of the second resource.
There is a commitment to meet total demand of 40.

It takes 50 minutes to make the first product and 70 minutes for product 2. Only
2400 minutes are available in a week and the rest is to be treated as overtime.

The target (goal) is to have a revenue of Rs 39000 and no overtime. Formulate a


problem
Let X1 and X2 be the quantities produced.

Maximize 800X1 + 900X2 Minimize d1


Minimize 50X1 + 70X2 Minimize e2
4X1 + 5X2 ≤ 200
4X1 + 5X2 ≤ 200 6X1 + 3X2 ≤ 210
6X1 + 3X2 ≤ 210 X1 + X2 ≥ 40
X1 + X2 ≥ 40
X1, X2 ≥ 0 800X1 + 900X2 + d1 – e1 = 39000
50X1 + 70X2 + d2 – e2 = 2400
X1 , X 2 ≥ 0
Minimize αd1 + βe2
Data Envelopment Analysis (Choosing the best school)
  Strength Teachers Facilities Professi Sports Visible
onal Entrepren
School A 800 60 32 courses eurs
School A 175 36 43
School B 1000 90 34
School B 186 37 60
School C 600 40 28
School C 163 40 36
we assign weights u1, u2 and u3 to the three input parameters and weights v1, v2 and v3 to
the output parameters, efficiency of School 1 is defined as

175v1  36v2  43v3


E1 
800u1  60u2  32u3

The weights are the unknowns (or decision variables). School 1 would like to find out the
weights ui and vj that maximizes its efficiency subject to the condition that the efficiency
is not more than 1.
175v1  36v2  43v3 ≤ 1
E ≤ 1 gives E1 
800u1  60u2  32u3

175v1  36v2  43v3  800u1  60u2  32u3  0


Maximize
175v1  36v2  43v3
Subject to
800u1  60u2  32u3  1

175v1  36v2  43v3  800u1  60u2  32u3  0

186v1  37v2  60v3  1000u1  90u2  34u3  0

163v1  40v2  36v3  600u1  40u2  28u3  0

ui, vj ≥ 0
How much to invest
A company has Rs 150000 and has expected payments in beginning of next 4
months. These are 20000, 30000, 50000 and 60000. Three investment schemes
are available. In A, for every Rs 10000 invested at the beginning of the year we
get Rs 12000 at the end of the first year. In B, for Rs 20000 invested, we get Rs
2000 in the end of first year and Rs 22000 in end of year 2. In C for every Rs
25000 invested, we get Rs 2000 in end of years 1 and 2 and Rs 28000 in end of
year 3. How much do we invest in each type to maximize return?
How much to invest
Since unit investments in A, B and C are 10000, 20000 and 25000 respectively, we
define X1, X2 and X3 as the number of unit investments in the three schemes.

The LP is to Maximize 2000X1 + 4000X2 + 7000X3


subject to
-10000X1 –20000X2 – 25000X3 ≥ -130000;
2000X1 – 18000X2 – 23000X3 ≥ -100000;
2000X1 + 4000X2 – 21000X3 ≥ -60000;
2000X1 + 4000X2 + 7000X3 ≥ -10000;

Xj ≥ 0.

You might also like