Sunteți pe pagina 1din 9

AAE 550 MULTIDISCIPLINARY DESIGN OPTIMIZATION FALL 2011 HOMEWORK ASSIGNMENT #3 DUE NOVEMBER 30, 2011

I.

NELDER-MEAD SIMPLEX

The Matlab routine fminsearch uses the Nelder-Mead Simplex algorithm. On the Blackboard page for Homework 3, the file callNM.m invokes the algorithm, and the file NMfunc.m contains the egg-crate function used in class. When turning in the assignment, include a copy of your versions of the callNM.m and NMfunc.m files. Complete tables like those suggested in the questions below to summarize your results. There are many commonly used functions to test global optimization algorithms. The Ackley Function is a common multi-modal test function for global optimization methods. Use the Nelder-Mead Simplex to find the minimum of the 5-D version (n = 5) of the Ackley Function:

1 n 1 n minimize f x = 20exp 0.2 xi2 exp cos 2 xi + 20 + exp 1 n i=1 n i=1

( )

()

10 xi 10
A 2-D version of this function appears in the figure below to provide an idea of the local minima. The n-D version of the Ackley Function has a global minimum of xi,,xn = 0, f(x*) = 0.

1) Formulate an appropriate objective function for the Nelder-Mead Simplex to account for the bounds on the design variables. Recall that function and / or slope continuity is not a requirement when developing your penalty function. 2) Solve the problem starting from x0 = [5 5 5 5 5]T. Be sure to use the first x* as x0 for a re-start of the algorithm. Summarize these runs in a table like the one shown below.

AAE 550 F A L L 2011 H O M E W O R K #3, P A G E 2

x0

Function evaluations

x*

f(x*)

Run 1

5 5 5 5 5

****

*.**** *.**** *.**** *.**** *.**** *.**** *.**** *.**** *.**** *.****

**.****

Re-start

*.**** *.**** *.**** *.**** *.****

****

**.****

3) Solve the problem again starting from x0 = [0.5 0.5 0.5 0.5 0.5]T. As before, use the first x* as x0 for a re-start of the algorithm. Summarize these runs in a table like the one shown below. x0 Function evaluations x* f(x*)

Run 1

0.5 0.5 0.5 0.5 0.5

****

*.**** *.**** *.**** *.**** *.**** *.**** *.**** *.**** *.**** *.****

**.****

Re-start

*.**** *.**** *.**** *.**** *.****

****

**.****

4) Solve the problem again starting from x0 = [-0.1 -0.1 -0.1 -0.1 -0.1]T. Be sure to use the first x* as x0 for a restart of the algorithm. Summarize these runs in a table like the one shown below. x0 Function evaluations x* f(x*)

Run 1

0.1 0.1 0.1 0.1 0.1

****

*.**** *.**** *.**** *.**** *.****

**.****

AAE 550 F A L L 2011 H O M E W O R K #3, P A G E 3

Re-start

*.**** *.**** *.**** *.**** *.****

****

*.**** *.**** *.**** *.**** *.****

**.****

5) Recall that Nelder-Mead Simplex is generally better at non-smooth optimization than it is at global optimization. Do your results indicate this? II. SIMULATED ANNEALING Three files are available from the Blackboard HW 3 page for simulated annealing. The file SA_550.m contains the simulated annealing algorithm; the file callSA_550.m demonstrates how to call the simulated annealing function; and the file SAfunc.m contains the egg crate function we used in class. When turning in the assignment, include a copy of your callSA_550.m and SAfunc.m files. Complete tables like those suggested in the questions below to summarize your results. Use simulated annealing to find the minimum of the 5-D version (n = 5) of the Ackley Function:

1 n 1 n minimize f x = 20exp 0.2 xi2 exp cos 2 xi + 20 + exp 1 n i=1 n i=1

( )

()

10 xi 10
1) Start from x0 = [8 8 8 8 8]T. Choose (or use default values) of T0 and rT. Run the SA algorithm again to see the effect of the random number generator. In some cases the number of function evaluations might reach the default maximum, so consider changing your default function evaluations. Also, use a different initial design of your own choice, and run the SA algorithm twice to see the effect of the random number generator. Summarize these runs in a table like the one shown below. function x0 T0 rT final T x* f(x*) evaluations *.**** 8 *.**** 8 Run 1 *** *** **** **** **.**** *.**** 8 *.**** 8 8 *.****

Run 2

Run 1 Run 2

8 8 8 8 8 New x0 Same x0 as above

