14
Part 2 Chapter 7 Optimization All images copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. PowerPoints organized by Dr. Michael R. Gustafson II, Duke University Revised by Prof. Jang, CAU

Part 2 Chapter 7 - CAUcau.ac.kr/~jjang14/NAE/Chap7.pdfChapter Objectives • Understanding why and where optimization occurs in engineering and scientific problem solving. • Recognizing

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

  • Part 2Chapter 7

    Optimization

    All images copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

    PowerPoints organized by Dr. Michael R. Gustafson II, Duke UniversityRevised by Prof. Jang, CAU

  • Chapter Objectives• Understanding why and where optimization occurs in

    engineering and scientific problem solving.• Recognizing the difference between one-dimensional

    and multi-dimensional optimization.• Distinguishing between global and local optima.• Locating the optimum of a single-variable function

    with the golden-section search.• Locating the optimum of a single-variable function

    with parabolic interpolation.• Knowing how to apply the fminbnd function to

    determine the minimum of a one-dimensional function.• Knowing how to apply the fminsearch function to

    determine the minimum of a multidimensional function.

  • Optimization• Optimization is the process of creating something

    that is as effective as possible.– Produce the greatest output for a given amount of input

    • From a mathematical perspective, optimization deals with finding the maxima and minima of a functionthat depends on one or more variables.

    Elevation as a function of time for an object initially projected upward with an initial velocity

    ( )( / )0 0( ) 1 c m tm mg mgz t z v e tc c c− = + + − −

  • Multidimensional Optimization• One-dimensional problems involve functions that depend

    on a single dependent variable -for example, f(x).• Multidimensional problems involve functions that depend

    on two or more dependent variables - for example, f(x,y)

    In (a), x* both minimize f(x) and maximize –f(x)

  • Global vs. Local• A global optimum represents the very best

    solution for the whole range while a local optimum is better than its immediate neighbors. Cases that include local optima are called multimodal.

    • Generally desire to find the global optimum.

  • Golden-Section Search• Search algorithm for finding a minimum on an

    interval [xl xu] which includes a single minimum(unimodal interval)

    • Uses the golden ratio φ=1.6180… to determine location of two interior points x1 and x2; by using the golden ratio, one of the interior points can be re-used in the next iteration.

    • This is similar to the bisection method (one middle point) except that two intermediate points are chosen according to the golden ratio.

  • Golden-Section Search (cont)

    • If f(x2)>f(x1), x2 becomes the new lower limit and x1 becomes the new x2 (as in figure).

    • If f(x2)

  • Code for Golden-Section Search

  • Example 7.2Q. Use the golden-section search to find the minimum

    of f(x) within the interval from xl= 0 to xu =4.

    For the first iteration

    2

    ( ) 2sin10xf x x= −

    1

    2

    0.61803(4 0) 2.47210 2.4721 2.47214 2.4721 1.5279

    dxx

    = − == + == − =

    2

    2

    2

    1

    1.5279( ) 2sin(1.5279) 1.764710

    2.4721( ) 2sin(2.4721) 0.630010

    f x

    f x

    = − = −

    = − = −

    i xl f(xl) x2 f(x2) x1 f(x1) xu f(xu) d 12345678

    00

    0.94430.94431.30501.30501.30501.3901

    00

    -1.5310-1.5310-1.7595-1.7595-1.7595-1.7742

    1.52790.94431.52791.30501.52791.44271.39011.4427

    -1.7647-1.5310-1.7647-1.7595-1.7647-1.7755-1.7742-1.7755

    2.47211.52791.88851.52791.66561.52791.44271.4752

    -0.6300-1.7647-1.5432-1.7647-1.7136-1.7647-1.7755-1.7732

    4.00002.47212.47211.88851.88851.66561.52791.5279

    3.1136-0.6300-0.6300-1.5432-1.5432-1.7136-1.7647-1.7647

    2.47211.52790.94430.58360.36070.22290.13780.0851

  • Parabolic Interpolation• Another algorithm uses

    parabolic interpolation of three points to estimate optimum location.

    • The location of the maximum/minimum of a parabola defined as the interpolation of three points (x1, x2, and x3) is:

    • The new point x4 and the two surrounding it (either x1 and x2or x2 and x3) are used for the next iteration of the algorithm.

    x4 = x2 −12

    x2 − x1( )2 f x2( )− f x3( )[ ]− x2 − x3( )2 f x2( )− f x1( )[ ]

    x2 − x1( ) f x2( )− f x3( )[ ]− x2 − x3( ) f x2( )− f x1( )[ ]

  • fminbnd Function

    • MATLAB has a built-in function, fminbnd, which combines the golden-section search and the parabolic interpolation.– [xmin, fval] = fminbnd(function, x1, x2)

    • Options may be passed through a fourth argument using optimset, similar to fzero.

  • Multidimensional Visualization• Functions of two-dimensions may be

    visualized using contour or surface/mesh plots.

  • fminsearch Function• MATLAB has a built-in function, fminsearch, that

    can be used to determine the minimum of a multidimensional function.– [xmin, fval] = fminsearch(function, x0)

    – xmin in this case will be a row vector containing the location of the minimum, while x0 is an initial guess. Note that x0 must contain as many entries as the function expects of it.

    • The function must be written in terms of a single variable, where different dimensions are represented by different indices of that variable.

  • fminsearch Function

    • To minimize f(x,y)=2+x-y+2x2+2xy+y2rewrite asf(x1, x2)=2+x1-x2+2(x1)2+2x1x2+(x2)2

    • f=@(x) 2+x(1)-x(2)+2*x(1)^2+2*x(1)*x(2)+x(2)^2[x, fval] = fminsearch(f, [-0.5, 0.5])

    • Note that x0 has two entries - f is expecting it to contain two values.

    • MATLAB reports the minimum value is 0.7500 at a location of [-1.000 1.5000]

    Part 2�Chapter 7Chapter ObjectivesOptimizationMultidimensional OptimizationGlobal vs. LocalGolden-Section SearchGolden-Section Search (cont)Code for Golden-Section SearchExample 7.2Parabolic Interpolationfminbnd FunctionMultidimensional Visualizationfminsearch Functionfminsearch Function