Commit f3ecb81f authored by Davis King's avatar Davis King

Changed default solver epsilon so that it will solve to full floating point

precision by default.  If the user is OK with less precision they can change
it.
parent 2ad9cd78
...@@ -120,7 +120,7 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de ...@@ -120,7 +120,7 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
std::vector<function_spec> specs, std::vector<function_spec> specs,
const max_function_calls num, const max_function_calls num,
const std::chrono::nanoseconds max_runtime = FOREVER, const std::chrono::nanoseconds max_runtime = FOREVER,
double solver_epsilon = 1e-11 double solver_epsilon = 0
) )
{ {
// Decide which parameters should be searched on a log scale. Basically, it's // Decide which parameters should be searched on a log scale. Basically, it's
...@@ -195,7 +195,7 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de ...@@ -195,7 +195,7 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
const std::vector<bool>& is_integer_variable, const std::vector<bool>& is_integer_variable,
const max_function_calls num, const max_function_calls num,
const std::chrono::nanoseconds max_runtime = FOREVER, const std::chrono::nanoseconds max_runtime = FOREVER,
double solver_epsilon = 1e-11 double solver_epsilon = 0
) )
{ {
std::vector<funct> functions(1,std::move(f)); std::vector<funct> functions(1,std::move(f));
...@@ -231,7 +231,7 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de ...@@ -231,7 +231,7 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
const matrix<double,0,1>& bound2, const matrix<double,0,1>& bound2,
const max_function_calls num, const max_function_calls num,
const std::chrono::nanoseconds max_runtime = FOREVER, const std::chrono::nanoseconds max_runtime = FOREVER,
double solver_epsilon = 1e-11 double solver_epsilon = 0
) )
{ {
return find_max_global(std::move(f), bound1, bound2, std::vector<bool>(bound1.size(),false), num, max_runtime, solver_epsilon); return find_max_global(std::move(f), bound1, bound2, std::vector<bool>(bound1.size(),false), num, max_runtime, solver_epsilon);
...@@ -264,7 +264,7 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de ...@@ -264,7 +264,7 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
const double bound2, const double bound2,
const max_function_calls num, const max_function_calls num,
const std::chrono::nanoseconds max_runtime = FOREVER, const std::chrono::nanoseconds max_runtime = FOREVER,
double solver_epsilon = 1e-11 double solver_epsilon = 0
) )
{ {
return find_max_global(std::move(f), matrix<double,0,1>({bound1}), matrix<double,0,1>({bound2}), num, max_runtime, solver_epsilon); return find_max_global(std::move(f), matrix<double,0,1>({bound1}), matrix<double,0,1>({bound2}), num, max_runtime, solver_epsilon);
...@@ -296,7 +296,7 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de ...@@ -296,7 +296,7 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
const matrix<double,0,1>& bound1, const matrix<double,0,1>& bound1,
const matrix<double,0,1>& bound2, const matrix<double,0,1>& bound2,
const std::chrono::nanoseconds max_runtime, const std::chrono::nanoseconds max_runtime,
double solver_epsilon = 1e-11 double solver_epsilon = 0
) )
{ {
return find_max_global(std::move(f), bound1, bound2, max_function_calls(), max_runtime, solver_epsilon); return find_max_global(std::move(f), bound1, bound2, max_function_calls(), max_runtime, solver_epsilon);
...@@ -312,7 +312,7 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de ...@@ -312,7 +312,7 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
const double bound1, const double bound1,
const double bound2, const double bound2,
const std::chrono::nanoseconds max_runtime, const std::chrono::nanoseconds max_runtime,
double solver_epsilon = 1e-11 double solver_epsilon = 0
) )
{ {
return find_max_global(std::move(f), bound1, bound2, max_function_calls(), max_runtime, solver_epsilon); return find_max_global(std::move(f), bound1, bound2, max_function_calls(), max_runtime, solver_epsilon);
...@@ -329,7 +329,7 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de ...@@ -329,7 +329,7 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
const matrix<double,0,1>& bound2, const matrix<double,0,1>& bound2,
const std::vector<bool>& is_integer_variable, const std::vector<bool>& is_integer_variable,
const std::chrono::nanoseconds max_runtime, const std::chrono::nanoseconds max_runtime,
double solver_epsilon = 1e-11 double solver_epsilon = 0
) )
{ {
return find_max_global(std::move(f), bound1, bound2, is_integer_variable, max_function_calls(), max_runtime, solver_epsilon); return find_max_global(std::move(f), bound1, bound2, is_integer_variable, max_function_calls(), max_runtime, solver_epsilon);
......
...@@ -78,7 +78,7 @@ namespace dlib ...@@ -78,7 +78,7 @@ namespace dlib
const std::vector<function_spec>& specs, const std::vector<function_spec>& specs,
const max_function_calls num, const max_function_calls num,
const std::chrono::nanoseconds max_runtime = FOREVER, const std::chrono::nanoseconds max_runtime = FOREVER,
double solver_epsilon = 1e-11 double solver_epsilon = 0
); );
/*! /*!
requires requires
...@@ -144,7 +144,7 @@ namespace dlib ...@@ -144,7 +144,7 @@ namespace dlib
const std::vector<bool>& is_integer_variable, const std::vector<bool>& is_integer_variable,
const max_function_calls num, const max_function_calls num,
const std::chrono::nanoseconds max_runtime = FOREVER, const std::chrono::nanoseconds max_runtime = FOREVER,
double solver_epsilon = 1e-11 double solver_epsilon = 0
); );
/*! /*!
requires requires
...@@ -227,7 +227,7 @@ namespace dlib ...@@ -227,7 +227,7 @@ namespace dlib
const matrix<double,0,1>& bound2, const matrix<double,0,1>& bound2,
const max_function_calls num, const max_function_calls num,
const std::chrono::nanoseconds max_runtime = FOREVER, const std::chrono::nanoseconds max_runtime = FOREVER,
double solver_epsilon = 1e-11 double solver_epsilon = 0
) )
{ {
return find_max_global(std::move(f), bound1, bound2, std::vector<bool>(bound1.size(),false), num, max_runtime, solver_epsilon); return find_max_global(std::move(f), bound1, bound2, std::vector<bool>(bound1.size(),false), num, max_runtime, solver_epsilon);
...@@ -260,7 +260,7 @@ namespace dlib ...@@ -260,7 +260,7 @@ namespace dlib
const double bound2, const double bound2,
const max_function_calls num, const max_function_calls num,
const std::chrono::nanoseconds max_runtime = FOREVER, const std::chrono::nanoseconds max_runtime = FOREVER,
double solver_epsilon = 1e-11 double solver_epsilon = 0
) )
{ {
return find_max_global(std::move(f), matrix<double,0,1>({bound1}), matrix<double,0,1>({bound2}), num, max_runtime, solver_epsilon); return find_max_global(std::move(f), matrix<double,0,1>({bound1}), matrix<double,0,1>({bound2}), num, max_runtime, solver_epsilon);
...@@ -292,7 +292,7 @@ namespace dlib ...@@ -292,7 +292,7 @@ namespace dlib
const matrix<double,0,1>& bound1, const matrix<double,0,1>& bound1,
const matrix<double,0,1>& bound2, const matrix<double,0,1>& bound2,
const std::chrono::nanoseconds max_runtime, const std::chrono::nanoseconds max_runtime,
double solver_epsilon = 1e-11 double solver_epsilon = 0
) )
{ {
return find_max_global(std::move(f), bound1, bound2, max_function_calls(), max_runtime, solver_epsilon); return find_max_global(std::move(f), bound1, bound2, max_function_calls(), max_runtime, solver_epsilon);
...@@ -308,7 +308,7 @@ namespace dlib ...@@ -308,7 +308,7 @@ namespace dlib
const double bound1, const double bound1,
const double bound2, const double bound2,
const std::chrono::nanoseconds max_runtime, const std::chrono::nanoseconds max_runtime,
double solver_epsilon = 1e-11 double solver_epsilon = 0
) )
{ {
return find_max_global(std::move(f), bound1, bound2, max_function_calls(), max_runtime, solver_epsilon); return find_max_global(std::move(f), bound1, bound2, max_function_calls(), max_runtime, solver_epsilon);
...@@ -325,7 +325,7 @@ namespace dlib ...@@ -325,7 +325,7 @@ namespace dlib
const matrix<double,0,1>& bound2, const matrix<double,0,1>& bound2,
const std::vector<bool>& is_integer_variable, const std::vector<bool>& is_integer_variable,
const std::chrono::nanoseconds max_runtime, const std::chrono::nanoseconds max_runtime,
double solver_epsilon = 1e-11 double solver_epsilon = 0
) )
{ {
return find_max_global(std::move(f), bound1, bound2, is_integer_variable, max_function_calls(), max_runtime, solver_epsilon); return find_max_global(std::move(f), bound1, bound2, is_integer_variable, max_function_calls(), max_runtime, solver_epsilon);
......
...@@ -224,7 +224,7 @@ namespace dlib ...@@ -224,7 +224,7 @@ namespace dlib
dlib::rand rnd; dlib::rand rnd;
double pure_random_search_probability = 0.02; double pure_random_search_probability = 0.02;
double min_trust_region_epsilon = 1e-11; double min_trust_region_epsilon = 0;
double relative_noise_magnitude = 0.001; double relative_noise_magnitude = 0.001;
size_t num_random_samples = 5000; size_t num_random_samples = 5000;
bool do_trust_region_step = true; bool do_trust_region_step = true;
......
...@@ -332,7 +332,7 @@ namespace dlib ...@@ -332,7 +332,7 @@ namespace dlib
ensures ensures
- #num_functions() == 0 - #num_functions() == 0
- #get_relative_noise_magnitude() == 0.001 - #get_relative_noise_magnitude() == 0.001
- #get_solver_epsilon() == 1e-11 - #get_solver_epsilon() == 0
- #get_monte_carlo_upper_bound_sample_num() == 5000 - #get_monte_carlo_upper_bound_sample_num() == 5000
- #get_pure_random_search_probability() == 0.02 - #get_pure_random_search_probability() == 0.02
!*/ !*/
...@@ -345,7 +345,7 @@ namespace dlib ...@@ -345,7 +345,7 @@ namespace dlib
- #num_functions() == 1 - #num_functions() == 1
- #get_function_evaluations() will indicate that there are no function evaluations yet. - #get_function_evaluations() will indicate that there are no function evaluations yet.
- #get_relative_noise_magnitude() == 0.001 - #get_relative_noise_magnitude() == 0.001
- #get_solver_epsilon() == 1e-11 - #get_solver_epsilon() == 0
- #get_monte_carlo_upper_bound_sample_num() == 5000 - #get_monte_carlo_upper_bound_sample_num() == 5000
- #get_pure_random_search_probability() == 0.02 - #get_pure_random_search_probability() == 0.02
!*/ !*/
...@@ -358,7 +358,7 @@ namespace dlib ...@@ -358,7 +358,7 @@ namespace dlib
- #num_functions() == functions.size() - #num_functions() == functions.size()
- #get_function_evaluations() will indicate that there are no function evaluations yet. - #get_function_evaluations() will indicate that there are no function evaluations yet.
- #get_relative_noise_magnitude() == 0.001 - #get_relative_noise_magnitude() == 0.001
- #get_solver_epsilon() == 1e-11 - #get_solver_epsilon() == 0
- #get_monte_carlo_upper_bound_sample_num() == 5000 - #get_monte_carlo_upper_bound_sample_num() == 5000
- #get_pure_random_search_probability() == 0.02 - #get_pure_random_search_probability() == 0.02
!*/ !*/
...@@ -376,7 +376,7 @@ namespace dlib ...@@ -376,7 +376,7 @@ namespace dlib
- #num_functions() == functions.size() - #num_functions() == functions.size()
- #get_function_evaluations() will return the provided initial_function_evals. - #get_function_evaluations() will return the provided initial_function_evals.
- #get_relative_noise_magnitude() == relative_noise_magnitude - #get_relative_noise_magnitude() == relative_noise_magnitude
- #get_solver_epsilon() == 1e-11 - #get_solver_epsilon() == 0
- #get_monte_carlo_upper_bound_sample_num() == 5000 - #get_monte_carlo_upper_bound_sample_num() == 5000
- #get_pure_random_search_probability() == 0.02 - #get_pure_random_search_probability() == 0.02
!*/ !*/
......
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