From 958266b1b8f25dad125555f1819b6f225d55dc12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lennart=20Sch=C3=A4permeier?= Date: Wed, 4 Oct 2023 12:12:57 +0200 Subject: [PATCH 1/4] Add support for the extended bi-objective BBOB The extended bi-objective BBOB adds FIDs 56-92. Resolves Issue #140 --- NEWS | 1 + NEWS.md | 4 ++++ R/makeBiObjBBOBFunction.R | 22 +++++++++++++++++++--- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index f2cb1d61..5da12aa8 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,7 @@ smoof 1.6.0.4 * Fixed bug in getLoggedValues when logging of x-values was set to FALSE in addLoggingWrapper * Fixed bug with instance ID mapping in makeBiObjBBOBFunction +* Added support for the extended bi-objective BBOB functions (FIDs 56-92) in makeBiObjBBOBFunction smoof 1.6.0.3 ============= diff --git a/NEWS.md b/NEWS.md index 87ca9a21..76eb8dc6 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,9 @@ # smoof 1.6.0.4 +## New features + +* Added support for the extended bi-objective BBOB functions (FIDs 56-92) in makeBiObjBBOBFunction + ## Bugfixes * Fixed bug in getLoggedValues when logging of x-values was set to FALSE in addLoggingWrapper diff --git a/R/makeBiObjBBOBFunction.R b/R/makeBiObjBBOBFunction.R index f6017a6d..9e2b11fc 100644 --- a/R/makeBiObjBBOBFunction.R +++ b/R/makeBiObjBBOBFunction.R @@ -1,5 +1,6 @@ #' Generator for the function set of the real-parameter Bi-Objective -#' Black-Box Optimization Benchmarking (BBOB). +#' Black-Box Optimization Benchmarking (BBOB) with Function IDs 1-55, as well as +#' its extended version (bbob-biobj-ext) with Function IDs 1-92. #' #' @note #' Concatenation of single-objective BBOB functions into @@ -8,7 +9,7 @@ #' @param dimensions [\code{integer(1)}]\cr #' Problem dimensions. Integer value between 2 and 40. #' @param fid [\code{integer(1)}]\cr -#' Function identifier. Integer value between 1 and 55. +#' Function identifier. Integer value between 1 and 92. #' @param iid [\code{integer(1)}]\cr #' Instance identifier. Integer value greater than or equal 1. #' @return [\code{smoof_multi_objective_function}] @@ -25,6 +26,8 @@ #' for a detailed description of the bi-objective BBOB functions. #' An overview of which pair of single-objective BBOB functions creates #' which of the 55 bi-objective BBOB functions can be found \href{http://numbbo.github.io/coco-doc/bbob-biobj/functions/#the-bbob-biobj-test-functions-and-their-properties}{here}. +#' A full description of the extended suite with 92 functions can be found +#' \href{http://numbbo.github.io/coco-doc/bbob-biobj/functions/#the-extended-bbob-biobj-ext-test-suite-and-its-functions}{here}. #' @export makeBiObjBBOBFunction = function(dimensions, fid, iid) { @@ -34,7 +37,7 @@ makeBiObjBBOBFunction = function(dimensions, fid, iid) { fid = asCount(fid) iid = asCount(iid) assertInt(dimensions, lower = 2L, upper = 40L) - assertInt(fid, lower = 1L, upper = 55L) + assertInt(fid, lower = 1L, upper = 92L) assertInt(iid, lower = 1L, upper = 15L) # restrict to documented "safe" range # touch vars @@ -51,6 +54,19 @@ makeBiObjBBOBFunction = function(dimensions, fid, iid) { grid = expand.grid(fids1 = fids, fids2 = fids) grid = grid[grid[, 1L] <= grid[, 2L], ] grid = grid[order(grid[, 1L]),] + + # Add all off-diagonal combinations per BBOB group (excluding FID 16) + # for the extended bi-objective suite + # cf. http://numbbo.github.io/coco-doc/bbob-biobj/functions/#the-extended-bbob-biobj-ext-test-suite-and-its-functions + for (group in list(1L:5L, 6L:9L, 10L:14L, setdiff(15L:19L, 16L), 20L:24L)) { + group.grid = expand.grid(fids1 = group, fids2 = group) + group.grid = group.grid[group.grid[, 1L] < group.grid[, 2L], ] + group.grid = group.grid[order(group.grid[, 1L]),] + + grid = rbind(grid, group.grid) + grid = grid[!duplicated(grid),] + } + rownames(grid) = NULL fid1 = grid[fid, "fids1"] From f94f6a0f137fd83f1e2cca9cdd7891d0c553b06c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lennart=20Sch=C3=A4permeier?= Date: Tue, 17 Oct 2023 16:24:33 +0200 Subject: [PATCH 2/4] Add simple tests for bi-objective BBOB --- tests/testthat/test_moofuns.R | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 tests/testthat/test_moofuns.R diff --git a/tests/testthat/test_moofuns.R b/tests/testthat/test_moofuns.R new file mode 100644 index 00000000..57112570 --- /dev/null +++ b/tests/testthat/test_moofuns.R @@ -0,0 +1,27 @@ +context("multi-objective test functions") + +test_that("(Extended) Bi-objective BBOB functions work", { + fids = 1:92 + iids = c(1, 5, 10, 15) + dimensions = c(2, 3) + + for (fid in fids) { + for (iid in iids) { + for (dimension in dimensions) { + generator = sprintf("(FID: %i, IID : %i, DIM: %i)", fid, iid, dimension) + + fn = makeBiObjBBOBFunction(dimensions = dimension, fid = fid, iid = iid) + # check vectorized input and output + + expectIsSmoofFunction(fn, generator) + + test.param = ParamHelpers::sampleValue(getParamSet(fn)) + test.val = fn(test.param) + expect_true(is.numeric(test.val)) + expect_true(is.logical(shouldBeMinimized(fn))) + expect_true(all(is.numeric(getUpperBoxConstraints(fn)))) + expect_true(all(is.numeric(getLowerBoxConstraints(fn)))) + } + } + } +}) From 7202d0be30d4025055331a7c155d60d826b9f819 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lennart=20Sch=C3=A4permeier?= Date: Fri, 20 Oct 2023 12:43:18 +0200 Subject: [PATCH 3/4] Convert documentation to speaking links --- R/makeBiObjBBOBFunction.R | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/R/makeBiObjBBOBFunction.R b/R/makeBiObjBBOBFunction.R index 9e2b11fc..2b4b0861 100644 --- a/R/makeBiObjBBOBFunction.R +++ b/R/makeBiObjBBOBFunction.R @@ -25,9 +25,10 @@ #' @references See the \href{http://numbbo.github.io/coco-doc/bbob-biobj/functions/}{COCO website} #' for a detailed description of the bi-objective BBOB functions. #' An overview of which pair of single-objective BBOB functions creates -#' which of the 55 bi-objective BBOB functions can be found \href{http://numbbo.github.io/coco-doc/bbob-biobj/functions/#the-bbob-biobj-test-functions-and-their-properties}{here}. -#' A full description of the extended suite with 92 functions can be found -#' \href{http://numbbo.github.io/coco-doc/bbob-biobj/functions/#the-extended-bbob-biobj-ext-test-suite-and-its-functions}{here}. +#' which of the 55 bi-objective BBOB functions can be found in the +#' \href{http://numbbo.github.io/coco-doc/bbob-biobj/functions/#the-bbob-biobj-test-functions-and-their-properties}{official documentation of the bi-objective BBOB test suite}. +#' And a full description of the extended suite with 92 functions can be found in the +#' \href{http://numbbo.github.io/coco-doc/bbob-biobj/functions/#the-extended-bbob-biobj-ext-test-suite-and-its-functions}{official documentation of the extended bi-objective BBOB test suite}. #' @export makeBiObjBBOBFunction = function(dimensions, fid, iid) { From 7ff4a8397efecc5a57091021052d130afd547a30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lennart=20Sch=C3=A4permeier?= Date: Fri, 20 Oct 2023 12:44:28 +0200 Subject: [PATCH 4/4] Add space when accessing grid rows. --- R/makeBiObjBBOBFunction.R | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/R/makeBiObjBBOBFunction.R b/R/makeBiObjBBOBFunction.R index 2b4b0861..abd0e166 100644 --- a/R/makeBiObjBBOBFunction.R +++ b/R/makeBiObjBBOBFunction.R @@ -54,7 +54,7 @@ makeBiObjBBOBFunction = function(dimensions, fid, iid) { # grid with all pairs of BBOB problems grid = expand.grid(fids1 = fids, fids2 = fids) grid = grid[grid[, 1L] <= grid[, 2L], ] - grid = grid[order(grid[, 1L]),] + grid = grid[order(grid[, 1L]), ] # Add all off-diagonal combinations per BBOB group (excluding FID 16) # for the extended bi-objective suite @@ -62,10 +62,10 @@ makeBiObjBBOBFunction = function(dimensions, fid, iid) { for (group in list(1L:5L, 6L:9L, 10L:14L, setdiff(15L:19L, 16L), 20L:24L)) { group.grid = expand.grid(fids1 = group, fids2 = group) group.grid = group.grid[group.grid[, 1L] < group.grid[, 2L], ] - group.grid = group.grid[order(group.grid[, 1L]),] + group.grid = group.grid[order(group.grid[, 1L]), ] grid = rbind(grid, group.grid) - grid = grid[!duplicated(grid),] + grid = grid[!duplicated(grid), ] } rownames(grid) = NULL