OR-Notes are a series of introductory notes on topics that fall under the broad heading of the field of operations research (OR). They were originally used by me in an introductory OR course I give at Imperial College. They are now available for use by any students and teachers interested in OR subject to the following conditions.

A full list of the topics available in OR-Notes can be found here.

The conditions for a mathematical model to be a linear program (LP) are:

- all variables continuous (i.e. can take fractional values)
- a single objective (minimise or maximise)
- the objective and constraints are linear i.e. any term is either a constant or a constant multiplied by an unknown.

LP's are important - this is because:

- many practical problems can be formulated as LP's
- there exists an algorithm (called the
*simplex*algorithm) which enables us to solve LP's numerically relatively easily.

We will return later to the simplex algorithm for solving LP's but for the moment we will concentrate upon formulating LP's.

Some of the major application areas to which LP can be applied are:

- Blending
- Production planning
- Oil refinery management
- Distribution
- Financial and economic planning
- Manpower planning
- Blast furnace burdening
- Farm planning

We consider below some specific examples of the types of problem that
can be formulated as LP's. Note here that the key to formulating LP's is
** practice**. However a useful hint is that common objectives
for LP's are

A bank makes four kinds of loans to its personal customers and these loans yield the following annual interest rates to the bank:

- First mortgage 14%
- Second mortgage 20%
- Home improvement 20%
- Personal overdraft 10%

The bank has a maximum foreseeable lending capability of £250 million and is further constrained by the policies:

- first mortgages must be at least 55% of all mortgages issued and at least 25% of all loans issued (in £ terms)
- second mortgages cannot exceed 25% of all loans issued (in £ terms)
- to avoid public displeasure and the introduction of a new windfall tax the average interest rate on all loans must not exceed 15%.

Formulate the bank's loan problem as an LP so as to maximise interest income whilst satisfying the policy limitations.

Note here that these policy conditions, whilst potentially limiting the profit that the bank can make, also limit its exposure to risk in a particular area. It is a fundamental principle of risk reduction that risk is reduced by spreading money (appropriately) across different areas.

We follow the approach:

- variables
- constraints
- objective.

**Note here that as in all formulation exercises we are translating
a verbal description of the problem into an equivalent mathematical
description. **

A useful tip when formulating LP's is to express the variables, constraints and objective in words before attempting to express them in mathematics.

Essentially we are interested in the amount (in £) the bank has loaned to customers in each of the four different areas (not in the actual number of such loans). Hence let

x_{i} = amount loaned in area i in £m (where i=1 corresponds
to first mortgages, i=2 to second mortgages etc)

and note that x_{i} >= 0 (i=1,2,3,4).

Note here that it is conventional in LP's to have all variables >=
0. Any variable (X, say) which can be positive *or* negative can be
written as X_{1}-X_{2} (the difference of two new variables)
where X_{1} >= 0 and X_{2} >= 0.

(a) limit on amount lent

x_{1} + x_{2} + x_{3} + x_{4} <=
250

Note here the use of <= rather than = (following the general rule,
**given a choice between an equality and an inequality choose the
inequality** (as this allows for more flexibility in optimising the objective
function)).

(b) policy condition 1

x_{1} >= 0.55(x_{1} + x_{2})

i.e. first mortgages >= 0.55(total mortgage lending) and also

x_{1} >= 0.25(x_{1} + x_{2} + x_{3}
+ x_{4})

i.e. first mortgages >= 0.25(total loans)

(c) policy condition 2

x_{2} <= 0.25(x_{1} + x_{2} + x_{3}
+ x_{4})

(d) policy condition 3 - we know that the total annual interest is 0.14x_{1}
+ 0.20x_{2} + 0.20x_{3} + 0.10x_{4} on total loans
of (x_{1} + x_{2} + x_{3} + x_{4}). Hence
the constraint relating to policy condition (3) is

0.14x_{1} + 0.20x_{2} + 0.20x_{3} + 0.10x_{4}
<= 0.15(x_{1} + x_{2} + x_{3} + x_{4})

Note: whilst many of the constraints given above could be simplified by collecting together terms this is not strictly necessary until we come to solve the problem numerically and does tend to obscure the meaning of the constraints.

To maximise interest income (which is given above) i.e.

maximise 0.14x_{1} + 0.20x_{2} + 0.20x_{3} +
0.10x_{4}

In case you are interested the optimal solution to this LP (solved using
the package
as dealt with later)
is x_{1}= 208.33, x_{2}=41.67 and x_{3}=x_{4}=0.
Note here this this optimal solution is not unique - other variable values,
e.g. x_{1}= 62.50, x_{2}=0, x_{3}=100 and x_{4}=87.50
also satisfy all the constraints and have exactly the same (maximum) solution
value of 37.5

Consider the example of a manufacturer of animal feed who is producing feed mix for dairy cattle. In our simple example the feed mix contains two active ingredients and a filler to provide bulk. One kg of feed mix must contain a minimum quantity of each of four nutrients as below:

Nutrient A B C D gram 90 50 20 2

The ingredients have the following nutrient values and cost

