0% found this document useful (0 votes)
9 views

Linear Optimisation

Uploaded by

james.flanagan
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Linear Optimisation

Uploaded by

james.flanagan
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 42

Linear Optimisation

Feasible Regions
• A feasible region is a region defined by simultaneous inequalities.

• It consists of those points (𝑥, 𝑦) which satisfy several inequalities at


the same time.

• Sketch the region defined by each inequality in turn. The intersection


of all these individual regions is the feasible region
E.g. – Sketching a Feasible Region
Sketch the feasible region defined by:

𝑥 + 2𝑦 ≤ 12
−𝑥 + 𝑦 ≤ 3
𝑥 ≥ 0, 𝑦≥0

• Step 1: Ignore the inequality signs and find the point of intersection of each line

• Step 2:Find an additional point on each line and hence sketch both lines

• Step 3: Shade in the feasible region, paying attention to the direction of the inequality sign.
o “Less than” implies we shade below the line
o “Greater than” implies we shade above the line
o “Equals to” implies we include the boundary in our feasible region
𝑥 + 2𝑦 ≤ 12
−𝑥 + 𝑦 ≤ 3

• Check as an exercise that the


point of intersection of these
lines is: (2,5)

• Let x = 0 and y = 0 to find other


points on each line and plot
Objective Functions
• The Objective Function is a mathematical expression we want to
optimise (i.e. maximise or minimise)

• A linear objective function has the form 𝒂𝒙 + 𝒃𝒚

• Constraints often include 𝑥 ≥ 0 and 𝑦 ≥ 0 (called non-negativity


constraints)
How to solve a linear programming problem
1. Sketch the Feasible Region
2. Identify the corners of the feasible region and find their co-
ordinates
3. Evaluate the objective function at these coordinates
4. Choose the coordinates which maximise or minimise the function

Note: It is possible for a system to have no solution or infinitely many


solutions. This generally occurs when the feasible region is unbounded
E.g. – Maximising an objective function
Maximise 3𝑥 + 5𝑦 subject to the following constraints:

𝑥 + 2𝑦 ≤ 10
3𝑥 + 𝑦 ≤ 10
𝑥 ≥ 0, 𝑦≥0

Step 1 - Sketch the Feasible Region

• Check via simultaneous equations that the point of intersection is (2,4)

10
• Check that the y-axis crossing is at (0,5) and the x-axis crossing is at ( , 0)
3
• The corners are at:

10
2,4 , 0,5 , ,0
3

• We evaluate 3𝑥 + 5𝑦 at each of these


points in turn, and get:

26, 25, 10

Hence, 𝑥, 𝑦 = 2,4 maximises the


function.
E.g. - Practical Applications
• A manufacturer produces two goods, A and B. Production costs for A
and B are 6 euro and 3 euro each, respectively. Selling prices are 7
euro and 4 euro respectively

• Transport costs are 20 cents and 30 cents each, respectively.


Maximum weekly production costs are limited to 2,700 euro.
Maximum weekly transport costs are limited to 120 euro.

• How should the manufacturer arrange production to maximise profit?


• Suppose we produce 𝒙 units of A and 𝒚 units of B.

• The unit profit on A is (7 − 6) = 1


• The unit profit on B is 4 − 3 = 1

𝑃𝑟𝑜𝑓𝑖𝑡 = 1𝑥 + 1𝑦
• Total production cost

20𝑥 + 30𝑦 ≤ 12,000


6𝑥 + 3𝑦 ≤ 2,700

Assume also we can’t deal in negative quantities of A and B, so 𝑥 ≥ 0 𝑎𝑛𝑑 𝑦 ≥ 0


So our task is to maximise:

𝑃𝑟𝑜𝑓𝑖𝑡 = 1𝑥 + 1𝑦

Over the feasible region defined by:

20𝑥 + 30𝑦 ≤ 12,000


6𝑥 + 3𝑦 ≤ 2,700
𝑥 ≥ 0, 𝑦≥0
• First let’s deal with the
simultaneous equations:

