BayesOpt
braninhighdim.m
1 %
2 % -------------------------------------------------------------------------
3 % This file is part of BayesOpt, an efficient C++ library for
4 % Bayesian optimization.
5 %
6 % Copyright (C) 2011-2015 Ruben Martinez-Cantin <rmcantin@unizar.es>
7 %
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.
12 %
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.
17 %
18 % You should have received a copy of the GNU Affero General Public License
19 % along with BayesOpt. If not, see <http://www.gnu.org/licenses/>.
20 % ------------------------------------------------------------------------
21 %
22 
23 function y = braninhighdim(x)
24 %Bounds [0,1]^2
25 % Min = 0.1239 0.8183
26 % Min = 0.5428 0.1517 => 0.3979
27 % Min = 0.9617 0.1650
28 
29 global MATRIX_A
30 global TRUE_I
31 
32 z = MATRIX_A*x';
33 
34 if (z(TRUE_I(1)) < 0) z(TRUE_I(1)) = 0; end;
35 if (z(TRUE_I(2)) < 0) z(TRUE_I(2)) = 0; end;
36 if (z(TRUE_I(1)) > 1) z(TRUE_I(1)) = 1; end;
37 if (z(TRUE_I(2)) > 1) z(TRUE_I(2)) = 1; end;
38 
39 % Trick: We assume the function has 1000 dims, but in reality, it is just
40 % the traditional 2D branin.
41 
42 a = z(TRUE_I(1)) * 15 - 5;
43 b = z(TRUE_I(2)) * 15;
44 
45 y = (b-(5.1/(4*pi^2))*a^2+5*a/pi-6)^2+10*(1-1/(8*pi))*cos(a)+10;