Linear Programming Formulation Examples
Linear Programming Formulation Examples
Linear Programming Formulation Examples
A cargo plane has three compartments for storing cargo: front, centre and rear. These
compartments have the following limits on both weight and space:
¦ rthermore, the weight of the cargo in the respective compartments m st be the same
proportion of that compartment's weight capacity to maintain the balance of the plane.
The following fo r cargoes are available for shipment on the next flight:
Any proportion of these cargoes can be accepted. The objective is to determine 2 2 (if
any) of each cargo C1, C2, C3 and C4 sho ld be accepted and 2
each among the
compartments so that the total profit for the flight is maximised.
x
xij be the n mber of tonnes of cargo i (i=1,2,3,4 for C1, C2, C3 and C4 respectively) that is p t
into compartment j (j=1 for ¦ront, j=2 for Centre and j=3 for Rear) where xij >=0 i=1,2,3,4;
j=1,2,3
Note here that we are explicitly told we can split the cargoes into any proportions (fractions) that
we like.
3Y the weight of the cargo in the respective compartments m st be the same proportion of
that compartment's weight capacity to maintain the balance of the plane
[x11 + x21 + x31 + x41]/10 = [x12 + x22 + x32 + x42]/16 = [x13 + x23 + x33 + x43]/8
A
The advantages of sing a software package to solve the above linear program, rather than a
j dgemental approach are:
3Y act ally maximise profit, rather than j st believing that o r j dgemental sol tion
maximises profit (we may have bad j dgement, even if we have an MÔA!)
3Y makes the cargo loading the decision one that we can solve in a ro tine operational
manner on a comp ter, rather than having to exercise j dgement each and every time we
want to solve it
3Y problems that can be appropriately form lated as linear programs are almost always
better solved by comp ters than by people
3Y can perform sensitivity analysis very easily sing a comp ter
c
Ôriefly describe the main steps in sing mathematical modelling to s pport management.
A canning company operates two canning plants. The growers are willing to s pply fresh fr its
in the following amo nts:
Plant A Plant B
Capacity 460 tonnes 560 tonnes
Labour cost £26/tonne £21/tonne
The canned fr its are sold at £50/tonne to the distrib tors. The company can sell at this price all
they can prod ce.
The objective is to find the best mixt re of the q antities s pplied by the three growers to the two
plants so that the company maximises its profits.
x
3Y 1. Problem identification
oY iagnosis of the problem from its symptoms if not obvio s (i.e. what is the
problem?)
oY elineation of the s bproblem to be st died. Often we have to ignore parts of the
entire problem.
oY ùstablishment of objectives, limitations and req irements.
3Y 2. ¦orm lation as a mathematical model
3Y 3. Model validation (or algorithm validation)
oY Model validation involves r nning the algorithm for the model on the comp ter in
order to ens re:
>Y the inp t data is free from errors
>Y the comp ter program is b g-free (or at least there are no o tstanding
b gs)
>Y the comp ter program correctly represents the model we are attempting to
validate
>Y the res lts from the algorithm seem reasonable (or if they are s rprising
we can at least nderstand why they are s rprising).
3Y 4. xol tion of the model
oY xtandard comp ter packages, or specially developed algorithms, can be sed to
solve the model.
oY ln practice, a "sol tion" often involves very many sol tions nder varying
ass mptions to establish sensitivity.
3Y 5. lmplementation
oY This phase may involve the implementation of the res lts of the st dy or the
implementation of the
2 for solving the model as an operational tool
( s ally in a comp ter package).
To form late the problem given in the q estion as a linear program we need to define:
3Y variables
3Y constraints
3Y objective
e need to decide how m ch to s pply from each of the three growers to each of the two
canning plants. Hence let xij be the n mber of tonnes s pplied from grower i (i=1,2,3 for x1, x2
and x3 respectively) to plant j (j=1 for Plant A and j=2 for Plant Ô) where xij >=0 i=1,2,3; j=1,2
A
maximise reven e - grower s pply cost - grower shipping cost - plant labo r cost
and this is
The d al val es associated with the s pply and plant capacity constraints in the optimal sol tion
of the above linear program tell s by how m ch the optimal objective f nction val e will
change if we change the right-hand side of the corresponding constraints
c
The prod ction manager of a chemical plant is attempting to devise a shift pattern for his
workforce. ùach day of every working week is divided into three eight-ho r shift periods (00:01-
08:00, 08:01-16:00, 16:01-24:00) denoted by night, day and late respectively. The plant m st be
manned at all times and the minim m n mber of workers req ired for each of these shifts over
any working week is as below:
x
The nion agreement is s ch that any worker can only start their fo r consec tive work days on
one of the seven days (Mon to x n) and in one of the three eight-ho r shifts (night, day, late).
Let:
Note here that strictly these variables sho ld be integer b t, as we are explicitly told to form late
the problem as a linear program in part (a) of the q estion, we allow them to take fractional
val es.
since each worker can start his working week only once d ring the seven day, three shift, week
3Y lower limit on the total n mber of workers req ired for each day/shift period
let ij be the (known) n mber of workers req ired on day i (i=1,...,7) and shift period j (j=1,...,3)
e.g. 53=11 (¦riday, Late)
The logic here is straightforward, for example for ednesday (day 3) the workers working shift j
on day 3 either started on ednesday (day 3, N3j) or on T esday (day 2, N2j) or on Monday (day
1, N1j) or on x nday (day 7, N7j) - so the s m of these variables is the total n mber of workers on
d ty on day 3 in shift j and this m st be at least the minim m n mber req ired (3j).
A
lt appears from the q estion that the prod ction manager's objective is simply to find a feasible
sched le so any objective is possible. Logically however he might be interested in red cing the
size of the workforce so the objective f nction co ld be:
where all variables Nij>=0 and contin o s (i.e. can take fractional val es).
xome of the advantages and disadvantages of solving this problem as a linear program are:
able to investigate changes (e.g. in shift patterns, workers needed per day, etc) very
easily.
c
A company man fact res fo r prod cts (1,2,3,4) on two machines (X and Y). The time (in
min tes) to process one nit of each prod ct on each machine is shown below:
Machine
X Y
Product 1 10 27
2 12 19
3 13 33
4 8 23
The profit per nit for each prod ct (1,2,3,4) is £10, £12, £17 and £8 respectively. Prod ct 1
m st be prod ced on 2 machines X and Y b t prod cts 2, 3 and 4 can be prod ced on either
machine.
The factory is very small and this means that floor space is very limited. Only one week's
prod ction is stored in 50 sq are metres of floor space where the floor space taken p by each
prod ct is 0.1, 0.15, 0.5 and 0.05 (sq are metres) for prod cts 1, 2, 3 and 4 respectively.
C stomer req irements mean that the amo nt of prod ct 3 prod ced sho ld be related to the
amo nt of prod ct 2 prod ced. Over a week approximately twice as many nits of prod ct 2
sho ld be prod ced as prod ct 3.
Ass ming a working week 35 ho rs long form late the problem of how to man fact re these
prod cts as a linear program.
x
ùssentially we are interested in the amo nt prod ced on each machine. Hence let:
Note here that as prod ct 1 m st be processed on both machines X and Y we do not define y1.
3Y floor space
x2 + y2 = 2(x3 + y3)
Note here that as this is only an approximate (±5% say) constraint we might do better to express
this constraint as
3Y available time
A
c
A company is planning its prod ction sched le over the next six months (it is c rrently the end
of month 2). The demand (in nits) for its prod ct over that timescale is as shown below:
Month 3 4 5 6 7 8
Demand 5000 6000 6500 7000 8000 9500
The company c rrently has in stock: 1000 nits which were prod ced in month 2; 2000 nits
which were prod ced in month 1; 500 nits which were prod ced in month 0.
The company can only prod ce p to 6000 nits per month and the managing director has stated
that stocks m st be b ilt p to help meet demand in months 5, 6, 7 and 8. ùach nit prod ced
costs £15 and the cost of holding stock is estimated to be £0.75 per nit per month (based pon
the stock held at the beginning of each month).
The company has a major problem with deterioration of stock in that the stock inspection which
takes place at the end of each month reg larly identifies r ined stock (costing the company £25
per nit). lt is estimated that, on average, the stock inspection at the end of month t will show
that 11% of the nits in stock which were prod ced in month t are r ined; 47% of the nits in
stock which were prod ced in month t-1 are r ined; 100% of the nits in stock which were
prod ced in month t-2 are r ined. The stock inspection for month 2 is j st abo t to take place.
The company wants a prod ction plan for the next six months that avoids stocko ts. ¦orm late
their problem as a linear program.
Ôeca se of the stock deterioration problem the managing director is thinking of directing that
c stomers sho ld always be s pplied with the oldest stock available. How wo ld this affect yo r
form lation of the problem?
x
Let
lit be the n mber of nits in stock at the
of month t which were prod ced in month i (i=t,t-
1,t-2)
xit be the n mber of nits in stock at the
of month t which were prod ced in month i
(i=t-1,t-2)
dit be the demand in month t met from nits prod ced in month i (i=t,t-1,t-2)
Pt <= 6000
l22 = 1000
l12 = 2000
l02 = 500
xt-1,t = 0.89lt-1,t-1
xt-2,t = 0.53lt-2,t-1
3Y inventory contin ity eq ation where we we can meet demand in month t from
prod ction in month t. Let t represent the (known) demand for the prod ct in month t
(t=3,4,...,8) then
and we have
lt,t = 0 + Pt - dt,t
where
3Y no stocko ts
A
Note beca se we are told to form late this problem as a linear program we ass me all variables
are fractional - in reality they are likely to be q ite large and so this is a reasonable
approximation to make (also a problem occ rs with finding integer val es which satisfy (for
example) xt-1,t=0.89lt-1,t-1 nless this is ass med).
lf we want to ens re that demand is met from the oldest stock first then we can concl de that this
is
ass med in the n merical sol tion to o r form lation of the problem since (plainly) it
worsens the objective to age stock nnecessarily and so in minimising costs we will
a tomatically s pply (via the dit variables) the oldest stock first to satisfy demand (altho gh the
managing director needs to the employees to iss e the oldest stock first).
c
A company assembles fo r prod cts (1, 2, 3, 4) from delivered components. The profit per nit
for each prod ct (1, 2, 3, 4) is £10, £15, £22 and £17 respectively. The maxim m demand in the
next week for each prod ct (1, 2, 3, 4) is 50, 60, 85 and 70 nits respectively.
There are three stages (A, Ô, C) in the man al assembly of each prod ct and the man-ho rs
needed for each stage per nit of prod ct are shown below:
Product
1 2 3 4
Stage A 2 2 1 1
B 2 4 1 2
C 3 6 1 5
The nominal time available in the next week for assembly at each stage (A, Ô, C) is 160, 200 and
80 man-ho rs respectively.
lt is possible to vary the man-ho rs spent on assembly at each stage s ch that workers previo sly
employed on stage Ô assembly co ld spend p to 20% of their time on stage A assembly and
workers previo sly employed on stage C assembly co ld spend p to 30% of their time on stage
A assembly.
Prod ction constraints also req ire that the ratio (prod ct 1 nits assembled)/(prod ct 4 nits
assembled) m st lie between 0.9 and 1.15.
¦orm late the problem of deciding how m ch to prod ce next week as a linear program.
x
Let
3Y maxim m demand
x1 <= 50
x2 <= 60
x3 <= 85
x4 <= 70
3Y ratio
3Y work-time
A
Note we neglect the fact that the xi variables sho ld be integer beca se we are told to form late
the problem as an LP.
c
A company makes three prod cts and has available 4 workstations. The prod ction time (in
min tes) per nit prod ced varies from workstation to workstation (d e to different manning
levels) as shown below:
Workstation
1 2 3 4
Product 1 5 7 4 10
2 6 12 8 15
3 13 14 9 17
ximilarly the profit (£) contrib tion (contrib tion to fixed costs) per nit varies from workstation
to workstation as below
Workstation
1 2 3 4
Product 1 10 8 6 9
2 18 20 15 17
3 15 16 13 17
lf, one week, there are 35 working ho rs available at each workstation how m ch of each
prod ct sho ld be prod ced given that we need at least 100 nits of prod ct 1, 150 nits of
prod ct 2 and 100 nits of prod ct 3. ¦orm late this problem as an LP.
x
At first sight we are trying to decide how m ch of each prod ct to make. However on closer
inspection it is clear that we need to decide how m ch of each prod ct to make at each
workstation. Hence let
Altho gh (strictly) all the xij variables sho ld be integer they are likely to be q ite large and so
we let them take fractional val es and ignore any fractional parts in the n merical sol tion. Note
too that the q estion explicitly asks s to form late the problem as an LP rather than as an lP.
e first form late each constraint in words and then in a mathematical way.
3Y limit on the n mber of min tes available each week for each workstation
A
maximise
10x11 + 8x12 + 6x13 + 9x14 + 18x21 + 20x22 + 15x23 + 17x24 + 15x31 + 16x32 + 13x33 + 17x34
Consider the prod ction of tin cans which are stamped from metal sheets. A can consists of a
main body and two ends,. e have 4 possible stamping patterns (involving 2 different types
(sizes) of metal sheet). as shown below
Pattern
1 2 3 4
Type of sheet used 1 2 1 1
Number of main bodies 1 4 2 0
Number of ends 7 4 3 9
Amount of scrap s1 s2 s3
s4
Time to stamp (hours) t1 t2 t3
t4
Note here that the si (i=1,2,3,4) and the ti (i=1,2,3,4) are
variables b t constants (which have
a known val e). Often in form lating LP's it is easier to se a symbol for a n mber rather than
write o t the n mber in f ll every time it occ rs in a constraint or in the objective f nction.
Let P be the profit obtained from selling one can, C be the cost per nit of scrap, T be the total
n mber of ho rs available per week, L1 be the n mber of metal sheets of type 1 which are
available for stamping per week and L2 be the n mber of metal sheets of type 2 which are
available for stamping per week.
At the start of the week there is nothing in stock. ùach ( n sed) main body in stock at the end of
the week inc rs a stock-holding cost of c1. ximilarly each ( n sed) end in stock at the end of the
week inc rs a stock-holding cost of c2. Ass me that all cans prod ced one week are sold that
week.
Let
Note xi >= 0 i=1,2,3,4 and y >= 0 and again we ass me that the xi and y are large eno gh for
fractional val es not to be significant.
3Y time available
3Y sheet availability
x1 + x3 + x4 <= L1 (sheet 1)
x2 <= L2 (sheet 2)
A
maximise
reven e - cost of scrap - n sed main bodies stock - holding cost - n sed ends stock - holding
cost
i.e. maximise
Py - C(s1x1 + s2x2 + s3x3 + s4x4) - c1(x1 + 4x2 + 2x3 - y) - c2((7x1 + 4x2 + 3x3 + 9x4) - 2y)
As noted above this form lation of the problem is not an LP - however it is relatively easy (for
this p
problem) to t rn it into an LP by replacing the y = min[,] non-linear eq ation by
linear eq ations.
y = min[ (7x1+4x2+3x3+9x4)/2,
(x1+4x2+2x3) ] (A)
(which are both linear constraints) then we do have an LP and in the p sol tion of this LP
either:
3Y constraint (Ô) or constraint (C) is satisfied with eq ality, in which case constraint (A) is
also satisfied with eq ality; or
3Y neither constraint (Ô) nor constraint (C) is satisfied with eq ality i.e. y <
(7x1+4x2+3x3+9x4 )/2
y < (x1+4x2+2x3) - b t in this case we can increase y (witho t
changing any xi val es), increasing the objective f nction (ass ming P + c1 + 2c2 >0) and
contradicting the statement (above) that we already had the optimal sol tion.
Hence case (b) cannot occ r and so case (a) is valid - replacing constraint (A) by constraints (Ô)
and (C) generates a valid LP form lation of the problem.
Note that this problem ill strates that even if o r initial form lation of the problem is non-linear
we may be able to transform it into an LP.
Note too that it is relatively easy to extend the LP form lation of the problem to cope with the
sit ation where can bodies/ends n sed at the end of one week are available for prod ction the
following week.
A company is prod cing a prod ct which req ires, at the final assembly stage, three parts. These
three parts can be prod ced by two different departments as detailed below.
One week, 1050 finished (assembled) prod cts are needed (b t p to 1200 can be prod ced if
necessary). lf department 1 has 100 working ho rs available, b t department 2 has 110 working
ho rs available, form late the problem of minimising the cost of prod cing the finished
(assembled) prod cts needed this week as an LP, s bject to the constraint that limited storage
space means that a total of only 200 nassembled parts (of all types) can be stored at the end of
the week.
Note: beca se of the way prod ction is organised in the two departments it is not possible to
prod ce, for example, only one or two parts in each department, e.g. one ho r of working in
department 1 prod ces 7 part 1 nits, 6 part 2 nits and 9 part 3 nits and this cannot be altered.
e need to decide the amo nt of time given over to the prod ction of parts in each department
(since we, obvio sly, may not make se of all the available working time) and also to decide the
total n mber of finished (assembled) prod cts made. Hence let:
where xi >= 0 i=1,2 and y >= 0 and (as is s al) we ass me that any fractional parts in the
variables in the n merical sol tion of the LP are not significant.
3Y working ho rs available
x1 <= 100
x2 <= 110
3Y prod ction constraints relating the ho rs worked to the n mber of assembled prod cts
e prod ce (7x1 + 6x2) part 1 nits, (6x1 + 11x2) part 2 nits and (9x1 + 5x2) part 3 nits. Now to
ens re that the n mber of assembled prod cts prod ced is exactly y we need at least y part 1
nits, at least y part 2 nits and at least y part 3 nits. Hence we have the three constraints
3Y the total n mber of parts (of all types) prod ced is (7x1 + 6x2) + (6x1 + 11x2) + (9x1 +
5x2) = 22x1 + 22x2. xince we prod ce exactly y assembled prod cts the n mber of parts
left over at the end of the week is (22x1 + 22x2) - 3y and hence the constraint relating to
the limited storage space is given by
A
Obvio s extensions to this problem involve increasing (from the c rrent val e of 3) the n mber
of parts needed for the finished prod ct and changing the ratio of parts sed in a finished prod ct
from its c rrent val e of 1:1:1.