A B C D Cost/kg Ingredient 1 (gram/kg) 100 80 40 10 40 Ingredient 2 (gram/kg) 200 150 20 - 60

What should be the amounts of active ingredients and filler in one kg of feed mix?

In order to solve this problem it is best to think in terms of one kilogram of feed mix. That kilogram is made up of three parts - ingredient 1, ingredient 2 and filler so let:

x_{1} = amount (kg) of ingredient 1 in one kg of feed mix

x_{2} = amount (kg) of ingredient 2 in one kg of feed mix

x_{3} = amount (kg) of filler in one kg of feed mix

where x_{1} >= 0, x_{2} >= 0 and x_{3} >=
0.

Essentially these variables (x_{1}, x_{2} and x_{3})
can be thought of as the recipe telling us how to make up one kilogram
of feed mix.

- nutrient constraints

100x_{1} + 200x_{2} >= 90 (nutrient A)

80x_{1} + 150x_{2} >= 50 (nutrient B)

40x_{1} + 20x_{2} >= 20 (nutrient C)

10x_{1} >= 2 (nutrient D)

Note the use of an inequality rather than an equality in these constraints, where we assume that the nutrient levels we want are lower limits on the amount of nutrient in one kg of feed mix.

- balancing constraint (an
*implicit*constraint due to the definition of the variables)

x_{1} + x_{2} + x_{3} = 1

Presumably to minimise cost, i.e.

minimise 40x_{1} + 60x_{2}

which gives us our complete LP model for the blending problem.

In case you are interested the optimal solution to this LP (solved using
the package
as dealt with later)
is x_{1}= 0.3667, x_{2}=0.2667 and x_{3}=0.3667
to four decimal places.

Obvious extensions/uses for this LP model include:

- increasing the number of nutrients considered
- increasing the number of possible ingredients considered - more ingredients can never increase the overall cost (other things being unchanged), and may lead to a decrease in overall cost
- placing both upper and lower limits on nutrients
- dealing with cost changes
- dealing with supply difficulties
- filler cost

Blending problems of this type were, in fact, some of the earliest applications of LP (for human nutrition during rationing) and are still widely used in the production of animal feedstuffs.

A company manufactures four variants of the same product and in the final part of the manufacturing process there are assembly, polishing and packing operations. For each variant the time required for these operations is shown below (in minutes) as is the profit per unit sold.

Assembly Polish Pack Profit (£) Variant 1 2 3 2 1.50 2 4 2 3 2.50 3 3 3 2 3.00 4 7 4 5 4.50

- Given the current state of the labour force the company estimate that, each year, they have 100000 minutes of assembly time, 50000 minutes of polishing time and 60000 minutes of packing time available. How many of each variant should the company make per year and what is the associated profit?
- Suppose now that the company is free to decide how much time to devote to each of the three operations (assembly, polishing and packing) within the total allowable time of 210000 (= 100000 + 50000 + 60000) minutes. How many of each variant should the company make per year and what is the associated profit?

Let:

x_{i} be the number of units of variant i (i=1,2,3,4) made per
year

T_{ass} be the number of minutes used in assembly per year

T_{pol} be the number of minutes used in polishing per year

T_{pac} be the number of minutes used in packing per year

where x_{i} >= 0 i=1,2,3,4 and T_{ass}, T_{pol},
T_{pac} >= 0

(a) operation time definition

T_{ass} = 2x_{1} + 4x_{2} + 3x_{3} +
7x_{4} (assembly)

T_{pol} = 3x_{1} + 2x_{2} + 3x_{3} + 4x_{4}
(polish)

T_{pac} = 2x_{1} + 3x_{2} + 2x_{3} + 5x_{4}
(pack)

(b) operation time limits

The operation time limits depend upon the situation being considered. In the first situation, where the maximum time that can be spent on each operation is specified, we simply have:

T_{ass} <= 100000 (assembly)

T_{pol} <= 50000 (polish)

T_{pac} <= 60000 (pack)

In the second situation, where the only limitation is on the total time spent on all operations, we simply have:

T_{ass} + T_{pol} + T_{pac} <= 210000 (total
time)

Presumably to maximise profit - hence we have

maximise 1.5x_{1} + 2.5x_{2} + 3.0x_{3} + 4.5x_{4}

which gives us the complete formulation of the problem.

We shall solve this particular problem later in the course.

Under normal working conditions a factory produces up to 100 units of a certain product in each of four consecutive time periods at costs which vary from period to period as shown in the table below.

Additional units can be produced by overtime working. The maximum quantity and costs are shown in the table below, together with the forecast demands for the product in each of the four time periods.

Time Demand Normal Overtime Overtime Period (units) Production Production Production Costs Capacity Cost (£K/unit) (units) (£K/unit) 1 130 6 60 8 2 80 4 65 6 3 125 8 70 10 4 195 9 60 11

It is possible to hold up to 70 units of product in store from one period
to the next at a cost of £1.5K per unit per period. (This figure
of £1.5K per unit per period is known as a *stock-holding cost*
and represents the fact that we are incurring costs associated with the
storage of stock).

It is required to determine the production and storage schedule which will meet the stated demands over the four time periods at minimum cost given that at the start of period 1 we have 15 units in stock. Formulate this problem as an LP.

