Linear Programming Background

advertisement
Linear Programming
Background
Linear programming deals with problems such as maximising profits, minimising costs or ensuring you make the best use of
available resources. From an applications perspective, mathematical (and therefore, linear) programming is an optimisation tool,
which allows the rationalisation of many managerial and/or technological decisions. An important factor for the applicability of the
mathematical programming methodology in various contexts, is the computational difficulty of the analytical models. With the advent
of modern computing technology, effective and efficient algorithmic procedures can provide a systematic and fast solution to these
models.
The seeds of linear programming were sown during World War II when the military supplies and personnel had to be moved
efficiently. Although linear programming problems can be very complicated, which is to be expected since they are real-world
problems, the principles can be understood by starting with simple problems that can be solved with GCSE algebra. Twodimensional Linear programming can be solved graphically. Problems with more than two variables (as is the case for most real
world problems) can be solved by using a technique called the simplex method (Wood and Dantzig 1949, Dantzig 1949). The
Simplex algorithm was one of the first Mathematical Programming algorithms to be developed and it provides a powerful
computational tool, able to provide fast solutions to very large-scale applications, sometimes including hundreds of thousands of
variables (i.e. decision factors). Its subsequent successful implementation in a series of applications significantly contributed to the
acceptance of the broader field of Operational Research as a scientific approach to decision making. linear optimisation, is the
problem of maximising a linear function over a convex polyhedron.
A Linear Programming problem is a special case of a Mathematical Programming problem. From an analytical perspective, a
mathematical program tries to identify an extreme (i.e., minimum or maximum) point of a function, which furthermore satisfies a set
of constraints. Linear programming is the specialisation of mathematical programming to the case where both, function f , called the
objective function, and the problem constraints are linear. Mathematical (and therefore, linear) programming is an optimisation tool,
which allows the rationalisation of many managerial and/or technological decisions required by contemporary applications. An
important factor for the applicability of the mathematical programming methodology in various contexts, is the computational
tractability of the resulting analytical models. The advent of modern computing technology means that effective and efficient
algorithmic procedures exist to provide a systematic and fast solution to these models. For Linear Programming problems, the
Simplex algorithm provides a powerful computational tool, able to provide fast solutions to very large-scale applications, sometimes
including hundreds of thousands of variables. In fact, the Simplex algorithm was one of the first Mathematical Programming
algorithms to be developed (Wood and Dantzig 1949, George Dantzig, 1947), and its subsequent successful implementation in a
series of applications significantly contributed to the acceptance of the broader field of Operational Research as a scientific approach
to decision making.
Linear programming is now used extensively in business, economics and engineering. An example of an engineering application
would be maximising profit in a factory that manufactures a number of different products from the same raw material using the same
resources. The constraints would be decided by the amounts of raw materials available. In the field of business and management,
linear programming is a method for solving complex problems in the two main areas of product mix (where the technique may be
used where it is difficult to decide just how much of each variable to use in order to satisfy certain criteria such as maximising profits
or minimising costs, subject to certain constraints) and distribution of goods.
As with all types of mathematical modelling, the effective application of Linear Programming requires good understanding of the
underlying modelling assumptions, and a pertinent interpretation of the analytical solutions obtained.
Graphical Method for solving problems with two variables
The graphical method for solving linear programming problems in two unknowns is as follows.
1. Define the variables
2. Define the constraints
3. Define the objective function (the function which is to be maximised or minimised)
4. Graph the feasible region.
5. Find the coordinates of the corner points.
6. Substitute the coordinates of the corner points into the objective function to see which gives the
optimal value.
Example:
A small factory produces two types of toys: trucks and bicycles. In the manufacturing process two machines
are used: the lathe and the assembler. The table shows the length of time needed for each toy:
Time on
lathe (hours)
Time on
assembler (hours)
Bicycle
2
2
Truck
1
3
The lathe can be operated for 16 hours a day and there are
two assemblers which can each be used for 12 hours a day.
Each bicycle gives a profit of £16 and each truck gives a
profit of £14. Formulate and solve a linear programming
problem so that the factory maximises its profit.
Think about the simplifying assumptions that have been made. Times are
given to the nearest hour. Costs, and hence profits, remain constant. There
are enough skilled workers to work the machines for the number of hours they
can be used.
Formulate the problem
Let x be number of bicycles made
Let y be number of trucks made.
Objective Function Maximise P = 16x + 14y
Subject to constraints
2x + y ≤ 16 Lathe
2x + 3y ≤ 24 Assembler
x, y ≤ 0
Method 1: Tour of vertices
(0,8)
profit = £112
(6,4)
profit = £152
(8,0)
profit = £128
Graphical solution
Method 2: Profit Line
Draw a line through the origin
parallel
to the gradient of the profit function.
Move this line up the y-axis until it is
just leaving the feasible region –
the point at which it leaves the
feasible region is the optimum value.
Interpret the solution
Optimal solution is to make 6 bicycles and 4 trucks. Profit £152
Formulating a linear Programming in business and management
This is a simplified example will illustrates the way in which a problem relating to business is formulated.
A large sub-contractor machines special parts to order. For one order he has two machines, X and Y
available. Unfortunately, the machines perform more effectively on some jobs than others. Machine Y can do
10 units per hour on contracts from Alpha Ltd., 12 per hour on components from Beater & Co. and 26 per
hour on those from Chester Inc., while Machine X can produce 16, 9 and 10 units per hour respectively.
However, this is complicated by certain constraints which are:
Maximum number of units per month of units from Alpha, Beater and Chester are 6,500, 4,440 and 800 per
month respectively
the machines X and Y are restricted to working a maximum of 260 and 350 hours per month respectively.
The problem is to find how many hours should each machine work to maximise profits. This is answered by
plotting machine Y's hours against machine X's hours using mathematical models for the three suppliers and
then solving these using linear programming.
1. Define the variables
Let the number of hours for machine X be x
Let the number of hours for machine Y be y
2. Define the constraints
The model for Alpha can be found by using the above data as follows:
Machine X can produce 16 units per hour so if it works x hours the total is 16x hours.
Machine Y can produce 10 units per hour, so if it works y hours the total is 10y hours.
So the model for Alpha, which cannot exceed 6,500 is: 10y + 16x ≤ 6500
and the model for Beater which cannot exceed 4,400 is: 12y + 9x ≤ 4400.
and the model for Chester which cannot exceed 8,000 is: 26y + 10x ≤ 8000.
3. Define the objective function
A profit model is necessary in order to find the conditions for maximum profit i.e. the optimum number of
hours for X and for Y. In this case, the profits on each machine's output are: X = £40 per hour and Y = £24,
so the total profit is P = 40x + 24y.
Because of the existence of only two variables (x and y) this can be solved by plotting the models on a graph
for the three suppliers and moving the profit model until it reaches the highest point of intersection of the
three supplier lines.
NOTE: With maximisation problems if the feasible region is not bounded, this method can be misleading:
optimal solutions always exist when the feasible region is bounded, but may or may not exist when the
feasible region is unbounded.
An example of a minimisation problem
Sometimes rather than maximising profits, you may be asked to minimise costs. In this case the feasible
region could be unbounded, as can be seen in this example
Minimise C = 3x + 4y
subject to the constraints:
3x - 4y ≤ 12,
x + 2y ≥ 4
x ≥1, y ≥ 0.
The feasible region for this set of constraints is shown on the graph.
The following table shows the value of C at each corner point:
Point C = 3x + 4y
(1, 1.5) 3(1)+4(1.5) = 9 minimum
(4, 0)
3(4)+4(0) = 12
Therefore, the solution is x = 1, y = 1.5, giving the minimum value C = 9.
Simplex Method for Standard Maximisation Problem
To solve a standard maximisation problem using the simplex method, we take the following steps:
•
Convert to a system of equations by introducing slack variables to turn the constraints into
equations, and rewriting the objective function in standard form.
•
Write down the initial tableau.
•
Select the pivot column: Choose the negative number with the largest magnitude in the objective
row. Its column is the pivot column. (If there are two candidates, choose either one.) If all the
numbers in the objective row are zero or positive then you have the optimal solution.
•
Divide each R.H.S. value by the corresponding element in the pivot column - ignore negative ratios
and division by zero, this is called the ratio test. Of these test ratios, choose the smallest one. The
corresponding number in the pivot column is the pivot.
•
If necessary, divide the pivot row by the value of the pivot to make the pivot element one.
•
Add/subtract multiples of the transformed pivot row to/from the other rows to create zeros in the pivot
column
•
Go to Step 3.
Slack Variables
In order to enable problems to be converted into a format that can be dealt with by computer, slack variables
are introduced to change the constraint inequalities into equalities. Each vertex of the feasible region would
then be defined by the intersection of two lines where the variables equal zero.
The Simplex Method
The Simplex Method starts at the origin and systematically moves round all the vertices, increasing the
objective function as it goes, until it reaches the one with the optimal solution. This is easy to visualise on a 2
dimensional problem, but can be generalised to include more variables. Once there are more than two
variables, a graphical approach is no longer appropriate, so we use the simplex tableau, a tabular form of the
algorithm which uses row reduction (remember Gaussian elimination?) to solve the problem.
Other types of problems: Simplex can be adapted to solve a range of problems, such as shortest path
(minimisation), maximum flow (maximisation) and game theory (maximin).
Example: A small factory produces two types of toys: trucks and bicycles. In the manufacturing process two
machines are used: the lathe and the assembler. The lathe can be operated for 16 hours a day and there
are two assemblers which can each be used for 12 hours a day. Each bicycle gives profit of £16 and each
truck gives a profit of £14. Formulate and solve a linear programming problem so that the factory maximises
its profit.
The table shows the length of time needed for each toy:
Lathe
Assembler
Bicycle
2 hours
2 hours
Truck
1 hour
3 hours
Formulate the
problem
Let x be number of bicycles made
Let y be number of trucks made.
Objective Function
Maximise P = 16x + 14y
Subject to constraints:
2x + y < 16
2x + 3y < 24
Graphical solution
Lathe
Assembler
P – 16x – 14y = 0
Introduce slack variables
2x + y + s1 = 16
2x + 3y + s2 = 24
Simplex tableau
Solve the problem
p
Number of
trucks
Number of bicycles
Interpret solution
6x + 6y + 2z ≤ 8
0 -6
1 0.5
0 2
1
0
0
0
1
0
8
0.5
-1
0
16 16/2=8
24 24/2=12
0 128
0
8 8/0.5=16
1
8 8/2=4
0
5
3 152
0 0.75 -0.25
6
1 -0.5
0.5
4
Reading from the tableau
P = £152 x = 6 y = 4
s1 = 0 and s2 = 0
Factory should make 6 bicycles and 4 trucks
each day. Profit £152
Factory should make 6 bicycles and 4 trucks
each day. Profit £152
Maximise P = 9x + 10y + 6z
2x + 3y + 4z ≤ 3
1
0
0
ratio test
By considering vertices
(8, 0) P = 16 X 8 = £128
(6, 4) P= (16 X 6) + (14 X 4) = £152
(0, 8) P = 14 X 8 =£112
Three variable example
Subject to constraints
x y
s1
s2
1 -16 -14
0
0
0 2 1
1
0
0 2 3
0
1
Initial
Tableau
P
x
y
z
s1
s2
RHS
Min ratio
1
-9
-10
-6
0
0
0
0
0
2
6
3
6
4
2
1
0
0
1
3
8
1
P
x
y
z
s1
s2
RHS
Min ratio
1
-2.333
0
7.3333
3.3333
0
10
0
0
0.6667
2
1
0
1.3333
-6
0.3333
-2
0
1
1
2
P
x
y
z
s1
s2
RHS
1
0
0
0.3333
1
1.1667
12.333
0
0
0
1
1
0
3.3333
-3
1
-1
-0.333
0.5
0.3333
1
Pivot 1
1
Pivot 2
Solution:
P = 12⅓ when x = 1, y = ⅓, z = 0
≥ constraints
The simplex algorithm relies on (0,0) being a feasible solution. If it is not, then you add
artificial variables a1, a2, etc. to all ≥ constraints which move us from (0,0) into the feasible
region. You now need surplus (as opposed to slack) variables which are subtracted from
the constraints as they tell us how much greater than the constraint line a point is. Then
introduce a new objective function Q = a1 + a2 + … which you must minimise, since when
Q = 0 you are in the feasible region and you can complete the simplex in the normal
way.
A furniture manufacturer makes square
dining tables, round dining tables and chairs.
Each square table needs £40 of raw materials
and takes 12 hours to make.Each round table
needs £50 of raw materials and takes 14 hours to
make. Each chair needs £40 of raw materials
and takes 16 hours to make. He must make at
least 4 times as many chairs as tables.
There are 500 hours available and £1500 of
raw materials.Each chair makes £40 profit each
square table makes £30 profit and each round
table makes £35 profit
Jo is making raspberry and chocolate cakes
for a charity fair
A raspberry cakes needs 200g of flour and
200g of sugar and 2 eggs
A chocolate cake needs 225g of flour and
150g of sugar and 2 eggs
There are 3Kg of flour, 2.5Kg of sugar and 28
eggs available.
A raspberry cake sells for £2.50 and a chocolate
cake sells for £3.00
A company produces three soft toys, an antelope,
a bear and a cat. For one day's production run it
has available 11 m 2 of fur fabric, 24 m 2 of wool
fabric and 30 glass eyes.
The antelope requires 0.5 m 2 of fur fabric, 2 m 2 of
wool fabric and two eyes. Each sells at a profit of £3.
The bear requires 1 m 2 of fur fabric, 1.5 m 2 of
wool fabric and two eyes. Each sells at a profit of £5.
The cat requires 1 m 2 of fur fabric, 1 m 2 of wool
fabric and two eyes. Each sells at a profit of £2.
Brad makes and sells three types of birdfood
A, B and C.
A contains 4 kg of bird seed, 2 suet blocks and
1 kg of nuts, B contains 5 kg of bird seed, 1 suet
block and 2 kg of nuts and C contains 10 kg of
bird seed, 4 suet blocks and 3 kg of nuts.
Each week Brad has 140 kg of bird seed, 60 suet
blocks and 60 kg of nuts available for the packs.
The profit made on each pack of A, B and C is
£3.50, £3.50 and £6.50 respectively.
A small factory makes 2 types of inflatable boats,
a 2 person and 4 person. Each 2 person boat
requires 0.9 hours in the cutting department and
0.8 hours in the assembly department. Each four
person boat requires 1.8 hours in the cutting
department and 0.5 hours in the assembly department.
The company makes profit of £25 on each 2 person
boat and £40 on each 4 person boat.The maximum
hours available each month in the cutting department
is 864 and the maximum hours available each month
in the assembly department is 672.
Anna is making birthday cards in 2 designs,
flowers and boats, to sell.She has enough card
to make 16 birthday cards but she needs to get
them all made in the next 6 hours. Flower cards
take 30 mins to make and sell for £1.25. Boat
cards take 20 mins to make and sell for £1.40
A manufacturer makes three products X, Y and Z.
They all require resources A, B, C and D which are
in short supply. The table shows the amount of each
resource needed and the profit on each product
A B C D profit
X
20 0 20 40
6
Y
50 20 40 30
4
Z
40 10 20 20 10
available 600 100 700 1800
Fine Foods Ltd buys vegetable oil from two
sources A and B.The oil from A contains
50% olive oil 10% sunflower oil and 40% corn
oil while the oil from B contains 20% olive oil,
60% sunflower oil and 20% corn oil.Fine foods
must make a blend with at least 30% olive oil
and at least 40% sunflower oil.They know that
they can sell up to 35,000 litres of the blended
oil at a profit of 25p per litre.
maximise P = 35x + 30y + 40z
subject to
4x + 10y + 4z ≤ 150
6x + 7y + 8z ≤ 250
x + y − 4z ≤ 0
maximise P = 2.5x + 3y
subject to
8x + 9y ≤ 120
4x + 3y ≤ 50
3x + 2y ≤ 28
maximise P = 3x + 5y + 2z
subject to
x + 2y + 2z ≤ 22
4x + 3y + 2z ≤ 48
x + y + z ≤ 15
maximise P = 3.5x + 3.5y + 6.5z
subject to
4x + 5y + 10z ≤ 140
2x + y + 4z ≤ 60
x + 2y + 3z ≤ 60
maximise P = 25x + 40y
subject to
3x + 6y ≤ 2880
8x + 5y ≤ 6720
maximise P = 1.25x + 1.4y
subject to
x + y ≤ 16
3x + 2y ≤ 36
maximise P = 6x + 4y + 10z
subject to
2x + 5y + 4z ≤ 60
2y + z ≤ 100
2x + 4y + 2z ≤ 70
4x + 3y + 2z ≤ 180
maximise P = 25x + 25y
subject to
2x − y ≤ 0
−x+y≤ 0
x + y ≤ 35
P x
y
1 − 2.5 − 3
1 − 35 − 30 − 40 0 0 0 0
0 4
10
4 1 0 0 150 0
8
9
0 6
7
8 0 1 0 250 0
4
3
P
x
y
0
1
1
z
s t u rhs
−4 0 0 1
0
0
3
2
s
0
1
0
s t u rhs P x
y
z
0 0 0 0 1 − 3.5 − 3.5 − 6.5
5
10
1 0 0 22 0 4
1
4
0 1 0 48 0 2
0
0 0 1 15
1
1
0
1
2
3
x
1 −6
0 2
0 0
0 2
0 4
y
z
− 4 − 10
5
4
2
1
4
2
3
2
s t u v rhs
0
1
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
1
0
60
100
70
180
P x
y s
1 − 25 − 25 0
0 2
−1 1
0 −1
1 0
0
1
1
s t u rhs
0 0 0 0
1 0 0 140
0 1 0 60
0 0 1 60
P x
y s t rhs
P
x
y
1 − 25 − 40 0 0 0
1 − 1.25 − 1.4
0 3
6 1 0 2880
0
1
1
0 8
5 0 1 6720
0
3
2
P
u rhs
0 0
0 120
0 50
0 0 1 28
P x
y
z
1 −3 −5 −2
0 1 2
2
0 4 3
2
1
t
0
0
1
s t rhs
0 0 0
1 0 16
0 1 36
t
0
0
1
u rhs
0 0
0 0
0 0
0 0 1 35
Download