26 #include <boost/numeric/ublas/assignment.hpp> 30 double testFunction(
unsigned int n,
const double *x,
35 for (
unsigned int i = 0; i < n; ++i)
37 f += (x[i] - .53) * (x[i] - .53);
53 for (
size_t i = 0; i < Xi.size(); ++i)
57 return testFunction(Xi.size(),x,NULL,NULL);
67 int main(
int nargs,
char *args[])
100 std::cout <<
"Running C++ interface" << std::endl;
109 diff = (double)(end-start) / (double)CLOCKS_PER_SEC;
112 std::cout <<
"Running C inferface" << std::endl;
115 double low[128], up[128], xmin[128], fmin[128];
118 for (
int i = 0; i < n; ++i)
128 diff2 = (double)(end-start) / (double)CLOCKS_PER_SEC;
133 std::cout <<
"Final result C++: " << result << std::endl;
134 std::cout <<
"Elapsed time in C++: " << diff <<
" seconds" << std::endl;
136 std::cout <<
"Final result C: [" << n <<
"](" << xmin[0];
137 for (
int i = 1; i < n; ++i )
139 std::cout <<
"," << xmin[i];
141 std::cout <<
")" << std::endl;
142 std::cout <<
"Elapsed time in C: " << diff2 <<
" seconds" << std::endl;
KernelParameters kernel
Kernel parameters.
std::string name
Name of the mean function.
BAYESOPT_API int bayes_optimization(int nDim, eval_func f, void *f_data, const double *lb, const double *ub, double *x, double *minf, bopt_params parameters)
C wrapper for the Bayesian optimization algorithm.
vectord coef_std
Basis function coefficients (std)
MeanParameters mean
Mean (parametric function) parameters.
vectord hp_mean
Kernel hyperparameters prior (mean, log space)
learning_type l_type
Type of learning for the kernel params.
Bayesian optimization for functions in continuous input spaces.
ContinuousModel()
Default constructor forbidden.
vectord coef_mean
Basis function coefficients (mean)
size_t n_init_samples
Number of samples before optimization.
BayesOpt main C++ interface.
BayesOpt wrapper for 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 &Xi)
Function that defines the actual function to be optimized.
vectord hp_std
Kernel hyperparameters prior (st dev, log space)
std::string surr_name
Name of the surrogate function.
double noise
Variance of observation noise (and nugget)
std::string name
Name of the kernel function.
score_type sc_type
Score type for kernel hyperparameters (ML,MAP,etc)
int random_seed
>=0 -> Fixed seed, <0 -> Time based (variable).
bool checkReachability(const vectord &query)
This function checks if the query is valid or not.
size_t n_iter_relearn
Number of samples before relearn kernel.