diff --git a/ChangeLog b/ChangeLog index 393266c4..d10c5f86 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2024-08-07 Romain Ait Abdelmalek-Lomenech + + Add camel test functions, with three and six humps + + * examples/test_functions/stk_testfun_sixhumpscamel.m: New tets function. + * examples/test_functions/stk_testfun_threehumpscamel.m: New tets function. + * admin/octpkg/INDEX: Update Octave package index. + * NEWS.md: Advertise the change. + 2024-03-28 Romain Ait Abdelmalek-Lomenech stk_param_estim.m: Fix nargout condition diff --git a/NEWS.md b/NEWS.md index b510ac54..0558c2f6 100644 --- a/NEWS.md +++ b/NEWS.md @@ -30,6 +30,14 @@ * `stk_length`: Removed. (Had been deprecated since 2.7.0.) +## Test functions + +* `stk_testfun_threehumpscamel`, `stk_testfun_sixhumpscamel`: New test + functions. + +* Most test functions in `examples/test_functions` are now also + available under the CC0 license (see each file). + ----- diff --git a/admin/octpkg/INDEX b/admin/octpkg/INDEX index 07a9cd14..fbbe8dce 100644 --- a/admin/octpkg/INDEX +++ b/admin/octpkg/INDEX @@ -307,6 +307,8 @@ Examples: test functions, datasets, etc. stk_testfun_hartman4 stk_testfun_hartman6 stk_testfun_hartman_generic + stk_testfun_sixhumpscamel + stk_testfun_threehumpscamel stk_testfun_twobumps stk_testcase_truss3 stk_testfun_truss3_bb diff --git a/examples/test_functions/stk_testfun_sixhumpscamel.m b/examples/test_functions/stk_testfun_sixhumpscamel.m new file mode 100644 index 00000000..56d8e15b --- /dev/null +++ b/examples/test_functions/stk_testfun_sixhumpscamel.m @@ -0,0 +1,75 @@ +% STK_TESTFUN_SIXHUMPSCAMEL computes the "six humps camel back" function +% +% CALL: Y = stk_testfun_sixhumpscamel (X) +% +% computes the value Y of the Hartman4 function at X. +% +% The six humps camel back function is a test function in dimension 2, +% which is usually evaluated over [-5, 5]^2. +% +% GLOBAL MINIMUM +% +% According to [1], the function has two global minima at +% +% x = [-0.0898, 0.7126] +% +% and +% +% x = [0.0898, -0.7126]. +% +% The corresponding function value is: +% +% f(x) = -1.0316. +% +% REFERENCES +% +% [1] M. Jamil & X. Yang, A Literature Survey of Benchmark Functions +% For Global Optimization Problems. Int. Journal of Mathematical +% Modelling and Numerical Optimisation, Vol. 4, No. 2, pp. 150–194 +% (2013). + +% Author +% +% Written in 2024 by Romain Ait Abdelmalek-Lomenech +% + +% Copying Permission Statement (this file) +% +% To the extent possible under law, CentraleSupelec has waived all +% copyright and related or neighboring rights to +% stk_testfun_sixhumpscamel.m. This work is published from France. +% +% License: CC0 + +% Copying Permission Statement (STK toolbox as a whole) +% +% This file is part of +% +% STK: a Small (Matlab/Octave) Toolbox for Kriging +% (https://github.com/stk-kriging/stk/) +% +% STK 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. +% +% STK 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 STK. If not, see . + +function y = stk_testfun_sixhumpscamel (x) + +x1 = x(:, 1); +x2 = x(:, 2); + +A = (4 - (2.1 * x1 .^ 2) + (x1 .^ 4) / 3) .* (x1 .^ 2); +B = x1 .* x2; +C = 4 * (x2 .^ 2 - 1) .* (x2 .^ 2); + +y = A + B + C; + +end % function diff --git a/examples/test_functions/stk_testfun_threehumpscamel.m b/examples/test_functions/stk_testfun_threehumpscamel.m new file mode 100644 index 00000000..a09d6e0d --- /dev/null +++ b/examples/test_functions/stk_testfun_threehumpscamel.m @@ -0,0 +1,71 @@ +% STK_TESTFUN_THREEHUMPSCAMEL computes the "three humps camel back" function +% +% CALL: Y = stk_testfun_threehumpscamel (X) +% +% computes the value Y of the Hartman4 function at X. +% +% The six humps camel back function is a test function in dimension 2, +% which is usually evaluated over [-5, 5]^2. +% +% GLOBAL MINIMUM +% +% According to [1], the function has one global minimum at +% +% x = [0, 0]. +% +% The corresponding function value is: +% +% f(x) = 0. +% +% REFERENCES +% +% [1] M. Jamil & X. Yang, A Literature Survey of Benchmark Functions +% For Global Optimization Problems. Int. Journal of Mathematical +% Modelling and Numerical Optimisation, Vol. 4, No. 2, pp. 150–194 +% (2013). + +% Author +% +% Written in 2024 by Romain Ait Abdelmalek-Lomenech +% + +% Copying Permission Statement (this file) +% +% To the extent possible under law, CentraleSupelec has waived all +% copyright and related or neighboring rights to +% stk_testfun_threehumpscamel.m. This work is published from France. +% +% License: CC0 + +% Copying Permission Statement (STK toolbox as a whole) +% +% This file is part of +% +% STK: a Small (Matlab/Octave) Toolbox for Kriging +% (https://github.com/stk-kriging/stk/) +% +% STK 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. +% +% STK 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 STK. If not, see . + +function y = stk_testfun_threehumpscamel (x) + +x1 = x(:, 1); +x2 = x(:, 2); + +A = (2 * x1 .^ 2) - (1.05 * x1 .^ 4) + (x1 .^ 6 / 6); +B = x1 .* x2; +C = x2 .^ 2; + +y = A + B + C; + +end % function