2) Run the simulated annealing algorithm from one of the x0 designs from part 1) first with at least one higher initial temperature and then again with at least one lower initial temperature than you used in part 1). Summarize your results in a table like the one below. What impact does initial temperature have on the quality

AAE 550 F A L L 2011 H O M E W O R K #3, P A G E 4 of the results (how close to the global minimum) and on the computational expense of the method (how many function evaluations)? x0 T0 rT function evaluations final T x* f(x*)

Run 1

8 8 8 8 8 8 8 8 8 8 8 8 8 8 8

0 or your x 0 or your x 0 or your x

***

***

****

****

*.**** *.**** *.**** *.**** *.****

**.****

Run 2

T0 from part 1)

Run 3

***

3) Choose your best initial temperature from part 2) and now run the SA algorithm with two different cooling rates than you used in parts 1) and 2). Summarize your results in a table like the one below. What impact does cooling rate appear to have on the quality of the results and on the computational expense? x0 T0 rT function evaluations final T x* f(x*)

Run 1

8 8 8 8 8 8 8 8 8 8 8 8 8 8 8

0 or your x 0 or your x 0 or your x

***

***

****

****

*.**** *.**** *.**** *.**** *.****

**.****

Run 2

rT from parts 1) and 2)

Run 3

***

***

AAE 550 F A L L 2011 H O M E W O R K #3, P A G E 5

III. GENETIC ALGORITHM Several of my graduate students and I have modified a Matlab-based genetic algorithm that was originally available from the Mathworks ftp site in the mid 1990s. This version uses uniform crossover with tournament selection. The code also uses a Gray coding scheme and provides a choice between the bit-string affinity and the consecutive generation stopping criteria. The default stopping criterion is a 90% bit-string affinity. This is different from the genetic algorithm now available from Mathworks in the Global Optimization toolbox. For consistency, use the files provided with this assignment, not the global optimization toolbox. To use the GA, you will need a suite of Matlab files available from the Blackboard page; these are: callGA.m, GAfunc.m, genetic.m, and goptions.m. The file callGA.m provides an example of how to use the genetic function; the main structure of the genetic algorithm is contained in genetic.m; and the file goptions.m explains how to change various input parameters. As with the previous two questions, when turning in the assignment, include your version of the callGA and GAfunc files. Complete tables like those given below to summarize your results. Using this version of the GA, find the minimum of the 5-D version (n = 5) of the Ackley Function:

1 n 1 n minimize f x = 20exp 0.2 xi2 exp cos 2 xi + 20 + exp 1 n i=1 n i=1

( )

()

10 xi 10
1) Start by using 10 bits to encode each design variable. Use the guidelines discussed in class for population size and mutation rates when solving this problem. Examine the effect of the random number generator by running the program at least two more times. The Matlab script automatically uses a different sequence of pseudorandom numbers each run. Population size Mutation rate Number of generations Function evaluations x* f(x*)

Run 1

***

***

***

****

*.**** *.**** *.**** *.**** *.****

**.****

Run 2 Run 3

AAE 550 F A L L 2011 H O M E W O R K #3, P A G E 6

2) Repeat 1) using 5 bits for each variable. Then, repeat 1) using 20 bits for each variable. Change your population and mutation rates according to the guidelines. How do these different coding resolutions affect the quality of the results and the runtime of the algorithm? Population size Run 1 (5 bits per xi) Run 2 (5 bits per xi) Run 3 (5 bits per xi) Run 1 (20 bits per xi) Run 2 (20 bits per xi) Run 3 (20 bits per xi) Mutation rate Number of generations Function evaluations x* f(x*)

***

***

***

****

*.**** *.**** *.**** *.**** *.****

**.****

AAE 550 F A L L 2011 H O M E W O R K #3, P A G E 7

IV. A COMBINATORIAL PROBLEM WITH THE GA For this last problem, you will use the GA to solve a combinatorial problem (one that combines discrete and continuous variables). The problem is to minimize the weight of the truss shown below.

Four possible materials are available for each element, and the relevant material properties appear below. For this problem, assume that the allowable stress is the same magnitude in both tension and compression. This will allow for one stress inequality constraint for each truss element. Because a GA will solve this problem, this constraint can use the absolute value function, which has discontinuous slope. Material Aluminum Titanium Steel Nickel E (Pa) 68.9109 116109 205109 207109 (kg/m3) 2700 4500 7872 8800 y (Pa) 55.2106 140106 285106 59.0106

