Skip to content

Commit

Permalink
Merge pull request #145 from schaepermeier/bbob-iid-fix
Browse files Browse the repository at this point in the history
Fix bi-objective BBOB instance mapping, Issue #139
  • Loading branch information
jakobbossek authored Oct 5, 2023
2 parents 3e2efee + f705ebb commit 99709fc
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 8 deletions.
1 change: 1 addition & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,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

smoof 1.6.0.3
=============
Expand Down
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## Bugfixes

* Fixed bug in getLoggedValues when logging of x-values was set to FALSE in addLoggingWrapper

* Fixed bug with instance ID mapping in makeBiObjBBOBFunction

# smoof 1.6.0.3

Expand Down
43 changes: 36 additions & 7 deletions R/makeBiObjBBOBFunction.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,22 @@
#' 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}.
#' @export
makeBiObjBBOBFunction = function(dimensions, fid, iid) {
# do some sanity checks

# ==== Sanity Checks ====

dimensions = asCount(dimensions)
fid = asCount(fid)
iid = asCount(iid)
assertInt(dimensions, lower = 2L, upper = 40L)
assertInt(fid, lower = 1L, upper = 55L)
assertInt(iid, lower = 1L)
assertInt(iid, lower = 1L, upper = 15L) # restrict to documented "safe" range

# touch vars
force(dimensions)
force(fid)
force(iid)

# ==== FID Mapping ====

# single-objective BBOB functions, which are used by bi-objective BBOB
fids = c(1L, 2L, 6L, 8L, 13L, 14L, 15L, 17L, 20L, 21L)
Expand All @@ -51,12 +55,37 @@ makeBiObjBBOBFunction = function(dimensions, fid, iid) {

fid1 = grid[fid, "fids1"]
fid2 = grid[fid, "fids2"]
# according to the description from COCO (http://numbbo.github.io/coco-doc/bbob-biobj/functions/#instances)
# the IID of the bi-objective BBOB problem is used for computing the IIDs of
# the two underlying single-objective BBOB problems as given below
iid1 = 2L * iid + 1L
iid2 = iid1 + 1L

# ==== IID Mapping ====

# Regularly, single objective IIDs are computed as
# IID_1 = 2 * IID + 1, and
# IID_2 = IID_1 + 1.
# (http://numbbo.github.io/coco-doc/bbob-biobj/functions/#instances)
#
# However, there are some exceptions either for historical reasons (IIDs 1, 2)
# or because optima are too close to each other in decision or objective space
# (IIDs 9, 15). Here, we restrict the list to the tested IIDs (up to IID 15)
# from the COCO source code.
# https://github.com/numbbo/coco/blob/29ac4063cea8cf74257e2a0671a6cafc4d5e7752/code-experiments/src/suite_biobj_utilities.c#L23-L39
max_iid = 15L

vec_iid_1 = 2 * (1:max_iid) + 1
vec_iid_2 = vec_iid_1 + 1

iid_mapping = cbind(vec_iid_1, vec_iid_2)

# exceptions, cf. above
iid_mapping[1L,] = c(2L, 4L)
iid_mapping[2L,] = c(3L, 5L)
iid_mapping[9L,] = c(19L, 21L)
iid_mapping[15L,] = c(31L, 34L)

iid1 = iid_mapping[iid,1]
iid2 = iid_mapping[iid,2]

# ==== Build smoof function ====

# build parameter set (bounds are [-5, 5] for all BBOB funs)
par.set = makeNumericParamSet("x", len = dimensions, lower = -5, upper = 5)

Expand Down

0 comments on commit 99709fc

Please sign in to comment.