SQP algorithm and always honoring constraints

조회 수: 16 (최근 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 CenterFile Exchange에서 Solver 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