Because this version of the problem is combinatorial, the objective function of weight must include the weight density of the material, and the constraints must incorporate the Youngs modulus and the yield stress. If you use the first design variable to represent the material selection for the first truss element, the coding will accommodate a minimum value of 1, a maximum value of 4, and a resolution of 1 using two bits for this variable. Then, you can set the material properties using an if statement. Matlab statements that would handle this appear below. if x(1) == 1 % E = 68.9e9; rho = 2700; sigma_y = 55.2e6; elseif x(1) == 2 % E = 116e9; rho = 4500; sigma_y = 140e6; elseif x(1) == 3 % E = 205e9; rho = 7872; sigma_y = 285e6; else % E = 207e9; rho = 8800; sigma_y = 59.0e6; end Aluminum % [Pa] % [km/m^3] % [Pa] Titanium % [Pa] % [kg/m^3] % [Pa] Steel % [psi] % [kg/m^3] % [Pa] Nickel % [Pa] % [kg/m^3] % [Pa]

AAE 550 F A L L 2011 H O M E W O R K #3, P A G E 8

Computing the mass of the truss can use the following equation. Use the undeformed truss element lengths in this calculation.

m = 1 A1 L1 + 2 A2 L2 + 3 A3 L3
The provided file stressHW3.m builds the stiffness matrix for the truss, solves for the change in length of each element, computes the strain in each element and finally computes the stress in each element. This code will use the material properties as input parameters. The lengths of the truss elements are treated as constant in building the stiffness matrix.

cos ( 45 ) EA1 K1 = {cos ( 45) sin ( 45)} sin ( 45 ) L1


The middle element (element 2) stiffness matrix is:

cos ( 90 ) EA2 K2 = {cos ( 90) sin ( 90)} sin ( 90 ) L2


The third element (3) has a stiffness matrix:

cos ( 135 ) EA3 K3 = {cos ( 135) sin ( 135)} sin ( 135 ) L3


Then, the total stiffness matrix is

K = K1 + K 2 + K 3
The load vector includes the components of the p vector in the x- and y-coordinate directions.

P cos ( 25 ) 54378 p= = N P sin ( 25 ) 25357


Then, find the displacements of the free node, u, by solving the system K u = p. Compute the change in the length of each element based on u.

L1 =

( 1.2 u1 ) + (1.2 u2 )
2

(1.2) + (1.2)
2 2

L2 = L3 =

( u1 ) + (1.2 u2 )
2 2 2

1.2
2 2

(1.2 u1 ) + (1.2 u2 )
i = E Li Li

(1.2) + (1.2)

Finally, the stress in each element is the strain in the element (L/L) multiplied by Youngs modulus.

1) Encode the material choice variable using two bits as suggested above. Choose your own values for the upper and lower bounds of the area variables; also choose the number of bits you are using to encode these variables. What resolution does this provide between each adjacent value? Determine the population size and mutation rate for this problem, following the guidelines for uniform crossover and tournament selection. 2) Develop a fitness function that uses an exterior penalty to enforce the constraints. Recall that you do not have to use the quadratic form of the penalty function; you can use the linear or step-linear forms.

AAE 550 F A L L 2011 H O M E W O R K #3, P A G E 9 3) Run the GA to find a solution; evaluate the objective, constraint and fitness function values at this best design. If you notice violated constraints, you need to increase the penalty multipliers. If you notice that all the constraints are large magnitude negative numbers (satisfied), you need to decrease the penalty multipliers. To determine a good set of penalty multipliers, you may need to experiment for several runs. Include your version of the GA_func.m file for this problem. 4) Once you are comfortable that you have good values for the penalty multipliers, run the GA three times. Record the number of generations, number of function evaluations, the best design and the objective, constraint and fitness function values at the best design for each of the runs using a table like those in question III. Again, the design from each of these runs may be slightly different. There are 43 (64) different combinations of discrete variables, which would require 64 different optimization runs to enumerate all available material selections. In this case, the GA becomes competitive computationally with solving 64 different problems using a gradient-based method. A 10-bar truss with four material choices would have 410 (1,048,576) different combinations of discrete variables, and the GA would be far more efficient than enumeration. The GA has no proof of finding the globally optimal solution, but for a combinatorial problem like this, the only way to assure global optimality is through enumeration of the discrete combinations. V. HOMEWORK 3 GRADING BREAKDOWN Homework 3 will be graded out of 100 points with the following approximate point breakdown: 25% Problem Formulation and Calculations 40% Tabulated Results and Quality of Answers 20% Discussion and other answers 15% Matlab code

S-ar putea să vă placă și