23 #define _USE_MATH_DEFINES 26 #include <boost/numeric/ublas/assignment.hpp> 34 #define M_PI 3.14159265358979323846 47 std::cout <<
"WARNING: This only works for 2D inputs." << std::endl
48 <<
"WARNING: Using only first two components." << std::endl;
56 std::string call =
"python ../examples/standalone_calls/eval_branin.py " +
57 fp.to_string(x1) +
" " + fp.to_string(x2);
58 int ret = system(call.c_str());
70 inline double sqr(
double x ){
return x*x; };
75 sv(0) = 0.1238938; sv(1) = 0.818333;
76 std::cout <<
"Solutions: " << sv <<
"->" 78 sv(0) = 0.5427728; sv(1) = 0.151667;
79 std::cout <<
"Solutions: " << sv <<
"->" 81 sv(0) = 0.961652; sv(1) = 0.1650;
82 std::cout <<
"Solutions: " << sv <<
"->" 88 int main(
int nargs,
char *args[])
92 if(!bayesopt::utils::ParamLoader::load(args[1], par)){
93 std::cout <<
"ERROR: provided file \"" << args[1] <<
"\" does not exist" << std::endl;
98 par = initialize_parameters_to_default();
111 std::cout <<
"Result: " << result <<
"->" 113 branin.printOptimal();
116 std::string filename(
"results.txt");
117 if(
remove( filename.c_str() ) == 0 ){
118 std::cout <<
"File \"" << filename <<
"\" successfully removed" << std::endl;
121 std::cout <<
"Error: cannot remove \"" << filename <<
"\" file" << std::endl;
Bayesian optimization for functions in continuous input spaces.
ContinuousModel()
Default constructor forbidden.
bool checkReachability(const vectord &query)
This function checks if the query is valid or not.
BayesOpt main C++ interface.
size_t n_iterations
Maximum BayesOpt evaluations (budget)
void optimize(vectord &bestPoint)
Execute the optimization process of the function defined in evaluateSample.
double evaluateSample(const vectord &xin)
Function that defines the actual function to be optimized.
int verbose_level
Neg-Error,0-Warning,1-Info,2-Debug -> stdout 3-Error,4-Warning,5-Info,>5-Debug -> logfile...
double noise
Variance of observation noise (and nugget)
Functions to write and parse data files.
Allows to load parameters from file.
int random_seed
>=0 -> Fixed seed, <0 -> Time based (variable).