20𝑥 + 30𝑦 = 12,000


6𝑥 + 3𝑦 = 2,700

• Solving these yields a point of


intersection of (375,150)

• We also have axis crossings at


(0, 400) and at (450, 0)
• So the corners of our feasible region are:

0, 0 , 0, 400 , 450, 0 , (375, 150)

• Substituting these into 1𝑥 + 1𝑦 yields:

0, 400, 450, 525

• Hence, 𝑥, 𝑦 = 375, 150 maximises the profit function

• i.e. we must sell 375 units of A and 150 units of B to attain the max profit of 525
The Simplex Method
As an alternative to the graphical method (which can be time consuming), we may use the simplex method,
which has the following steps

1. Convert each inequality in the set of constraints to an equation by adding slack variables.
2. Create the initial simplex tableau.
3. Locate the most negative entry in the bottom row. The column for this entry is called the entering
column. (If ties occur, any of the tied entries can be used to determine the entering column).
4. Form the ratios of the entries in the “b-column” with their corresponding positive entries in the entering
column. The departing row corresponds to the smallest nonnegative ratio (If all entries in the entering
column are 0 or negative, then there is no maximum solution. For ties, choose either entry). The entry in
the departing row and the entering column is called the pivot.
5. Use elementary row operations so that the pivot is 1, and all other entries in the entering column are 0.
This process is called pivoting.
6. If all entries in the bottom row are zero or positive, this is the final tableau. If not, go back to Step 3.
7. If you obtain a final tableau, then the linear programming problem has a maximum solution, which is
given by the entry in the lower-right corner of the tableau
Simplex Method – Worked Example
• Suppose we have an objective function 𝑍 = 40𝑥1 + 30𝑥2 and that the constraints are given by:

𝑥1 + 𝑥2 ≤ 12
2𝑥1 + 𝑥2 ≤ 16
𝑥1 ≥ 0, 𝑥2 ≥ 0

• Step 1 – we add a slack variable to each inequality to convert to an equation. We also rewrite the
objective function as an equation:

−40x1 − 30x2 + Z = 0
x1 + x2 + y1 = 12
2𝑥1 + 𝑥2 + 𝑦2 = 16

• We call 𝑦1 and 𝑦2 the slack variables, they serve to bring the inequalities up to equations.
• Step 2 – We construct the initial Simplex Tableau by inputting the coefficients into a matrix

𝐱𝟏 𝐱𝟐 𝐲𝟏 𝐲𝟐 𝐙
1 1 1 0 0 12
2 1 0 1 0 16
−40 −30 0 0 1 0

• Step 3 – Identify the column with the largest negative entry (the pivot column). This is column 1,
with an entry of −40

• Step 4 – Divide the entries in the final column by the entries in the pivot column, excluding the
entries in the final row, yielding 12/1 = 12 and 16/2 = 8. The row with the smallest quotient is
identified to get the pivot row. Thus row 2 becomes the pivot row. The intersection of the pivot
row and the pivot column gives the pivot element, i.e. 2 (which is in column 1, row 2)
• Step 5 – perform pivoting to ensure all other entries in the pivot
column are 0

𝐱𝟏 𝐱𝟐 𝐲𝟏 𝐲𝟐 𝐙
1 1 1 0 0 12
2 1 0 1 0 16
−40 −30 0 0 1 0

𝑅
• Divide 𝑟𝑜𝑤 2 by 2 ( 2 )
2
• Subtract 𝑟𝑜𝑤 2 from 𝑟𝑜𝑤 1 (𝑅1 = 𝑅1 − 𝑅2 )
• Add 40 𝑡𝑖𝑚𝑒𝑠 𝑟𝑜𝑤 2 𝑡𝑜 𝑟𝑜𝑤 3 (𝑅3 = 𝑅3 + 40𝑅2 )

