If the objective function and all of the constraints are linear then we call the problem of optimising the objective function subject to these constraints a linear program. All optimisation problems we will look at will be linear programs.
The major consequence of the constraints being linear is that the feasible region is always a polygon. This is evident since the constraints that define the feasible region all contribute a line segment to its boundary (see Figure 1). It is also always true that the feasible region is a convex polygon.
The objective function being linear means that the feasible point(s) that gives the solution of a linear program always lies on one of the vertices of the feasible region. This is very important since, as we will soon see, it gives us a way of solving linear programs.
We will now see why the solutions of a linear program always lie on the vertices of the feasible region. Firstly, note that if we think of f(x,y)f(x,y) as lying on the zz axis, then the function f(x,y)=ax+byf(x,y)=ax+by (where aa and bb are real numbers) is the definition of a plane. If we solve for yy in the equation defining the objective function then
f
(
x
,
y
)
=
a
x
+
b
y
∴
y
=
-
a
b
x
+
f
(
x
,
y
)
b
f
(
x
,
y
)
=
a
x
+
b
y
∴
y
=
-
a
b
x
+
f
(
x
,
y
)
b
(4)What this means is that if we find all the points where f(x,y)=cf(x,y)=c for any real number cc (i.e. f(x,y)f(x,y) is constant with a value of cc), then we have the equation of a line. This line we call a level line of the objective function.
Consider again the feasible region described in Figure 1. Let's say that we have the objective function f(x,y)=x-2yf(x,y)=x-2y with this feasible region. If we consider Equation Equation 4 corresponding to
f
(
x
,
y
)
=
-
20
f
(
x
,
y
)
=
-
20
(5)then we get the level line
y
=
1
2
x
+
10
y
=
1
2
x
+
10
(6)which has been drawn in (Reference). Level lines corresponding to
f
(
x
,
y
)
=
-
10
or
y
=
x
2
+
5
f
(
x
,
y
)
=
0
or
y
=
x
2
f
(
x
,
y
)
=
10
or
y
=
x
2
-
5
f
(
x
,
y
)
=
20
or
y
=
x
2
-
10
f
(
x
,
y
)
=
-
10
or
y
=
x
2
+
5
f
(
x
,
y
)
=
0
or
y
=
x
2
f
(
x
,
y
)
=
10
or
y
=
x
2
-
5
f
(
x
,
y
)
=
20
or
y
=
x
2
-
10
(7)have also been drawn in. It is very important to realise that these are not the only level lines; in fact, there are infinitely many of them and they are all parallel to each other. Remember that if we look at any one level line f(x,y)f(x,y) has the same value for every point (x,y)(x,y) that lies on that line. Also, f(x,y)f(x,y) will always have different values on different level lines.
If a ruler is placed on the level line corresponding to f(x,y)=-20f(x,y)=-20 in Figure 2 and moved down the page parallel to this line then it is clear that the ruler will be moving over level lines which correspond to larger values of f(x,y)f(x,y). So if we wanted to maximise f(x,y)f(x,y) then we simply move the ruler down the page until we reach the “lowest” point in the feasible region. This point will then be the feasible point that maximises f(x,y)f(x,y). Similarly, if we wanted to minimise f(x,y)f(x,y) then the “highest” feasible point will give the minimum value of f(x,y)f(x,y).
Since our feasible region is a polygon, these points will always lie on vertices in the feasible region. The fact that the value of our objective function along the line of the ruler increases as we move it down and decreases as we move it up depends on this particular example. Some other examples might have that the function increases as we move the ruler up and decreases as we move it down.
It is a general property, though, of linear objective functions that they will consistently increase or decrease as we move the ruler up or down. Knowing which direction to move the ruler in order to maximise/minimise f(x,y)=ax+byf(x,y)=ax+by is as simple as looking at the sign of bb (i.e. “is bb negative, positive or zero?"). If bb is positive, then f(x,y)f(x,y)increases as we move the ruler up and f(x,y)f(x,y)decreases as we move the ruler down. The opposite happens for the case when bb is negative: f(x,y)f(x,y)decreases as we move the ruler up and f(x,y)f(x,y)increases as we move the ruler down. If b=0b=0 then we need to look at the sign of aa.
If aa is positive then f(x,y)f(x,y) increases as we move the ruler to the right and decreases if we move the ruler to the left. Once again, the opposite happens for aa negative. If we look again at the objective function mentioned earlier,
f
(
x
,
y
)
=
x
-
2
y
f
(
x
,
y
)
=
x
-
2
y
(8)with a=1a=1 and b=-2b=-2, then we should find that f(x,y)f(x,y) increases as we move the ruler down the page since b=-2<0b=-2<0. This is exactly what we found happening in Figure 2.
The main points about linear programming we have encountered so far are
- The feasible region is always a polygon.
- Solutions occur at vertices of the feasible region.
- Moving a ruler parallel to the level lines of the objective function up/down to the top/bottom of the feasible region shows us which of the vertices is the solution.
- The direction in which to move the ruler is determined by the sign of bb and also possibly by the sign of aa.
These points are sufficient to determine a method for solving any linear program.
If we wish to maximise the objective function f(x,y)f(x,y) then:
- Find the gradient of the level lines of f(x,y)f(x,y) (this is always going to be -ab-ab as we saw in Equation (Reference))
- Place your ruler on the xyxy plane, making a line with gradient -ab-ab (i.e. bb units on the xx-axis and -a-a units on the yy-axis)
- The solution of the linear program is given by appropriately moving the ruler. Firstly we need to check whether bb is negative, positive or zero.
- If b>0b>0, move the ruler up the page, keeping the ruler parallel to the level lines all the time, until it touches the “highest” point in the feasible region. This point is then the solution.
- If b<0b<0, move the ruler in the opposite direction to get the solution at the “lowest” point in the feasible region.
- If b=0b=0, check the sign of aa
- If a<0a<0 move the ruler to the “leftmost” feasible point. This point is then the solution.
- If a>0a>0 move the ruler to the “rightmost” feasible point. This point is then the solution.
As part of their opening specials, a furniture store has promised to give away at least 40 prizes with a total value of at least R2 000. The prizes are kettles and toasters.
- If the company decides that there will be at least 10 of each prize, write down two more inequalities from these constraints.
- If the cost of manufacturing a kettle is R60 and a toaster is R50, write down an objective function CC which can be used to determine the cost to the company of both kettles and toasters.
- Sketch the graph of the feasibility region that can be used to determine all the possible combinations of kettles and toasters that honour the promises of the company.
- How many of each prize will represent the cheapest option for the company?
- How much will this combination of kettles and toasters cost?
- Step 1. Identify the decision variables :
Let the number of kettles be xkxk and the number of toasters be ytyt and write down two constraints apart from xk≥0xk≥0 and yt≥0yt≥0 that must be adhered to.
- Step 2. Write constraint equations :
Since there will be at least 10 of each prize we can write:
and
Also the store has promised to give away at least 40 prizes in total. Therefore:
x
k
+
y
t
≥
40
x
k
+
y
t
≥
40
(11)
- Step 3. Write the objective function :
The cost of manufacturing a kettle is R60 and a toaster is R50. Therefore the cost the total cost CC is:
C
=
60
x
k
+
50
y
t
C
=
60
x
k
+
50
y
t
(12)
- Step 4. Sketch the graph of the feasible region :
- Step 5. Determine vertices of feasible region :
From the graph, the coordinates of vertex A are (30,10) and the coordinates of vertex B are (10,30).
- Step 6. Draw in the search line :
The seach line is the gradient of the objective function. That is, if the equation C=60x+50yC=60x+50y is now written in the standard form y=...y=..., then the gradient is:
m
=
-
6
5
,
m
=
-
6
5
,
(13)
which is shown with the broken line on the graph.
- Step 7. Calculate cost at each vertex :
At vertex A, the cost is:
C
=
60
x
k
+
50
y
t
=
60
(
30
)
+
50
(
10
)
=
1800
+
500
=
2300
C
=
60
x
k
+
50
y
t
=
60
(
30
)
+
50
(
10
)
=
1800
+
500
=
2300
(14)
At vertex B, the cost is:
C
=
60
x
k
+
50
y
t
=
60
(
10
)
+
50
(
30
)
=
600
+
1500
=
2100
C
=
60
x
k
+
50
y
t
=
60
(
10
)
+
50
(
30
)
=
600
+
1500
=
2100
(15)
- Step 8. Write the final answer :
The cheapest combination of prizes is 10 kettles and 30 toasters, costing the company R2 100.
As a production planner at a factory manufacturing lawn cutters your job
will be to advise the management on how many of each model should be produced per week in
order to maximise the profit on the local production. The factory is producing two types of
lawn cutters: Quadrant and Pentagon.
Two of the production processes that the lawn cutters must go through are: bodywork and engine
work.
- The factory cannot operate for less than 360 hours on engine work for the lawn cutters.
- The factory has a maximum capacity of 480 hours for bodywork for the lawn cutters.
- Half an hour of engine work and half an hour of bodywork is required to produce one
Quadrant.
- The ratio of Pentagon lawn cutters to Quadrant lawn cutters produced per week must be at
least 3:2.
- A minimum of 200 Quadrant lawn cutters must be produced per week.
Let the number of Quadrant lawn cutters manufactured in a week be xx.
Let the number of Pentagon lawn cutters manufactured in a week be yy.
Two of the constraints are:
3
x
+
2
y
≥
2
160
3
x
+
2
y
≥
2
160
(17)
- Write down the remaining constraints in terms of xx and yy to represent the abovementioned
information.
- Use graph paper to represent the constraints graphically.
- Clearly indicate the feasible region by shading it.
- If the profit on one Quadrant lawn cutter is R1 200 and the profit on one Pentagon
lawn cutter is R400, write down an equation that will represent the profit on the
lawn cutters.
- Using a search line and your graph, determine the number of Quadrant and
Pentagon lawn cutters that will yield a maximum profit.
- Determine the maximum profit per week.
- Step 1. Remaining constraints: :
1
2
x
+
1
5
y
≤
480
1
2
x
+
1
5
y
≤
480
(18)
- Step 2. Graphical representation :
- Step 3. Profit equation :
P
=
1
200
x
+
400
y
P
=
1
200
x
+
400
y
(20)
- Step 4. Maximum profit :
By moving the search line upwards, we see that the point of maximum profit is at (600,900). Therefore
P
=
1
200
(
600
)
+
400
(
900
)
P
=
1
200
(
600
)
+
400
(
900
)
(21)
P
=
R
1
080
000
P
=
R
1
080
000
(22)