exerii

Upload: widhisaputrawijaya

Post on 14-Apr-2018

216 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/30/2019 ExerII

    1/3

    Exercises II

    4M020: Design Tools

    Eindhoven University of Technology

    Objective

    Learn to use Matlabs constrained minimizer fmincon

    Case Problem

    Consider again the two-bar planar truss design problem with two design variables x1 = h and

    x2 = d, see Exercises I. Aim is to design the truss such that the mass of the truss is minimizedwhile satisfying the constraints on the yield stress and the critical buckling force. There is also a

    space limitation: height h has an upper limit Hmax (positive value).

    Exercise 1: Getting started with fmincon

    In Exercise 2 of Exercises I, the optimization problem was formulated in negative null form as:

    minx

    f(x) = C0 x2

    2

    S2 +x2

    1

    s.t. g1(x) = C1x11 0

    g2(x) = C2

    S2 +x2

    1

    x22x1

    1 0

    g3(x) = C3

    S2 +x2

    1

    3/2x42x1

    1 0

    : x1,x2 > 0,

    (1)

    with C0 = 1.24, C1 = 0.25, C2 = 0.606, C3 = 10.32, = 100, and S= 1. The optimal solutionwas determined by visual inspection.

    Now we find it numerically using fmincon.

    a) Type help fmincon in Matlab. Also type doc fmincon. Read the documentation that

    goes with the fmincon function in the Matlab optimization toolbox.

    b) Type demo in Matlab. Unfold the Toolboxes directory (by clicking the +). Unfold the

    Optimization directory. Select Tutorial. Read the sections entitled Constrained opti-

    mization example: inequalities and Constrained optimization example: inequalities and

    bounds.

    c) Why is fmincon suitable to solve optimization problem (1)?

    1

  • 7/30/2019 ExerII

    2/3

    d) Solve the two-bar truss design problem using fmincon. Make three small m-files, one con-

    taining the call to fmincon (the main program), and the two others containing the objec-

    tive function and the constraints, respectively.

    Compare the outcome with the plot of the previous week. Which constraint(s) is (are) active

    at the minimizer?

    Exercise 2: Visualization of the search path offmincon

    We change algorithm parameter settings in fmincon using optimset, and then visualize the

    iteration path to investigate how fmincon searches for the constrained minimizer.

    a) Matlab has various default parameter settings for the optimization algorithms in the MatlabOptimization Toolbox. Include the lines

    options = optimset(fmincon);

    options = optimset(options,LargeScale,off);

    options = optimset(options,Display,Iter);

    options = optimset(options,TolX,1e-4,TolCon,1e-4,...

    TolFun,1e-4);

    before calling fmincon, and include the options argument in your call of fmincon.

    Solve problem (1) starting from initial design x0 = (3,4).

    Explain what the above lines do.

    b) The iteration points xk with the respective objective function values fk along the iteration path

    can be obtained as follows: include

    global HISTORY

    HISTORY.x = [];

    HISTORY.fval = [];

    options = optimset(options,outputfcn,@outfun);

    afteryour optimset options definition(s) and before the call to fmincon. Add to your

    working directory the m-file outfun.m.

    Run your program again. Investigate the contents ofHISTORY by typing HISTORY.x and

    HISTORY.fval on the Matlab command line. Run the file plothistory.m to plot the

    iteration path in the contour plot of the two-bar truss.

    c) Change your initial design to the (infeasible) starting point x0 = (3,1) and see how the iterationpath offmincon changes.

    d) fmincon is a Newton-type of local search algorithm. Gradients of the objective function and

    constraints are an indispensible part of such an algorithm.

    Did you provide gradient information? How does fmincon obtain the gradients if you did

    not?

    How can the user provide the gradients to fmincon? (you do not need to implement this

    for this exercise)

    2

  • 7/30/2019 ExerII

    3/3

    Exercise 3: FEM-model in the loop

    Instead of the analytical expressions for objective function and constraints we now use the Matlab

    FEM-2D model to calculate mass m, bar force P, and stress . The optimization problem is then

    given by:

    minx

    f(x) = m(x)

    s.t. g1(x) = C1x11 0

    g2(x) =(x)

    y1 0

    g3(x) =P(x)

    Pcrit(x)1 0

    : x1,x2 > 0,

    (2)

    a) Edit the files of Exercise 1 d) such that the FEM-2D model is used for the calculation of the

    objective function and constraints.

    b) Run your program and compare with Exercise 1 and 2.

    3