diff --git a/test/t_tutorial.cxx b/test/t_tutorial.cxx index f9a0ccc3..9dd4de18 100644 --- a/test/t_tutorial.cxx +++ b/test/t_tutorial.cxx @@ -5,6 +5,8 @@ #include #include +int count = 0; // counter for objective-function evaluations + double myvfunc(const std::vector &x, std::vector &grad, void *data) { (void)data; @@ -27,6 +29,7 @@ double myvconstraint(const std::vector &x, std::vector &grad, vo grad[0] = 3 * a * (a*x[0] + b) * (a*x[0] + b); grad[1] = -1.0; } + ++count; return ((a*x[0] + b) * (a*x[0] + b) * (a*x[0] + b) - x[1]); } @@ -59,7 +62,8 @@ int main(int argc, char *argv[]) { try{ opt.optimize(x, minf); std::cout << "found minimum at f(" << x[0] << "," << x[1] << ") = " - << std::setprecision(10) << minf <