Week 12
Week 12
LECTURE 12 – WEEK 12
NUMERICAL TOOLS FOR
OPTIMIZATIONS
Ho Chi Minh City University of technology
Image:
Convex Optimization
Convexity of a one-dimensional function:
Given the function f = x2, determine its’ convexity
Image:
CONVEXITY & CONCAVITY
For the following functions, determine if f(x) is convex, concave,
strictly convex, strictly concave, all, or none these classes (indefinite)
in the range of -4 ≤ x ≤ +4
i. f(x) = 3x2
ii. f(x) = 2x
iii. f(x) = -5x2
iv. f(x) = 2x2 - x3
Image:
CONVEXITY & CONCAVITY
Solution
Image:
CONVEXITY & CONCAVITY
Classify the function 𝑓 𝑥 = 2𝑥12 − 3𝑥1 𝑥2 + 2𝑥22 using the categories in
Table below, or state that it does not belong in any of the categories.
Image:
CONVEXITY & CONCAVITY
Image:
1D Unconstrained Optimisation
Image:
1D Unconstrained Optimisation
Image:
Convex Optimisation
Unconstrained Non-Linear Optimisation
Image:
Convex Optimisation
Newton Method
▪ The necessary condition for f(x) to have an optimum is that f ’(x) = 0
▪ Applying Newtons method to solve f ’(x) = 0
Image:
NEWTON’S METHOD
Minimise the following function using the Newton method:
f(x) = x2 - x
Image:
NEWTON’S METHOD
Minimise the following function using the Newton method:
f(x) = x2 – x
f'(x) = 2x - 1
f"(x) = 2.
Note f"(x) is always positive-definite.
Let say we pick a bracket on the minimum, say x = -10 to x = 10. Assume
x0 = 10 is the starting point for the minimization.
x1= 10 – [19/2] = 1.5
x2= 1.5 – [2/2] = 0.5
x3= 0.5 – [0/2] = 0.5 (converged)
Note: if our initial guess is 3, then we only need 1 guess to obtain the solution
NEWTON’S METHOD
Image:
NEWTON’S METHOD
How to solve this in Matlab?
We can use subroutine fminsearch
x=
0.5000
Image:
NEWTON’S METHOD
How to solve this in
Wolfram?
Image:
NEWTON’S METHOD
Example:
Minimise a nonquadratic function f(x) = x4 - x + 1
Solution:
For Newton's method, f' = 4x3 - 1 and f " = 12x2, and the sequence of
steps is
Image:
NEWTON’S METHOD
Image:
NEWTON’S METHOD
How to solve this in Matlab?
We can use subroutine fminsearch
x=
0.6299
Image:
THIS WEEK MATERIAL
Tools for Optimization
PROBLEM-SOLVING
Image:
NUMERICAL METHOD
Image:
NUMERICAL METHOD
Image:
NUMERICAL METHOD
Image:
ROOT FINDING METHODs
BISECTION METHOD
The bisection method, which is alternatively called binary chopping,
interval halving, or Bolzano’s method, is one type of incremental
search method in which the interval is always divided in half.
Image:
BISECTION METHOD
Image:
BISECTION METHOD
Problem Statement
Use the graphical approach to determine the drag coefficient c needed
for a parachutist of mass m = 68.1 kg to have a velocity of 40 m/s after
free- falling for time t = 10 s. Note: The acceleration due to gravity is
9.81 m/s2.
Solution
This problem can be solved by determining the root of the eqn above
Image:
BISECTION METHOD
The initial estimate of the root xr lies at the midpoint of the interval
Image:
BISECTION METHOD
The process can be repeated to obtain refined estimates.
xrnew is the root for the present iteration and xrold is the root from the
previous iteration.
Image:
BISECTION METHOD
Thus, after six iterations ɛa finally falls below ɛs = 0.5%, and the
computation can be terminated.
Image:
THE SECANT METHOD
Graphical depiction of the Secant
method. This technique is similar to
the Newton-Raphson technique in
the sense that an estimate of the
root is predicted by extrapolating a
tangent of the function to the
x axis.
Image:
THE SECANT METHOD
(Newton-Raphson Method) (Secant Method)
Image:
THE SECANT METHOD
Image:
THE SECANT METHOD
Problem Statement:
Use the secant method to estimate the root of
f(x) = e-x – x
Solution
Recall that the true root is 0.56714329
Image:
THE SECANT METHOD
First iteration:
Second iteration:
Image:
THE SECANT METHOD
Third iteration:
Image:
DO IT YOURSELF
Determine the highest real root of
f(x) = e-x – x
Image:
DO IT YOURSELF
Starting with an initial guess of x0 = 0, this iterative equation can be
applied to compute
Image:
DO IT YOURSELF
Determine the highest real root of
Image:
DO IT YOURSELF
Determine the highest real root of
Image:
THE OTHER METHODS
THE FALSE-POSITION METHOD
Image:
LINEAR PROGRAMMING
Linear programming (LP) is an optimization approach that deals with
meeting a desired objective such as maximizing profit or minimizing
cost in the presence of constraints such as limited resources.
Image:
Example – Cost Optimization
The effect of insulation thickness
on total cost (x* = optimum
thickness). Insulation can be
purchased in 0.5-in. increments.
Image:
LINEAR PROGRAMMING
Problem Statement
The following problem is developed from the area of chemical or petroleum engineering. However, it
is relevant to all areas of engineering that deal with producing products with limited resources.
Image:
LINEAR PROGRAMMING
Develop a linear programming formulation to maximize the profits for
this operation!
Solution
The engineer operating this plant must decide how much of each gas
to produce to maximize profits. If the amounts of regular and premium
produced weekly are designated as x1 and x2, respectively, the total
weekly profit can be calculated as:
Image:
LINEAR PROGRAMMING
The constraints can be developed in a similar fashion. For example,
the total raw gas used can be computed as
Image:
LINEAR PROGRAMMING
First, the constraints can be plotted on the
solution space. For example, the first
constraint can be reformulated as a line by
replacing the inequality by an equal sign and
solving for x2
Image:
LINEAR PROGRAMMING
Now, since we are interested in maximizing
Z, we can increase it to say, 600, and the
objective function is
Image:
LINEAR PROGRAMMING
The maximum value of Z corresponds to approximately 1400. At this
point, x1 and x2 are equal to approximately 4.9 and 3.9, respectively.
Thus, the graphical solu- tion tells us that if we produce these
quantities of regular and premium, we will reap a maximum profit of
about 1400.
Image:
SOLVING ODEs
Image:
SOLVING ODEs
Plots of (a) y versus x and (b) dy/dx versus
x for the function
Image:
SLOPE METHOD
An ODE
Image:
EULER METHOD
An ODE
Image:
EULER METHOD
Use Euler’s method to numerically integrate
Image:
EULER METHOD
Image:
EULER METHOD
The approximate values were computed using Euler’s method with a step size of 0.5. The local error
refers to the error incurred over a single step.
Image:
EULER METHOD
Image:
EULER METHOD
Image:
RUNGE-KUTTA METHOD
Image:
RUNGE-KUTTA METHOD
Image:
RUNGE-KUTTA METHOD
Use the classical fourth-order RK method to integrate
Image:
PLEASE CONTACT ME!
AQSHA
Assistant (Research) Professor
Dept. of Bioenergy Engineering & Chemurgy
Dept. of Chemical Engineering
Institut Teknologi Bandung, Indonesia
Program Studi Teknik Kimia, Teknik Pangan, Teknik Bioenergi dan Kemurgi, Institut Teknologi Bandung 65