2 % -------------------------------------------------------------------------
3 % This file is part of BayesOpt, an efficient C++ library for
4 % Bayesian optimization.
6 % Copyright (C) 2011-2015 Ruben Martinez-Cantin <rmcantin@unizar.es>
8 % BayesOpt is free software: you can redistribute it and/or modify it
9 % under the terms of the GNU Affero General Public License as published by
10 % the Free Software Foundation, either version 3 of the License, or
11 % (at your option) any later version.
13 % BayesOpt is distributed in the hope that it will be useful, but
14 % WITHOUT ANY WARRANTY; without even the implied warranty of
15 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 % GNU Affero General Public License
for more details.
18 % You should have received a copy of the GNU Affero General Public License
19 % along with BayesOpt. If not, see <http:
20 % ------------------------------------------------------------------------
23 addpath('testfunctions')
25 params.n_iterations = 190;
26 params.n_init_samples = 10;
27 params.crit_name =
'cEI';
28 params.surr_name =
'sStudentTProcessNIG';
30 params.kernel_name =
'kMaternARD5';
31 params.kernel_hp_mean = [1];
32 params.kernel_hp_std = [10];
33 params.verbose_level = 1;
34 params.log_filename =
'matbopt.log';
37 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
38 disp(
'Continuous optimization');
39 fun =
'branin'; n = 2;
44 bayesoptcont(fun,n,params,lb,ub)
49 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
50 disp(
'Discrete optimization');
52 % The
set of points must be numDimension x numPoints.
54 xset = repmat((ub-lb),1,np) .* rand(n,np) - repmat(lb,1,np);
57 bayesoptdisc(fun, xset, params)
61 yset(i) = feval(fun,xset(:,i));
63 [y_min,id] = min(yset);
64 disp(
'Actual optimal');
70 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
71 disp(
'Continuous optimization');
72 fun =
'hartmann'; n = 6;
77 bayesoptcont(fun,n,params,lb,ub)