𝐱𝟏 𝐱 𝟐 𝐲𝟏 𝐲𝟐 𝐙
1 1
0 1 − 0 4
2 2
1 1
1 0 0 8
2 2
0 −10 0 20 1 320
• Step 6 – Check if the last row has
negative entries. If not then we are
done and we have an optimal
solution. If there are negative
entries then we must return to step
3 and repeat the process. Our
matrix has a −10 in the final row,
so we need to repeat the process,
yielding:

𝐱𝟏 𝐱𝟐 𝐲𝟏 𝐲𝟐 𝐙
0 1 2 −1 0 8
1 0 −1 1 0 4
0 0 20 10 1 400
𝐱𝟏 𝐱𝟐 𝐲𝟏 𝐲𝟐 𝐙
0 1 2 −1 0 8
1 0 −1 1 0 4
0 0 20 10 1 400

• Rewriting the final row yields 𝑍 = 400 − 20𝑦1 − 10𝑦2

• Thus 400 is the highest possible value of 𝑍 under the given constraints, achieved when
both 𝑦1 and 𝑦2 are 0.

• When 𝑥1 = 4 and 𝑥2 = 8 then 𝑍 = 400

• Thus our optimal solution is 𝑥1 , 𝑥2 = (4, 8)


Minimisation Problems
• So far our examples have dealt with Maximisation, i.e. finding a set of
inputs which yield the maximum value of the objective function
under the given constraints.

• However, consider instead a scenario where we want to minimise


rather than maximise.

• There is a simple trick that makes this very easy! If we can convert a
minimisation problem to its related maximisation problem then we
can apply the simplex method as before.
E.g.
• Consider the following minimisation problem:

𝑊 = 3𝑥1 + 3𝑥2

2𝑥1 + 𝑥2 ≥ 4
𝑥1 + 2𝑥2 ≥ 4
𝑥1 ≥ 0, 𝑥2 ≥ 0

Notice how we have moved from ≤ to ≥ signs here.


• Let’s try to visualize the
problem

• We want the region of the


plane that lies above both
lines, so we need the point of
intersection (4/3, 4/3)

• We also observe the non-


negativity conditions
• The first step will be to convert our inequalities to a matrix
representation:

2𝑥1 + 𝑥2 = 4
𝑥1 + 2𝑥2 = 4
𝑊 = 3𝑥1 + 3𝑥2

2 1 4
1 2 4
3 3 0
• The next step will be to transpose our matrix, so that the first row of the
original matrix becomes the first column of its transpose, etc:

2 1 4
1 2 4
3 3 0

Becomes:

2 1 3
1 2 3
4 4 0
• The related maximisation problem is known as the “dual” and is
written:

2𝑦1 + 𝑦2 ≤ 3
𝑦1 + 2𝑦2 ≤ 3
𝑊 = 4𝑦1 + 4𝑦2

• Writing this as a simplex tableau we get:


y1 y2 s1 s2 w RHS
2 1 1 0 0 3
1 2 0 1 0 3
-4 -4 0 0 1 0
y1 y2 s1 s2 w RHS
1 0.5 0.5 0 0 1.5
0 1.5 -0.5 1 0 1.5
0 -2 2 0 1 6

Hence row 1 has the smallest quotient and so becomes our pivot row.

The 2 in row 1, column 1 becomes our pivot entry


y1 y2 s1 s2 w RHS
1 0 0.666667 -0.33333 0 1
0 1 -0.33333 0.666667 0 1
0 0 1.333333 1.333333 1 8

• So the optimum is ?
Sensitivity Analysis
• Sometimes we may wish to investigate how our solution might
change for a small change in the initial conditions of our problem.

• We essentially carry out the same operations, but allow for a change
of ∆
Worked Example
Maximise:

7𝐴 + 4𝐵

Subject to:

𝑃𝑟𝑜𝑑𝑢𝑐𝑡𝑖𝑜𝑛: 6𝐴 + 3𝐵 ≤ 2700
𝑇𝑟𝑎𝑛𝑠𝑝𝑜𝑟𝑡: 2𝐴 + 3𝐵 ≤ 1200

