Linear Programming
Linear Programming
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 + X 2 + X 3 + X 4 + X 5 + X 6
X1 + X2 ≥ 15
X2 + X3 ≥ 10 Requirement of
period 2
X3 + X 4 ≥ 8
12 noon to 4 pm
X4 + X 5 ≥ 6
X5 + X6 ≥ 10
X6 + X1 ≥ 12
X1 , X 2 , X 3 , X 4 , X 5 , X 6 ≥ 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 product 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?
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
Yi di
Xi, Yi, 0.
Formulation 7 – Maximum flow problem
10
2 Find the maximum flow in the network
The arc capacities are given
20 30 5
30
25
1 4 Let Xij be the flow in arc i-j.
35 Let f be the flow in the network
40 20
3
Variables are X12, X13, X23, X24, X25, X34, X35 and X45
Formulation 7 – Maximum flow problem
10 Maximize f X12 ≤ 20
2 Subject to
X13 ≤ 40
X12 + X13 = f
20 30 5 X23 ≤ 30
-X12 + X23 + X24 + X25 = 0
30 X24 ≤ 30
25 -X13 -X23 + X34 + X35 = 0
1 4 X25 ≤ 10
35 -X24 -X34 + X45 = 0
40 20 X34 ≤ 35
X25 + X35 + X45 = f
3 X35 ≤ 20
Maximize X25 + X35 + X45 X45 ≤ 25
Subject to f, Xij ≥ 0.
-X12 + X23 + X24 + X25 = 0
-X13 -X23 + X34 + X35 = 0
-X24 -X34 + X45 = 0
Formulation 8 – Bin packing
You are given the numbers 8, 6, 9, 28, 17, 24, 7, 21. Make minimum number of groups
such that the sum of the numbers in each group does not exceed 45.
Minimize
Minimize Y1 + Y2 + Y3 + Y4 + Y5 + Y6 + Y7 + Y8
Formulation 8 – Bin packing
You are given the numbers 8, 6, 9, 28, 17, 24, 7, 21. Make minimum number of groups
such that the sum of the numbers in each group does not exceed 45.
X11 + X12 + X13 + X14 + X15 + X16 + X17 + X18 = 1
There are 64 + 8 = 72
Xij, Yj = 0,1
Variables and 16 constraints
Formulation 8 – Bin packing
You are given the numbers 8, 6, 9, 28, 17, 24, 7, 21. Make minimum number of groups
such that the sum of the numbers in each group does not exceed 45.
A simple solution would be {8, 6, 9}, {28, 17}, {24, 7}, {21}. There are 4 groups. Using this
We can reduce the Yj variables to 4 and allot numbers to 4 groups while minimizing the
number of groups.
The formulation would have 8x4 + 4 = 36 variables and 8+4 = 12 constraints and is
simpler
We can verify whether there is a solution by defining 3 groups. The formulation
would have 8x3 + 3 = 27 variables and 8+3 = 11 constraints.
Sometimes, starting with a solution gives better formulations for some integer (binary)
programming problems