how to bypass my complex values inside objective functions? bounds and constraints not working…

조회 수: 3 (최근 30일)
This is of my dissertation. Huge headache! I am estimating this 20-parameter time-series model, minimizing this GMM objective function.
I was many times given the error message ’obj function returns complex values, fmincon or fminsearch cannot continue’. I know that fmincon/fminsearch these minimizers only handle real values, only real number can be minimized. My problem lies in a very complicated Square Root expression inside my obj function. The expression is so complex a function of those parameters that no way I could simply bound my parameters to guarantee the expression positive.
fmincon has the option to attach constraints, so I constrained that expression to be positive, but as many have pointed out here on Matlab forums, constraints in “fmincon algorithm” is not strictly obeyed. In my case, I still receive same error message after constrained. While fminsearch does not deal with constraints.
What are the solutions to this complex error? Bounds or constraints appear not working for it. Can one in some way tell the minimizer to skip/ignore this complex iteration and proceed to the next feasible iteration? Or is there a totally different solver that is free from complex issues? Gratefully appreciate any relevant feedback.

답변 (2개)

Roger Stafford
Roger Stafford 2014년 10월 26일
I would suggest that in computing your objective function, you yourself apply the constraint of non-negativity to the expression inside the square root by applying max(expression,0) to it. Then when a negative value occurs in the expression, the square root will simply be zero and never complex-valued.
  댓글 수: 1
jun
jun 2014년 10월 26일
Thanks for the quick reply! Sounds a small smart move that could possible make a whole difference. Will absolutely try that and get back here. Thanks again Roger.

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


Nayan Rawat
Nayan Rawat 2019년 8월 7일
Solved?

카테고리

Help CenterFile Exchange에서 Get Started with Optimization Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by