summaryrefslogtreecommitdiff
path: root/training/lbfgs_test.cc
diff options
context:
space:
mode:
authorKenneth Heafield <github@kheafield.com>2011-11-03 19:53:08 +0000
committerKenneth Heafield <github@kheafield.com>2011-11-03 19:53:08 +0000
commit976e492a10d88df932acbff3fec8142edc990929 (patch)
tree308efe2d0d0f72bcecaae4b270c4715cf021a021 /training/lbfgs_test.cc
parent3106cf8eca76df8b46d139b8f5ce5002200d660d (diff)
parent6de8f58cd13813bf33af4903bf386439683c0fd6 (diff)
Merge branch 'master' of github.com:redpony/cdec
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;
}