Commit 1eee5ccd authored by Davis King's avatar Davis King

Cleanup

parent f924b448
...@@ -573,13 +573,16 @@ namespace dlib ...@@ -573,13 +573,16 @@ namespace dlib
global_function_search:: global_function_search::
global_function_search( global_function_search(
const std::vector<function_spec>& functions_, const std::vector<function_spec>& functions_,
const std::vector<std::vector<function_evaluation>>& initial_function_evals const std::vector<std::vector<function_evaluation>>& initial_function_evals,
) : global_function_search(functions_) const double relative_noise_magnitude_
) : global_function_search(functions_)
{ {
DLIB_CASSERT(functions_.size() == initial_function_evals.size()); DLIB_CASSERT(functions_.size() == initial_function_evals.size());
DLIB_CASSERT(relative_noise_magnitude >= 0);
relative_noise_magnitude = relative_noise_magnitude_;
for (size_t i = 0; i < initial_function_evals.size(); ++i) for (size_t i = 0; i < initial_function_evals.size(); ++i)
{ {
functions[i]->ub = upper_bound_function(initial_function_evals[i]); functions[i]->ub = upper_bound_function(initial_function_evals[i], relative_noise_magnitude);
} }
} }
...@@ -669,7 +672,7 @@ namespace dlib ...@@ -669,7 +672,7 @@ namespace dlib
auto tmp = pick_next_sample_quad_interp(info->ub.get_points(), auto tmp = pick_next_sample_quad_interp(info->ub.get_points(),
info->radius, info->spec.lower, info->spec.upper, info->spec.is_integer_variable); info->radius, info->spec.lower, info->spec.upper, info->spec.is_integer_variable);
std::cout << "QP predicted improvement: "<< tmp.predicted_improvement << std::endl; std::cout << "QP predicted improvement: "<< tmp.predicted_improvement << std::endl;
if (tmp.predicted_improvement > qp_eps) if (tmp.predicted_improvement > min_trust_region_epsilon)
{ {
do_trust_region_step = false; do_trust_region_step = false;
outstanding_function_eval_request new_req; outstanding_function_eval_request new_req;
...@@ -746,7 +749,7 @@ namespace dlib ...@@ -746,7 +749,7 @@ namespace dlib
double global_function_search:: double global_function_search::
get_solver_epsilon ( get_solver_epsilon (
) const { return qp_eps; } ) const { return min_trust_region_epsilon; }
void global_function_search:: void global_function_search::
set_solver_epsilon ( set_solver_epsilon (
...@@ -754,7 +757,7 @@ namespace dlib ...@@ -754,7 +757,7 @@ namespace dlib
) )
{ {
DLIB_CASSERT(0 <= eps); DLIB_CASSERT(0 <= eps);
qp_eps = eps; min_trust_region_epsilon = eps;
} }
double global_function_search:: double global_function_search::
......
...@@ -144,7 +144,8 @@ namespace dlib ...@@ -144,7 +144,8 @@ namespace dlib
global_function_search( global_function_search(
const std::vector<function_spec>& functions_, const std::vector<function_spec>& functions_,
const std::vector<std::vector<function_evaluation>>& initial_function_evals const std::vector<std::vector<function_evaluation>>& initial_function_evals,
const double relative_noise_magnitude = 0.001
); );
global_function_search(const global_function_search&) = delete; global_function_search(const global_function_search&) = delete;
...@@ -210,7 +211,7 @@ namespace dlib ...@@ -210,7 +211,7 @@ namespace dlib
dlib::rand rnd; dlib::rand rnd;
double pure_random_search_probability = 0.02; double pure_random_search_probability = 0.02;
double qp_eps = 1e-11; double min_trust_region_epsilon = 1e-11;
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;
......
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