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

6 visualizaciones (últimos 30 días)
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.

Respuestas (2)

Roger Stafford
Roger Stafford el 26 de Oct. de 2014
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 comentario
jun
jun el 26 de Oct. de 2014
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.

Iniciar sesión para comentar.


Nayan Rawat
Nayan Rawat el 7 de Ag. de 2019
Solved?

Categorías

Más información sobre Get Started with Optimization Toolbox en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by