MATLAB Examples

Matlab_Abaqus_25_Bar_Truss

Find the cross-sections of the members of the 25-bar truss so that its weight is minimized and the constraints are satisfied. For more information please see the Documentation of Matlab_Abaqus_25_Bar_Truss package.

Contents

Run the optimization procedure

Set the variables NumNodes & NumElements as global, in order to be read by the other external functions of the package.

global NumNodes NumElements

Specify the number of nodes and the number of elements of the truss.

NumNodes=10;
NumElements=25;

Make a starting guess for the solution.

x0 = 10*ones(8,1);

Set the lower limit of the cross section areas of the members of the truss.

AreaMin=0.01;
lb=AreaMin*ones(8,1);

Specify some options for the optimization function (fmincon).

options = optimset('MaxFunEvals',8000,'Display','Iter');

Initialize timer.

tic

Perform the optimization of the truss (constrained optimization with fmincon).

[X,fval,exitflag,output,lambda] = fmincon(@Truss25objfun,x0,[],[],[],[], lb ,[],'Truss25confun',options)
Warning: The default
trust-region-reflective
algorithm does not solve
problems with the constraints
you have specified. FMINCON will
use the active-set algorithm
instead. For information on
applicable algorithms, see
Choosing the Algorithm in the
documentation. 
Warning: Your current settings
will run a different algorithm
(interior-point) in a future
release. 

                                Max     Line search  Directional  First-order 
 Iter F-count        f(x)   constraint   steplength   derivative   optimality Procedure 
    0      9      3307.21      -0.2723                                         
    1     19      1664.59      -0.1947          0.5         -120          312   
    2     29      961.384     -0.06675          0.5         -102          180  Hessian modified twice  
    3     40      792.754     -0.02067         0.25        -90.6          171  Hessian modified twice  
    4     52      722.124     -0.01655        0.125        -95.1          156   
    5     65      692.587     -0.01261       0.0625        -90.4          124   
    6     77      649.439    -0.006804        0.125          -62          103   
    7     89       621.84    -0.003911        0.125        -54.6         67.8   
    8    102      612.491    -0.002635       0.0625        -34.4         56.5   
    9    114      599.207    -0.001694        0.125        -39.2         44.8   
   10    126      589.636    -0.000392        0.125        -24.9         39.8   
   11    139      586.238   -0.0003501       0.0625        -23.9         40.4   
   12    152      583.845   -0.0003261       0.0625        -25.3         30.7   
   13    167      583.091   -8.435e-05       0.0156        -31.6         65.6  Hessian modified  
   14    180      579.669    4.828e-07       0.0625          -32           37   
   15    191      571.683    0.0001703         0.25        -23.9         40.1   
   16    200      557.944    0.0002757            1        -16.7         36.7   
   17    211      557.521    0.0002589         0.25        -4.67         36.3  Hessian modified  
   18    222      556.728    0.0002931         0.25        -7.25         61.2   
   19    232      552.727      0.00107          0.5        -8.31           37   
   20    241      549.816    4.048e-05            1        -6.57           32   
   21    250      547.975    0.0005738            1        -8.17         68.3   
   22    259      548.528      5.8e-05            1         22.8         31.8   
   23    268       548.03    0.0001046            1         -4.4         60.8   
   24    277      547.246    0.0001603            1        -7.52         61.6   
   25    286      545.927    0.0003216            1        -10.2         61.3   
   26    295      545.751    0.0001679            1        -1.63         59.6   
   27    306       545.76    0.0001489         0.25        0.789         54.5   
   28    315      545.821    7.634e-05            1         2.13         59.7   
   29    324      545.878    5.786e-06            1         2.25           60   
   30    333      545.744    3.382e-05            1        -2.18         60.6   
   31    342      545.735    4.402e-06            1       -0.434         60.7   
   32    354      545.686    3.356e-05        0.125        -4.82           53   
   33    363      545.699    4.608e-08            1         1.74         52.6   
   34    378      545.649    2.936e-05       0.0156        -6.15         60.7  Hessian modified  
   35    387      545.657    1.703e-07            1         2.05         61.1   
   36    399      545.137    0.0002306        0.125        -8.25           38  Hessian modified  
   37    408      545.406    7.653e-06            1         11.4         39.9   
   38    423      545.292    3.593e-05       0.0156        -3.01         60.3  Hessian modified  
   39    433      545.273    4.184e-05          0.5         -2.1         42.5   
   40    442      545.303    2.764e-07            1         2.98         41.8   
   41    451      545.129    0.0001028            1        -2.97         63.4  Hessian modified twice  
   42    460      545.218    2.967e-06            1         4.84         63.2   
   43    473      545.175    3.303e-06       0.0625        -4.63         63.2   
   44    488       545.15    1.533e-05       0.0156        -5.17         37.9   
   45    497      545.171     5.92e-09            1         40.3         37.1   
   46    513      545.165    3.386e-06      0.00781        -7.21         53.2  Hessian modified  
   47    525      545.164    2.967e-06        0.125        -1.17         63.2   
   48    543      545.164    2.962e-06      0.00195        -2.36           63  Hessian modified  
   49    564      545.164    2.961e-06     0.000244        -3.42         63.4   
   50    581      545.164     2.95e-06      0.00391         -3.9         63.2   
   51    609      545.164    2.949e-06     1.91e-06        -4.52         63.1   
   52    633      545.164    2.949e-06     3.05e-05        -4.75         63.1   
   53    642      545.167    2.927e-11            1          102         72.5   infeasible
   54    662      545.154    1.319e-05     0.000488          -37         43.6  Hessian modified twice  
   55    680      545.144    1.683e-05      0.00195          -25         66.1   
   56    699      545.138    1.921e-05     0.000977        -36.6         37.3   
   57    716      545.136    2.026e-05      0.00391        -30.5         63.2   
   58    732      545.134    2.173e-05      0.00781        -19.3         38.4   
   59    746      545.134    2.169e-05       0.0313        -4.85         63.3   
   60    763      545.133    2.181e-05      0.00391          -28         37.5   
   61    791      545.133    2.184e-05     1.91e-06        -14.1         67.2   
   62    800      545.163    1.346e-05            1         47.8           37   
   63    809      545.167    5.598e-11            1          123         72.5   infeasible
   64    821      545.166    4.814e-07        0.125          -11         63.2  Hessian modified twice  
   65    833      545.165    1.121e-06        0.125        -38.1           37   
   66    842      545.166    1.019e-06            1         10.9         63.2   
   67    851      545.166    7.164e-05            1          8.3           37   

