summaryrefslogtreecommitdiff
path: root/training/lbfgs_test.cc
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2011-11-03 00:38:49 +0100
committerPatrick Simianer <p@simianer.de>2011-11-03 00:38:49 +0100
commit5ccbfda8675d01d91e56be477ab4e2f50db85aa9 (patch)
treea03e4a950c07982dfdbd73bc91ae15433fe48691 /training/lbfgs_test.cc
parent4b6b25c944270df34852c9b8de3a0ba714d76dcf (diff)
parenta769e4964db2443ce165043095e18dfc0d788910 (diff)
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'training/lbfgs_test.cc')
-rw-r--r--training/lbfgs_test.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/training/lbfgs_test.cc b/training/lbfgs_test.cc
index fc21e98d..c94682e9 100644
--- a/training/lbfgs_test.cc
+++ b/training/lbfgs_test.cc
@@ -28,11 +28,14 @@ double TestOptimizer() {
g[2] = 2 * x[2] + 6;
obj = 4 * x[0]*x[0] + x[0] * x[1] + x[1]*x[1] + x[2]*x[2] + 6 * x[2] + 5;
opt.run(x, obj, g);
-
+ if (!opt.requests_f_and_g()) {
+ if (converged(x,g)) break;
+ opt.run(x, obj, g);
+ }
cerr << x[0] << " " << x[1] << " " << x[2] << endl;
cerr << " obj=" << obj << "\td/dx1=" << g[0] << " d/dx2=" << g[1] << " d/dx3=" << g[2] << endl;
cerr << opt << endl;
- } while (!converged(x, g));
+ } while (true);
return obj;
}