Thanks for the quick reply!
I don't provide an analytic gradient function at all. I am just using minlmcreatev like in the minlm_d_v example. Is a gradient needed in my case?
I want to fit a superellipsoid into a set of 3d points. The ellipsoid has 11 parameters (3x position, 3x orientation, 3x size, 2x shape parameter) So I basically do this in my fvec-function:
Kind of pseudo-code
Code:
myfunc(const real_1d_array &x, real_1d_array &fi, void* ptr) {
Points* points = (Points*) ptr;
transform(points, x[0], ..., x[5]);
for each p in points {
tmpx = p.x / x[6];
F1 = pow(tmpx * tmpx, 1.0/x[10]);
tmpy = p.y / x[7];
F2 = pow(tmpy * tmpy, 1.0/x[10]);
tmpz = p.z / x[8];
F3 = pow(tmpz * tmpz, 1.0/x[9]);
FA = pow(F1 + F2, x[10]/x[9]);
double F = pow(FA + F3, x[9]);
fi[i] = sqrt(x[6]*x[7]*x[8]) * (F - 1);
}
}
I already checked fi[i] for contating infinity, nan or the like, but it does not. The Equation is taken from this aged
paper.
Thanks!