Linear Programming
Linear Programming
5 LINEAR
PROGRAMMING
Objectives
After studying this chapter you should
5.0
Introduction
5.1
Formation of linear
programming problems
84
Transistors Similarly
10x + 20y 120
Capacitors
Similarly
x 0, y 0 .
(c) What is the profit?
Since each type A gives 5 profit and each type B gives 12
profit, the total profit is P, where
P = 5x + 12y .
P = 5x + 12y
subject to
Activity 1
Feasible solutions
At this stage, you will not continue with finding the actual solutions
but will concentrate on further practice in formulating problems of
this type.
The key stage is the first one, namely that of identifying the
unknowns; so you must carefully read the problem through in order
to identify the basic unknowns. Once you have done this
successfully, it should be straight forward to express both the
constraints and the profit function in terms of the unknowns.
85
Example
A small firm builds two types of garden shed.
Type A requires 2 hours of machine time and 5 hours of
craftsman time.
Type B requires 3 hours of machine time and 5 hours of
craftsman time.
Each day there are 30 hours of machine time available and 60
hours of craftsman time. The profit on each type A shed is 60
and on each type B shed is 84.
Formulate the appropriate linear programming problem.
Solution
(a)
Unknowns
Define
x = number of Type A sheds produced each day,
Constraints
Machine time:
Craftsman time:
5x + 5y 60
and
(c)
2x + 3y 30
x 0, y 0
Profit
P = 60x + 84y
So, in summary, the linear programming problem is
maximise P = 60x + 84y
subject to 2x + 3y
x+y
x
y
86
30
12
0
0
Exercise 5A
1. Ann and Margaret run a small business in which
they work together making blouses and skirts.
Each blouse takes 1 hour of Ann's time together
with 1 hour of Margaret's time. Each skirt
involves Ann for 1 hour and Margaret for half an
hour. Ann has 7 hours available each day and
Margaret has 5 hours each day.
They could just make blouses or they could just
make skirts or they could make some of each.
Their first thought was to make the same number
of each. But they get 8 profit on a blouse and
only 6 on a skirt.
(a) Formulate the problem as a linear
programming problem.
(b) Find three solutions which satisfy the
constraints.
2. A distribution firm has to transport 1200
packages using large vans which can take 200
packages each and small vans which can take 80
packages each. The cost of running each large
van is 40 and of each small van is 20. Not
more than 300 is to be spent on the job. The
number of large vans must not exceed the
number of small vans.
Formulate this problem as a linear programming
problem given that the objective is to minimise
costs.
5.2
Graphical solution
87
12
Feasible region
0
0
12
16
20
y
5
C = 45
C = 30
C = 15
0
0
Activity 2
Check that the points
x = 1, y =
25
12
x = 2, y =
5
3
x = 4, y =
5
6
each lie on the line defined by C = 30. What profit does each of
these points give?
88
Feasible region
y=0
10
Example
A farmer has 20 hectares for growing barley and swedes. The farmer
has to decide how much of each to grow. The cost per hectare for
barley is 30 and for swedes is 20. The farmer has budgeted 480.
Barley requires 1 man-day per hectare and swedes require 2 man-days
per hectare. There are 36 man-days available.
The profit on barley is 100 per hectare and on swedes is 120 per
hectare.
Find the number of hectares of each crop the farmer should sow to
maximise profits.
Solution
The problem is formulated as a linear programming problem:
(a) Unknowns
x = number of hectares of barley
(c) Profit
P = 100x + 120y
20
480
36
0
0
89
C = 100x + 120y
and again you can see that C increases as the line (shown dotted)
moves to the right. Continuing in this way, the maximum profit
will occur at the intersection of
x + 2y = 36 and x + y = 20
y
24
x=0
16
c = 1800
x + 2y = 36
12
c = 1200
8
feasible
region
c = 600
4
x + y = 20
x
0
0
12
16
20
24
28
32
36
y=0
The farmer should sow 4 hectares with barley and 16 with swedes.
Exercise 5B
1. Solve the linear programming problem defined in
Question 1 of Exercise 5A.
90
4. The annual subscription for a tennis club is 20 for 5. The numbers of units of vitamins A, B and C in a
adults and 8 for juniors. The club needs to raise at
kilogram of foods X and Y are as follows:
least 800 in subscriptions to cover its expenses.
The total number of members is restricted to 50.
The number of junior members is to be between one
quarter and one third of the number of adult
members.
Food
5.3
Simplex method
1
2
), but less
3
2
).
So the solution will occur at the intersection of the two lines with
slopes
1
2
and 1.
Activity 3
Check the slopes of the constraints and profit function in the first
example in the text in Section 5.2.
Profit
2160
2320
2240
1600
As you can see, as you move round the feasible region, the
profit increases from 0 to A to B, but then decreases to C to D
and back to 0.
In more complicated problems, it is helpful to introduce the idea of
slack variables. For the problem above, with the three inequalities
x + y 20
30x + 20y 480
x + 2y 36
three new variables are defined by
r = 20 x y
s = 480 30x 20y
t = 36 x 2y
The three inequalities can now be written as
r 0, s 0, t 0
as well as x 0, y 0. The variables r, s and t are called the slack
variables as they represent the amount of slack between the total
quantity available and how much is being used.
The importance of the slack variables is that you can now define
each vertex in terms of two of the variables, x, y, r, s, or t, being
zero; for example, at A,
x = t = 0.
92
y
22
increasing
20 A p = 2160
profit
18
B p = 2320
16
14
C
p = 2240
12
10
8
6
4
1600
p = 2320
0
p = 2320
2
D x
0
0 2 4 6 8 10 12 14 16 18
Activity 4
Complete the table below, defining each vertex
0
x=y=0
t=x=0
................
................
................
P = 100x + 120y = 0 at x = y = 0
Clearly P will increase in either direction from the origin moving up the y axis means that x is held at zero whilst y
increases. Although you know from the diagram that the next
vertex reached will be A, how could you work that out without a
picture? As x is being kept at zero and y is increasing the next
vertex met will either be where
x = r = 0 or where x = s = 0 or where x = t = 0 . But note that
x = r = 0 y = 20
x = s = 0 y = 24
x = t = 0 y = 18 smallest
(36 x t )
2
= 40x 60t + 2160
93
t=s=0x=6
t = r = 0 x = 4 smallest
t = y = 0 x = 36
So the next vertex reached is where t = r = 0, (which is B) and P
is now expressed in terms of t and r. To do this eliminate y
from the first and third of the original equations by noting that
2r t = 2( 20 x y ) (36 x 2y ) = 4 x
Hence
P = 40x 60t + 2160
= 40( 4 2r + t ) 60t + 2160
= 80r 20t + 2320
y
20
A
16
t=0
B
12
s=0
x=0
Activity 5
r=0
y=0
12
16
Exercise 5C
1. (a) Solve the linear programming problem
maximise P = 2 x + 4 y
subject to x + 5y
4x + y
x
y
10
8
0
0
by a graphical method.
(b) Introduce slack variables r and s, and solve
the problem by the simplex method.
8
12
9
0
0
94
P = x + 2y
subject to x + 4y 20
x+y 8
5x + y 32
x 0
y 0
As usual introduce slack variables r, s and t defined by
x + 4y + r = 20
x+y+s =8
5x + y + t = 32
P x 2y
x + 4y +r
x + y
+s
5x + y
=0
= 20
=8
+t = 32
0
0
P 0
x 20
y =
8
r 32
s
t
95
The augmented matrix with the extra right hand column will be used.
P
1
0
0
0
1
1
1
5
2
4
1
1
0
1
0
0
0
0
1
0
0
0
0
1
0
20
8
32
1
0
0
0
1
1
1
1
2
4
1
0
0
1
0
0
0
0
0
20
8
1
5
0
1
0
0
1
5
32
5
R4 / 5
9
5
0
0
0
1
19
5
4
5
1
5
0
0
1
0
32
5
68
5
8
5
32
5
R1 + R 4
1
5
1
5
1
5
1
5
9
5
19
5
32
5
68
5
5
4
1
5
1
5
1
5
1
4
1
5
1
4
10
R1 + 9 R 3
5
R 2 19 R 3
5
3
4
1
4
1
4
9
4
19
4
5
4
1
4
1
4
10
4
3
1
4
1
4
12
R3 + 1 R2
4
R4 1 R2
4
96
9
4
19
3
5
4
1
4
1
3
4
3
1
3
1
3
2
3
19
3
1
3
4
3
Comments
R2 R4
R3 R 4
R 3 / ( 4 5)
32
5
2
6
R 4 1 R3
5
3
R2 / ( 4 )
R1 + 1 R 2
4
Example
Maximise P = 4x + 5y + 3z
subject to 8x + 5y + 2z 3
3x + 6y + 9z 2
x, y, z 0
Solution
As usual slack variables r and s are introduced;
8x + 5y + 2z + r = 3
3x + 6y + 9z + s = 2
Now x, y, z, r, s 0 and the simplex tableau is shown below.
P
5
8
2
8
1
8
3
8
5
2
5
8
33
8
2
8
33
4
1
2
1
8
3
8
3
2
3
8
7
8
5
2
5
8
2
8
1
2
1
8
1
11
8
33
3
2
3
8
7
33
3
11
2
11
1
11
20
33
5
33
8
33
67
33
8
33
7
33
0
1
Comments
Increase x initially and compare 3 / 8*, 2 / 3 .
This smaller positive value of x occurs where
R2 / 8
R1 + 4R 2
R 3 3R 2
R3 /
s=0
and so express P
( 33 )
8
5
R1 + 2 R 3
5
R2 8 R3
97
Exercise 5D
Use the simplex algorithm to solve the following
problems.
1. Maximise P = 4 x + 6 y
3. Maximise P = 3x + 8y 5z
subject to 2 x 3y + z 3
2 x + 5y + 6z
x
y
z
subject to x + y 8
7x + 4 y 14
x 0
y 0
2. Maximise P = 10 x + 12 y + 8z
4. Maximise 3x + 6 y + 2z
subject to 3x + 4 y + 2z 2
x + 3y + 2z 1
subject to 2 x + 2 y 5
5x + 3y + 4z
x
y
z
5.5
5
0
0
0
x 0
15
0
0
0
y 0
z 0
Miscellaneous Exercises
98
Tablet
Iron
Calcium Vitamin
Xtravit
Yeastalife
99
100