Вы находитесь на странице: 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 x 1 = h and x2 = d , see Exercises I. Aim is to design the truss such that the mass of the truss is minimized while 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: min
x

f (x) = C0 x2 2

S 2 + x2 1 S 2 + x2 1 x2 2 x1

s.t.

g1 (x) = C1 x1 1 0 g2 (x) = C2 g3 (x) = C3 1 0 1 0 (1)

: x1 , x2 > 0,

S 2 + x2 1 x x4 2 1

3/2

with C0 = 1.24, C1 = 0.25, C2 = 0.606, C3 = 10.32, = 100, and S = 1. The optimal solution was determined by visual inspection. Now we nd 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 optimization example: inequalities and Constrained optimization example: inequalities and bounds. c) Why is fmincon suitable to solve optimization problem (1)? 1

d) Solve the two-bar truss design problem using fmincon. Make three small m-les, one containing the call to fmincon (the main program), and the two others containing the objective 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 of fmincon


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 Matlab Optimization Toolbox. Include the lines options options options options = = = = optimset(fmincon); optimset(options,LargeScale,off); optimset(options,Display,Iter); 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 x 0 = (3, 4). Explain what the above lines do. b) The iteration points xk with the respective objective function values f k along the iteration path can be obtained as follows: include global HISTORY HISTORY.x = []; HISTORY.fval = []; options = optimset(options,outputfcn,@outfun); after your optimset options denition(s) and before the call to fmincon. Add to your working directory the m-le outfun.m. Run your program again. Investigate the contents of HISTORY by typing HISTORY.x and HISTORY.fval on the Matlab command line. Run the le 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 x 0 = (3, 1) and see how the iteration path of fmincon 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

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: min f (x) = m(x)
x

s.t.

g1 (x) = C1 x1 1 0 (x) g2 (x) = 1 0 y P(x) 1 0 g3 (x) = Pcrit (x) : x1 , x2 > 0,

(2)

a) Edit the les 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.

Вам также может понравиться