# Bayesian-Optimization / matlab / testfunctions / braninhighdim.m

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43``` ```% % ------------------------------------------------------------------------- % This file is part of BayesOpt, an efficient C++ library for % Bayesian optimization. % % Copyright (C) 2011-2013 Ruben Martinez-Cantin % % BayesOpt is free software: you can redistribute it and/or modify it % under the terms of the GNU General Public License as published by % the Free Software Foundation, either version 3 of the License, or % (at your option) any later version. % % BayesOpt is distributed in the hope that it will be useful, but % WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with BayesOpt. If not, see . % ------------------------------------------------------------------------ % function y = branin(x) %Bounds [0,1]^2 % Min = 0.1239 0.8183 % Min = 0.5428 0.1517 => 0.3979 % Min = 0.9617 0.1650 global MATRIX_A z = MATRIX_A*x'; if (z(1) < 0) z(1) = 0; end; if (z(2) < 0) z(2) = 0; end; if (z(1) > 1) z(1) = 1; end; if (z(2) > 1) z(2) = 1; end; % Trick: We assume the function has 1000 dims, but in reality, it is just % the traditional 2D branin. a = z(1) * 15 - 5; b = z(2) * 15; y = (b-(5.1/(4*pi^2))*a^2+5*a/pi-6)^2+10*(1-1/(8*pi))*cos(a)+10; ```