Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
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.
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
Truck
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.
profit = 112
(6,4)
profit = 152
(8,0)
profit = 128
Graphical solution
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
Convert to a system of equations by introducing slack variables to turn the constraints into
equations, and rewriting the objective function in standard form.
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
Objective Function
Lathe
Assembler
P 16x 14y = 0
Introduce slack variables
2x + y + s1 = 16
2x + 3y + s2 = 24
Simplex tableau
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
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
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
s1
s2
RHS
Min ratio
-9
-10
-6
0
0
2
6
3
6
4
2
1
0
0
1
3
8
s1
s2
RHS
Min ratio
-2.333
7.3333
3.3333
10
0
0
0.6667
2
1
0
1.3333
-6
0.3333
-2
0
1
1
2
s1
s2
RHS
0.3333
1.1667
12.333
0
0
0
1
1
0
3.3333
-3
1
-1
-0.333
0.5
0.3333
1
Pivot 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.
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 = 6x + 4y + 10z
subject to
2x + 5y + 4z 60
2y + z 100
2x + 4y + 2z 70
4x + 3y + 2z 180
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
s t u rhs
4 0 0 1
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 1 15
1 6
0 2
0 0
0 2
0 4
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
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