Linear Optimisation
Linear Optimisation
Feasible Regions
• A feasible region is a region defined by simultaneous inequalities.
𝑥 + 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
𝑥 + 2𝑦 ≤ 10
3𝑥 + 𝑦 ≤ 10
𝑥 ≥ 0, 𝑦≥0
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
26, 25, 10
𝑃𝑟𝑜𝑓𝑖𝑡 = 1𝑥 + 1𝑦
• Total production cost
𝑃𝑟𝑜𝑓𝑖𝑡 = 1𝑥 + 1𝑦
• 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
• Thus 400 is the highest possible value of 𝑍 under the given constraints, achieved when
both 𝑦1 and 𝑦2 are 0.
• 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
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
Hence row 1 has the smallest quotient and so becomes our pivot row.
• 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
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
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
1 13
∆≥−
4 12
13
∆≥−
3
1 1
∆≤
4 4
∆≤1
13
Putting both together we get: − ≤ ∆≤1
3
Alternative Method
Adjust the final tableau thus:
𝑅3 = 𝑅3 + ∆𝑅1
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
1
375 + ∆ ≥ 0 ⇒ ∆ ≥ −1,500
4
1
150 − ∆ ≥ 0 ⇒ ∆ ≤ 900
6
Hence:
−1500 ≤ ∆ ≤ 900