SQP algorithm and always honoring constraints

7 ビュー (過去 30 日間)
Aaron Pancost
Aaron Pancost 2013 年 8 月 27 日
Does the 'AlwaysHonorConstraints' option for fmincon apply to the inequality constraints in lb and ub, or to all the constraints supplied to fmincon?
I'm trying to estimate the parameters of a nonlinear filtering problem constraining the magnitude of the eigenvalues of a matrix to be less than 1, and on the first iteration it tries a point with unstable eigenvalues. This causes the program to crash.
The first constraint in the function 'c' in the code below is the one that is being violated. It occurs with either the 'sqp' or the 'active-set' algorithms, whether I specify 'AlwaysHonorConstraints' or not. Thanks!
c = @(x) [ max(abs(eig(reshape(x(8:16), 3, 3)))); ...
max(abs(eig([x(2:4)'; 1 0 0; 0 1 0])))] - [1; max(abs(eig(phiStar)))];
ceq = @(x) [];
nonlcon = @(x) deal(c(x), ceq(x));
fminconOptions = optimset('Display', 'iter-detailed', 'Algorithm', 'sqp', ...
'TolX', errTol, 'UseParallel', 'always', 'AlwaysHonorConstraints', 'bounds');
[estAllTheta, ~, ~, ~, lambdaOpt, gradient, hessian] = ...
fmincon(obj, allParams, [], [], [], [], [], [], nonlcon, fminconOptions);

採用された回答

Matt J
Matt J 2013 年 8 月 27 日
編集済み: Matt J 2013 年 8 月 27 日
'AlwaysHonorConstraints' only applies to lb and ub. Also, you cannot have max(abs(eig(...))) operations in your constraints, because they render c(x) non-differentiable.
  3 件のコメント
Aaron Pancost
Aaron Pancost 2013 年 8 月 27 日
編集済み: Aaron Pancost 2013 年 8 月 27 日
All three eigenvalues are very close to 1 (two are complex), so I could try replacing it with abs(eig()) - ones(3,1). abs() is not differentiable at zero but it should never get anywhere near eigenvalues of zero.
Thanks for your help! You've saved me a few hours wrestling with it before giving up in vain. I was certain that MATLAB would not call something 'AlwaysHonorConstraints' unless it applied to all of them.
Matt J
Matt J 2013 年 8 月 28 日
編集済み: Matt J 2013 年 8 月 28 日
It seems sort of misleading to have an option called 'AlwaysHonorConstraints' that really only applies to some constraints.
I agree. It should be renamed 'AlwaysHonorBoxConstraints'.
Is there any way to enforce nonlinear constraints at each iteration?
The SQP algorithm might abide by nonlinear constraints if you specify a feasible initial point and if you set c(x)=Inf whenever the constraint is violated. SQP has the ability to retry an iteration if it encounters NaN or Inf. However, I think doing this could spoil convergence, especially if the region c(x)=Inf is an open set.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSolver Outputs and Iterative Display についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by