Matlab is violating restrictions of fmincon

Hi
I want to solve a constrained maximization problem and i am using the function fmincon.
[theta] = fmincon('gmmsimobj2',theta0,[-1 0 0;0 0 -1;0 1 0;0 6.85988 1;0 -5 -1],[0.001 0 0 0.5 0],[],[],[],[],[],foptions,simfunc,e,sp,beta,momfunc,y,mp,alg,W);
One of the restrictions I am including is that the first parameter cannot be negative, but when matlab solves the problem insists on setting it at -1.0000e-003. The problem has no solution for non-positive values. Why does matlab try to solve the problem with this value even violating the restriction? Am I including it wrong or it is a common issue?
Thank you!
Javier

댓글 수: 1

Matt J
Matt J 2013년 11월 27일
편집: Matt J 2013년 11월 27일
Incidentally, it is bad practice to pass more than 10 arguments to fmincon. I don't know how much longer this will be supported. There are newer and better ways to pass fixed parameters to your objective function.

댓글을 달려면 로그인하십시오.

 채택된 답변

Matt J
Matt J 2013년 11월 27일
편집: Matt J 2013년 11월 27일

1 개 추천

In the A,b constraint data that you've shown, it doesn't appear that you've constrained x(1) to be non-negative. I see a lower bound of -1e-3, in perfect consistency with the output you're reporting.
Neverthelss, you should know that FMINCON can violate any constraints within foptions.TolCon, so you should still expect to see constraint violations by that amount even after fixing your b(1)=-1e-3 value. You should NOT try to avoid this by setting TolCon=0.
Finally, non-negativity and other bounds should really be specified using the lb,ub input arguments, not the A,b arguments. If you do it using ub, lb some algorithms like interior-point (with AlwaysHonorConstraints 'on') and sqp can enforce the bounds rigorously.

댓글 수: 3

Javier
Javier 2013년 11월 28일
What a great answer!
I don´t understand why you are saying that i am not constraining the first value to be non-negative. If A*X<B and the first row of A is 1 0 0 then 1*x1+0*x2+0*x3 <0. Isn´t that correct? I would check what you said about using ub, lb instead, and i will use that restriction.
Thank you very much!
Matt J
Matt J 2013년 11월 28일
편집: Matt J 2013년 11월 28일
If A*X<B and the first row of A is 1 0 0 then 1*x1+0*x2+0*x3 <0. Isn´t that correct?
It would be correct if A(1,:)=[-1 0 0] and B(1)=0. However, you do not have B(1)=0 in what you posted. You have B(1)=.001.
Javier
Javier 2013년 12월 2일
You´re right, I had 0 previously but then I changed to make the restriction more binding.
Well, I am now using lower and upper bound restrictions as you suggested. The program is working I have understood better how Matlab works with this function.
Thank you!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

질문:

2013년 11월 27일

댓글:

2013년 12월 2일

Community Treasure Hunt

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

Start Hunting!

Translated by