Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Let users pass in an nlopt algorithm to the TuneConfig. #58

Merged
merged 1 commit into from
Oct 30, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions albatross/tune.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,14 @@ template <class FeatureType> struct TuneModelConfig {
set_default_optimizer();
};

void set_default_optimizer() {
void
set_default_optimizer(const nlopt::algorithm &algorithm = nlopt::LN_PRAXIS) {
// The various algorithms in nlopt are coded by the first two characters.
// In this case LN stands for local, gradient free.
auto m = model_creator();

auto tunable_params = m->get_tunable_parameters();
optimizer =
nlopt::opt(nlopt::LN_PRAXIS, (unsigned)tunable_params.values.size());
optimizer = nlopt::opt(algorithm, (unsigned)tunable_params.values.size());
optimizer.set_ftol_abs(1e-8);
optimizer.set_ftol_rel(1e-6);
optimizer.set_lower_bounds(tunable_params.lower_bounds);
Expand Down