搜索内容 搜索用户

# [已答复] cvx 工具箱 最优值为NAN

 请问cvx工具箱做优化为什么会出现Status: Failed Optimal value (cvx_optval): NaN 这种情况 但是还得到了解 这个解是随意给出的不是最优值吗。

6 条回复

## 倒序浏览

 [H,T,D,F,Q,R]=mpcgain2(Ad,Bd,G,q,r,qn,N);%求出了HTDFQR矩阵 cvx_begin       cvx_precision best       variable M(3*N,6*N);       variable K(3*N,6);       variable v1(3*N,1);       variable v2(3*N,1);       variable v3(3*N,1);       variable P(6*N,6*N) symmetric        minimize(trace((deta1)*M*F*OMIGA+P*OMIGA)+(v1')*(deta2)*v1+G1T*v1-2*(v1')*(H')*Q*R1+trace((deta1)*M*F*OMIGA+P*OMIGA)+(v2')*(deta2)*v2+G2T*v2-2*(v2')*(H')*Q*R2+trace((deta1)*M*F*OMIGA+P*OMIGA)+(v3')*(deta2)*v3+G3T*v3-2*(v3')*(H')*Q*R3) subject to [P,F'*M';M*F,inv(deta2)]>=0; cvx_end

 这里HTDFQR M P deta1 deta2 v1 v2 v3均已经定义或者求好了 结果是 Calling SDPT3 4.0: 10451 variables, 2076 equality constraints    For improved efficiency, SDPT3 is solving the dual problem. ------------------------------------------------------------ num. of constraints = 2076 dim. of socp   var  = 276,   num. of socp blk  =  3 dim. of linear var  = 10175 16738 linear variables from unrestricted variable. *** convert ublk to lblk *******************************************************************    SDPT3: Infeasible path-following algorithms ******************************************************************* version  predcorr  gam  expon  scale_data     NT      1      0.000   1        0    it pstep dstep pinfeas dinfeas  gap      prim-obj      dual-obj    cputime ------------------------------------------------------------------- 0|0.000|0.000|2.5e+03|6.3e+03|9.6e+22| 4.295250e+05  0.000000e+00| 0:0:00| spchol  2  2 1|0.989|0.989|2.7e+01|6.9e+01|2.6e+20| 1.037919e+15 -3.025311e+15| 0:0:00| spchol  2  2 2|0.989|0.990|3.0e-01|9.4e-01|1.2e+18|-4.517191e+14 -5.052772e+14| 0:0:00| spchol  2  2 3|0.989|0.990|3.3e-03|1.3e-01|1.9e+16|-4.800245e+14 -4.786932e+14| 0:0:00| spchol  2  2 4|0.988|1.000|3.9e-05|6.3e-02|4.2e+14|-4.803506e+14 -4.790023e+14| 0:0:00| spchol  2  2 5|0.897|1.000|4.1e-06|3.1e-02|2.3e+13|-4.803590e+14 -4.792172e+14| 0:0:00| spchol  2  2 6|0.151|1.000|3.5e-06|1.6e-02|1.3e+13|-4.803592e+14 -4.752472e+14| 0:0:00| spchol  2  2 7|0.015|1.000|3.4e-06|7.8e-03|4.6e+13|-4.803592e+14  7.999643e+14| 0:0:00| spchol  2  2 8|0.001|1.000|3.4e-06|3.9e-03|6.1e+16|-4.803592e+14  2.658255e+20| 0:0:00| spchol  2  2 9|0.000|1.000|3.4e-06|2.0e-03|1.6e+23|-4.803584e+14  9.556148e+27| 0:0:00|   sqlp stop: primal or dual is diverging, 5.0e+16 ------------------------------------------------------------------- number of iterations   =  9 Total CPU time (secs)  = 0.25   CPU time per iteration = 0.03   termination code       =  3 DIMACS: 5.9e-06  0.0e+00  2.7e-03  0.0e+00  -1.0e+00  1.7e-05 ------------------------------------------------------------------- ------------------------------------------------------------ Status: Failed Optimal value (cvx_optval): NaN

 这里HTMDFQRP v1 v2 v3 g1 g2 g3 都已经定义好或者求出 最后结果是 Calling SDPT3 4.0: 10451 variables, 2076 equality constraints    For improved efficiency, SDPT3 is solving the dual problem. ------------------------------------------------------------ num. of constraints = 2076 dim. of socp   var  = 276,   num. of socp blk  =  3 dim. of linear var  = 10175 16738 linear variables from unrestricted variable. *** convert ublk to lblk *******************************************************************    SDPT3: Infeasible path-following algorithms ******************************************************************* version  predcorr  gam  expon  scale_data     NT      1      0.000   1        0    it pstep dstep pinfeas dinfeas  gap      prim-obj      dual-obj    cputime ------------------------------------------------------------------- 0|0.000|0.000|2.5e+03|6.3e+03|9.6e+22| 4.295250e+05  0.000000e+00| 0:0:00| spchol  2  2 1|0.989|0.989|2.7e+01|6.9e+01|2.6e+20| 1.037919e+15 -3.025311e+15| 0:0:00| spchol  2  2 2|0.989|0.990|3.0e-01|9.4e-01|1.2e+18|-4.517191e+14 -5.052772e+14| 0:0:00| spchol  2  2 3|0.989|0.990|3.3e-03|1.3e-01|1.9e+16|-4.800245e+14 -4.786932e+14| 0:0:00| spchol  2  2 4|0.988|1.000|3.9e-05|6.3e-02|4.2e+14|-4.803506e+14 -4.790023e+14| 0:0:00| spchol  2  2 5|0.897|1.000|4.1e-06|3.1e-02|2.3e+13|-4.803590e+14 -4.792172e+14| 0:0:00| spchol  2  2 6|0.151|1.000|3.5e-06|1.6e-02|1.3e+13|-4.803592e+14 -4.752472e+14| 0:0:00| spchol  2  2 7|0.015|1.000|3.4e-06|7.8e-03|4.6e+13|-4.803592e+14  7.999643e+14| 0:0:00| spchol  2  2 8|0.001|1.000|3.4e-06|3.9e-03|6.1e+16|-4.803592e+14  2.658255e+20| 0:0:00| spchol  2  2 9|0.000|1.000|3.4e-06|2.0e-03|1.6e+23|-4.803584e+14  9.556148e+27| 0:0:00|   sqlp stop: primal or dual is diverging, 5.0e+16 ------------------------------------------------------------------- number of iterations   =  9 Total CPU time (secs)  = 0.25   CPU time per iteration = 0.03   termination code       =  3 DIMACS: 5.9e-06  0.0e+00  2.7e-03  0.0e+00  -1.0e+00  1.7e-05 ------------------------------------------------------------------- ------------------------------------------------------------ Status: Failed Optimal value (cvx_optval): NaN

 请问题主解决了吗？

 丁丁学长 发表于 2019-5-5 15:05 [H,T,D,F,Q,R]=mpcgain2(Ad,Bd,G,q,r,qn,N);%求出了HTDFQR矩阵 cvx_begin       cvx_precision best 这么长的目标函数和约束，能证明是凸问题吗？

 楼主您解决了吗？我也遇到了这个问题
 您需要登录后才可以回帖 登录 | 注册 本版积分规则 回帖后跳转到最后一页