diff options
author | Patrick Simianer <p@simianer.de> | 2011-11-03 00:38:49 +0100 |
---|---|---|
committer | Patrick Simianer <p@simianer.de> | 2011-11-03 00:38:49 +0100 |
commit | bcfb20c1e1e9434ae04a30240859db6a353457d0 (patch) | |
tree | 4611721111f4fef5bd132ed3236b820c4e16fa9c /training/lbfgs_test.cc | |
parent | 4df1aea9e6edce1c79059d3310d55947be0a302e (diff) | |
parent | 6de8f58cd13813bf33af4903bf386439683c0fd6 (diff) |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'training/lbfgs_test.cc')
-rw-r--r-- | training/lbfgs_test.cc | 7 |
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; } |