||
check(Constraints)
该功能是YALMIP用于返回求解器所求参数使得约束条件满足的程度。比如,将求解器的结果反代入约束不等式中,检查其最小特征根(约束残差)。
如何根据check的输出判断可解性呢?
如果所有残差都是非负,解可行。
check仅仅计算残差,不能够判断不可行性。即如果有负值残差,则check不能判断解的不可行性。
(对不起这是错误观点,下面为YALMIP 开发者的原话,意思是负值残差不可行,但存在不同程度的不可行)
“Negative primal residual means the solution is infeasible. Both your solutions appears to be of normal infeasibility size. No solvers guarantee strictly feasible solutions”
(几乎所有求解器都返回稍微不可行的解,这是普遍现象。如果要求严格可行解,改变约束。)
(Most solvers actually use infeasible/exterior algorithms, so slightly infeasible solutions are common. If you really need a strictly feasible point (assuming one really exists), simply define a slightly tighter constraint than wanted (e.g., change your constraint from X>=0 to X>=eye(n)*smallconstant in the case of semidefinite constraints etc.)
下面,给出一个仿真例子说明残差与可行性的关系:
(1)可以看出标红的基本残差出现较大的负值,mosek求解器反馈为不可行问题。
yalmiptime: 1.6179
solvertime: 159.8621
info: 'Infeasible problem (MOSEK)'
problem: 1
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
| ID| Constraint| Primal residual| Dual residual|
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
| #1| Matrix inequality| -4144.4061| 9.3629e-10|
| #2| Matrix inequality| -1.3945e-08| 6.9721e-09|
| #3| Matrix inequality| -1.3941e-08| 1.2857e-09|
| #4| Matrix inequality| 1.0793e-05| 1.7006e-06|
| #5| Matrix inequality| 1.7192e-08| 1.3149e-08|
| #6| Matrix inequality| -4144.4089| 9.361e-10|
| #7| Matrix inequality| -5.4468e-09| 7.567e-09|
| #8| Matrix inequality| -5.444e-09| 1.2267e-09|
| #9| Matrix inequality| 9.8493e-06| 1.8639e-06|
| #10| Matrix inequality| 5.5668e-09| 8.0165e-08|
| #11| Matrix inequality| -8.2905e-09| 8.6451e-08|
| #12| Matrix inequality| 5.6136e-09| 2.0207e-08|
| #13| Matrix inequality| -8.2907e-09| 1.0286e-08|
| #14| Matrix inequality| 1.026e-06| 1.7932e-05|
| #15| Matrix inequality| 7.8309e-07| 2.3366e-05|
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
(2) 如1仿真例子,调整参数后的求解结果。最小的残差在1e-10, 虽然为负数,属于极弱的不可行性解,mosek求解反馈为容许的可行解,可以认为是求解器的鲁棒性。
yalmiptime: 1.6407
solvertime: 145.3443
info: 'Successfully solved (MOSEK)'
problem: 0
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
| ID| Constraint| Primal residual| Dual residual|
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
| #1| Matrix inequality| -8.3014e-14| -2.925e-11|
| #2| Matrix inequality| -5.3339e-11| -2.5298e-11|
| #3| Matrix inequality| -3.7489e-11| -3.0001e-11|
| #4| Matrix inequality| 5.0631| 8.0308e-13|
| #5| Matrix inequality| 1.1363| 3.5754e-14|
| #6| Matrix inequality| -1.9031e-13| -2.8845e-11|
| #7| Matrix inequality| -3.5579e-11| -2.4029e-11|
| #8| Matrix inequality| -4.5288e-11| -2.2119e-11|
| #9| Matrix inequality| 4.5931| 8.8035e-13|
| #10| Matrix inequality| -2.0087e-12| -2.1065e-11|
| #11| Matrix inequality| -4.4255e-12| -5.3764e-11|
| #12| Matrix inequality| -8.7285e-12| -1.8854e-11|
| #13| Matrix inequality| -4.8195e-12| -5.7504e-11|
| #14| Matrix inequality| 0.44848| 8.4853e-12|
| #15| Matrix inequality| 0.3944| 1.102e-11|
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-10-19 21:44
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社