Week 11
Week 11
LECTURE 11 – WEEK 11
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
How to determine the convexity (concavity) of a multivariable function,
f(x), where x is a vector of variables?
Answer:
Use Hessian matrix to represent second order derivative for a multi-
variable function
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:
CONVEXITY & CONCAVITY
previous one
the Table
Image:
CONVEXITY & CONCAVITY
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:
fun = @(x)x^4-x+1;
x0 = [10];
options = optimset('Display','iter','PlotFcns',@optimplotfval);
[x,fval,exitflag,output] = fminsearch(fun,x0,options)
NEWTON’S METHOD
Image:
NEWTON’S METHOD
How to solve this in Matlab?
We can use subroutine fminsearch
x=
0.6299
Image:
NEWTON’S METHOD
Example – Do it yourself:
Minimize this function
− −
Image:
Using Matlab
Fungsi FMINBND
FMINBND Single-variable bounded nonlinear function minimization.
X = FMINBND(FUN,x1,x2) attempts to find a local minimizer X of the function
FUN in the interval x1 < X < x2. FUN is a function handle. FUN accepts
scalar input X and returns a scalar function value F evaluated at X.
………..
FMINBND uses the Golden Section algorithm and Quadratic Interpolation. (FMINBND
Matlab documentation)
Example
Determine the value of x that minimizes the function :
f(x) = 5 x6 – 36 x5 + (165/2) x4 + 60 x3 + 36
R = M + ( M − W ) = 2M − W
4. Expansion to point E
If the function value of point R is smaller than W, then the direction to
the minimum point is correct. Maybe the minimum point is a little
further from point R. Therefore, the search point is expanded to point
E by increasing the distance d from point R.
E = R + (R − W ) = 2R − W
5. Shrinking to point C
If the function value of point R is greater than G, then the minimum
point is between WR. Determine point C:
C = ( M + R) / 2 = 2M − R
6. Shrinking to point B
If the function value of point C is not smaller than the function value of
W, then points G and W must shrink towards B. Point G is replaced by
point M while point W is replaced by point S which is the midpoint of
lines B and W.
7. Repeat step 1 until all three points are close to each other.
Example steps:
Rosenbroc Banana Function
Himmelblau Function
Matlab® Subroutines
• Nelder-Mead Subroutine in Matlab ® :
x = fminsearch(fun,x0)
• x is a vector that represents the optimum point of the objective function
• ‘fun’ is a subroutine of the objective function
• x0 is a vector that represents the starting point of the search
Example:
Determine the minimum point of the function:
f (x) = x12 − x1 x2 + 4 x1 + x22 − x2
function simpleks1;
x_star = fminsearch(@fun,[0;0])
function z = fun(x)
z = x(1).^2 - x(1)*x(2) - 4*x(1) + x(2).^2 - x(2);
Example:
Determine the radius and height of the cylinder that give the minimum surface
area of the cylinder for a given volume.
Equation manipulation:
2
𝑉
𝐹 𝑥 = 2𝜋𝑟 + 2𝜋𝑟
𝜋𝑟 2
2𝑉
= 2𝜋𝑟 2 +
𝑟
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 42