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

Removed all typedefs

parent cff2da56
......@@ -179,7 +179,7 @@ The return type of the function to be optimized is ``eval_t``, which is defined
.. code-block:: cpp
typedef std::pair<double, boost::optional<Eigen::VectorXd>> eval_t;
using eval_t = std::pair<double, boost::optional<Eigen::VectorXd>>;
To make it easy to work with ``eval_t``, Limbo defines a few shortcuts:
......
......@@ -119,12 +119,12 @@ Then, when declaring the types to use:
::
typedef opt::Cmaes<ParamsAcquiOpt> Acqui_opt_t;
typedef opt::Cmaes<ParamsGPOpt> Gp_opt_t;
using Acqui_opt_t = opt::Cmaes<ParamsAcquiOpt>;
using Gp_opt_t = opt::Cmaes<ParamsGPOpt>;
typedef kernel::MaternFiveHalfs<Params> Kernel_t;
typedef mean::Data<Params> Mean_t;
typedef model::GP<Params, Kernel_t, Mean_t, model::gp::KernelLFOpt<Params, Gp_opt_t>> GP_t;
typedef acqui::UCB<Params, GP_t> Acqui_t;
using Kernel_t = kernel::MaternFiveHalfs<Params>;
using Mean_t = mean::Data<Params>;
using GP_t = model::GP<Params, Kernel_t, Mean_t, model::gp::KernelLFOpt<Params, Gp_opt_t>>;
using Acqui_t = acqui::UCB<Params, GP_t>;
bayes_opt::BOptimizer<Params, modelfun<GP_t>, acquifun<Acqui_t>, acquiopt<Acqui_opt_t>> opt;
......@@ -137,17 +137,16 @@ int main()
{
srand(time(NULL));
typedef kernel::SquaredExpARD<Params> Kernel_t;
typedef opt::Chained<Params, opt::NLOptNoGrad<DirectParams, nlopt::GN_DIRECT_L>, opt::NLOptNoGrad<BobyqaParams, nlopt::LN_BOBYQA>> AcquiOpt_t;
typedef boost::fusion::vector<stop::MaxIterations<Params>> Stop_t;
// typedef mean_functions::MeanFunctionARD<Params, mean_functions::MeanData<Params>> Mean_t;
typedef mean::Constant<Params> Mean_t;
typedef boost::fusion::vector<> Stat_t;
typedef init::RandomSampling<Params> Init_t;
typedef model::GP<Params, Kernel_t, Mean_t, model::gp::KernelLFOpt<Params, opt::NLOptNoGrad<BobyqaParams_HP, nlopt::LN_BOBYQA>>> GP_t;
typedef acqui::UCB<Params, GP_t> Acqui_t;
typedef bayes_opt::BOptimizer<Params, modelfun<GP_t>, initfun<Init_t>, acquifun<Acqui_t>, acquiopt<AcquiOpt_t>, statsfun<Stat_t>, stopcrit<Stop_t>> Opt_t;
using Kernel_t = kernel::SquaredExpARD<Params>;
using AcquiOpt_t = opt::Chained<Params, opt::NLOptNoGrad<DirectParams, nlopt::GN_DIRECT_L>, opt::NLOptNoGrad<BobyqaParams, nlopt::LN_BOBYQA>>;
using Stop_t = boost::fusion::vector<stop::MaxIterations<Params>>;
using Mean_t = mean::Constant<Params>;
using Stat_t = boost::fusion::vector<>;
using Init_t = init::RandomSampling<Params>;
using GP_t = model::GP<Params, Kernel_t, Mean_t, model::gp::KernelLFOpt<Params, opt::NLOptNoGrad<BobyqaParams_HP, nlopt::LN_BOBYQA>>>;
using Acqui_t = acqui::UCB<Params, GP_t>;
using Opt_t = bayes_opt::BOptimizer<Params, modelfun<GP_t>, initfun<Init_t>, acquifun<Acqui_t>, acquiopt<AcquiOpt_t>, statsfun<Stat_t>, stopcrit<Stop_t>>;
benchmark<Opt_t, BraninNormalized>("branin");
benchmark<Opt_t, Hartmann6>("hartmann6");
......
......@@ -125,17 +125,16 @@ int main()
{
srand(time(NULL));
typedef kernel::MaternFiveHalves<Params> Kernel_t;
typedef opt::Chained<Params, opt::NLOptNoGrad<DirectParams, nlopt::GN_DIRECT_L>, opt::NLOptNoGrad<BobyqaParams, nlopt::LN_BOBYQA>> AcquiOpt_t;
typedef boost::fusion::vector<stop::MaxIterations<Params>> Stop_t;
// typedef mean_functions::MeanFunctionARD<Params, mean_functions::MeanData<Params>> Mean_t;
typedef mean::Constant<Params> Mean_t;
typedef boost::fusion::vector<> Stat_t;
typedef init::RandomSampling<Params> Init_t;
typedef model::GP<Params, Kernel_t, Mean_t> GP_t;
typedef acqui::UCB<Params, GP_t> Acqui_t;
typedef bayes_opt::BOptimizer<Params, modelfun<GP_t>, initfun<Init_t>, acquifun<Acqui_t>, acquiopt<AcquiOpt_t>, statsfun<Stat_t>, stopcrit<Stop_t>> Opt_t;
using Kernel_t = kernel::MaternFiveHalves<Params>;
using AcquiOpt_t = opt::Chained<Params, opt::NLOptNoGrad<DirectParams, nlopt::GN_DIRECT_L>, opt::NLOptNoGrad<BobyqaParams, nlopt::LN_BOBYQA>>;
using Stop_t = boost::fusion::vector<stop::MaxIterations<Params>>;
using Mean_t = mean::Constant<Params>;
using Stat_t = boost::fusion::vector<>;
using Init_t = init::RandomSampling<Params>;
using GP_t = model::GP<Params, Kernel_t, Mean_t>;
using Acqui_t = acqui::UCB<Params, GP_t>;
using Opt_t = bayes_opt::BOptimizer<Params, modelfun<GP_t>, initfun<Init_t>, acquifun<Acqui_t>, acquiopt<AcquiOpt_t>, statsfun<Stat_t>, stopcrit<Stop_t>>;
benchmark<Opt_t, BraninNormalized>("branin");
benchmark<Opt_t, Hartmann6>("hartmann6");
......
......@@ -116,7 +116,7 @@ struct cosine {
int main()
{
tools::par::init();
typedef cosine func_t;
using func_t = cosine;
using Stop_t = boost::fusion::vector<stop::MaxIterations<Params>>;
using Stat_t = boost::fusion::vector<stat::Samples<Params>,
......
......@@ -313,22 +313,19 @@ int main(int argc, char** argv)
tools::par::init();
#ifdef USE_TBB
typedef tbb::concurrent_hash_map<std::string, std::vector<std::pair<double, double>>>
res_t;
using res_t = tbb::concurrent_hash_map<std::string, std::vector<std::pair<double, double>>>;
#else
typedef std::map<std::string,
std::vector<std::pair<double, double>>>
res_t;
using res_t = std::map<std::string, std::vector<std::pair<double, double>>>;
#endif
res_t results;
typedef kernel::Exp<Params> kf_t;
typedef mean::Constant<Params> mean_t;
typedef model::GP<Params, kf_t, mean_t> model_t;
typedef init::NoInit<Params> init_t;
typedef acqui::experimental::UCB_IMGPO<Params, model_t> acqui_t;
using kf_t = kernel::Exp<Params>;
using mean_t = mean::Constant<Params>;
using model_t = model::GP<Params, kf_t, mean_t>;
using init_t = init::NoInit<Params>;
using acqui_t = acqui::experimental::UCB_IMGPO<Params, model_t>;
typedef bayes_opt::experimental::IMGPO<Params, modelfun<model_t>, initfun<init_t>, acquifun<acqui_t>> Opt_t;
using Opt_t = bayes_opt::experimental::IMGPO<Params, modelfun<model_t>, initfun<init_t>, acquifun<acqui_t>>;
if (!is_in_argv(argc, argv, "--only") || is_in_argv(argc, argv, "sphere"))
tools::par::replicate(nb_replicates, [&]() {
......
......@@ -197,13 +197,13 @@ int main()
tools::par::init();
#ifdef ZDT1
typedef zdt1 func_t;
using func_t = zdt1;
#elif defined ZDT2
typedef zdt2 func_t;
using func_t = zdt2;
#elif defined ZDT3
typedef zdt3 func_t;
using func_t = zdt3;
#else
typedef mop2 func_t;
using func_t = mop2;
#endif
#ifdef PAREGO
......
......@@ -112,10 +112,10 @@ struct fit_eval {
int main()
{
typedef kernel::MaternFiveHalves<Params> Kernel_t;
typedef mean::Data<Params> Mean_t;
typedef model::GP<Params, Kernel_t, Mean_t> GP_t;
typedef acqui::UCB<Params, GP_t> Acqui_t;
using Kernel_t = kernel::MaternFiveHalves<Params>;
using Mean_t = mean::Data<Params>;
using GP_t = model::GP<Params, Kernel_t, Mean_t>;
using Acqui_t = acqui::UCB<Params, GP_t>;
using stat_t = boost::fusion::vector<stat::ConsoleSummary<Params>,
stat::Samples<Params>,
stat::Observations<Params>,
......
......@@ -102,7 +102,7 @@ struct StateEval {
};
struct Average {
typedef double result_type;
using result_type = double;
double operator()(const Eigen::VectorXd& x) const
{
return x.sum() / x.size();
......@@ -110,7 +110,7 @@ struct Average {
};
struct SecondElem {
typedef double result_type;
using result_type = double;
double operator()(const Eigen::VectorXd& x) const
{
return x(1);
......@@ -119,10 +119,10 @@ struct SecondElem {
int main()
{
typedef kernel::MaternFiveHalves<Params> Kernel_t;
typedef mean::Data<Params> Mean_t;
typedef model::GP<Params, Kernel_t, Mean_t> GP_t;
typedef acqui::GP_UCB<Params, GP_t> Acqui_t;
using Kernel_t = kernel::MaternFiveHalves<Params>;
using Mean_t = mean::Data<Params>;
using GP_t = model::GP<Params, Kernel_t, Mean_t>;
using Acqui_t = acqui::GP_UCB<Params, GP_t>;
bayes_opt::BOptimizer<Params, modelfun<GP_t>, acquifun<Acqui_t>> opt;
......
......@@ -207,10 +207,10 @@ struct fit_eval {
int main()
{
typedef kernel::SquaredExpARD<Params> Kernel_t;
typedef mean::FunctionARD<Params, MeanComplet<Params>> Mean_t;
typedef model::GP<Params, Kernel_t, Mean_t, model::gp::KernelMeanLFOpt<Params>> GP_t;
typedef UCB_multi<Params, GP_t> Acqui_t;
using Kernel_t = kernel::SquaredExpARD<Params>;
using Mean_t = mean::FunctionARD<Params, MeanComplet<Params>>;
using GP_t = model::GP<Params, Kernel_t, Mean_t, model::gp::KernelMeanLFOpt<Params>>;
using Acqui_t = UCB_multi<Params, GP_t>;
bayes_opt::BOptimizer<Params, modelfun<GP_t>, acquifun<Acqui_t>> opt;
opt.optimize(fit_eval());
......
......@@ -95,7 +95,7 @@ namespace limbo {
};
struct FirstElem {
typedef double result_type;
using result_type = double;
double operator()(const Eigen::VectorXd& x) const
{
return x(0);
......@@ -116,11 +116,11 @@ namespace limbo {
namespace bayes_opt {
typedef boost::parameter::parameters<boost::parameter::optional<tag::statsfun>,
using bobase_signature = boost::parameter::parameters<boost::parameter::optional<tag::statsfun>,
boost::parameter::optional<tag::initfun>,
boost::parameter::optional<tag::acquifun>,
boost::parameter::optional<tag::stopcrit>,
boost::parameter::optional<tag::modelfun>> bobase_signature;
boost::parameter::optional<tag::modelfun>>;
// clang-format off
template <class Params,
......@@ -167,40 +167,40 @@ namespace limbo {
For Statistics, the default value is: ``boost::fusion::vector<stat::Samples<Params>, stat::AggregatedObservations<Params>, stat::ConsoleSummary<Params>>``
Example of customization:
- ``typedef kernel::MaternFiveHalves<Params> Kernel_t;``
- ``typedef mean::Data<Params> Mean_t;``
- ``typedef model::GP<Params, Kernel_t, Mean_t> GP_t;``
- ``typedef acqui::UCB<Params, GP_t> Acqui_t;``
- ``using Kernel_t = kernel::MaternFiveHalves<Params>;``
- ``using Mean_t = mean::Data<Params>;``
- ``using GP_t = model::GP<Params, Kernel_t, Mean_t>;``
- ``using Acqui_t = acqui::UCB<Params, GP_t>;``
- ``bayes_opt::BOptimizer<Params, modelfun<GP_t>, acquifun<Acqui_t>> opt;``
*/
class BoBase {
public:
typedef Params params_t;
using params_t = Params;
// defaults
struct defaults {
typedef init::RandomSampling<Params> init_t; // 1
using init_t = init::RandomSampling<Params>; // 1
typedef kernel::Exp<Params> kf_t;
typedef mean::Data<Params> mean_t;
typedef model::GP<Params, kf_t, mean_t> model_t; // 2
using kf_t = kernel::Exp<Params>;
using mean_t = mean::Data<Params>;
using model_t = model::GP<Params, kf_t, mean_t>; // 2
// WARNING: you have to specify the acquisition function
// if you use a custom model
typedef acqui::UCB<Params, model_t> acqui_t; // 3
typedef boost::fusion::vector<stat::Samples<Params>, stat::AggregatedObservations<Params>, stat::ConsoleSummary<Params>> stat_t; // 4
typedef boost::fusion::vector<stop::MaxIterations<Params>> stop_t; // 5
using acqui_t = acqui::UCB<Params, model_t>; // 3
using stat_t = boost::fusion::vector<stat::Samples<Params>, stat::AggregatedObservations<Params>, stat::ConsoleSummary<Params>>; // 4
using stop_t = boost::fusion::vector<stop::MaxIterations<Params>>; // 5
};
// extract the types
typedef typename bobase_signature::bind<A1, A2, A3, A4, A5, A6>::type args;
typedef typename boost::parameter::binding<args, tag::initfun, typename defaults::init_t>::type init_function_t;
typedef typename boost::parameter::binding<args, tag::acquifun, typename defaults::acqui_t>::type acquisition_function_t;
typedef typename boost::parameter::binding<args, tag::modelfun, typename defaults::model_t>::type model_t;
typedef typename boost::parameter::binding<args, tag::statsfun, typename defaults::stat_t>::type Stat;
typedef typename boost::parameter::binding<args, tag::stopcrit, typename defaults::stop_t>::type StoppingCriteria;
typedef typename boost::mpl::if_<boost::fusion::traits::is_sequence<StoppingCriteria>, StoppingCriteria, boost::fusion::vector<StoppingCriteria>>::type stopping_criteria_t;
typedef typename boost::mpl::if_<boost::fusion::traits::is_sequence<Stat>, Stat, boost::fusion::vector<Stat>>::type stat_t;
using args = typename bobase_signature::bind<A1, A2, A3, A4, A5, A6>::type;
using init_function_t = typename boost::parameter::binding<args, tag::initfun, typename defaults::init_t>::type;
using acquisition_function_t = typename boost::parameter::binding<args, tag::acquifun, typename defaults::acqui_t>::type;
using model_t = typename boost::parameter::binding<args, tag::modelfun, typename defaults::model_t>::type;
using Stat = typename boost::parameter::binding<args, tag::statsfun, typename defaults::stat_t>::type;
using StoppingCriteria = typename boost::parameter::binding<args, tag::stopcrit, typename defaults::stop_t>::type;
using stopping_criteria_t = typename boost::mpl::if_<boost::fusion::traits::is_sequence<StoppingCriteria>, StoppingCriteria, boost::fusion::vector<StoppingCriteria>>::type;
using stat_t = typename boost::mpl::if_<boost::fusion::traits::is_sequence<Stat>, Stat, boost::fusion::vector<Stat>>::type;
/// default constructor
BoBase() : _total_iterations(0) { _make_res_dir(); }
......
......@@ -77,12 +77,12 @@ namespace limbo {
namespace bayes_opt {
typedef boost::parameter::parameters<boost::parameter::optional<tag::acquiopt>,
using boptimizer_signature = boost::parameter::parameters<boost::parameter::optional<tag::acquiopt>,
boost::parameter::optional<tag::statsfun>,
boost::parameter::optional<tag::initfun>,
boost::parameter::optional<tag::acquifun>,
boost::parameter::optional<tag::stopcrit>,
boost::parameter::optional<tag::modelfun>> boptimizer_signature;
boost::parameter::optional<tag::modelfun>>;
// clang-format off
/**
......@@ -119,21 +119,21 @@ namespace limbo {
// defaults
struct defaults {
#ifdef USE_NLOPT
typedef opt::NLOptNoGrad<Params, nlopt::GN_DIRECT_L_RAND> acquiopt_t;
using acquiopt_t = opt::NLOptNoGrad<Params, nlopt::GN_DIRECT_L_RAND>;
#elif defined(USE_LIBCMAES)
typedef opt::Cmaes<Params> acquiopt_t;
using acquiopt_t = opt::Cmaes<Params>;
#else
#warning NO NLOpt, and NO Libcmaes: the acquisition function will be optimized by a grid search algorithm (which is usually bad). Please install at least NLOpt or libcmaes to use limbo!.
typedef opt::GridSearch<Params> acquiopt_t;
using acquiopt_t = opt::GridSearch<Params>;
#endif
};
/// link to the corresponding BoBase (useful for typedefs)
typedef BoBase<Params, A1, A2, A3, A4, A5, A6> base_t;
typedef typename base_t::model_t model_t;
typedef typename base_t::acquisition_function_t acquisition_function_t;
using base_t = BoBase<Params, A1, A2, A3, A4, A5, A6>;
using model_t = typename base_t::model_t;
using acquisition_function_t = typename base_t::acquisition_function_t;
// extract the types
typedef typename boptimizer_signature::bind<A1, A2, A3, A4, A5, A6>::type args;
typedef typename boost::parameter::binding<args, tag::acquiopt, typename defaults::acquiopt_t>::type acqui_optimizer_t;
using args = typename boptimizer_signature::bind<A1, A2, A3, A4, A5, A6>::type;
using acqui_optimizer_t = typename boost::parameter::binding<args, tag::acquiopt, typename defaults::acquiopt_t>::type;
/// The main function (run the Bayesian optimization algorithm)
template <typename StateFunction, typename AggregatorFunction = FirstElem>
......
......@@ -73,8 +73,8 @@ namespace limbo {
#ifdef USE_SFERES
struct SferesParams {
struct evo_float {
typedef sferes::gen::evo_float::mutation_t mutation_t;
typedef sferes::gen::evo_float::cross_over_t cross_over_t;
using mutation_t = sferes::gen::evo_float::mutation_t;
using cross_over_t = sferes::gen::evo_float::cross_over_t;
SFERES_CONST float cross_rate = 0.5f;
SFERES_CONST float mutation_rate = 0.1f;
SFERES_CONST float eta_m = 15.0f;
......@@ -135,11 +135,11 @@ namespace limbo {
BOOST_PARAMETER_TEMPLATE_KEYWORD(statsfun)
BOOST_PARAMETER_TEMPLATE_KEYWORD(stopcrit)
typedef boost::parameter::parameters<boost::parameter::optional<tag::statsfun>,
using bo_multi_signature = boost::parameter::parameters<boost::parameter::optional<tag::statsfun>,
boost::parameter::optional<tag::initfun>,
boost::parameter::optional<tag::acquifun>,
boost::parameter::optional<tag::stopcrit>,
boost::parameter::optional<tag::modelfun>> bo_multi_signature;
boost::parameter::optional<tag::modelfun>>;
template <class Params,
class A1 = boost::parameter::void_,
......@@ -150,14 +150,14 @@ namespace limbo {
class A6 = boost::parameter::void_>
class BoMulti : public limbo::bayes_opt::BoBase<Params, A1, A2, A3, A4, A5, A6> {
public:
typedef typename bo_multi_signature::bind<A1, A2, A3, A4, A5, A6>::type args;
using args = typename bo_multi_signature::bind<A1, A2, A3, A4, A5, A6>::type;
typedef limbo::bayes_opt::BoBase<Params, A1, A2, A3, A4, A5, A6> base_t;
typedef typename base_t::model_t model_t;
typedef typename base_t::acquisition_function_t acquisition_function_t;
using base_t = limbo::bayes_opt::BoBase<Params, A1, A2, A3, A4, A5, A6>;
using model_t = typename base_t::model_t;
using acquisition_function_t = typename base_t::acquisition_function_t;
// point, obj, sigma
typedef std::tuple<Eigen::VectorXd, Eigen::VectorXd, Eigen::VectorXd> pareto_point_t;
typedef std::vector<pareto_point_t> pareto_t;
using pareto_point_t = std::tuple<Eigen::VectorXd, Eigen::VectorXd, Eigen::VectorXd>;
using pareto_t = std::vector<pareto_point_t>;
size_t nb_objs() const { return this->_observations[0].size(); }
......@@ -183,12 +183,12 @@ namespace limbo {
{
this->_update_models();
#ifdef USE_SFERES
typedef sferes::gen::EvoFloat<D, multi::SferesParams> gen_t;
typedef sferes::phen::Parameters<gen_t, multi::SferesFit<model_t>, multi::SferesParams> phen_t;
typedef sferes::eval::Parallel<multi::SferesParams> eval_t;
typedef boost::fusion::vector<> stat_t;
typedef sferes::modif::Dummy<> modifier_t;
typedef sferes::ea::Nsga2<phen_t, eval_t, stat_t, modifier_t, multi::SferesParams> nsga2_t;
using gen_t = sferes::gen::EvoFloat<D, multi::SferesParams>;
using phen_t = sferes::phen::Parameters<gen_t, multi::SferesFit<model_t>, multi::SferesParams>;
using eval_t = sferes::eval::Parallel<multi::SferesParams>;
using stat_t = boost::fusion::vector<>;
using modifier_t = sferes::modif::Dummy<>;
using nsga2_t = sferes::ea::Nsga2<phen_t, eval_t, stat_t, modifier_t, multi::SferesParams>;
// commented to remove a dependency to a particular version of sferes
nsga2_t ea;
......
......@@ -79,14 +79,13 @@ namespace limbo {
namespace bayes_opt {
typedef boost::parameter::parameters<boost::parameter::optional<limbo::tag::acquiopt>,
using cboptimizer_signature = boost::parameter::parameters<boost::parameter::optional<limbo::tag::acquiopt>,
boost::parameter::optional<limbo::tag::statsfun>,
boost::parameter::optional<limbo::tag::initfun>,
boost::parameter::optional<limbo::tag::acquifun>,
boost::parameter::optional<limbo::tag::stopcrit>,
boost::parameter::optional<limbo::tag::modelfun>,
boost::parameter::optional<limbo::experimental::tag::constraint_modelfun>>
cboptimizer_signature;
boost::parameter::optional<limbo::experimental::tag::constraint_modelfun>>;
// clang-format off
/**
......@@ -124,27 +123,27 @@ namespace limbo {
// defaults
struct defaults {
#ifdef USE_NLOPT
typedef limbo::opt::NLOptNoGrad<Params, nlopt::GN_DIRECT_L_RAND> acquiopt_t;
using acquiopt_t = limbo::opt::NLOptNoGrad<Params, nlopt::GN_DIRECT_L_RAND>;
#elif defined(USE_LIBCMAES)
typedef limbo::opt::Cmaes<Params> acquiopt_t;
using acquiopt_t = limbo::opt::Cmaes<Params>;
#else
#warning NO NLOpt, and NO Libcmaes: the acquisition function will be optimized by a grid search algorithm (which is usually bad). Please install at least NLOpt or libcmaes to use limbo!.
typedef limbo::opt::GridSearch<Params> acquiopt_t;
using acquiopt_t = limbo::opt::GridSearch<Params>;
#endif
typedef limbo::kernel::Exp<Params> kf_t;
typedef limbo::mean::Constant<Params> mean_t;
typedef limbo::model::GP<Params, kf_t, mean_t> constraint_model_t;
using kf_t = limbo::kernel::Exp<Params>;
using mean_t = limbo::mean::Constant<Params>;
using constraint_model_t = limbo::model::GP<Params, kf_t, mean_t>;
};
/// link to the corresponding BoBase (useful for typedefs)
typedef limbo::bayes_opt::BoBase<Params, A1, A2, A3, A4, A5, A6> base_t;
typedef typename base_t::model_t model_t;
using base_t = limbo::bayes_opt::BoBase<Params, A1, A2, A3, A4, A5, A6>;
using model_t = typename base_t::model_t;
typedef typename base_t::acquisition_function_t acquisition_function_t;
using acquisition_function_t = typename base_t::acquisition_function_t;
// extract the types
typedef typename cboptimizer_signature::bind<A1, A2, A3, A4, A5, A6, A7>::type args;
typedef typename boost::parameter::binding<args, limbo::tag::acquiopt, typename defaults::acquiopt_t>::type acqui_optimizer_t;
using args = typename cboptimizer_signature::bind<A1, A2, A3, A4, A5, A6, A7>::type;
using acqui_optimizer_t = typename boost::parameter::binding<args, limbo::tag::acquiopt, typename defaults::acquiopt_t>::type;
typedef typename boost::parameter::binding<args, limbo::experimental::tag::constraint_modelfun, typename defaults::constraint_model_t>::type constraint_model_t;
using constraint_model_t = typename boost::parameter::binding<args, limbo::experimental::tag::constraint_modelfun, typename defaults::constraint_model_t>::type;
/// The main function (run the Bayesian optimization algorithm)
template <typename StateFunction, typename AggregatorFunction = FirstElem>
......
......@@ -69,7 +69,7 @@ namespace limbo {
BOOST_PARAMETER_TEMPLATE_KEYWORD(acquiopt)
typedef boost::parameter::parameters<boost::parameter::optional<tag::acquiopt>> ehvi_signature;
using ehvi_signature = boost::parameter::parameters<boost::parameter::optional<tag::acquiopt>>;
template <class Params,
class A1 = boost::parameter::void_,
......@@ -83,21 +83,21 @@ namespace limbo {
public:
struct defaults {
#ifdef USE_NLOPT
typedef opt::NLOptNoGrad<Params, nlopt::GN_DIRECT_L_RAND> acquiopt_t;
using acquiopt_t = opt::NLOptNoGrad<Params, nlopt::GN_DIRECT_L_RAND>;
#elif defined(USE_LIBCMAES)
typedef opt::Cmaes<Params> acquiopt_t;
using acquiopt_t = opt::Cmaes<Params>;
#else
#warning NO NLOpt, and NO Libcmaes: the acquisition function will be optimized by a grid search algorithm (which is usually bad). Please install at least NLOpt or libcmaes to use limbo!.
typedef opt::GridSearch<Params> acquiopt_t;
using acquiopt_t = opt::GridSearch<Params>;
#endif
};
typedef typename ehvi_signature::bind<A1, A2, A3, A4, A5, A6>::type args;
typedef typename boost::parameter::binding<args, tag::acquiopt, typename defaults::acquiopt_t>::type acqui_optimizer_t;
using args = typename ehvi_signature::bind<A1, A2, A3, A4, A5, A6>::type;
using acqui_optimizer_t = typename boost::parameter::binding<args, tag::acquiopt, typename defaults::acquiopt_t>::type;
typedef std::tuple<Eigen::VectorXd, Eigen::VectorXd, Eigen::VectorXd> pareto_point_t;
typedef limbo::experimental::bayes_opt::BoMulti<Params, A1, A2, A3, A4, A5, A6> base_t;
typedef typename base_t::model_t model_t;
using pareto_point_t = std::tuple<Eigen::VectorXd, Eigen::VectorXd, Eigen::VectorXd>;
using base_t = limbo::experimental::bayes_opt::BoMulti<Params, A1, A2, A3, A4, A5, A6>;
using model_t = typename base_t::model_t;
template <typename EvalFunction>
void optimize(const EvalFunction& feval, bool reset = true)
......@@ -125,7 +125,7 @@ namespace limbo {
Eigen::Vector3d(Params::bayes_opt_ehvi::x_ref(), Params::bayes_opt_ehvi::y_ref(), 0));
// maximize with inner opt
typedef std::pair<Eigen::VectorXd, double> pair_t;
using pair_t = std::pair<Eigen::VectorXd, double>;
pair_t init(Eigen::VectorXd::Zero(1), -std::numeric_limits<float>::max());
auto body = [&](int i) -> pair_t {
......
......@@ -85,9 +85,9 @@ namespace limbo {
// http://papers.nips.cc/paper/5715-bayesian-optimization-with-exponential-convergence
class IMGPO : public limbo::bayes_opt::BoBase<Params, A1, A2, A3, A4, A5> {
public:
typedef BoBase<Params, A1, A2, A3, A4, A5> base_t;
typedef typename base_t::model_t model_t;
typedef typename base_t::acquisition_function_t acquisition_function_t;
using base_t = BoBase<Params, A1, A2, A3, A4, A5>;
using model_t = typename base_t::model_t;
using acquisition_function_t = typename base_t::acquisition_function_t;
template <typename StateFunction, typename AggregatorFunction = FirstElem>
void optimize(const StateFunction& sfun, const AggregatorFunction& afun = AggregatorFunction(), bool reset = true)
......
......@@ -64,8 +64,7 @@ namespace limbo {
// clang-format on
class Nsbo : public BoMulti<Params, A2, A3, A4, A5, A6> {
public:
typedef std::tuple<Eigen::VectorXd, Eigen::VectorXd, Eigen::VectorXd>
pareto_point_t;
using pareto_point_t = std::tuple<Eigen::VectorXd, Eigen::VectorXd, Eigen::VectorXd>;
template <typename EvalFunction>
void optimize(const EvalFunction& feval, bool reset = true)
......
......@@ -59,7 +59,7 @@ namespace limbo {
BOOST_PARAMETER_TEMPLATE_KEYWORD(parego_modelfun)
typedef boost::parameter::parameters<boost::parameter::optional<tag::parego_modelfun>> parego_signature;
using parego_signature = boost::parameter::parameters<boost::parameter::optional<tag::parego_modelfun>>;