This yields the final tableau:

𝐵𝑎𝑠𝑖𝑐 𝑉𝑎𝑟𝑖𝑎𝑏𝑙𝑒𝑠 𝐴 𝐵 𝑠1 𝑠2 𝑅𝐻𝑆


𝐴 1 0 1/4 −1/4 375
𝐵 0 1 −1/6 1/2 150
𝑍 0 0 13/12 1/4 3225
𝐵𝑎𝑠𝑖𝑐 𝑉𝑎𝑟𝑖𝑎𝑏𝑙𝑒𝑠 𝐴 𝐵 𝑠1 𝑠2 𝑅𝐻𝑆
𝐴 1 0 1/4 −1/4 375
𝐵 0 1 −1/6 1/2 150
𝑍 0 0 13/12 1/4 3225

In what range can the selling price of 𝐴 vary without changing the optimal
basis?
𝐵𝑎𝑠𝑖𝑐 𝑉𝑎𝑟𝑖𝑎𝑏𝑙𝑒𝑠 𝐴 𝐵 𝑠1 𝑠2 𝑅𝐻𝑆
𝑠1 6 3 1 0 2,700
𝑠2 2 3 0 1 1,200
𝑍 −7 − ∆ −4 0 0 0
𝐵𝑎𝑠𝑖𝑐 𝑉𝑎𝑟𝑖𝑎𝑏𝑙𝑒𝑠 𝐴 𝐵 𝑠1 𝑠2 𝑅𝐻𝑆
𝑠1 6 3 1 0 2,700
𝑠2 2 3 0 1 1,200
𝑍 −7 − ∆ −4 0 0 0
1
𝑅1 = ∗ 𝑅1
6
𝐵𝑎𝑠𝑖𝑐 𝑉𝑎𝑟𝑖𝑎𝑏𝑙𝑒𝑠 𝐴 𝐵 𝑠1 𝑠2 𝑅𝐻𝑆
𝑠1 1 1/2 1/6 0 450
𝑠2 2 3 0 1 1,200
𝑍 −7 − ∆ −4 0 0 0
𝐵𝑎𝑠𝑖𝑐 𝑉𝑎𝑟𝑖𝑎𝑏𝑙𝑒𝑠 𝐴 𝐵 𝑠1 𝑠2 𝑅𝐻𝑆
𝐴 1 1/2 1/6 0 450
𝑠2 2 3 0 1 1,200
𝑍 −7 − ∆ −4 0 0 0

𝑅2 = 𝑅2 − 2𝑅1
𝑅3 = 𝑅3 + 7 + ∆ 𝑅1
𝐵𝑎𝑠𝑖𝑐 𝑉𝑎𝑟𝑖𝑎𝑏𝑙𝑒𝑠 𝐴 𝐵 𝑠1 𝑠2 𝑅𝐻𝑆
𝐴 1 1/2 1/6 0 450
𝑠2 0 2 −1/3 1 300
1 1 7 7
𝑍 0 − + ∆ + ∆ 0 3,150 + 450∆
2 2 6 6
𝐵𝑎𝑠𝑖𝑐 𝑉𝑎𝑟𝑖𝑎𝑏𝑙𝑒𝑠 𝐴 𝐵 𝑠1 𝑠2 𝑅𝐻𝑆
𝐴 1 1/2 1/6 0 450
𝑠2 0 2 −1/3 1 300
1 1 7 7
𝑍 0 − + ∆ + ∆ 0 3,150 + 450∆
2 2 6 6
1
𝑅2 = ∗ 𝑅2
2
𝐵𝑎𝑠𝑖𝑐 𝑉𝑎𝑟𝑖𝑎𝑏𝑙𝑒𝑠 𝐴 𝐵 𝑠1 𝑠2 𝑅𝐻𝑆
𝐴 1 1/2 1/6 0 450
𝐵 0 1 −1/6 1/2 150
1 1 7 7
𝑍 0 − + ∆ + ∆ 0 3,150 + 450∆
2 2 6 6
𝐵𝑎𝑠𝑖𝑐 𝑉𝑎𝑟𝑖𝑎𝑏𝑙𝑒𝑠 𝐴 𝐵 𝑠1 𝑠2 𝑅𝐻𝑆
𝐴 1 1/2 1/6 0 450
𝐵 0 1 −1/6 1/2 150
1 1 7 7
𝑍 0 − + ∆ + ∆ 0 3,150 + 450∆
2 2 6 6
1
𝑅1 = 𝑅1 − 𝑅2
2
1 1
𝑅3 = 𝑅3 + − ∆ 𝑅2
2 2

