SQP algorithm and always honoring constraints

3 views (last 30 days)
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);

Accepted Answer

Matt J
Matt J on 27 Aug 2013
Edited: Matt J on 27 Aug 2013
'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 Comments
Aaron Pancost
Aaron Pancost on 27 Aug 2013
Edited: Aaron Pancost on 27 Aug 2013
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 on 28 Aug 2013
Edited: Matt J on 28 Aug 2013
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.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!