Added an example of using be_verbose() to see the optimization progress.

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%403780
This commit is contained in:
Davis King 2010-07-24 22:04:07 +00:00
parent 9a6305af79
commit 71bec0bd6f
1 changed files with 4 additions and 3 deletions

View File

@ -174,12 +174,13 @@ int main()
// The L-BFGS algorithm however uses only O(N) memory. So if you have a // The L-BFGS algorithm however uses only O(N) memory. So if you have a
// function of a huge number of variables the L-BFGS algorithm is probably // function of a huge number of variables the L-BFGS algorithm is probably
// a better choice. // a better choice.
starting_point = 4, 8; starting_point = 0.8, 1.3;
find_min(lbfgs_search_strategy(10), // The 10 here is basically a measure of how much memory L-BFGS will use. find_min(lbfgs_search_strategy(10), // The 10 here is basically a measure of how much memory L-BFGS will use.
objective_delta_stop_strategy(1e-7), objective_delta_stop_strategy(1e-7).be_verbose(), // Adding be_verbose() causes a message to be
// printed for each iteration of optimization.
&rosen, &rosen_derivative, starting_point, -1); &rosen, &rosen_derivative, starting_point, -1);
cout << starting_point << endl; cout << endl << starting_point << endl;
starting_point = -94, 5.2; starting_point = -94, 5.2;
find_min_using_approximate_derivatives(lbfgs_search_strategy(10), find_min_using_approximate_derivatives(lbfgs_search_strategy(10),