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

3 visualizzazioni (ultimi 30 giorni)
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.

Risposte (2)

Roger Stafford
Roger Stafford il 26 Ott 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 Commento
jun
jun il 26 Ott 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.

Accedi per commentare.


Nayan Rawat
Nayan Rawat il 7 Ago 2019
Solved?

Categorie

Scopri di più su Get Started with Optimization Toolbox in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by