全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 MATLAB等数学软件专版
1762 1
2014-05-08
未命名.jpg 目标函数:maxW'HW,H为N*N的方阵,约束条件为:W’W=1,W>0,求解W
matlab版本是R2010b。

程序如下:
function x=main(H)
v1=zeros(N,1);
v2=ones(N,1);
x0=[zeros(N-1,1);1];
opt=[];
x=fmincon(@objfun1,x0,[],[],[],[],v1,v2,@consfun1,opt);   
   function f=objfun1(x)
        f=-x'*H*x;
    end
    function [c1,c2]=consfun1(x)
        c1=[];
        c2=x'*x-1;
    end
end
c=main(H)
运行之后出现:Warning: Trust-region-reflective algorithm does not solve this type of problem, using active-set algorithm. Youcould also try the interior-point or sqp algorithms: set the Algorithm option to 'interior-point' or 'sqp' andrerun. For more help, see Choosing the Algorithm in the documentation.
> In fmincon at 472
  In main at 6
Local minimum possible. Constraints satisfied.
fmincon stopped because the size of the current search direction is less thantwice the default value of the step size tolerance and constraints were satisfied to within the default value of the constraint tolerance.
<stopping criteria details>
Active inequalities (to within options.TolCon = 1e-006):
  lower      upper     ineqlin   ineqnonlin
    2
    3
   4
  6
  16
   17
20
21
   25
c= 0.3036
   -0.0000
   -0.0000
    0.0000
    0.1650
    0.0000
    0.0200
    0.0738
    0.0862
    0.0020
    0.2012
    0.2933
    0.1685
    0.2939
    0.2910
    0.0000
    0.0000
    0.1943
    0.0561
    0.0000
    0.0000
    0.2886
    0.2374
    0.2950
   -0.0000
    0.2511
    0.2241
    0.2893
    0.2772
这儿的c值也就是W值还满足约束条件吗?如果有错应该怎么改?
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2014-5-8 12:47:01
还是说这个不是非线性规划的问题而是其他的?
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群