𝐵𝑎𝑠𝑖𝑐 𝑉𝑎𝑟𝑖𝑎𝑏𝑙𝑒𝑠 𝐴 𝐵 𝑠1 𝑠2 𝑅𝐻𝑆


𝐴 1 0 1/4 −1/4 375
𝐵 0 1 −1/6 1/2 150
13 1 1 1
𝑍 0 0 + ∆ − ∆ 3,225 + 375∆
12 4 4 4
𝐵𝑎𝑠𝑖𝑐 𝑉𝑎𝑟𝑖𝑎𝑏𝑙𝑒𝑠 𝐴 𝐵 𝑠1 𝑠2 𝑅𝐻𝑆
𝐴 1 0 1/4 −1/4 375
𝐵 0 1 −1/6 1/2 150
13 1 1 1
𝑍 0 0 + ∆ − ∆ 3,225 + 375∆
12 4 4 4

Compare this with the solution provided initially:

𝐵𝑎𝑠𝑖𝑐 𝑉𝑎𝑟𝑖𝑎𝑏𝑙𝑒𝑠 𝐴 𝐵 𝑠1 𝑠2 𝑅𝐻𝑆


𝐴 1 0 1/4 −1/4 375
𝐵 0 1 −1/6 1/2 150
𝑍 0 0 13/12 1/4 3225

13 1 1 1
Optimal if: + ∆ ≥ 0 and − ∆ ≥0
12 4 4 4
13 1 1 1
Optimal if: 12 + 4 ∆ ≥ 0 and 4 − 4 ∆ ≥ 0

Take the first inequality:

1 13
∆≥−
4 12
13
∆≥−
3

Take the second inequality:

1 1
∆≤
4 4

∆≤1

13
Putting both together we get: − ≤ ∆≤1
3
Alternative Method
Adjust the final tableau thus:

𝐵𝑎𝑠𝑖𝑐 𝑉𝑎𝑟𝑖𝑎𝑏𝑙𝑒𝑠 𝐴 𝐵 𝑠1 𝑠2 𝑅𝐻𝑆


𝐴 1 0 1/4 −1/4 375
𝐵 0 1 −1/6 1/2 150
𝑍 −∆ 0 13/12 1/4 3225

𝑅3 = 𝑅3 + ∆𝑅1

𝐵𝑎𝑠𝑖𝑐 𝑉𝑎𝑟𝑖𝑎𝑏𝑙𝑒𝑠 𝐴 𝐵 𝑠1 𝑠2 𝑅𝐻𝑆


𝐴 1 0 1/4 −1/4 375
𝐵 0 1 −1/6 1/2 150
13 1 1 1
𝑍 0 0 + ∆ − ∆ 3,225 + 375∆
12 4 4 4

And we should get the same answer as before


Worked Example 2
In what range can the production cost vary without changing the capacity?

𝐵𝑎𝑠𝑖𝑐 𝑉𝑎𝑟𝑖𝑎𝑏𝑙𝑒𝑠 𝐴 𝐵 𝑠1 𝑠2 𝑅𝐻𝑆


