16 #define debug 1 // print values 34 for (
int i = 0; i < n; i++) {
38 p[i] = old + delta[i];
39 double ftmp = (p[i] == old) ? fmin : f(p);
44 p[i] = old + delta[i];
45 ftmp = (p[i] == old) ? fmin : f(p);
58 double rho,
double epsilon,
int itermax)
63 int n = parameter.
size();
65 double *delta =
new double[n];
68 for (
int i = 0; i < n; i++)
69 delta[i] = fabs(parameter[i].Range() / 10);
71 double steplength = rho;
72 double newf = f(newx);
78 while (iteration < itermax && steplength > epsilon) {
88 for (
int i = 0; i < n; i++) {
89 double dxi = newx[i] - oldx[i];
91 delta[i] = (dxi <= 0.0) ? -fabs(delta[i]) : fabs(delta[i]);
94 newx[i] = newx[i] + dxi;
106 for (i = 0; i < n; i++)
107 if (fabs(newx[i] - oldx[i]) > (0.5 * fabs(delta[i])))
113 if (steplength >= epsilon && newf >= oldf) {
115 for (
int i = 0; i < n; i++)
int Print(const char *fmt,...)
for Output methods, can be redirected
double Optimize_hooke(opt_function_t f, ParameterVector ¶meter, double rho, double epsilon, int itermax)
Implementation of class CalendarList interface is static - using global functions in SQS namespace...
Basic optimization framework + methods.
static double hooke_step(double *delta, opt_function_t f, ParameterVector &p, double min0)
double(* opt_function_t)(const ParameterVector &p)
Internal header file for SIMLIB/C++.
Main SIMLIB/C++ interface.