凸优化工具箱
% Boyd & Vandenberghe "Convex Optimization" % Almir Mutapcic - 01/30/06 % Updated to use GP mode 02/08/06 % (a figure is generated) % % We have a segmented cantilever beam with N segments. Each segment % has a unit length and variable width and height (rectangular profile). % The goal is minimize the total volume of the beam, over all segment % widths w_i and heights h_i, subject to constraints on aspect ratios, % maximum allowable stress in the material, vertical deflection y, etc. % % The problem can be posed as a geometric program (posynomial form) % minimize sum( w_i* h_i) % s.t. w_min <= w_i <= w_max, for all i = 1,...,N % h_min <= h_i <= h_max % S_min <= h_i/w_i <= S_max % 6*i*F/(w_i*h_i^2) <= sigma_max % 6*F/(E*w_i*h_i^3) == d_i % (2*i - 1)*d_i + v_(i+1) <= v_i % (i - 1/3)*d_i + v_(i+1) + y_(i+1) <= y_i % y_1 <= y_max % % with variables w_i, h_i, d_i, (i = 1,...,N) and v_i, y_i (i = 1,...,N+1). % (Consult the book for other definitions and a recursive formulation of % this problem.) % optimization variables N = 8; % constants 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 % optimization variables variables w(N) h(N) v(N+1) y(N+1); % objective is the total volume of the beam % obj = sum of (widths*heights*lengths) over each section % (recall that the length of each segment is set to be 1) minimize( w'*h ) subject to % non-recursive formulation d = 6*F*ones(N,1)./(E*ones(N,1).*w.*h.^3); for i = 1:N (2*i-1)*d(i) + v(i+1) <= v(i); (i-1/3)*d(i) + v(i+1) + y(i+1) <= y(i); end % constraint set 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 % display results 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)) % plot the 3D model of the optimal cantilever beam figure, clf cantilever_beam_plot([h; w]) Successive approximation method to be employed. SDPT3 will be called several times to refine the solution. Original size: 200 variables, 65 equality constraints For improved efficiency, SDPT3 is solving the dual problem. Approximation size: 585 variables, 305 equality constraints ----------------------------------------------------------------- Target Conic Solver Precision Error Status --------------------------- 1.221e-04 1.958e+00 Solved 1.221e-04 4.438e-02 Solved 1.221e-04 0.000e+00 Solved 1.490e-08 4.364e-08 Inaccurate/Solved 1.490e-08 0.000e+00 Inaccurate/Solved ----------------------------------------------------------------- Status: Inaccurate/Solved Optimal value (cvx_optval): +42.3966 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.3966.
- 1
- 2
- 3
- 4
- 5
- 6
- 18
- wanghonglei_20022016-02-29我用的是matlab2015a版本,亲自实验后,确实能用,在matlab运行.m程序即可!
- 粉丝: 0
- 资源: 2
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- web期末大作业-HTML+CSS+JS仿王者荣耀官网网站HTML5项目实训源码.zip
- 帕鲁ppt备份只是为了方便
- 3.15 设计vi,产生一个0.0到10.0的随机数,与10.0相乘,然后通过一个字vi将积与100相加后开方
- 3.14 设计vi,比较两个数,如果其中一个数大于另一个数,则点亮LED指示灯
- 08最短路径_Floyd.c
- 02二叉排序树_BinarySortTree.c
- python字符串逆序方法.md
- qt软件开发+代码+注释+自我学习+windows软件开发+图像分割
- python二叉树的遍历.md
- 1cdd0859202f67f8bf6945fd9559ea102d27d11b