𝑠1 6 3 1 0 2,700 + ∆
𝑠2 2 3 0 1 1,200
𝑍 −7 −4 0 0 0
1
𝑅1 = ∗ 𝑅1
6
𝐵𝑎𝑠𝑖𝑐 𝑉𝑎𝑟𝑖𝑎𝑏𝑙𝑒𝑠 𝐴 𝐵 𝑠1 𝑠2 𝑅𝐻𝑆
𝐴 1 1/2 1/6 0 450 + ∆/6
𝑠2 2 3 0 1 1,200
𝑍 −7 −4 0 0 0
Worked Example 2
𝐵𝑎𝑠𝑖𝑐 𝑉𝑎𝑟𝑖𝑎𝑏𝑙𝑒𝑠 𝐴 𝐵 𝑠1 𝑠2 𝑅𝐻𝑆
𝐴 1 1/2 1/6 0 450 + ∆/6
𝑠2 2 3 0 1 1,200
𝑍 −7 −4 0 0 0
𝑅2 = 𝑅2 − 2𝑅1
𝑅3 = 𝑅3 + 7𝑅1
𝐵𝑎𝑠𝑖𝑐 𝑉𝑎𝑟𝑖𝑎𝑏𝑙𝑒𝑠 𝐴 𝐵 𝑠1 𝑠2 𝑅𝐻𝑆
𝐴 1 1/2 1/6 0 450 + ∆/6
𝑠2 0 2 −1/3 1 300 − ∆/3
𝑍 0 −1/2 7/6 0 3150 + 7∆/6
Worked Example 2
𝐵𝑎𝑠𝑖𝑐 𝑉𝑎𝑟𝑖𝑎𝑏𝑙𝑒𝑠 𝐴 𝐵 𝑠1 𝑠2 𝑅𝐻𝑆
𝐴 1 1/2 1/6 0 450 + ∆/6
𝑠2 0 2 −1/3 1 300 − ∆/3
𝑍 0 −1/2 7/6 0 3150 + 7∆/6

1
𝑅2 = ∗ 𝑅2
2
𝐵𝑎𝑠𝑖𝑐 𝑉𝑎𝑟𝑖𝑎𝑏𝑙𝑒𝑠 𝐴 𝐵 𝑠1 𝑠2 𝑅𝐻𝑆
𝐴 1 1/2 1/6 0 450 + ∆/6
𝐵 0 1 −1/6 1/2 150 − ∆/6
𝑍 0 −1/2 7/6 0 3150 + 7∆/6
Worked Example 2
𝐵𝑎𝑠𝑖𝑐 𝑉𝑎𝑟𝑖𝑎𝑏𝑙𝑒𝑠 𝐴 𝐵 𝑠1 𝑠2 𝑅𝐻𝑆
𝐴 1 1/2 1/6 0 450 + ∆/6
𝐵 0 1 −1/6 1/2 150 − ∆/6
𝑍 0 −1/2 7/6 0 3150 + 7∆/6

1
𝑅1 = 𝑅1 − 𝑅2
2
1
𝑅3 = 𝑅3 + 𝑅2
2
𝐵𝑎𝑠𝑖𝑐 𝑉𝑎𝑟𝑖𝑎𝑏𝑙𝑒𝑠 𝐴 𝐵 𝑠1 𝑠2 𝑅𝐻𝑆
𝐴 1 0 1/4 −1/4 375 + ∆/4
𝐵 0 1 −1/6 1/2 150 − ∆/6
𝑍 0 0 13/12 1/4 3225 + 13∆/12
Worked Example 2
𝐵𝑎𝑠𝑖𝑐 𝑉𝑎𝑟𝑖𝑎𝑏𝑙𝑒𝑠 𝐴 𝐵 𝑠1 𝑠2 𝑅𝐻𝑆
𝐴 1 0 1/4 −1/4 375 + ∆/4
𝐵 0 1 −1/6 1/2 150 − ∆/6
𝑍 0 0 13/12 1/4 3225 + 13∆/12

The solution is optimal if:

1
375 + ∆ ≥ 0 ⇒ ∆ ≥ −1,500
4

1
150 − ∆ ≥ 0 ⇒ ∆ ≤ 900
6

Hence:

−1500 ≤ ∆ ≤ 900

You might also like