BayesOpt
hartmann.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 = hartmann(x)
24 %Bounds [0,1]^2
25 % Min = (0.20169, 0.150011, 0.476874, 0.275332, 0.311652, 0.6573),
26 % => -3.32236
27  a = [10.0, 3.0, 17.0, 3.5, 1.7, 8.0;
28  0.05, 10.0, 17.0, 0.1, 8.0, 14.0;
29  3.0, 3.5, 1.7, 10.0, 17.0, 8.0;
30  17.0, 8.0, 0.05, 10.0, 0.1, 14.0];
31  c = [1.0, 1.2, 3.0, 3.2];
32  p = [0.1312, 0.1696, 0.5569, 0.0124, 0.8283, 0.5886;
33  0.2329, 0.4135, 0.8307, 0.3736, 0.1004, 0.9991;
34  0.2348, 0.1451, 0.3522, 0.2883, 0.3047, 0.6650;
35  0.4047, 0.8828, 0.8732, 0.5743, 0.1091, 0.0381];
36 
37  y = 0;
38  for i=1:4
39  sum = 0;
40  for j=1:6
41  sum = sum - a(i,j)*(x(j)-p(i,j))^2;
42  end;
43  y = y - c(i)*exp(sum);
44  end;