Note 7 - Numerical Optimization
Note 7 - Numerical Optimization
7 Numerical Optimization
7.1 Introduction
• Optimization is the term often used for minimizing or maximizing a function.
• Geometrically, the maximum or minimum occurs at the turning point or at the end points
of a function.
• Mathematically, the derivative of function is zero at the turning point. Moreover, the
second derivative, f 00 (x), indicates whether the optimum is a minimum or a maximum: if
f 00 (x) < 0, the point is a maximum; if f 00 (x) > 0, the point is a minimum.
Figure 7.1
• In one dimensional optimization problem, we need to find x that corresponds the deriva-
tive f 0 (x) is equal to zero.
• In engineering, the quantity that we wish to optimize, f (x), called the merit function or
objective function, and the quantities that we are free to adjust, x, known as the design
variables.
• Sometimes both local and global optima can occur in optimization as shown in figure.
Such cases are called multimodal. If function has single optimum (i.e. maximum or
minumum), then it is unimodal.
• In almost all instances, we will be interested in finding the absolute highest or lowest
value of a function. Thus, we must take care that we do not mistake a local result for the
global optimum.
1 UoM
In20 S2 MA1024
Figure 7.2
• The method starts with two initial guesses, xl and xu , that bracket one extremum of f (x).
x1 = xl + d (7.2)
x2 = xu − d (7.3)
where √
5−1
d= (xu − xl ) (7.4)
2
• If f (x1 ) > f (x2 ), then the domain of x to the left of x2 , from xl to x2 , can be eliminated
because it does not contain the maximum. For this case, x2 becomes the new xl for the
next round.
Figure 7.3
• If f (x2 ) > f (x1 ), then the domain of x to the right of x1 , from x1 to xu would have been
eliminated. In this case, x1 becomes the new xu for the next round.
1
Two quantities are in the golden ratio if their ratio is the same as the ratio of their sum to the larger of the
two quantities.i.e. if a > b > 0 √
a+b a def 1+ 5
= = ϕ= (7.1)
a b 2
2 UoM
In20 S2 MA1024
• The best thing of this method is that we do not have to recalculate all the function values
for the next iteration.
• For example, for the case f (x1 ) > f (x2 ) the old x1 becomes the new x2 and therefore
f (x1 ) of previous step is same as f (x2 ) of current step.
Figure 7.4
• Repeat the steps until the approximate solution closes to true solution.
• Then the true value be at the far right or far left as shown in figure.
Figure 7.5
3 UoM
In20 S2 MA1024
x2
f (x) = 2 sin(x) −
10
within the interval xl = 0 and xu = 4.
Figure 7.6
Solution
4 UoM
In20 S2 MA1024
• Since f (x2 ) > f (x1 ), the maximum is in the interval defined by xl , x2 , and x1 . That is,
the maximum lies in the interval [xl , x1 ] = [0, 2.472].
• In this step,
xu − xl (4 − 0)
max error = (1 − R) = (1 − 0.618) =1 (7.13)
xopt
1.528
√
5−1
d= (2.472 − 0) = 1.528 (7.15)
2
new x2 = 2.472 − 1.528 = 0.944 , f (x2 ) = 1.531 (7.16)
• Since f (x1 ) > f (x2 ), the maximum is in the interval defined by x2 , x1 , and xu . That is,
the maximum lies in the interval [x2 , xu ] = [0.944, 2.472].
• In this step,
xu − xl (2.472 − 0)
max error = (1 − R) = (1 − 0.618) = 0.618 (7.17)
xopt
1.528
f (xi )
xi+1 = xi − (7.18)
f 0 (xi )
f 0 (xi )
xi+1 = xi − (7.19)
f 00 (xi )
5 UoM
In20 S2 MA1024
Solution
1
REFERENCES
(i) Numerical Analysis, Richard L. Burden, J.Douglas Faires.
(ii) Numerical Methods for Engineers, Steven C. Chapra, Raymond P. Canale
6 UoM