-/* Copyright (c) 2007-2010 Massachusetts Institute of Technology
+/* Copyright (c) 2007-2014 Massachusetts Institute of Technology
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
#define CHECK_EVAL(xc,fc) \
stop->nevals++; \
+ if (nlopt_stop_forced(stop)) { ret=NLOPT_FORCED_STOP; goto done; } \
if ((fc) <= *minf) { \
*minf = (fc); memcpy(x, (xc), n * sizeof(double)); \
if (*minf < stop->minf_max) { ret=NLOPT_MINF_MAX_REACHED; goto done; } \
ub[i] : lb[i]) + x[i]);
}
}
- if (close(pt[1+i], x[i])) { ret=NLOPT_FAILURE; goto done; }
+ if (close(pt[1+i], x[i])) {
+ nlopt_stop_msg(stop, "starting step size led to simplex that was too small in dimension %d: %g is too close to x[%d]=%g",
+ i, pt[1+i], i, x[i]);
+ ret=NLOPT_FAILURE;
+ goto done;
+ }
pt[0] = f(n, pt+1, NULL, f_data);
CHECK_EVAL(pt+1, pt[0]);
}
*fdiff = fh - fl;
if (init_diam == 0) /* initialize diam. for psi convergence test */
- for (i = 0; i < n; ++i) init_diam = fabs(xl[i] - xh[i]);
+ for (i = 0; i < n; ++i) init_diam += fabs(xl[i] - xh[i]);
if (psi <= 0 && nlopt_stop_ftol(stop, fl, fh)) {
ret = NLOPT_FTOL_REACHED;
*minf = f(n, x, NULL, f_data);
stop->nevals++;
+ if (nlopt_stop_forced(stop)) return NLOPT_FORCED_STOP;
if (*minf < stop->minf_max) return NLOPT_MINF_MAX_REACHED;
if (nlopt_stop_evals(stop)) return NLOPT_MAXEVAL_REACHED;
if (nlopt_stop_time(stop)) return NLOPT_MAXTIME_REACHED;