MATLAB Examples

Script to solve Haftka Exercise 6.3.1 using SLP

Haftka, R. T. and Z. Gurdal (1992), Elements of Structural Optimization, Kluwer Academic Publishers

Contents

Initialize guess for design variables and move limit bounds

clear; clc
x0  = [ 1; 1];
xlb = [ 0; 0];
xub = [10; 10];

Initialize termination criteria tolerances

options=optimset('TolX',0.01,'TolCon',1e-3,'Display','iter');
options.MoveLimit=0.5;

Sequential Linear Programming with Trust Region Strategy

options.TrustRegion='merit';
[xopt,fval] = slp_trust(@fHaftka6p3p1,x0,options,xlb,xub,@gHaftka6p3p1)
 
         Sequential Linear Programming Iteration History
Iteration      Objective MaxConstraint    Index   Step-size   Merit      MoveLimit  TrustRatio
        0             -3            -7      2           0          -3
        1           -4.5            -7      2         0.5        -4.5        0.5           1  *
        2           -7.5            -7      2           1        -7.5          1           1  *
        3         -11.95         4.105      1        1.95        -7.5          2     -0.3511  + Rejected
        4          -10.5          -0.5      1           1       -10.5          1           1  +
        5        -11.107        0.5026      1      0.5357       -10.5          1           0  +
        6        -11.001      0.002525      1     0.03556         -11        0.5      0.9945  +
        7            -11      6.91e-08      1   0.0002101         -11        0.5           1  + Unbound
              ----------  ------------         ----------
    Criteria       1e-06         0.001               0.01
SLP converged. Final objective function value = -11
               Lagrangian gradient   2-norm = 0.00010557
               Lagrangian gradient inf-norm = 7.9009e-05
Trust Region Strategy uses Merit function
* Dominates prior points
+ Nondominated
- Dominated by prior point(s)

xopt =

    4.0000
    3.0000


fval =

  -11.0000

SLP Trust Region with Adaptive Move Limits

options.TrustRegion='TRAM';
[xopt,fval] = slp_trust(@fHaftka6p3p1,x0,options,xlb,xub,@gHaftka6p3p1)
 
         Sequential Linear Programming Iteration History
Iteration      Objective MaxConstraint    Index   Step-size   Merit      MoveLimit  TrustRatio
        0             -3            -7      2           0          -3
        1           -4.5            -7      2         0.5        -4.5        0.5           1  *
        2          -10.5       -0.5004      1           2       -10.5          2           1  *
        3        -11.107        0.5026      1      0.5358       -10.5      2.035           0  + !
        4        -11.001      0.002525      1     0.03556         -11      1.257      0.9945  +
        5            -11      6.91e-08      1     0.00021         -11      1.257           1  + Unbound
              ----------  ------------         ----------
    Criteria       1e-06         0.001               0.01
SLP converged. Final objective function value = -11
               Lagrangian gradient   2-norm = 0.00010558
               Lagrangian gradient inf-norm = 7.903e-05
Trust Region Strategy uses Merit function
* Dominates prior points
+ Nondominated
- Dominated by prior point(s)
! Trust Radius set by Merit function minimization
_ Trust Radius set by target Trust Ratio
f/g/m Objective/Constraint/Merit governs Trust Ratio

xopt =

    4.0000
    3.0000


fval =

  -11.0000

Linear Objective function, Quadratic Constraints, 2-DV

type fHaftka6p3p1
type gHaftka6p3p1
function [f,g]=fHaftka6p3p1( x )
% Function evaluation for Example 6.3.1 taken from
% "Elements of Structural Optimization" by Haftka and Gurdal
% N.B., Haftka uses g>=0; whereas, Matlab uses g<=0.
%
%--Input
%
%  x........ Design variable vector of length 2
%
%--Ouput
%
%  f........ Objective function value (scalar) - linear in x
%  g........ Constraint function values (vector)

f = [-2 -1]*x(:);
g = [(sum(x.^2)-25)
     x(1)^2-x(2)^2-7];

function [gradf,gradg]=gHaftka6p3p1( x )
% Gradient evaluation for Example 6.3.1 taken from
% "Elements of Structural Optimization" by Haftka and Gurdal
% N.B., Haftka uses g>=0; whereas, Matlab uses g<=0.
%
%--Input
%
%  x........ Design variable vector of length 2
%
%--Ouput
%
%  gradf.... Gradient of objective function (column vector)
%  gradg.... Gradients of constraints (#variables by #constraints matrix)
%            i.e., a constraint gradient in each column
gradf = [-2; -1];
gradg = [2*x(:), [2; -2].*x(:)];