No feasible solution found.

fmincon stopped because the size of the current search direction is less than
twice the default value of the step size tolerance but constraints are not 
satisfied to within the default value of the constraint tolerance.




X =

    0.0100
    1.9856
    2.9969
    0.0100
    0.0100
    0.6790
    1.6769
    2.6676


fval =

  545.1660


exitflag =

    -2


output = 

         iterations: 68
          funcCount: 851
       lssteplength: 1
           stepsize: 4.6111e-07
          algorithm: 'medium-scale: SQP, Quasi-Newton, line-search'
      firstorderopt: 37.0171
    constrviolation: 7.1636e-05
            message: [1x745 char]


lambda = 

         lower: [8x1 double]
         upper: [8x1 double]
         eqlin: [0x1 double]
      eqnonlin: [0x1 double]
       ineqlin: [0x1 double]
    ineqnonlin: [29x1 double]

Report elapsed time.

toc
Elapsed time is 43843.599315 seconds.
____________________________________________________
Copyright (c) 2016 by George Papazafeiropoulos
Captain, Infrastructure Engineer, Hellenic Air Force
Civil Engineer, M.Sc., Ph.D. candidate, NTUA
Email: gpapazafeiropoulos@yahoo.gr
Website: http://users.ntua.gr/gpapazaf/