Commit 59409fb5 authored by Davis King's avatar Davis King

Added a BOBYQA example.

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%403216
parent 1f93746e
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
routines from the dlib C++ Library. routines from the dlib C++ Library.
The library provides implementations of the conjugate gradient, The library provides implementations of the conjugate gradient,
BFGS and L-BFGS optimization algorithms. These algorithms allow BFGS, L-BFGS, and BOBYQA optimization algorithms. These algorithms allow
you to find the minimum of a function of many input variables. you to find the minimum of a function of many input variables.
This example walks though a few of the ways you might put these This example walks though a few of the ways you might put these
routines to use. routines to use.
...@@ -208,5 +208,24 @@ int main() ...@@ -208,5 +208,24 @@ int main()
test_function(target), starting_point, -1); test_function(target), starting_point, -1);
cout << starting_point << endl; cout << starting_point << endl;
// Finally, lets try the BOBYQA algorithm. This is a technique specially
// designed to minimize a function in the absence of derivative information.
// Generally speaking, it is the method of choice if derivatives are not available.
// For the details on what the parameters to this function represent see its documentation.
starting_point = -4,5,99,3;
find_min_bobyqa(test_function(target),
starting_point,
9, // number of interpolation points
uniform_matrix<double>(4,1, -1e100), // lower bound constraint
uniform_matrix<double>(4,1, 1e100), // upper bound constraint
10, // initial trust region radius
1e-6, // stopping trust region radius
100 // max number of objective function evaluations
);
cout << starting_point << endl;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment