Linear Programming and Excel`s Solver

advertisement
Linear Programming and Excel's Solver
The Problem
FurnCo manufactures desks and chairs. Each desk uses 4 units of wood, and each chair 3
units of wood. A desk contributes £40 to profit and a chair contributes £25. Marketing
restrictions require that the number of chairs produced to be at least twice the number of
desk produced. There are 20 units of wood available.
a) Use Excel's SOLVER to maximise FurnCo's profit
b) Confirm graphically that the solution, to part a, maximises FurnCo's profit.
Setting up the Problem in LP Format
We start by stating the Objective Function: that is, what do we want to maximise; profit in
this case. Then we state all of the constraints of which we are aware that we need to solve
the problem.
Here's my version of the solution:
Maximise 25c + 40d
Subject to 3c + 4d <= 20 (wood constraint ie the maximum amount of wood
available is 20units)
c >= 2d (marketing constraint ie we need to sell twice as many
chairs as desks)
c, d >= 0 (non negativity constraint ie we cannot sell negative
numbers of chairs and desks)
Since this is a relatively simple problem both to model and to solve, the non negativity
constraints can easily be ignored when setting up and solving it. We have found this to be
generally true for small, simple problems.
SOLVER
MS Excel's Help file can give you a good start in terms of understanding what SOLVER is,
what it does and how it works. Here's an extract from the Help File:
Solver is part of a suite of commands sometimes called what-if analysis tools. With Solver,
you can find an optimal value for a formula in one cell - called the target cell - on a
worksheet. Solver works with a group of cells that are related, either directly or indirectly,
to the formula in the target cell. Solver adjusts the values in the changing cells you specify
- called the adjustable cells - to produce the result you specify from the target cell formula.
You can apply constraints to restrict the values Solver can use in the model, and the
constraints can refer to other cells that affect the target cell formula.
Use Solver to determine the maximum or minimum value of one cell by changing other
cells - for example, you can change the amount of your projected advertising budget and
see the affect on your projected profit amount.
Help has examples and discussion that is useful and will get you at least partly able to use
SOLVER. We have to confess, however, that some people will find using SOLVER
difficult. This is not surprising: it's not SOLVER that's the problem, though, but the setting
up of the problem that causes the problem. So, let's work through Sanj's problem and how
we need to set it up so that SOLVER can deal with it.
How to Programme SOLVER
The Problem Itself
The figures in bold red should be recognised as part of the basic information provided by
the question. The wood used column figures will be provided by SOLVER and we have set
them as bold purple figures are: we have put the formula = units of wood per unit *
contribution per unit = wood used for the desk and for the chair (cell E2=B2*C2 and E3
=B3*C3), the values will be provided as part of the solution by SOLVER. Cell E4 is also a
formula that simply evaluates the total amount of wood to be used once we have found the
amount to use on a product by product basis: E4= =E2+E3The units to produce column is
left blank since SOLVER will tell us how many desks and how many chairs we should
make. Finally, the figure in bold blue is the maximum profit that SOLVER finds for us by
multiplying the number of units of each product to make and sell and cell B5 MUST be a
formula: in this case =B2*D2+B3*D3.
It's probably helpful to show all of the functions and formulae we programmed for this
problem:
Using SOLVER
Call up SOLVER
Tools … Solver …
Immediately the SOLVER dialogue box opens … ready for us to fill it in! The following
screenshot shows exactly what we did to solve Sanj's problem: just set up a sheet
EXACTLY like ours and it will work for you!
We simply set the TARGET CELL by pointing SOLVER to it. Equal to means that we tell
SOLVER to find the Maximum value (as in this case), the minimum value (if we were
minimising costs, for example) or setting an exact Value of … if we already knew what the
profit should be but we still didn't know the units of chairs and desks.
Then we set the constraints: what does $B$>=2*$B$2 mean and what does $E$4<=20
mean? If it's not obvious, they are our constraints:
Subject to 3c + 4d <= 20 (wood constraint ie the maximum amount of wood
available is 20units)
c >= 2d (marketing constraint ie we need to sell twice as many
chairs as desks)
as we saw before. However, how to we set the constraints? We click Add and then
complete the dialogue box we then see … one for EACH constraint:
After entering this first constraint, click Add to add another one or click OK to finish.
Now click Solve and whiz and whoosh, the answer is revealed as follows:
To remind you, the figures in bold red are part of the basic information provided by the
question. The bold purple figures are provided as part of the solution by SOLVER. The
figure in bold blue is the maximum profit that SOLVER finds for us.
The above table tells us that we should make and sell
2 desks and 4 chairs (notice that c = 2d)
we use
8 units of wood on the desks and 12 units of wood on the chairs: complying with the
constraint that the maximum amount of wood available is 20 units
the profit is
£25 contribution per chair * 4 chairs + £40 contribution per desk * 2 desks = £180
That's all there is to it!
Graphical Solution
Very briefly, here's the graph!
How to Plot the Lines on the Graph
It's sometimes a problem to work out how to plot the lines on an LP graph using Excel:
here's how to do this one! Set up an area on your sheet as follows:
Now use the "c output" column as your "X" variable, the d output column represents the
"4d + 3c <= 20" constraint and the marketing constraint column represents the "marketing
constraint" constraint! The final screenshot shows you how:
Finally, in case it isn't obvious how we have derived the values for the graph, here is the
entire worksheet that we have now formulated, inlcuding the details of the formulae we
have programmed:
Please note, we haven't plotted the Profit at max d and max c column even though we have
included the calculations and formulae. You might also find this page of use: how to draw
an LP graph it's a PowerPoint Presentation par excellence from yours truly!
© Duncan Williamson
14 December 2002 updated 16 & 17 December 2003
Download