Commit d418f33d authored by Konstantinos Chatzilygeroudis's avatar Konstantinos Chatzilygeroudis
Browse files

Test commit - this branch should be deleted:

parent c2be9d46
......@@ -40,17 +40,20 @@ struct Params {
struct DirectParams {
struct opt_nloptnograd {
BO_DYN_PARAM(int, iterations);
BO_PARAM(bool, test, false);
};
};
struct BobyqaParams {
struct opt_nloptnograd {
BO_DYN_PARAM(int, iterations);
BO_PARAM(bool, test, false);
};
};
struct BobyqaParams_HP {
struct opt_nloptnograd {
BO_DYN_PARAM(int, iterations);
BO_PARAM(bool, test, true);
};
};
......@@ -65,7 +68,7 @@ void benchmark(const std::string& name)
DirectParams::opt_nloptnograd::set_iterations(static_cast<int>(iters_base * Function::dim_in * 0.9));
BobyqaParams::opt_nloptnograd::set_iterations(iters_base * Function::dim_in - DirectParams::opt_nloptnograd::iterations());
BobyqaParams_HP::opt_nloptnograd::set_iterations(10 * Function::dim_in * Function::dim_in);
BobyqaParams_HP::opt_nloptnograd::set_iterations(10 * Function::dim_in * (Function::dim_in - 1));
auto t1 = std::chrono::steady_clock::now();
Optimizer opt;
......
......@@ -36,12 +36,14 @@ struct Params {
struct DirectParams {
struct opt_nloptnograd {
BO_DYN_PARAM(int, iterations);
BO_PARAM(bool, test, false);
};
};
struct BobyqaParams {
struct opt_nloptnograd {
BO_DYN_PARAM(int, iterations);
BO_PARAM(bool, test, false);
};
};
......
......@@ -21,7 +21,7 @@ namespace limbo {
int dim = gp.kernel_function().h_params_size();
KernelLFOptimization<GP> optimization(gp);
Optimizer optimizer;
auto params = optimizer(optimization, tools::random_vector(dim), false);
auto params = optimizer(optimization, gp.kernel_function().h_params(), true);
gp.kernel_function().set_h_params(params);
gp.set_lik(opt::eval(optimization, params));
gp.recompute(false);
......
......@@ -80,6 +80,9 @@ namespace limbo {
catch (nlopt::roundoff_limited& e) {
// In theory it's ok to ignore this error
}
catch (std::invalid_argument& e) {
// In theory it's ok to ignore this error
}
return Eigen::VectorXd::Map(x.data(), x.size());
}
......
......@@ -87,6 +87,10 @@ namespace limbo {
if (bounded) {
opt.set_lower_bounds(std::vector<double>(dim, 0));
opt.set_upper_bounds(std::vector<double>(dim, 1));
if (Params::opt_nloptnograd::test()) {
opt.set_lower_bounds(std::vector<double>(dim, -6.0));
opt.set_upper_bounds(std::vector<double>(dim, 1.0));
}
}
double max;
......@@ -97,6 +101,9 @@ namespace limbo {
catch (nlopt::roundoff_limited& e) {
// In theory it's ok to ignore this error
}
catch (std::invalid_argument& e) {
// In theory it's ok to ignore this error
}
return Eigen::VectorXd::Map(x.data(), x.size());
}
......
Supports Markdown
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