The decisions that need to be made relate to the amount to produce in normal/overtime working each period. Hence let:

x_{t} = number of units produced by normal working in period
t (t=1,2,3,4), where x_{t} >= 0

y_{t} = number of units produced by overtime working in period
t (t=1,2,3,4) where y_{t} >= 0

In fact, for this problem, we also need to decide how much stock we carry over from one period to the next so let:

I_{t} = number of units in stock at the end of period t (t=0,1,2,3,4)

- production limits

x_{t} <= 100 t=1,2,3,4

y_{1} <= 60

y_{2} <= 65

y_{3} <= 70

y_{4} <= 60

- limit on space for stock carried over

I_{t} <= 70 t=1,2,3,4

- we have an
*inventory continuity equation*of the form

closing stock = opening stock + production - demand

then assuming

- opening stock in period t = closing stock in period t-1 and
- that production in period t is available to meet demand in period t

we have that

I_{1} = I_{0} + (x_{1} + y_{1}) - 130

I_{2} = I_{1} + (x_{2} + y_{2}) - 80

I_{3} = I_{2} + (x_{3} + y_{3}) - 125

I_{4} = I_{3} + (x_{4} + y_{4}) - 195

where I_{0} = 15

Note here that inventory continuity equations of the type shown above
are common in production planning problems involving more than one time
period. Essentially the inventory variables (I_{t}) and the inventory
continuity equations link together the time periods being considered and
represent a physical accounting for stock.

- demand must always be met - i.e. no "stock-outs". This is equivalent to saying that the opening stock in period t plus the production in period t must be greater than (or equal to) the demand in period t, i.e.

I_{0} + (x_{1} + y_{1}) >= 130

I_{1} + (x_{2} + y_{2}) >= 80

I_{2} + (x_{3} + y_{3}) >= 125

I_{3} + (x_{4} + y_{4}) >= 195

However these equations can be viewed in another way. Considering the inventory continuity equations we have that the above equations which ensure that demand is always met can be rewritten as:

I_{1} >= 0

I_{2} >= 0

I_{3} >= 0

I_{4} >= 0

To minimise cost - which consists of the cost of ordinary working plus the cost of overtime working plus the cost of carrying stock over (1.5K per unit). Hence the objective is:

minimise

(6x_{1} + 4x_{2} + 8x_{3} + 9x_{4})
+ (8y_{1} + 6y_{2} + 10y_{3} + 11y_{4})
+ (1.5I_{0} + 1.5I_{1} + 1.5I_{2} + 1.5I_{3}
+ 1.5I_{4})

Note here that we have assumed that if we get an answer involving fractional variable values this is acceptable (since the number of units required each period is reasonably large this should not cause too many problems).

In case you are interested the optimal solution to this LP (solved using
the package
as dealt with later)
is x_{1}=x_{2}=x_{3}=x_{4}=100; y_{1}=15,
y_{2}=50, y_{3}=0 and y_{4}=50; I_{0}=15,
I_{1}=0, I_{2}=70, I_{3}=45 and I_{4}=0
with the minimal objective function value being 3865

Note:

- As discussed above assuming I
_{t}>= 0 t=1,2,3,4 means "no stock-outs" i.e. we need a production plan in which sufficient is produced to ensure that demand is always satisfied. - Allowing I
_{t}(t=1,2,3,4) to be unrestricted (positive or negative) means that we may end up with a production plan in which demand is unsatisfied in period t (I_{t}< 0). This unsatisfied demand will be carried forward to the next period (when it will be satisfied if production is sufficient, carried forward again otherwise). - If I
_{t}is allowed to be negative then we need to amend the objective to ensure that we correctly account for stock-holding costs (and possibly to account for stock-out costs). - If we get a physical loss of stock over time (e.g. due to damage, pilferage, etc) then this can be easily accounted for. For example if we lose (on average) 2% of stock each period then multiply the right-hand side of the inventory continuity equation by 0.98. If this is done then we often include a term in the objective function to account financially for the loss of stock.
- If production is not immediately available to meet customer demand
then the appropriate time delay can be easily incorporated into the inventory
continuity equation. For example a 2 period time delay for the problem
dealt with above means replace (x
_{t}+ y_{t}) in the inventory continuity equation for I_{t}by (x_{t-2}+ y_{t-2}). - In practice we would probably deal with the situation described above on a "rolling horizon" basis in that we would get an initial production plan based on current data and then, after one time period (say), we would update our LP and resolve to get a revised production plan. In other words even though we plan for a specific time horizon, here 4 months, we would only even implement the plan for the first month, so that we are always adjusting our 4 month plan to take account of future conditions as our view of the future changes. We illustrate this below.

Period 1 2 3 4 5 6 7 8 P=plan P P P P D=do (follow) the plan in a period D P P P P D P P P P D P P P P

This rolling horizon approach would be preferable to carrying out the plan for 4 time periods and then producing a new plan for the next 4 time periods, such as shown below.

Period 1 2 3 4 5 6 7 8 P=plan P P P P D=do (follow) the plan in a period D D D D P P P P D D D D

Some more LP formulation examples can be found here.