Hello everyone
I'm having some trouble with the minBFGS optimization routine where i pass my own gradient. The problem is that the optimization exits with code 4 after the first iteration. I've debugged the problem, at it seems like the state.innerobj.g array is 0. My quess is then that for some reason, the gradient that i'm updating inside the function "OptimizationFunction_AD_grad" is not passed in to the state of the algorithm.
I've copied my code for initiating the optimization problem and the optimization function itself (the callback).
http://textuploader.com/drgps
The gradient that is calculated in the function (grad) looks fine and is non-zero, so i cannot figure out, what goes wrong.
Does anyone have an idea of what is wrong based on the code i've uploaded?
Best
|