Resources

function calculation fail error message from Constrained Optimization

0

Good morning, there.

I got this error message “function calculation fail” when using CO to solve optimization problem. But when I plug in the parameter value of that iteration, Gauss is able to give the function value. I don’t understand why it says “function calculation fail”. What might cause this problem?

Thanks.

Huihui

Tags: asked August 12, 2013

1 Answer

0

Apparently the failure occurs after the first iteration.  It would be unusual for it to fail after the first call because CO usually is able to recover when the function fails but sometimes it still can fail and that seems to be what is happening to you.   The function value may be computable with the parameter value at that iteration and still fail because during any iterations CO will try variations on those parameters, in particular for the line search.

What is probably happening is that a temporary value for a parameter is being tried which happens to be outside the computable parameter space.   Such an error suggests that additional constraints are need to keep the parameters inside the computable parameter space.  For example, if you are taking a log of a parameter, CO may be attempting a value of zero for that parameter for calculating the gradient or during a line search.

Put print statements in your objective function procedure printing out all the necessary quantities.  You should be able to see what is happening.  If you see a parameter exceeding computable parameter space, place a constraint on that parameter to keep it inside computable parameter space.

If the failure is the result of a complex calculations involving that parameter, use the procedure computing the objective function for the procedure placing the constraint on the parameter.