Optimisation
Prof. Ogheneruona (Ruona) Diemuodeke
Professor of Energy and Thermofluids Systems
Department of Mechanical Engineering
What is Optimization?
Optimization is the process of finding the best
solution from a set of feasible solutions, given
a set of constraints
Areas of Applications
▪ Common in logistics
▪ Supply chain management
▪ Finance and economics
▪ Engineering, and more.
Department of Mechanical Engineering
Types of Optimization Problems
▪ Linear vs. Nonlinear: Whether relationships in the
problem are linear or non-linear.
▪ Deterministic vs. Stochastic: Whether all inputs are
known with certainty or contain randomness.
▪ Static vs. Dynamic: Whether the optimisation is
performed once or continuously over time.
Department of Mechanical Engineering
Components of an Optimisation Problem
Objective Function: The function that needs to be
maximised or minimised (e.g., cost, profit).
Decision Variables: The variables that influence the
outcome of the objective function.
Constraints: Conditions that the solution must
satisfy (e.g., resource limits, capacity constraints).
Department of Mechanical Engineering
Standard Form of an Optimisation
Problem
Objective: 𝑚𝑖𝑛, 𝑚𝑎𝑥 𝑓 𝑥
Subject to: 𝑔𝑖 𝑥 ≤ 𝑏𝑖 where 𝑖 = 1,2,3, … , 𝑚
Department of Mechanical Engineering
Type of Optimisation Models
a. Linear Programming (LP)
Used when the objective function and constraints are linear.
Example: Maximizing profit given resource constraints in
b. Integer Programming (IP)
Similar to LP but decision variables are integers.
Applications: Network design, facility location, production planning.
c. Nonlinear Programming (NLP)
For problems where the objective function or constraints are nonlinear.
Requires more complex solution methods (e.g., gradient-based methods).
d. Mixed-Integer Programming (MIP)
Combines integer and continuous decision variables.
Example: Selecting projects under a fixed budget with divisible and indivisible resources.
e. Dynamic Programming (DP)
Used for problems that can be broken down into sub-problems and solved sequentially.
Often used for multi-stage decision problems (e.g., inventory control, finance).
f. Stochastic Optimisation
Deals with optimisation under uncertainty.
Applications: Inventory management, financial portfolio selection.
Department
6 of Mechanical Engineering
Linear Programming
Formulating a Linear Programming Model
Standard Form:
Objective: 𝑚𝑎𝑥. 𝑚𝑖𝑛 𝑧 = σ𝑛𝑖=1 𝑐𝑖 𝑥𝑖 ; where 𝑖 = 1,2,3, … , 𝑛
Constraints: σ𝑛𝑖=1 𝑎𝑗𝑖 𝑥𝑖 𝜌𝑏𝑗 ; where 𝜌𝜖 <, >, ≤, ≥, = 𝑗 = 1,2,3, … , 𝑚
Non-negativity: 𝑥𝑖 ≥ 0
Where 𝑛 and 𝑚 are the number of decision variables and constraints
Department
7 of Mechanical Engineering
Graphical Method
Phase 1: Development of the Mathematical Program
Step 1: Summary of the Problem
Step 2: Establish the Objective function
Step 3: Establish the Constraints
Step 4: Establish Hidden Conditions
Step 5: The Linear Program(LP)
Phase 2: Graphical Solution
Step 1: Establish Coordinate Points
Step 2: Plot the Graph and Establish Feasible Region
Step 3: Establish Optimum Point
Step 4: Obtain the Optimal Solution
Step 5: Interpretation and Presentation of Results
Department
8 of Mechanical Engineering
Example
An oil and gas chemical production company well known in the oil and gas industry that
produces subsea wellhead corrosion inhibitors wants to expand its business portfolio to include
scale inhibitors due to the demand for scale inhibitors. The implication is that two production
lines will be required – corrosion inhibitor and scale inhibitor. In order to match its production
with demands, the company needs to do a thorough market survey. Fortunately, the company
has a staff who has just completed an Applied Mathematics and Optimisation course at Emerald
Energy Institute, UniPort, and is now resting on the staff to advise the company properly. After a
thorough market survey, it has been established that the demand for scale inhibitors never
exceeds 3 tons per day, and the demand for corrosion inhibitors is never less than 1 ton per
day. It costs N 1BN to produce 1 ton of corrosion inhibitors and N 2BN to produce 1 ton of scale
inhibitors. The company can only provide N 8BN daily for the production of corrosion inhibitor
and scale inhibitors. It is also known, from the work-study conducted by staff, that it takes 2
hours to process 1 ton of corrosion inhibitors and 1 hour to process 1 ton of scale inhibitors. The
company operates 84 hours per seven-day working week. The after-sales profit per ton of
corrosion inhibitors is N 2BN and N 3BN per ton of scale inhibitors. Assuming you are the
company’s staff, what will be the amount of corrosion inhibitors and scale inhibitors in tons to
maximise profit.
Department
9 of Mechanical Engineering
Solution
Phase 1: Development of the Mathematical Program
Step 1: Summary of the Problem
Process
Demand Cost Profit
time
[ton/day] [BNN/ton] [BNN/ton]
[hr/ton]
Corrosion
(≥) 1 2 1 2
inhibitors
Scale inhibitors (≤) 3 1 2 3
Other
84/7= 12
Limitations and - 8 [BNN/day] Maximise
[hr/day]
requirements
Department
10 of Mechanical Engineering
Solution
Phase 1: Development of the Mathematical Program
Step 2: Establish the Objective function
Let the quantity of corrosion inhibitors in tons per day: 𝑥1 [ton/day]
Let the quantity of scale inhibitors in tons per day: 𝑥2 [ton/day]
The problem is a maximisation problem that will take the form
max: 𝑧 = 𝑐1 𝑥1 + 𝑐2 𝑥2
where 𝑐1 =2 [BNN/ton] is the profit coefficient for corrosion inhibitors
𝑐2 = 3 [BNN/ton] is the profit coefficient for scale inhibitors
Therefore, the objective function becomes
𝐦𝐚𝐱: 𝒛 = 𝟐𝒙𝟏 + 𝟑𝒙𝟐 (a)
Department
11 of Mechanical Engineering
Step 3: Establish the Constraints Use >= for requirements (like minimum quality or quantity) and <= for limitations (like storage).
demand requirements for corrosion inhibitors: 𝑥1 ≥ 1 (b)
demand requirement for scale inhibitors: 𝑥2 ≤ 3 (c)
cost limitation for production: 𝑥1 + 2𝑥2 ≤ 8 (d)
production time constraint: 2𝑥1 + 𝑥2 ≤ 12 (e)
Step 4: Establish Hidden Conditions
No negative quantity of corrosion inhibitors (𝑥1 ) or scale inhibitors (𝑥2 ) can be produced,
therefore,
𝑥1 ≥ 0 (f)
X1, X2 >= 0
𝑥2 ≥ 0 (g)
Department
12 of Mechanical Engineering
Step 5: The Linear Program(LP)
Equ. (a) through Equ. (g) are assembled to form the LP as follows
Maximise: 𝑧 = 2𝑥1 + 3𝑥2 (a)
Subject to: 𝑥1 ≥ 1 (b)
𝑥2 ≤ 3 (c)
𝑥1 + 2𝑥2 ≤ 8 (d)
2𝑥1 + 𝑥2 ≤ 12 (e)
𝑥1 ≥ 0 (f)
𝑥2 ≥ 0 (g)
Department
13 of Mechanical Engineering
Phase 2: Graphical Solution
Step 1: Establish Coordinate Points
The coordinate system adopted is (𝑥1 , 𝑥2 )
Point 1 Point 2
line tag Equation
(𝑥1 , 𝑥2 ) (𝑥1 , 𝑥2 )
b 𝑥1 = 1 (1,0) (1,∞)
c 𝑥2 = 3 (0,3) (∞,3)
d 𝑥1 + 2𝑥2 = 8 (8,0) (0,4)
e 2𝑥1 + 𝑥2 = 12 (6,0) (0,12)
f 𝑥1 = 0 (0,0) (0,∞)
g 𝑥2 = 0 (0,0) (∞,0)
2𝑥1 + 3𝑥2 = 0 (zero
a (0,0) (3,-2)
iso-profit line)
Department
14 of Mechanical Engineering
Step 2: Plot the Graph and Establish Feasible Region
12
11 Q2.1b
10 Q2.1c
9 Q2.1d
8 Q2.1e
7 Q2.1f
6 Q2.1g
5 Q2.1a
4
3
2
F.R
1
0
-1 0 1 2 3 4 5 6 7 8 9 10 11 12
-2
-3
Department
15 of Mechanical Engineering
Step 3: Establish Optimum Point
12
11 Q2.1b
10 Q2.1c
9 Q2.1d
8 Q2.1e
7 Q2.1f
6 Q2.1g
5 Q2.1a
4
3
2
F.R z*
1
0
-1 0 1 2 3 4 5 6 7 8 9 10 11 12
-2
-3
Point z* is the optimum point because it gave the longest
distance from the zero iso-profit line
Department
16 of Mechanical Engineering
Step 4: Obtain the Optimal Solution
Line tags (d) and (e) intercept gave the optimum point, thus, solve simultaneously
𝑥1 + 2𝑥2 = 8 (d)
2𝑥1 + 𝑥2 = 12 €
Starting with this will give all -ve values which will cancel out during division
Apply Crammer’s Rule as follows Start with 2X1 + X2 = 12
X1 + 2X2 = 8 this will give +ve values
Set up the Matrices
Calculate the Main Determinant (D)
2 1 𝑥1 12 2 1
= ; ∆= = 2×2−1×1=3
1 2 𝑥2 8 1 2
Calculate Variable Determinants (D_{x1} and D_{x2})
12 1 2 12
∆𝑥1 = = 12 × 2 − 8 × 1 = 16; ∆𝑥2 = = 2 × 8 − 12 × 1 = 4
8 2 1 8
Therefore, the optima solutions are
Solve for the Variables
∆𝑥1 16
𝒙∗𝟏 = = = 𝟓. 𝟑𝟑 [ton/day]
∆ 3
∆𝑥2 4
𝒙∗𝟐 = = 3 = 𝟏. 𝟑𝟑 [ton/day]
∆
The optimum objective function, z*, can be obtain by substituting 𝒙∗𝟏 and 𝒙∗𝟐 into the Objective
Function, Equ. (1a), as follow:
16 4
𝑧 ∗ = 2𝑥1∗ + 3𝑥2∗ ≡ 2 × +3× = 𝟏𝟒. 𝟔𝟔𝟕[BNN/day]
3 3
Department
17 of Mechanical Engineering
Step 5: Interpretation and Presentation of Results
The company, under the given circumstance, has to produce:
5.33 tons of corrosion inhibitors a day, and 1.33 tons of scale
inhibitors a day in order to maximise the company’s daily profit
at N14,667,000,000.
Department
18 of Mechanical Engineering
LP Solution with MS Excel Solver
▪ Go to File
Department
19 of Mechanical Engineering
LP Solution with MS Excel Solver
▪ Go to File
▪ Locate and left-click Option
Department
20 of Mechanical Engineering
LP Solution with MS Excel Solver
▪ Go to File
▪ Locate and left-click Option
▪ Locate and click on Add-ins
Department
21 of Mechanical Engineering
LP Solution with MS Excel Solver
▪ Go to File
▪ Locate and left-click Option
▪ Locate and click on Add-ins
▪ Look out for Solver Add-in
Department
22 of Mechanical Engineering
LP Solution with MS Excel Solver
▪ Go to File
▪ Locate and left-click Option
▪ Locate and click on Add-ins
▪ Look out for Solver Add-in
▪ Click on Go
Department
23 of Mechanical Engineering
LP Solution with MS Excel Solver
▪ Go to File
▪ Locate and left-click Option
▪ Locate and click on Add-ins
▪ Look out for Solver Add-in
▪ Click on Go
▪ Select Solver Add-in in the panel
Department
24 of Mechanical Engineering
LP Solution with MS Excel Solver
▪ Go to File
▪ Locate and left-click Option
▪ Locate and click on Add-ins
▪ Look out for Solver Add-in
▪ Click on Go
▪ Select Solver Add-in in the panel
▪ Click OK
Department
25 of Mechanical Engineering
LP Solution with MS Excel Solver
▪ Go to File
▪ Locate and left-click Option
▪ Locate and click on Add-ins
▪ Look out for Solver Add-in
▪ Click on Go
▪ Select Solver Add-in in the panel
▪ Click OK
▪ Go to Data (look out for Solver at the extreme of the toolbar)
Department
26 of Mechanical Engineering
LP Solution with MS Excel Solver
▪ Go to File
▪ Locate and left-click Option
▪ Locate and click on Add-ins
▪ Look out for Solver Add-in
▪ Click on Go
▪ Select Solver Add-in in the panel
▪ Click OK
▪ Go to Data (look out for Solver at the extreme of the toolbar)
▪ Click on Solver
▪ Enter the relevant cells
Department
27 of Mechanical Engineering
LP Solution with MS Excel Solver
▪ Go to File
▪ Locate and left-click Option
▪ Locate and click on Add-ins
▪ Look out for Solver Add-in
▪ Click on Go
▪ Select Solver Add-in in the panel
▪ Click OK
▪ Go to Data (look out for Solver at the extreme of the toolbar)
▪ Click on Solver
▪ Enter the relevant cells
▪ Click on Solve
▪ Check your results
Department
28 of Mechanical Engineering
The Example with MS Excel Solver
Department
29 of Mechanical Engineering
The Example with MS Excel Solver
Department
30 of Mechanical Engineering
The Example with MS Excel Solver
Department
31 of Mechanical Engineering