Section 4.5.4: Design of a cantilever beam: recursive formulation (GP)
N = 8;
wmin = .1; wmax = 100;
hmin = .1; hmax = 6;
Smin = 1/5; Smax = 5;
sigma_max = 1;
ymax = 10;
E = 1; F = 1;
cvx_begin gp
variables w(N) h(N)
v = cvx( zeros(N+1,1) );
y = cvx( zeros(N+1,1) );
for i = N:-1:1
fprintf(1,'Building recursive relations for index: %d\n',i);
v(i) = 12*(i-1/2)*F/(E*w(i)*h(i)^3) + v(i+1);
y(i) = 6*(i-1/3)*F/(E*w(i)*h(i)^3) + v(i+1) + y(i+1);
end
minimize( w'*h )
subject to
wmin <= w; w <= wmax;
hmin <= h; h <= hmax;
Smin <= h./w; h./w <= Smax;
6*F*[1:N]'./(w.*(h.^2)) <= sigma_max;
y(1) <= ymax;
cvx_end
disp('The optimal widths and heights are: ');
w, h
fprintf(1,'The optimal minimum volume of the beam is %3.4f.\n', sum(w.*h))
figure, clf
cantilever_beam_plot([h; w])
Building recursive relations for index: 8
Building recursive relations for index: 7
Building recursive relations for index: 6
Building recursive relations for index: 5
Building recursive relations for index: 4
Building recursive relations for index: 3
Building recursive relations for index: 2
Building recursive relations for index: 1
Successive approximation method to be employed.
SDPT3 will be called several times to refine the solution.
Original size: 125 variables, 38 equality constraints
For improved efficiency, SDPT3 is solving the dual problem.
Approximation size: 310 variables, 153 equality constraints
-----------------------------------------------------------------
Target Conic Solver
Precision Error Status
---------------------------
1.221e-04 2.205e+00 Solved
1.221e-04 6.141e-02 Solved
1.221e-04 0.000e+00 Solved
1.490e-08 1.102e-06 Solved
1.490e-08 0.000e+00 Solved
-----------------------------------------------------------------
Status: Solved
Optimal value (cvx_optval): +42.3965
The optimal widths and heights are:
w =
0.6214
0.7830
0.9060
1.0124
1.1004
1.1762
1.2000
1.3333
h =
3.1072
3.9149
4.5298
5.0620
5.5019
5.8811
6.0000
6.0000
The optimal minimum volume of the beam is 42.3965.