AAE 550, F AL L 2022
H OM EWO RK #2, P AGE 1
AAE 550 MULTIDISCIPLINARY DESIGN OPTIMIZATION
FALL 2022
HOMEWORK ASSIGNMENT #3
DUE NOVEMBER 7, 2022
Note: Read each question carefully and be sure to fully answer every question (even if not preceded by a formal
question number). Provide all analytic expressions, Matlab scripts, and Excel screenshots when prompted.
REMEMBER TO INCLUDE UNITS ON ALL ANSWERS WHERE APPLICABLE. Each of the items mentioned
has a direct counterpart in the grading rubric. MATLAB code snippets/Excel spreadsheets pasted in the report
shows that you have completed the work yourself. Graders should not be expected to read the code to determine
the response. You are only expected to upload a single file to Gradescope; do not upload separate MATLAB *.m
files and MS excel spreadsheet. A solution template will be provided.
I. CONSTRAINED MINIMIZATION IN N VARIABLES – DIRECT METHODS
A rectangular cantilevered beam with cross-sectional dimensions b and h, and length (l = 20 ft) is subjected to a
vertical end load (P = 110,000 lb) centered on the end face of the beam. (See figure below.)
The beam must resist flexural stress due to bending; the stress in the beam can be computed using:
ο³ =−
M
y
I zz
where M is the internal moment created by the applied load P, and Izz is the bending moment of inertia for the
beam. The largest moment will be at the cantilever end of the beam, so use l = 20 ft to compute M = P × l. The
highest magnitude stresses will be at the top and bottom of the beam (at y = ±h/2). In the flexural stress formula,
negative stress results from compression and a positive stress results from tension. For a rectangular section with
base b and height h, the moments of inertia are Izz = bh3/12 and Iyy = b3h/12. Also due to manufacturing constraints,
the base b should be at least 0.5 inches. The height h should be at least 0.5 inches and no more than 36 inches. In
addition, h cannot be any bigger than six times the size of b.
In addition to a flexural failure, cantilever beams can collapse through lateral instability by twisting. The critical
load for a beam of length l is given by:
Pcr = 4.013
©Prof William A. Crossley, Purdue University, 2022
EIleast c
l2
AAE 550, F AL L 2022
H OM EWO RK #2, P AGE 2
In this formula, E is Young’s modulus of the material. Ileast is the smallest moment of inertia (i.e., the smaller of
either Izz = bh3/12 or Iyy = b3h/12). The torsional rigidity of the beam, c, is given by
c = 0.312hb 3G
with G as the shear modulus.
Design a minimum mass beam to prevent failure in both flexure and twisting. Assume a density of ο² = 0.284
lb/in3, a Young’s modulus of E = 29,700 ksi, a shear modulus of G = 11,600 ksi, and an allowable stress of ο³allow
= 45,000 psi in both tension and compression. The use of Ileast to describe failure by twisting is best handled by
using two constraint functions. Formulate two constraints using both Izz and Iyy in the equation for Pcr.
1) Provide your optimization problem statement for each optimization method. Clearly present the variables
you intend to use as the design variables. Formulate the constraints into gi(x) ≤ 0 formulations and clearly
present them in your submittal. Present how you wish to treat the variable bounds. Consider any other issues
like variable scaling, or using volume of the beam rather than mass as the objective function.
While trying to keep gi(x) on the order of one near the constraints, consider keeping the design variables in
the numerator rather than the denominator of fractions whenever possible in the constraint functions.
Because of the bounds on the problem, none of the design variables should approach zero. If variables are
in the denominator, the gradients move further from linear functions instead of closer to linear (e.g.
d 2
d
x = 2 x , while
1 x 2 = −2 x −3 ). In general, it will not be possible to maintain order of one and keep
dx
dx
design variables out of the denominator for all constraints.
( )
(
)
2) Solve the beam design problem with one of the two available constrained optimization methods that make
use of linear programming. We have discussed how to use linear programming algorithms to solve
constrained problems via Sequential Linear Programming and the Method of Centers.
Be sure to indicate which of these two LP-based methods you are using. Also, state what values you are
imposing for move limits. Use at least two different x0 points, if not more. Present your results using the
results table format shown in the solution template.
You can modify the example Matlab files available from the assignment page. Be sure to cut and paste your
modified version into your submittal. Note that I have used analytic derivatives in my example
implementation of SLP and Method of Centers. You can replace this with numerical derivatives; however,
I will ask you to use analytic derivatives and explicitly provide gradients with fmincon in a subsequent
part of this assignment, so finding analytic derivatives for SLP or Method of Centers is not a wasted effort.
It is also possible that an appropriate transformation will make finding derivatives a bit easier. Finally,
remember that linprog uses all matrices and vectors to describe the linear programming problem; it does not
call any separate Matlab functions. Specify the simplex algorithm with:
options= optimoptions('linprog','Algorithm','dual-simplex','Display','iter’);
Note that newer versions of Matlab use more efficient algorithms (interior-point and dual-simplex), but all
options should provide the same answer.
3) Solve the problem with the Generalized Reduced Gradient (GRG) Nonlinear method available in the Excel
solver. For this you are limited to using numerical gradients. As in question 2), use at least two different x0
points, if not more. Present your results using the results table format shown in the solution template.
4) Solve the problem with the Sequential Quadratic Programming (SQP) method available in Matlab’s
fmincon. For this question, use numerical gradients (this is the default option with fmincon). Again,
use at least two different x0 points, if not more.
©Prof William A. Crossley, Purdue University, 2022
AAE 550, F AL L 2022
H OM EWO RK #2, P AGE 3
5) Because all of the functions used in this problem are explicit functions of the design variables, it is possible
to obtain analytic gradients for the objective and constraint functions. Develop and state analytic gradients
for the objective and constraint functions and then repeat question 4) using fmincon with the user-supplied
gradient option. This may seem tedious, but I want you to examine the difference in function evaluations
when user-supplied derivatives are available.
II.
CONSTRAINED MINIMIZATION IN N VARIABLES – THEORY
Question 1: True or False
Statement
True or False? Fill in the table.
SQP’s computational cost is increased because the linear and non-linear
constraints are handled separately by the optimizer
SQP can handle an infeasible x0
The Method of Centers will always provide a feasible x
It’s important to formulate your constraints to be linear in order to improve
the efficiency of the Method of Centers
Question 2. In context of the Method of Centers, what is a hypersphere? Choose one.
A. The largest circle inside feasible space that reduces πΜ(π)
B. The largest circle passing through all vertices of the simplex
C. The largest circle containing all feasible space that reduces πΜ (π)
D. The largest circle inside the given move limits
E. The predecessor to the hyperloop
Question 3. You are using the SLP method to solve a design problem with design variables π = [π₯1 π₯2 π₯3]. At the
end of an iteration, you obtain a solution with 2 active constraints. What is your best course of action? Choose one.
A. Check the exit flag to confirm that you have found your π∗
B. Reformulate your constraints to remove any non-linearities
C. Remove any move limits that might prevent the optimizer from finding a better π∗
D. Impose move limits on the optimizer because the problem is under constrained
Question 4. Which of the Methods would you expect to have the lowest computational cost? Choose one.
A. SLP
B. SQP with analytic gradients
C. SQP with numerical gradients
D. GRG
E. MOC
©Prof William A. Crossley, Purdue University, 2022
AAE 550, F AL L 2022
H OM EWO RK #2, P AGE 4
Question 5. Which of the methods would you expect to have the highest computational cost? Choose one.
F. SLP
G. SQP with analytic gradients
H. SQP with numerical gradients
I. GRG
J. MOC
Use the following optimization problem statement to answer questions 6 & 7 below.
Minimize:
π(π) = (π₯1 +π₯2 )2 /(π₯3 )
Subject to:
π1 (π) = π₯1 − π₯2 − π₯3 ≤ 0
π2 (π) = 1 − (π₯1 π₯2) ≤ 0
β(π) = π₯1 + 3π₯3 = 8
Where:
0 ≤ π₯1 ≤ 5
−10 ≤ π₯2 ≤ 10
0 ≤ π₯3 ≤ 1
π = [π₯1 π₯2 π₯3 ]
Question: As part of the GRG algorithm, how would the solver need to address the constraints in this problem?
Choose one.
A. 2 inequality, 1 equality and bounds on three variables
B. 3 equality constraints and bounds on five variables
C. 3 inequality constraints and bounds on five variables
D. 8 inequality constraints and 1 equality constraint
E. GRG could not be used to solve this problem
Question: If this problem were to be reformulated for use with an SQP solver, how many constraints would be
entered in the form π¨π = π ? Assume the use of the naming convention used in the class example codes. Choose
one.
A. 1
B. 2
C. 6
D. 7
E. 8
©Prof William A. Crossley, Purdue University, 2022
AAE 550, F AL L 2022
H OM EWO RK #2, P AGE 5
III.
ADDITIONAL USAGE NOTES
In addition to the videos I recorded to demonstrate using fmincon and the Excel solver for non-linear constrained
optimization, here are few more usage notes.
Matlab: In the Matlab optimization toolbox, the fmincon function by default uses ‘interior-point’, but it will switch
to the “medium-scale” SQP when it determines the problem is “small”. That will likely be the case with this problem,
but we want to you intentionally use the SQP algorithm for this problem. You can turn on the medium scale SQP
algorithm, and you will probably benefit from output every iteration:
options = optimoptions(‘fmincon’, ‘Algorithm’, ‘sqp’, ‘Display’, ‘iter’).
You will need to write two *.m files that compute the objective function (FUN.m) and the non-linear constraints
(NONLCON.m). Any linear constraints are handled using the A, B, Aeq and Beq arrays. Remember, the SQP
algorithm is more efficient when linear constraints are handled separately from the nonlinear constraints; you can get
the same, or nearly the same, solution if you combine the linear and nonlinear constraints, but you will lose points on
this assignment for not using this algorithm in the most appropriate manner. Upper and lower bounds on the variables
are handled using the lb and ub arrays.
To run use the command:
[x,fval,exitflag,output] = fmincon(@FUN,x0,A,B,Aeq,Beq,lb,ub,@NONLCON,options)
If you need to pass on extra parameters to your objective and/or constraint functions, you can do this using the
following command:
[x,fval,exitflag,output] = fmincon(@(x) FUN(x,param1,param2),x0,A,B,Aeq,Beq,lb,ub,
@(x)NONLCON(x,param1,param2),options)
And you should define your function as:
function f = FUN(x,param1,param2)
# Function definition goes here
function [g,h] = NONLCON(x,param1,param2)
# Nonlinear constraints are defined here
Keep in mind that you will need to add additional output arguments to your versions of FUN and NONLCON for the
user-defined gradients. See the help files and / or the recorded demo for suggestions on how to do this.
The output vector also returns information about the optimization (number of function evaluations, etc.). For more
details type help fmincon at the prompt; the Optimization Toolbox User’s Guide or the Matlab help window also
contains additional information.
Excel: The “Solver” add-in available with Microsoft Excel uses the generalized reduced gradient method. Access
the solver by choosing the “Tools” menu and select the “Solver…” option. The Excel implementation of the
generalized reduced gradient method only uses numerical derivatives; however, in the solver options window, forward
or central difference derivatives are available. Also, consider the effect of automatic scaling for this problem.
When using the Excel Solver, it can be problematic to develop all of the equations using the traditional Excel formula.
You might consider making several cells for intermediate calculations as you develop the objective and constraint
equations; for instance, you might want to compute the moment of inertia in one cell and then use this value in the
calculation of stress in another cell. Be sure to examine the various report options to gather the information you need
about the run. You may want to select the “show iteration results” option to see intermediate information about the
search and to count the number of iterations. This can be tedious because you need to click the continue button to
start each iteration.
©Prof William A. Crossley, Purdue University, 2022