mxArray *plhs[2];
mxArray *prhs[MAXRHS];
int xrhs, nrhs;
+ int verbose, neval;
} user_function_data;
static double user_function(int n, const double *x,
memcpy(gradient, mxGetPr(d->plhs[1]), n * sizeof(double));
mxDestroyArray(d->plhs[1]);
}
+ d->neval++;
+ if (d->verbose) mexPrintf("nlopt_minimize eval #%d: %g\n", d->neval, f);
return f;
}
xtol_rel = struct_val_default(prhs[6], "xtol_rel", 0);
maxeval = (int) (struct_val_default(prhs[6], "maxeval", -1) + 0.5);
maxtime = struct_val_default(prhs[6], "maxtime", -1);
+ d.verbose = (int) struct_val_default(prhs[6], "verbose", 0);
+ d.neval = 0;
{
mxArray *val = mxGetField(prhs[6], 0, "xtol_abs");
if (val) {
typedef struct {
octave_function *f;
Cell f_data;
+ int neval, verbose;
} user_function_data;
static double user_function(int n, const double *x,
gradient[i] = grad(i);
}
}
+ data->neval++;
+ if (data->verbose) printf("nlopt_minimize eval #%d: %g\n",
+ data->neval, res(0).double_value());
return res(0).double_value();
}
return 0;
% stop.fmin_max = stop when f < fmin_max is found
% stop.maxeval = maximum number of function evaluations
% stop.maxtime = maximum run time in seconds
+% stop.verbose = > 0 indicates verbose output
% Minimization stops when any one of these conditions is met; any
% condition that is omitted from stop will be ignored. WARNING:
% not all algorithms interpret the stopping criteria in exactly the