From 79edb58f4a01ff5a2f36983b14ff9d1608767cdc Mon Sep 17 00:00:00 2001 From: Harshit Purohit <71263771+Titanx9-exe@users.noreply.github.com> Date: Wed, 31 Jan 2024 13:20:36 +0100 Subject: [PATCH 1/4] Fixed issues regarding function prefixes and improved the documentation. --- R/addCountingWrapper.R | 9 ++- R/addLoggingWrapper.R | 15 ++-- R/computeExpectedRunningTime.R | 18 ++--- R/conversion.R | 19 ++--- R/doesCountEvaluations.R | 3 +- R/filterFunctionsByTags.R | 10 +-- R/getAvailableTags.R | 3 +- R/getBoxConstraints.R | 3 +- R/getDescription.R | 3 +- R/getGlobalOptimum.R | 8 +- R/getID.R | 8 +- R/getLocalOptimum.R | 2 +- R/getLoggedValues.R | 8 +- R/getMeanFunction.R | 3 +- R/getName.R | 3 +- R/getNumberOfEvaluations.R | 3 +- R/getNumberOfObjectives.R | 3 +- R/getNumberOfParameters.R | 5 +- R/getRefPoint.R | 3 +- R/getTags.R | 3 +- R/getWrappedFunction.R | 3 +- R/hasConstraints.R | 5 +- R/hasGlobalOptimum.R | 3 +- R/hasTags.R | 15 ++-- R/isMultiobjective.R | 2 +- R/isNoisy.R | 1 + R/isSingleobjective.R | 2 +- R/isSmoofFunction.R | 1 + R/isVectorized.R | 3 +- R/isWrappedSmoofFunction.R | 1 + R/makeBBOBFunction.R | 19 +++-- R/makeBiObjBBOBFunction.R | 19 +++-- R/makeFunctionsByName.R | 11 +-- R/makeMultiObjectiveFunction.R | 6 +- R/makeNKFunction.R | 5 +- R/makeObjectiveFunction.R | 105 ++++++++++++++------------- R/makeSingleObjectiveFunction.R | 62 ++++++++-------- R/makeUFFunction.R | 12 +-- R/mnof.R | 17 +++-- R/mof.BK1.R | 6 +- R/mof.ED1.R | 10 ++- R/mof.ED2.R | 9 ++- R/mof.MOP1.R | 3 +- R/mof.MOP2.R | 7 +- R/mof.MOP3.R | 7 +- R/mof.MOP4.R | 3 +- R/mof.MOP5.R | 5 +- R/mof.MOP6.R | 3 +- R/mof.MOP7.R | 5 +- R/mof.SYMPARTrotated.R | 18 +++-- R/mof.SYMPARTsimple.R | 15 ++-- R/mof.WFG1.R | 11 +-- R/mof.WFG2.R | 13 ++-- R/mof.WFG3.R | 13 ++-- R/mof.WFG4.R | 11 +-- R/mof.WFG5.R | 11 +-- R/mof.WFG6.R | 11 +-- R/mof.WFG7.R | 11 +-- R/mof.WFG8.R | 11 +-- R/mof.WFG9.R | 11 +-- R/mof.dent.R | 5 +- R/mof.dtlz1.R | 7 +- R/mof.dtlz2.R | 7 +- R/mof.dtlz3.R | 7 +- R/mof.dtlz4.R | 9 ++- R/mof.dtlz5.R | 9 ++- R/mof.dtlz6.R | 7 +- R/mof.dtlz7.R | 9 ++- R/mof.gomop.R | 15 ++-- R/mof.kursawe.R | 5 +- R/mof.mmf1.R | 5 +- R/mof.mmf10.R | 7 +- R/mof.mmf11.R | 11 +-- R/mof.mmf12.R | 11 +-- R/mof.mmf13.R | 9 ++- R/mof.mmf14.R | 13 ++-- R/mof.mmf14a.R | 13 ++-- R/mof.mmf15.R | 13 ++-- R/mof.mmf15a.R | 13 ++-- R/mof.mmf1e.R | 8 +- R/mof.mmf1z.R | 9 ++- R/mof.mmf2.R | 7 +- R/mof.mmf3.R | 7 +- R/mof.mmf4.R | 7 +- R/mof.mmf5.R | 8 +- R/mof.mmf6.R | 7 +- R/mof.mmf7.R | 7 +- R/mof.mmf8.R | 7 +- R/mof.mmf9.R | 9 ++- R/mof.omni.R | 3 +- R/mof.sphere.R | 7 +- R/mof.viennet.R | 5 +- R/mof.zdt1.R | 7 +- R/mof.zdt2.R | 10 ++- R/mof.zdt3.R | 8 +- R/mof.zdt4.R | 9 ++- R/mof.zdt6.R | 11 +-- R/plot.autoplot.R | 64 ++++++++-------- R/plot.helpers.R | 39 +++++----- R/plot.plot.R | 38 +++++----- R/plot3D.R | 28 ++++--- R/smoof.R | 4 +- R/smoof_function.R | 6 +- R/snof.R | 10 +-- R/sof.ackley.R | 11 ++- R/sof.adjiman.R | 11 ++- R/sof.alpine01.R | 11 ++- R/sof.alpine02.R | 13 +++- R/sof.aluffi-pentini.R | 2 +- R/sof.bartels.conn.R | 9 ++- R/sof.beale.R | 11 ++- R/sof.bent.cigar.R | 9 ++- R/sof.bird.R | 9 ++- R/sof.bohachevsky.n1.R | 13 +++- R/sof.booth.R | 7 +- R/sof.branin.R | 7 +- R/sof.brent.R | 7 +- R/sof.brown.R | 11 ++- R/sof.bukin.n2.R | 9 ++- R/sof.bukin.n4.R | 11 ++- R/sof.bukin.n6.R | 9 ++- R/sof.carrom.table.R | 7 +- R/sof.chichinadze.R | 7 +- R/sof.chung.reynolds.R | 15 ++-- R/sof.complex.R | 5 +- R/sof.cosine.mixture.R | 9 ++- R/sof.cross.in.tray.R | 7 +- R/sof.cube.R | 9 ++- R/sof.deckkers.aarts.R | 7 +- R/sof.deflected.corrugated.spring.R | 12 ++- R/sof.dixon.price.R | 9 ++- R/sof.double.sum.R | 9 ++- R/sof.drop.wave.R | 11 ++- R/sof.easom.R | 9 ++- R/sof.eggcrate.R | 7 +- R/sof.eggholder.R | 5 ++ R/sof.el.attar.vidyasagar.dutta.R | 11 ++- R/sof.engvall.R | 5 +- R/sof.exponential.R | 9 ++- R/sof.freudenstein.roth.R | 7 +- R/sof.giunta.R | 9 ++- R/sof.goldstein.price.R | 7 +- R/sof.griewank.R | 11 ++- R/sof.hansen.R | 7 +- R/sof.hartmann.R | 11 ++- R/sof.himmelblau.R | 11 ++- R/sof.holder.table.n1.R | 11 ++- R/sof.holder.table.n2.R | 9 ++- R/sof.hosaki.R | 7 +- R/sof.hyper.ellipsoid.R | 11 ++- R/sof.jennrichsampson.R | 5 +- R/sof.judge.R | 11 ++- R/sof.keane.R | 9 ++- R/sof.kearfott.R | 11 ++- R/sof.leon.R | 9 ++- R/sof.matyas.R | 9 ++- R/sof.mccormick.R | 9 ++- R/sof.michalewicz.R | 13 +++- R/sof.modrastrigin.R | 11 ++- R/sof.mpm2.R | 21 +++--- R/sof.periodic.R | 7 +- R/sof.powell.sum.R | 9 ++- R/sof.price.n1.R | 11 ++- R/sof.price.n2.R | 9 ++- R/sof.price.n4.R | 9 ++- R/sof.rastrigin.R | 11 ++- R/sof.rosenbrock.R | 9 ++- R/sof.schaffer.function.2.R | 9 ++- R/sof.schaffer.function.4.R | 11 ++- R/sof.schwefel.R | 11 ++- R/sof.shekel.R | 16 ++-- R/sof.shubert.R | 7 +- R/sof.six.hump.camel.back.function.R | 5 ++ R/sof.sphere.R | 7 +- R/sof.styblinski.tang.R | 9 ++- R/sof.sum.of.different.powers.R | 8 +- R/sof.swiler2014.R | 16 ++-- R/sof.three.hump.camel.R | 11 ++- R/sof.trecanni.R | 11 ++- R/sof.vincent.R | 11 ++- R/sof.zettl.R | 9 ++- R/violatesConstraints.R | 2 +- R/visualizeParetoOptimalFront.R | 21 +++--- 183 files changed, 1176 insertions(+), 693 deletions(-) diff --git a/R/addCountingWrapper.R b/R/addCountingWrapper.R index f048937b..86f09423 100644 --- a/R/addCountingWrapper.R +++ b/R/addCountingWrapper.R @@ -10,14 +10,15 @@ #' @param fn [\code{smoof_function}]\cr #' Smoof function which should be wrapped. #' @return [\code{smoof_counting_function}] +#' The function that includes the counting feature. #' @examples #' fn = makeBBOBFunction(dimensions = 2L, fid = 1L, iid = 1L) #' fn = addCountingWrapper(fn) #' -#' # we get a value of 0 since the function has not been called yet +#' # We get a value of 0 since the function has not been called yet #' print(getNumberOfEvaluations(fn)) #' -#' # now call the function 10 times consecutively +#' # Now call the function 10 times consecutively #' for (i in seq(10L)) { #' fn(runif(2)) #' } @@ -31,8 +32,8 @@ #' @seealso \code{\link{getNumberOfEvaluations}}, \code{\link{resetEvaluationCounter}} #' @export addCountingWrapper = function(fn) { - if (!testClass(fn, "smoof_function") && !testClass(fn, "smoof_wrapped_function")) { - stopf("The passed function needs to be a (wrapped) smoof function.") + if (!checkmate::testClass(fn, "smoof_function") && !checkmate::testClass(fn, "smoof_wrapped_function")) { + BBmisc::stopf("The passed function needs to be a (wrapped) smoof function.") } force(fn) n.evals = 0L diff --git a/R/addLoggingWrapper.R b/R/addLoggingWrapper.R index b8107318..69ec7a8b 100644 --- a/R/addLoggingWrapper.R +++ b/R/addLoggingWrapper.R @@ -20,9 +20,10 @@ #' In case of an overflow (i.e., more function evaluations than space reserved) #' the data structures are re-initialized by adding space for another \code{size} evaluations. #' This comes handy if you know the number of function evaluations (or at least -#' an upper bound thereof) a-priori and may serve to reduce the time complextity +#' an upper bound thereof) a-priori and may serve to reduce the time complexity #' of logging values. #' @return [\code{smoof_logging_function}] +#' The function with an added logging capability. #' @examples #' # We first build the smoof function and apply the logging wrapper to it #' fn = makeSphereFunction(dimensions = 2L) @@ -44,20 +45,20 @@ #' #' @export addLoggingWrapper = function(fn, logg.x = FALSE, logg.y = TRUE, size = 100L) { - if (!testClass(fn, "smoof_function") && !testClass(fn, "smoof_wrapped_function")) { - stopf("The passed function needs to be a (wrapped) smoof function.") + if (!checkmate::testClass(fn, "smoof_function") && !checkmate::testClass(fn, "smoof_wrapped_function")) { + BBmisc::stopf("The passed function needs to be a (wrapped) smoof function.") } - assertFlag(logg.x) - assertFlag(logg.y) + checkmate::assertFlag(logg.x) + checkmate::assertFlag(logg.y) size = checkmate::asInt(size, lower = 1L) if (!logg.x && !logg.y) { - stopf("At least x or y values must be logged.") + BBmisc::stopf("At least x or y values must be logged.") } par.set = ParamHelpers::getParamSet(fn) - par.ids = getParamIds(par.set, with.nr = TRUE, repeated = TRUE) + par.ids = ParamHelpers::getParamIds(par.set, with.nr = TRUE, repeated = TRUE) n.obj = getNumberOfObjectives(fn) n.pars = getNumberOfParameters(fn) diff --git a/R/computeExpectedRunningTime.R b/R/computeExpectedRunningTime.R index c89f32a3..4060da31 100644 --- a/R/computeExpectedRunningTime.R +++ b/R/computeExpectedRunningTime.R @@ -13,7 +13,7 @@ #' #' @details The Expected Running Time (ERT) is one of the most popular performance #' measures in optimization. It is defined as the expected number of function -#' evaluations needed to reach a given precision level, i. e., to reach a certain +#' evaluations needed to reach a given precision level, i.e., to reach a certain #' objective value for the first time. #' #' @references A. Auger and N. Hansen. Performance evaluation of an advanced local @@ -24,7 +24,7 @@ #' Vector containing the number of function evaluations. #' @param fun.success.runs [\code{logical}]\cr #' Boolean vector indicating which algorithm runs were successful, -#' i. e., which runs reached the desired target value. Default is \code{NULL}. +#' i.e., which runs reached the desired target value. Default is \code{NULL}. #' @param fun.reached.target.values [\code{numeric} | \code{NULL}]\cr #' Numeric vector with the objective values reached in the runs. Default is #' \code{NULL}. @@ -42,27 +42,27 @@ computeExpectedRunningTime = function(fun.evals, fun.target.value = NULL, penalty.value = Inf) { #FIXME: maybe enable missing values and offer inpute mechanism? - assertInteger(fun.evals, lower = 1L, any.missing = FALSE) - assertNumber(penalty.value) + checkmate::assertInteger(fun.evals, lower = 1L, any.missing = FALSE) + checkmate::assertNumber(penalty.value) n = length(fun.evals) # sanity check that one of the options is used (see docs). if (!xor(!is.null(fun.success.runs), (!is.null(fun.reached.target.values) || !is.null(fun.target.value)))) { - stopf("Either 'fun.success.runs' or 'fun.reached.target.values' and 'fun.target.value' need to be specified, + BBmisc::stopf("Either 'fun.success.runs' or 'fun.reached.target.values' and 'fun.target.value' need to be specified, but not both or none.") } # compute successful runs if (!is.null(fun.reached.target.values)) { if (is.null(fun.target.value)) { - stopf("You need to pass a 'fun.target.value' in case you passed 'fun.reached.target.values'.") + BBmisc::stopf("You need to pass a 'fun.target.value' in case you passed 'fun.reached.target.values'.") } - assertNumeric(fun.reached.target.values, len = n, any.missing = FALSE) - assertNumber(fun.target.value) + checkmate::assertNumeric(fun.reached.target.values, len = n, any.missing = FALSE) + checkmate::assertNumber(fun.target.value) fun.success.runs = (fun.reached.target.values <= fun.target.value) } - assertLogical(fun.success.runs, len = n, any.missing = FALSE) + checkmate::assertLogical(fun.success.runs, len = n, any.missing = FALSE) # Finally compute the ERT # compute the success rate (since fun.success.runs is logical, this is correct) diff --git a/R/conversion.R b/R/conversion.R index 05c55556..f27a2cb9 100644 --- a/R/conversion.R +++ b/R/conversion.R @@ -3,11 +3,11 @@ #' #' @description #' We can minimize f by maximizing -f. The majority of predefined objective functions -#' in \pkg{smoof} should be minimized by default. However, there is a handful of +#' in \pkg{smoof} should be minimized by default. However, there are a handful of #' functions, e.g., Keane or Alpine02, which shall be maximized by default. #' For benchmarking studies it might be beneficial to inverse the direction. #' The functions \code{convertToMaximization} and \code{convertToMinimization} -#' do exactly that keeping the attributes. +#' do exactly that, keeping the attributes. #' #' @note #' Both functions will quit with an error if multi-objective functions are passed. @@ -15,6 +15,7 @@ #' @param fn [\code{smoof_function}]\cr #' Smoof function. #' @return [\code{smoof_function}] +#' Converted smoof function #' @examples #' # create a function which should be minimized by default #' fn = makeSphereFunction(1L) @@ -43,15 +44,15 @@ convertToMinimization = function(fn) { } convertProblemDirection = function(fn, minimize.after = TRUE) { - assertFlag(minimize.after) + checkmate::assertFlag(minimize.after) if (isWrappedSmoofFunction(fn)) { - stopf("Conversion works only for unwrapped functions! Apply, e.g., counting wrapper + BBmisc::stopf("Conversion works only for unwrapped functions! Apply, e.g., counting wrapper after conversion.") } if (isMultiobjective(fn)) { - stopf("Conversion to maximization only supported for single-objective problems + BBmisc::stopf("Conversion to maximization only supported for single-objective problems at the moment, but your function '%s' has %i objectives.", getName(fn), getNumberOfObjectives(fn)) } @@ -59,7 +60,7 @@ convertProblemDirection = function(fn, minimize.after = TRUE) { # If both are false, we want to convert max to max # Otherwise the conversion is ok if ((shouldBeMinimized(fn) && minimize.after) || (!shouldBeMinimized(fn) && !minimize.after)) { - stopf("Function should already be %s.", (if (minimize.after) "minimized" else "maximized")) + BBmisc::stopf("Function should already be %s.", (if (minimize.after) "minimized" else "maximized")) } # get attributes @@ -77,12 +78,12 @@ convertProblemDirection = function(fn, minimize.after = TRUE) { # flip sign(s) of optima if (hasGlobalOptimum(fn2)) - fn2 = setAttribute(fn2, "global.opt.value", -1.0 * attr(fn2, "global.opt.value")) + fn2 = BBmisc::setAttribute(fn2, "global.opt.value", -1.0 * attr(fn2, "global.opt.value")) if (hasLocalOptimum(fn2)) - fn2 = setAttribute(fn2, "local.opt.value", -1.0 * attr(fn2, "local.opt.value")) + fn2 = BBmisc::setAttribute(fn2, "local.opt.value", -1.0 * attr(fn2, "local.opt.value")) # flip maximization stuff - fn2 = setAttribute(fn2, "minimize", !should.minimize) + fn2 = BBmisc::setAttribute(fn2, "minimize", !should.minimize) return(fn2) } diff --git a/R/doesCountEvaluations.R b/R/doesCountEvaluations.R index e5dbb900..8701f941 100644 --- a/R/doesCountEvaluations.R +++ b/R/doesCountEvaluations.R @@ -2,13 +2,14 @@ #' Check whether the function is counting its function evaluations. #' #' @description -#' In this case the function is of type \code{smoof_counting_function} or it +#' In this case, the function is of type \code{smoof_counting_function} or it #' is further wrapped by another wrapper. This function then checks recursively, #' if there is a counting wrapper. #' #' @param object [any]\cr #' Arbitrary R object. #' @return \code{logical(1)} +#' \code{TRUE} if the function counts its evaluations, \code{FALSE} otherwise. #' @seealso \code{\link{addCountingWrapper}} #' @export doesCountEvaluations = function(object) { diff --git a/R/filterFunctionsByTags.R b/R/filterFunctionsByTags.R index 7df6fbd4..68a1d7be 100644 --- a/R/filterFunctionsByTags.R +++ b/R/filterFunctionsByTags.R @@ -4,7 +4,7 @@ #' @description #' Single objective functions can be tagged, e.g., as unimodal. Searching for all #' functions with a specific tag by hand is tedious. The \code{filterFunctionsByTags} -#' function helps to filter all single objective smoof function. +#' function helps to filter all single objective smoof functions. #' #' @param tags [\code{character}]\cr #' Character vector of tags. All available tags can be determined with a call @@ -24,11 +24,11 @@ #' filterFunctionsByTags(c("multimodal", "separable"), or = TRUE) #' @export filterFunctionsByTags = function(tags, or = FALSE) { - assertSubset(tags, choices = getAvailableTags(), empty.ok = FALSE) - assertFlag(or) + checkmate::assertSubset(tags, choices = getAvailableTags(), empty.ok = FALSE) + checkmate::assertFlag(or) - if (isSubset(c("single-objective", "multi-objective"), tags)) { - stopf("Trying to search for both single- and multi-objective functions.") + if (BBmisc::isSubset(c("single-objective", "multi-objective"), tags)) { + BBmisc::stopf("Trying to search for both single- and multi-objective functions.") } fun.generators = getGeneratorFunctions() diff --git a/R/getAvailableTags.R b/R/getAvailableTags.R index 0780f8cb..7bf62ccb 100644 --- a/R/getAvailableTags.R +++ b/R/getAvailableTags.R @@ -3,12 +3,13 @@ #' #' @description #' Test function are frequently distinguished by characteristic high-level properties, -#' e.g., unimodal or multimodal, continuous or discontinuous, separable or non-separable. +#' e.g., uni-modal or multi-modal, continuous or discontinuous, separable or non-separable. #' The \pkg{smoof} package offers the possibility to associate a set of properties, #' termed \dQuote{tags} to a \code{smoof_function}. This helper function returns #' a character vector of all possible tags. #' #' @return [\code{character}] +#' Character vector of all the possible tags #' @export getAvailableTags = function() { c("unimodal", "multimodal", diff --git a/R/getBoxConstraints.R b/R/getBoxConstraints.R index 8d1ec1ce..e7be22a4 100644 --- a/R/getBoxConstraints.R +++ b/R/getBoxConstraints.R @@ -1,7 +1,8 @@ -#' Return lower box constaints. +#' Returns lower box constraints for a Smoof function. #' #' @template arg_smoof_function #' @return [\code{numeric}] +#' Numeric vector representing the lower box constraints #' @export getLowerBoxConstraints = function(fn) { UseMethod("getLowerBoxConstraints") diff --git a/R/getDescription.R b/R/getDescription.R index f0166c0b..aecface1 100644 --- a/R/getDescription.R +++ b/R/getDescription.R @@ -1,7 +1,8 @@ -#' Return the description of the function. +#' Returns the description of the function. #' #' @template arg_smoof_function #' @return [\code{character(1)}] +#' A character string representing the description of the function. #' @export getDescription = function(fn) { UseMethod("getDescription") diff --git a/R/getGlobalOptimum.R b/R/getGlobalOptimum.R index ca8af056..21e9ac09 100644 --- a/R/getGlobalOptimum.R +++ b/R/getGlobalOptimum.R @@ -3,9 +3,9 @@ #' @template arg_smoof_function #' @return [\code{list}] List containing the following entries: #' \itemize{ -#' \item{param [\code{list}]}{Named list of parameter value(s).} -#' \item{value [\code{numeric(1)}]}{Optimal value.} -#' \item{is.minimum [\code{logical(1)}]}{Is the global optimum a minimum or maximum?} +#' \item{param [\code{list}]} {Named list of parameter value(s).} +#' \item{value [\code{numeric(1)}]} {Optimal value.} +#' \item{is.minimum [\code{logical(1)}]} {Is the global optimum a minimum or maximum?} #' } #' @note Keep in mind, that this method makes sense only for single-objective target function. #' @export @@ -24,7 +24,7 @@ getGlobalOptimum.smoof_single_objective_function = function(fn) { #' @export getGlobalOptimum.smoof_multi_objective_function = function(fn) { - stopf("No global optimum available for multi-objective function.") + BBmisc::stopf("No global optimum available for multi-objective function.") } #' @export diff --git a/R/getID.R b/R/getID.R index 22ae3443..6be47155 100644 --- a/R/getID.R +++ b/R/getID.R @@ -1,7 +1,11 @@ -#' Return the ID / short name of the function or \code{NA} if no ID is set. +#' @title +#' Returns the ID / short name of the function. +#' +#' @description +#' Returns the ID / short name of the function or \code{NA} if no ID is set. #' #' @template arg_smoof_function -#' @return [\code{character(1)}] or \code{NA} +#' @return [\code{character(1)}] ID / short name or \code{NA} #' @export getID = function(fn) { UseMethod("getID") diff --git a/R/getLocalOptimum.R b/R/getLocalOptimum.R index 6f09ad14..4402be62 100644 --- a/R/getLocalOptimum.R +++ b/R/getLocalOptimum.R @@ -29,7 +29,7 @@ getLocalOptimum.smoof_single_objective_function = function(fn) { #' @export getLocalOptimum.smoof_multi_objective_function = function(fn) { - stopf("No local optimum available for multi-objective function.") + BBmisc::stopf("No local optimum available for multi-objective function.") } #' @export diff --git a/R/getLoggedValues.R b/R/getLoggedValues.R index d016aa02..7751f46f 100644 --- a/R/getLoggedValues.R +++ b/R/getLoggedValues.R @@ -1,4 +1,4 @@ -#' Extract logged values of a function wrapped by a logging wrapper. +#' Extracts the logged values of a function wrapped by a logging wrapper. #' #' @param fn [\code{wrapped_smoof_function}]\cr #' Wrapped smoof function. @@ -10,8 +10,8 @@ #' \describe{ #' \item{pars}{Data frame of parameter values, i.e., x-values or the empty #' data frame if x-values were not logged.} -#' \item{obj.vals}{Numeric vector of objective vals in the single-objective -#' case respectively a matrix of objective vals for multi-objective functions.} +#' \item{obj.vals}{Numeric vector of objective values in the single-objective +#' case respectively a matrix of objective values for multi-objective functions.} #' } #' @seealso \code{\link{addLoggingWrapper}} #' @export @@ -21,7 +21,7 @@ getLoggedValues = function(fn, compact = FALSE) { #' @export getLoggedValues.smoof_logging_function = function(fn, compact = FALSE) { - assertFlag(compact) + checkmate::assertFlag(compact) env = environment(fn) max.idx = env$curr.idx - 1L diff --git a/R/getMeanFunction.R b/R/getMeanFunction.R index b7a32e8f..586d8abc 100644 --- a/R/getMeanFunction.R +++ b/R/getMeanFunction.R @@ -1,7 +1,8 @@ -#' Return the true mean function in the noisy case. +#' Returns the true mean function in the noisy case. #' #' @template arg_smoof_function #' @return [\code{function}] +#' True mean function in the noisy case. #' @export getMeanFunction = function(fn) { UseMethod("getMeanFunction") diff --git a/R/getName.R b/R/getName.R index 05d27445..130c9943 100644 --- a/R/getName.R +++ b/R/getName.R @@ -1,7 +1,8 @@ -#' Return the name of the function. +#' Returns the name of the function. #' #' @template arg_smoof_function #' @return [\code{character(1)}] +#' The name of the function. #' @export getName = function(fn) { UseMethod("getName") diff --git a/R/getNumberOfEvaluations.R b/R/getNumberOfEvaluations.R index cbf000a5..681efd26 100644 --- a/R/getNumberOfEvaluations.R +++ b/R/getNumberOfEvaluations.R @@ -1,9 +1,10 @@ -#' Return the number of function evaluations performed by the wrapped +#' Returns the number of function evaluations performed by the wrapped #' \code{smoof_function}. #' #' @param fn [\code{smoof_counting_function}]\cr #' Wrapped \code{smoof_function}. #' @return [\code{integer(1)}] +#' The number of function evaluations. #' @export getNumberOfEvaluations = function(fn) { UseMethod("getNumberOfEvaluations") diff --git a/R/getNumberOfObjectives.R b/R/getNumberOfObjectives.R index 02e5d04c..8b372c4c 100644 --- a/R/getNumberOfObjectives.R +++ b/R/getNumberOfObjectives.R @@ -1,7 +1,8 @@ -#' Determine the number of objectives. +#' Determines the number of objectives. #' #' @template arg_smoof_function #' @return [\code{integer(1)}] +#' The number of objectives. #' @export getNumberOfObjectives = function(fn) { UseMethod("getNumberOfObjectives") diff --git a/R/getNumberOfParameters.R b/R/getNumberOfParameters.R index c2ee2327..05b2bacc 100644 --- a/R/getNumberOfParameters.R +++ b/R/getNumberOfParameters.R @@ -1,7 +1,8 @@ -#' Determine the number of parameters. +#' Determines the number of parameters. #' #' @template arg_smoof_function #' @return [\code{integer(1)}] +#' The number of parameters. #' @export getNumberOfParameters = function(fn) { UseMethod("getNumberOfParameters") @@ -9,7 +10,7 @@ getNumberOfParameters = function(fn) { #' @export getNumberOfParameters.smoof_function = function(fn) { - return(sum(getParamLengths(getParamSet(fn)))) + return(sum(ParamHelpers::getParamLengths(getParamSet(fn)))) } #' @export diff --git a/R/getRefPoint.R b/R/getRefPoint.R index ebb2312e..609d28cf 100644 --- a/R/getRefPoint.R +++ b/R/getRefPoint.R @@ -2,6 +2,7 @@ #' #' @template arg_smoof_function #' @return [\code{numeric}] +#' The reference point. #' @note Keep in mind, that this method makes sense only for multi-objective target functions. #' @export getRefPoint = function(fn) { @@ -10,7 +11,7 @@ getRefPoint = function(fn) { #' @export getRefPoint.smoof_single_objective_function = function(fn) { - stopf("No reference point available for single-objective function.") + BBmisc::stopf("No reference point available for single-objective function.") } #' @export diff --git a/R/getTags.R b/R/getTags.R index a240b4d3..2e5691e7 100644 --- a/R/getTags.R +++ b/R/getTags.R @@ -1,7 +1,8 @@ -#' Returns vector of associated tags. +#' Returns the vector of associated tags. #' #' @template arg_smoof_function #' @return [\code{character}] +#' Vector of associated tags. #' @export getTags = function(fn) { UseMethod("getTags") diff --git a/R/getWrappedFunction.R b/R/getWrappedFunction.R index 682a8b35..d72980c9 100644 --- a/R/getWrappedFunction.R +++ b/R/getWrappedFunction.R @@ -17,6 +17,7 @@ #' \code{TRUE} the function unwraps recursively until the \dQuote{deepest} wrapped #' \code{smoof_function} is reached. Default is \code{FALSE}. #' @return [\code{function}] +#' The extracted wrapped function. #' @seealso \code{\link{addCountingWrapper}}, \code{\link{addLoggingWrapper}} #' @export getWrappedFunction = function(fn, deepest = FALSE) { @@ -25,7 +26,7 @@ getWrappedFunction = function(fn, deepest = FALSE) { #' @export getWrappedFunction.smoof_wrapped_function = function(fn, deepest = FALSE) { - assertFlag(deepest) + checkmate::assertFlag(deepest) wrapped.fn = environment(fn)$fn if (deepest) { return(getWrappedFunction(wrapped.fn, deepest)) diff --git a/R/hasConstraints.R b/R/hasConstraints.R index d2f85892..136a1616 100644 --- a/R/hasConstraints.R +++ b/R/hasConstraints.R @@ -2,6 +2,7 @@ #' #' @template arg_smoof_function #' @return [\code{logical(1)}] +#' \code{TRUE} if the function has constraints, \code{FALSE} otherwise. #' @export hasConstraints = function(fn) { UseMethod("hasConstraints") @@ -29,12 +30,12 @@ hasBoxConstraints = function(fn) { #' @export hasBoxConstraints.smoof_function = function(fn) { - return(hasFiniteBoxConstraints(getParamSet(fn))) + return(ParamHelpers::hasFiniteBoxConstraints(getParamSet(fn))) } #' @export hasBoxConstraints.smoof_wrapped_function = function(fn) { - return(hasFiniteBoxConstraints(getParamSet(getWrappedFunction(fn)))) + return(ParamHelpers::hasFiniteBoxConstraints(getParamSet(getWrappedFunction(fn)))) } #' Checks whether the objective function has other constraints. diff --git a/R/hasGlobalOptimum.R b/R/hasGlobalOptimum.R index 4ac22fb3..6306e3ff 100644 --- a/R/hasGlobalOptimum.R +++ b/R/hasGlobalOptimum.R @@ -1,7 +1,8 @@ -#' Checks whether global optimum is known. +#' Checks whether the global optimum is known. #' #' @template arg_smoof_function #' @return [\code{logical(1)}] +#' \code{TRUE} if the global optimum is known, \code{FALSE} otherwise. #' @export hasGlobalOptimum = function(fn) { UseMethod("hasGlobalOptimum") diff --git a/R/hasTags.R b/R/hasTags.R index bddcfc5d..1d5f2f47 100644 --- a/R/hasTags.R +++ b/R/hasTags.R @@ -1,5 +1,5 @@ #' @title -#' Check if function has assigend special tags. +#' Checks if the function has assigned special tags. #' #' @description #' Each single-objective smoof function has tags assigned to it (see @@ -11,6 +11,7 @@ #' @param tags [\code{character}]\cr #' Vector of tags/properties to check \code{fn} for. #' @return [\code{logical(1)}] +#' Logical vector indicating the presence of specified tags. #' @export hasTags = function(fn, tags) { UseMethod("hasTags") @@ -18,22 +19,22 @@ hasTags = function(fn, tags) { #' @export hasTags.smoof_function = function(fn, tags) { - assertChoice(tags, choices = getAvailableTags()) - return(isSubset(tags, getTags(fn))) + checkmate::assertChoice(tags, choices = getAvailableTags()) + return(BBmisc::isSubset(tags, getTags(fn))) } #' @export hasTags.smoof_generator = function(fn, tags) { - assertChoice(tags, choices = getAvailableTags()) - return(isSubset(tags, attr(fn, "tags"))) + checkmate::assertChoice(tags, choices = getAvailableTags()) + return(BBmisc::isSubset(tags, attr(fn, "tags"))) } #' @export hasTags.character = function(fn, tags) { - assertChoice(tags, choices = getAvailableTags()) + checkmate::assertChoice(tags, choices = getAvailableTags()) generator = getGeneratorByName(fn) if (is.null(generator)) { - stopf("No generator for function '%s'", fn) + BBmisc::stopf("No generator for function '%s'", fn) } return(hasTags(generator, tags)) } diff --git a/R/isMultiobjective.R b/R/isMultiobjective.R index 13e9409b..2f21dbc3 100644 --- a/R/isMultiobjective.R +++ b/R/isMultiobjective.R @@ -1,7 +1,7 @@ #' Checks whether the given function is multi-objective. #' #' @template arg_smoof_function -#' @return [\code{logical(1)}] \code{TRUE} if function is multi-objective. +#' @return [\code{logical(1)}] \code{TRUE} if function is multi-objective, \code{FALSE} otherwise. #' @export isMultiobjective = function(fn) { UseMethod("isMultiobjective") diff --git a/R/isNoisy.R b/R/isNoisy.R index 2e77b413..75568c91 100644 --- a/R/isNoisy.R +++ b/R/isNoisy.R @@ -2,6 +2,7 @@ #' #' @template arg_smoof_function #' @return [\code{logical(1)}] +#' \code{TRUE} if the function is noisy, \code{FALSE} otherwise. #' @export isNoisy = function(fn) { UseMethod("isNoisy") diff --git a/R/isSingleobjective.R b/R/isSingleobjective.R index 4256510e..33439ca9 100644 --- a/R/isSingleobjective.R +++ b/R/isSingleobjective.R @@ -1,7 +1,7 @@ #' Checks whether the given function is single-objective. #' #' @template arg_smoof_function -#' @return [\code{logical(1)}] \code{TRUE} if function is single-objective. +#' @return [\code{logical(1)}] \code{TRUE} if function is single-objective, \code{FALSE} otherwise. #' @export isSingleobjective = function(fn) { UseMethod("isSingleobjective") diff --git a/R/isSmoofFunction.R b/R/isSmoofFunction.R index 7095809b..ffcb3d27 100644 --- a/R/isSmoofFunction.R +++ b/R/isSmoofFunction.R @@ -4,6 +4,7 @@ #' @param object [any]\cr #' Arbitrary R object. #' @return [\code{logical(1)}] +#' \code{TRUE} if the object is a SMOOF function or wrapped function, \code{FALSE} otherwise. #' @seealso \code{\link{addCountingWrapper}}, \code{\link{addLoggingWrapper}} #' @export isSmoofFunction = function(object) { diff --git a/R/isVectorized.R b/R/isVectorized.R index 18424e52..ab1bd80f 100644 --- a/R/isVectorized.R +++ b/R/isVectorized.R @@ -1,7 +1,8 @@ -#' Checks whether the given function accept \dQuote{vectorized} input. +#' Checks whether the given function accepts \dQuote{vectorized} input. #' #' @template arg_smoof_function #' @return [\code{logical(1)}] +#' \code{TRUE} if the function accepts vectorized input, \code{FALSE} otherwise. #' @export isVectorized = function(fn) { UseMethod("isVectorized") diff --git a/R/isWrappedSmoofFunction.R b/R/isWrappedSmoofFunction.R index 98dd1fdf..acbcc5e5 100644 --- a/R/isWrappedSmoofFunction.R +++ b/R/isWrappedSmoofFunction.R @@ -3,6 +3,7 @@ #' @param object [any]\cr #' Arbitrary R object. #' @return [\code{logical(1)}] +#' \code{TRUE} if the object is a SMOOF wrapped function, \code{FALSE} otherwise. #' @export isWrappedSmoofFunction = function(object) { inherits(object, what = "smoof_wrapped_function") diff --git a/R/makeBBOBFunction.R b/R/makeBBOBFunction.R index 4278a144..eab9f571 100644 --- a/R/makeBBOBFunction.R +++ b/R/makeBBOBFunction.R @@ -1,3 +1,7 @@ +#' @title +#' Generator for noiseless function set of the real-parameter BBOB. +#' +#' @description #' Generator for the noiseless function set of the real-parameter Black-Box #' Optimization Benchmarking (BBOB). #' @@ -12,6 +16,7 @@ #' @param iid [\code{integer(1)}]\cr #' Instance identifier. Integer value greater than or equal 1. #' @return [\code{smoof_single_objective_function}] +#' Noiseless function from the BBOB benchmark. #' @examples #' # get the first instance of the 2D Sphere function #' fn = makeBBOBFunction(dimensions = 2L, fid = 1L, iid = 1L) @@ -23,12 +28,12 @@ #' @export makeBBOBFunction = function(dimensions, fid, iid) { # do some sanity checks - dimensions = asCount(dimensions) - fid = asCount(fid) - iid = asCount(iid) - assertInt(dimensions, lower = 2L, upper = 40L) - assertInt(fid, lower = 1L, upper = 24L) - assertInt(iid, lower = 1L) + dimensions = checkmate::asCount(dimensions) + fid = checkmate::asCount(fid) + iid = checkmate::asCount(iid) + checkmate::assertInt(dimensions, lower = 2L, upper = 40L) + checkmate::assertInt(fid, lower = 1L, upper = 24L) + checkmate::assertInt(iid, lower = 1L) # touch vars force(dimensions) @@ -36,7 +41,7 @@ makeBBOBFunction = function(dimensions, fid, iid) { force(iid) # build parameter set (bounds are [-5, 5] for all BBOB funs) - par.set = makeNumericParamSet("x", len = dimensions, lower = -5, upper = 5) + par.set = ParamHelpers::makeNumericParamSet("x", len = dimensions, lower = -5, upper = 5) # get optimal values optimals = getOptimumForBBOBFunction(dimensions, fid, iid) diff --git a/R/makeBiObjBBOBFunction.R b/R/makeBiObjBBOBFunction.R index abd0e166..c402bf47 100644 --- a/R/makeBiObjBBOBFunction.R +++ b/R/makeBiObjBBOBFunction.R @@ -1,3 +1,7 @@ +#' @title +#' Generate Bi-Objective Function from the Real-Parameter Bi-Objective Black-Box Optimization Benchmarking (BBOB) +#' +#' @description #' Generator for the function set of the real-parameter Bi-Objective #' Black-Box Optimization Benchmarking (BBOB) with Function IDs 1-55, as well as #' its extended version (bbob-biobj-ext) with Function IDs 1-92. @@ -13,6 +17,7 @@ #' @param iid [\code{integer(1)}]\cr #' Instance identifier. Integer value greater than or equal 1. #' @return [\code{smoof_multi_objective_function}] +#' Bi-objective function from the BBOB benchmark. #' @examples #' # get the fifth instance of the concatenation of the #' # 3D versions of sphere and Rosenbrock @@ -34,12 +39,12 @@ makeBiObjBBOBFunction = function(dimensions, fid, iid) { # ==== Sanity Checks ==== - dimensions = asCount(dimensions) - fid = asCount(fid) - iid = asCount(iid) - assertInt(dimensions, lower = 2L, upper = 40L) - assertInt(fid, lower = 1L, upper = 92L) - assertInt(iid, lower = 1L, upper = 15L) # restrict to documented "safe" range + dimensions = checkmate::asCount(dimensions) + fid = checkmate::asCount(fid) + iid = checkmate::asCount(iid) + checkmate::assertInt(dimensions, lower = 2L, upper = 40L) + checkmate::assertInt(fid, lower = 1L, upper = 92L) + checkmate::assertInt(iid, lower = 1L, upper = 15L) # restrict to documented "safe" range # touch vars force(dimensions) @@ -104,7 +109,7 @@ makeBiObjBBOBFunction = function(dimensions, fid, iid) { # ==== Build smoof function ==== # build parameter set (bounds are [-5, 5] for all BBOB funs) - par.set = makeNumericParamSet("x", len = dimensions, lower = -5, upper = 5) + par.set = ParamHelpers::makeNumericParamSet("x", len = dimensions, lower = -5, upper = 5) makeMultiObjectiveFunction( name = sprintf("Bi-Objective BBOB_%i_%i_%i", dimensions, fid, iid), diff --git a/R/makeFunctionsByName.R b/R/makeFunctionsByName.R index d08891d8..3c12b2ff 100644 --- a/R/makeFunctionsByName.R +++ b/R/makeFunctionsByName.R @@ -12,6 +12,7 @@ #' @param ... [any]\cr #' Further arguments passed to generator. #' @return [\code{smoof_function}] +#' Smoof function generated based on the specified names and arguments. #' @examples #' # generate a testset of multimodal 2D functions #' \dontrun{ @@ -20,7 +21,7 @@ #' @seealso \code{\link{filterFunctionsByTags}} #' @export makeFunctionsByName = function(fun.names, ...) { - assertCharacter(fun.names, min.len = 1L, any.missing = FALSE, all.missing = FALSE) + checkmate::assertCharacter(fun.names, min.len = 1L, any.missing = FALSE, all.missing = FALSE) fun.generators = getGeneratorFunctions() valid.fun.names = sapply(fun.generators, function(generator) attr(generator, "name")) @@ -29,7 +30,7 @@ makeFunctionsByName = function(fun.names, ...) { funs = lapply(fun.names, function(fun.name) { if (fun.name %nin% valid.fun.names) { - stopf("There is no generator for function '%s'.", fun.name) + BBmisc::stopf("There is no generator for function '%s'.", fun.name) } # find the right generator @@ -50,14 +51,14 @@ makeFunctionsByName = function(fun.names, ...) { if (is.null(args$dimensions)) { if ("scalable" %in% attr(generator, "tags")) { - stopf("'%s' is scalable and needs a dimension argument to be passed.", fun.name) + BBmisc::stopf("'%s' is scalable and needs a dimension argument to be passed.", fun.name) } return(do.call(generator, args)) } else { if ("scalable" %in% attr(generator, "tags")) { tryres = try({do.call(generator, args)}, silent = TRUE) if (inherits(tryres, "try-error")) { - warningf("Function '%s' could not be generated.", fun.name) + BBmisc::warningf("Function '%s' could not be generated.", fun.name) return(NA) } return(tryres) @@ -65,7 +66,7 @@ makeFunctionsByName = function(fun.names, ...) { args$dimensions = NULL return(do.call(generator, args)) } else { - warningf("Dimension attribute passed, but '%s' is a non-scalable function.", fun.name) + BBmisc::warningf("Dimension attribute passed, but '%s' is a non-scalable function.", fun.name) return(NA) } } diff --git a/R/makeMultiObjectiveFunction.R b/R/makeMultiObjectiveFunction.R index b824d9c9..da36397b 100644 --- a/R/makeMultiObjectiveFunction.R +++ b/R/makeMultiObjectiveFunction.R @@ -17,7 +17,7 @@ #' @template arg_vectorized #' @template arg_constraint_fn #' @param ref.point [\code{numeric}]\cr -#' Optional reference point in the objective space, e.g., for hypervolume computation. +#' Optional reference point in the objective space, e.g., for hyper-volume computation. #' @return [\code{function}] Target function with additional stuff attached as attributes. #' @examples #' fn = makeMultiObjectiveFunction( @@ -50,10 +50,10 @@ makeMultiObjectiveFunction = function( ) if (!is.null(ref.point)) { - assertNumeric(ref.point, len = n.objectives, any.missing = FALSE, all.missing = FALSE) + checkmate::assertNumeric(ref.point, len = n.objectives, any.missing = FALSE, all.missing = FALSE) } - smoof.fn = setAttribute(smoof.fn, "ref.point", ref.point) + smoof.fn = BBmisc::setAttribute(smoof.fn, "ref.point", ref.point) class(smoof.fn) = c("smoof_multi_objective_function", class(smoof.fn)) return(smoof.fn) diff --git a/R/makeNKFunction.R b/R/makeNKFunction.R index cfb24e57..7bc13771 100644 --- a/R/makeNKFunction.R +++ b/R/makeNKFunction.R @@ -32,6 +32,7 @@ #' #' @family nk_landscapes #' @return [\code{smoof_single_objective_function}] +#' NK-landscape function. #' @export makeNKFunction = function(N, K) { N = checkmate::asInt(N) @@ -303,7 +304,7 @@ makeNKFunctionInternal = function(nk_properties, m) { id = "NK_landscape", fn = fn, minimize = FALSE, - par.set = makeParamSet(makeIntegerVectorParam( + par.set = ParamHelpers::makeParamSet(ParamHelpers::makeIntegerVectorParam( len = N, id = "x", lower = rep(0, N), @@ -351,7 +352,7 @@ makeMNKFunctionInternal = function(nk_properties) { id = "rMNK_landscape", fn = fn, minimize = rep(FALSE, M), # always to be maximised - par.set = makeParamSet(makeIntegerVectorParam( + par.set = ParamHelpers::makeParamSet(ParamHelpers::makeIntegerVectorParam( len = N, id = "x", lower = rep(0, N), diff --git a/R/makeObjectiveFunction.R b/R/makeObjectiveFunction.R index dc46c0c8..db163831 100644 --- a/R/makeObjectiveFunction.R +++ b/R/makeObjectiveFunction.R @@ -1,38 +1,39 @@ -# Internal generator for function of smoof type. -# -# @param name [\code{character(1)}]\cr -# Optional function name used e.g. in plots. -# @param description [\code{character(1)} | \code{NULL}]\cr -# Optional function description. -# @param fn [\code{function}]\cr -# Target function. -# @param has.simple.signature [\code{logical(1)}]\cr -# Set this to \code{TRUE} if the target function expects a vector as input and \code{FALSE} -# if it expects a named list of values. The latter is needed if the function depends on mixed -# parameters. Default is \code{TRUE}. -# @param par.set [\code{\link[ParamHelpers]{ParamSet}}]\cr -# Parameter set describing different ascpects of the target function parameters, i. e., -# names, lower and/or upper bounds, types and so on. See \code{\link[ParamHelpers]{makeParamSet}} -# for further information. -# @param n.objectives [\code{integer(1)}]\cr -# Number of objectives of the multi-objective function. -# @param noisy [\code{logical(1)}]\cr -# Is the function noisy? Defaults to \code{FALSE}. -# @param fn.mean [\code{function}]\cr -# Optional true mean function in case of a noisy objective function. This functions should -# have the same mean as \code{fn}. -# @param minimize [\code{logical}]\cr -# Logical vector of length \code{n.objectives} indicating which objectives shall -# be minimzed/maximized. -# The default is \code{TRUE} \code{n.objectives} times. -# @param vectorized [\code{logical(1)}]\cr -# Can the handle \dQuote{vector} input, i. e., does it accept matrix of -# parameters? Default is \code{FALSE}. -# @param constraint.fn [\code{function | NULL}]\cr -# Function which returns a logical vector indicating which indicates whether certain conditions -# are met or not. Default is \code{NULL}, which means, that there are no constraints (beside possible) -# box constraints defined via the \code{par.set} argument. -# @return [\code{function}] Target function with additional stuff attached as attributes. +#' Internal generator for function of smoof type. +#' +#' @param name [\code{character(1)}]\cr +#' Optional function name used e.g. in plots. +#' @param description [\code{character(1)} | \code{NULL}]\cr +#' Optional function description. +#' @param fn [\code{function}]\cr +#' Target function. +#' @param has.simple.signature [\code{logical(1)}]\cr +#' Set this to \code{TRUE} if the target function expects a vector as input and \code{FALSE} +#' if it expects a named list of values. The latter is needed if the function depends on mixed +#' parameters. Default is \code{TRUE}. +#' @param par.set [\code{\link[ParamHelpers]{ParamSet}}]\cr +#' Parameter set describing different aspects of the target function parameters, i. e., +#' names, lower and/or upper bounds, types and so on. See \code{\link[ParamHelpers]{makeParamSet}} +#' for further information. +#' @param n.objectives [\code{integer(1)}]\cr +#' Number of objectives of the multi-objective function. +#' @param noisy [\code{logical(1)}]\cr +#' Is the function noisy? Defaults to \code{FALSE}. +#' @param fn.mean [\code{function}]\cr +#' Optional true mean function in case of a noisy objective function. This functions should +#' have the same mean as \code{fn}. +#' @param minimize [\code{logical}]\cr +#' Logical vector of length \code{n.objectives} indicating which objectives shall +#' be minimized/maximized. +#' The default is \code{TRUE} \code{n.objectives} times. +#' @param vectorized [\code{logical(1)}]\cr +#' Can the handle \dQuote{vector} input, i. e., does it accept matrix of +#' parameters? Default is \code{FALSE}. +#' @param constraint.fn [\code{function | NULL}]\cr +#' Function which returns a logical vector indicating which indicates whether certain conditions +#' are met or not. Default is \code{NULL}, which means, that there are no constraints (beside possible) +#' box constraints defined via the \code{par.set} argument. +#' @return [\code{function}] Target function with additional stuff attached as attributes. +#' @export makeObjectiveFunction = function( name = NULL, id = NULL, @@ -49,14 +50,14 @@ makeObjectiveFunction = function( # sanity checks if (!is.null(name)) - assertString(name) + checkmate::assertString(name) if (!is.null(id)) - assertString(id) + checkmate::assertString(id) if (!is.null(description)) - assertString(description) - assertFunction(fn) - assertFlag(has.simple.signature) + checkmate::assertString(description) + checkmate::assertFunction(fn) + checkmate::assertFlag(has.simple.signature) if (has.simple.signature) { fn = makeInternalObjectiveFunction(fn) @@ -65,42 +66,42 @@ makeObjectiveFunction = function( } } - assertClass(par.set, "ParamSet") + checkmate::assertClass(par.set, "ParamSet") # guess number of objectives if (is.null(n.objectives)) { - test.pars = sampleValue(par.set) + test.pars = ParamHelpers::sampleValue(par.set) test.res = do.call(fn, test.pars) n.objectives = length(test.res) } - assertInt(n.objectives, lower = 1L) - assertFlag(noisy) + checkmate::assertInt(n.objectives, lower = 1L) + checkmate::assertFlag(noisy) if (!noisy && !is.null(fn.mean)) { - stopf("Setting fn.mean only makes sense for noisy functions.") + BBmisc::stopf("Setting fn.mean only makes sense for noisy functions.") } if (!is.null(fn.mean)) { - assertFunction(fn.mean) + checkmate::assertFunction(fn.mean) } if (is.null(minimize)) minimize = rep(TRUE, n.objectives) - assertLogical(minimize, len = n.objectives, any.missing = FALSE, all.missing = FALSE) + checkmate::assertLogical(minimize, len = n.objectives, any.missing = FALSE, all.missing = FALSE) assertFlag(vectorized) if (!has.simple.signature && vectorized) { - stopf("At the moment we allow 'vectorized' functions only for functions with simple signature.") + BBmisc::stopf("At the moment we allow 'vectorized' functions only for functions with simple signature.") } if (!is.null(constraint.fn)) { - assertFunction(constraint.fn) + checkmate::assertFunction(constraint.fn) } structure( fn, - name = coalesce(name, ""), - id = coalesce(id, as.character(NA)), - description = coalesce(description, ""), + name = BBmisc::coalesce(name, ""), + id = BBmisc::coalesce(id, as.character(NA)), + description = BBmisc::coalesce(description, ""), par.set = par.set, noisy = noisy, fn.mean = fn.mean, diff --git a/R/makeSingleObjectiveFunction.R b/R/makeSingleObjectiveFunction.R index a25cd4ba..68dd89a6 100644 --- a/R/makeSingleObjectiveFunction.R +++ b/R/makeSingleObjectiveFunction.R @@ -94,7 +94,7 @@ makeSingleObjectiveFunction = function( ) #FIXME: currently we offer this only for single objective functions - assertSubset(tags, choices = getAvailableTags(), empty.ok = TRUE) + checkmate::assertSubset(tags, choices = getAvailableTags(), empty.ok = TRUE) global.opt.params = preprocessOptima(global.opt.params, smoof.fn, par.set, "global") local.opt.params = preprocessOptima(local.opt.params, smoof.fn, par.set, "local") @@ -104,25 +104,25 @@ makeSingleObjectiveFunction = function( } if (!is.null(global.opt.params) && !is.null(global.opt.value)) { - assertNumber(global.opt.value, finite = TRUE) + checkmate::assertNumber(global.opt.value, finite = TRUE) } if (is.null(local.opt.values) && !is.null(local.opt.params)) { # print(local.opt.params) # print(par.set) - local.opt.params2 = dfRowsToList(df = local.opt.params, par.set = par.set, enforce.col.types = TRUE) + local.opt.params2 = BBmisc::dfRowsToList(df = local.opt.params, par.set = par.set, enforce.col.types = TRUE) local.opt.values = sapply(local.opt.params2, smoof.fn) } if (!is.null(local.opt.params) && !is.null(local.opt.values)) { - assertNumeric(local.opt.values, len = nrow(local.opt.params), finite = TRUE, any.missing = FALSE, all.missing = FALSE) + checkmate::assertNumeric(local.opt.values, len = nrow(local.opt.params), finite = TRUE, any.missing = FALSE, all.missing = FALSE) } - smoof.fn = setAttribute(smoof.fn, "global.opt.params", global.opt.params) - smoof.fn = setAttribute(smoof.fn, "global.opt.value", global.opt.value) - smoof.fn = setAttribute(smoof.fn, "local.opt.params", local.opt.params) - smoof.fn = setAttribute(smoof.fn, "local.opt.value", local.opt.values) - smoof.fn = setAttribute(smoof.fn, "tags", tags) + smoof.fn = BBmisc::setAttribute(smoof.fn, "global.opt.params", global.opt.params) + smoof.fn = BBmisc::setAttribute(smoof.fn, "global.opt.value", global.opt.value) + smoof.fn = BBmisc::setAttribute(smoof.fn, "local.opt.params", local.opt.params) + smoof.fn = BBmisc::setAttribute(smoof.fn, "local.opt.value", local.opt.values) + smoof.fn = BBmisc::setAttribute(smoof.fn, "tags", tags) class(smoof.fn) = c("smoof_single_objective_function", class(smoof.fn)) @@ -132,27 +132,27 @@ makeSingleObjectiveFunction = function( #' @export print.smoof_function = function(x, ...) { n.objectives.text = ifelse(isSingleobjective(x), "Single", "Multi") - catf("%s-objective function", n.objectives.text) + BBmisc::catf("%s-objective function", n.objectives.text) if (isMultiobjective(x)) { - catf("Number of objectives: %i", getNumberOfObjectives(x)) + BBmisc::catf("Number of objectives: %i", getNumberOfObjectives(x)) ref.point = getRefPoint(x) if (!is.null(x)) { - catf("Reference point: (%s)", collapse(ref.point, ", ")) + BBmisc::catf("Reference point: (%s)", BBmisc::collapse(ref.point, ", ")) } } - catf("Name: %s", getName(x)) + BBmisc::catf("Name: %s", getName(x)) description = getDescription(x) - catf("Description: %s", if (description == "") "no description" else description) + BBmisc::catf("Description: %s", if (description == "") "no description" else description) - catf("Tags: %s", collapse(getTags(x), sep = ", ")) - catf("Noisy: %s", as.character(isNoisy(x))) - catf("Minimize: %s", collapse(shouldBeMinimized(x))) - catf("Constraints: %s", as.character(hasConstraints(x))) - catf("Number of parameters: %i", getNumberOfParameters(x)) + BBmisc::catf("Tags: %s", BBmisc::collapse(getTags(x), sep = ", ")) + BBmisc::catf("Noisy: %s", as.character(isNoisy(x))) + BBmisc::catf("Minimize: %s", BBmisc::collapse(shouldBeMinimized(x))) + BBmisc::catf("Constraints: %s", as.character(hasConstraints(x))) + BBmisc::catf("Number of parameters: %i", getNumberOfParameters(x)) print(getParamSet(x)) if (hasGlobalOptimum(x)) { opt = getGlobalOptimum(x) - catf("Global optimum objective value of %.4f at", opt$value) + BBmisc::catf("Global optimum objective value of %.4f at", opt$value) print(opt$param) } } @@ -161,29 +161,29 @@ preprocessOptima = function(opt.params, fn, par.set, type) { n.params = getNumberOfParameters(fn) if (!is.null(opt.params)) { - if (!testDataFrame(opt.params)) { + if (!checkmate::testDataFrame(opt.params)) { # single numeric only value passed - if (testList(opt.params, len = n.params, any.missing = FALSE)) { + if (checkmate::testList(opt.params, len = n.params, any.missing = FALSE)) { opt.params = as.data.frame(opt.params) - } else if (testMatrix(opt.params)) { + } else if (checkmate::testMatrix(opt.params)) { opt.params = as.data.frame(opt.params) - } else if (testNumeric(opt.params, len = n.params, any.missing = FALSE)) { + } else if (checkmate::testNumeric(opt.params, len = n.params, any.missing = FALSE)) { opt.params = as.data.frame(t(opt.params)) } else { - stopf("Parameter(s) for known %s optima must be passed as vector, list, matrix or data.frame.", type) + BBmisc::stopf("Parameter(s) for known %s optima must be passed as vector, list, matrix or data.frame.", type) } - colnames(opt.params) = getParamIds(par.set, with.nr = TRUE, repeated = TRUE) + colnames(opt.params) = ParamHelpers::getParamIds(par.set, with.nr = TRUE, repeated = TRUE) } - assertDataFrame(opt.params, ncols = n.params, col.names = "unique") + checkmate::assertDataFrame(opt.params, ncols = n.params, col.names = "unique") # check if the passed parameters are indeed within the feasible region lapply(1:nrow(opt.params), function(i) { - if (!isFeasible(par.set, ParamHelpers::dfRowToList(opt.params, par.set, i))) { - stopf("%s optimum out of bounds.", type) + if (!editrules::isFeasible(par.set, ParamHelpers::dfRowToList(opt.params, par.set, i))) { + BBmisc::stopf("%s optimum out of bounds.", type) } }) - if (!setequal(getParamIds(par.set, repeated = TRUE, with.nr = TRUE), colnames(opt.params))) { - stopf("Names of passed %s optimum parameters do not match names in parameter set.", type) + if (!setequal(ParamHelpers::getParamIds(par.set, repeated = TRUE, with.nr = TRUE), colnames(opt.params))) { + BBmisc::stopf("Names of passed %s optimum parameters do not match names in parameter set.", type) } } return(opt.params) diff --git a/R/makeUFFunction.R b/R/makeUFFunction.R index fa9bad6d..43bc3ec7 100644 --- a/R/makeUFFunction.R +++ b/R/makeUFFunction.R @@ -6,18 +6,18 @@ #' @return [\code{smoof_single_objective_function}] #' #' @author Jakob Bossek \email{j.bossek@@gmail.com} -#' @note The implementation is based on the original CPP implemenation by Qingfu +#' @note The implementation is based on the original CPP implementation by Qingfu #' Zhang, Aimin Zhou, Shizheng Zhaoy, Ponnuthurai Nagaratnam Suganthany, Wudong Liu #' and Santosh Tiwar. #' #' @export makeUFFunction = function(dimensions, id) { # do some sanity checks - dimensions = asCount(dimensions) - id = asCount(id) + dimensions = checkmate::asCount(dimensions) + id = checkmate::asCount(id) #FIXME: I guess the lowest possible search space dimension is 3 - assertInt(dimensions, lower = 3L) - assertInt(id, lower = 1L, upper = 10L) + checkmate::assertInt(dimensions, lower = 3L) + checkmate::assertInt(id, lower = 1L, upper = 10L) # touch vars force(dimensions) @@ -75,5 +75,5 @@ makeUFParamSet = function(id, dimensions) { lower = c(0, 0, rep(-2, dimensions - 2L)) upper = c(1, 1, rep(2, dimensions - 2L)) } - makeNumericParamSet("x", lower = lower, upper = upper, len = dimensions) + ParamHelpers::makeNumericParamSet("x", lower = lower, upper = upper, len = dimensions) } diff --git a/R/mnof.R b/R/mnof.R index 5d749da9..87498abe 100644 --- a/R/mnof.R +++ b/R/mnof.R @@ -1,5 +1,5 @@ #' @title -#' Helper function to create numeric multi-objective optimization test function. +#' Helper function to create a numeric multi-objective optimization test function. #' #' @description #' This is a simplifying wrapper around \code{\link{makeMultiObjectiveFunction}}. @@ -11,6 +11,9 @@ #' @template arg_par.id #' @template arg_par.lower #' @template arg_par.upper +#' @return [\code{smoof_multi_objective_function}] +#' Returns a numeric multi-objective optimization test function created using the provided parameters. +#' #' @examples #' # first we generate the 10d sphere function the long way #' fn = makeMultiObjectiveFunction( @@ -48,17 +51,17 @@ mnof = function(name = NULL, ref.point = NULL ) { - assertString(par.id, null.ok = TRUE) - par.len = asCount(par.len) - n.objectives = asCount(n.objectives) + checkmate::assertString(par.id, null.ok = TRUE) + par.len = checkmate::asCount(par.len) + n.objectives = checkmate::asCount(n.objectives) # furhter checks are performed by ParamHelpers if (is.null(par.lower)) par.lower = -Inf if (is.null(par.upper)) par.upper = Inf - assertNumeric(par.lower, min.len = 1L) - assertNumeric(par.upper, min.len = 1L) + checkmate::assertNumeric(par.lower, min.len = 1L) + checkmate::assertNumeric(par.upper, min.len = 1L) makeMultiObjectiveFunction( name = name, @@ -67,7 +70,7 @@ mnof = function(name = NULL, description = description, fn = fn, has.simple.signature = TRUE, # numeric funs always have a simple signature - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = par.len, id = par.id, lower = par.lower, diff --git a/R/mof.BK1.R b/R/mof.BK1.R index 7e529081..0f61b3c9 100644 --- a/R/mof.BK1.R +++ b/R/mof.BK1.R @@ -2,12 +2,14 @@ #' BK1 function generator #' #' @description -#' ... +#' Generates the BK1 function, a multi-objective optimization test function. The BK1 function +#' is commonly used in benchmarking studies for evaluating the performance of optimization algorithms. #' #' @references #' ... #' #' @return [\code{smoof_multi_objective_function}] +#' Returns an instance of the BK1 function as a \code{smoof_multi_objective_function} object. #' @export makeBK1Function = function() { @@ -22,7 +24,7 @@ makeBK1Function = function() { id = "bk1", description = "BK1 function", fn = fn, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 2L, id = "x", lower = rep(-5, 2L), diff --git a/R/mof.ED1.R b/R/mof.ED1.R index ed32d3e4..0e5cd8b9 100644 --- a/R/mof.ED1.R +++ b/R/mof.ED1.R @@ -37,11 +37,13 @@ #' Parameter vector, whose components have to be between \code{0} and \code{0.5*pi}. #' The default is \code{theta = (pi/2) * x} (with \code{x} being the point from the decision space) as recommended by Emmerich and Deutz. #' @return [\code{smoof_multi_objective_function}] +#' Returns an instance of the ED1 function as a \code{smoof_multi_objective_function} object. +#' #' @export makeED1Function = function(dimensions, n.objectives, gamma = 2, theta) { - assertInt(n.objectives, lower = 2L) - assertInt(dimensions, lower = n.objectives) - assertNumber(gamma, na.ok = FALSE, lower = .Machine$double.eps) + checkmate::assertInt(n.objectives, lower = 2L) + checkmate::assertInt(dimensions, lower = n.objectives) + checkmate::assertNumber(gamma, na.ok = FALSE, lower = .Machine$double.eps) force(n.objectives) force(dimensions) @@ -65,7 +67,7 @@ makeED1Function = function(dimensions, n.objectives, gamma = 2, theta) { id = paste0("ED1_", dimensions, "d_", n.objectives, "o"), description = "Emmerich and Deutz", fn = fn, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = dimensions, id = "x", lower = rep(0, dimensions), diff --git a/R/mof.ED2.R b/R/mof.ED2.R index 401f7906..042a5fbf 100644 --- a/R/mof.ED2.R +++ b/R/mof.ED2.R @@ -40,11 +40,12 @@ #' Parameter vector, whose components have to be between \code{0} and \code{0.5*pi}. #' The default is \code{theta = (pi/2) * x} (with \code{x} being the point from the decision space) as recommended by Emmerich and Deutz. #' @return [\code{smoof_multi_objective_function}] +#' Returns an instance of the ED2 function as a \code{smoof_multi_objective_function} object. #' @export makeED2Function = function(dimensions, n.objectives, gamma = 2, theta) { - assertInt(n.objectives, lower = 2L) - assertInt(dimensions, lower = n.objectives) - assertNumber(gamma, na.ok = FALSE, lower = .Machine$double.eps) + checkmate::assertInt(n.objectives, lower = 2L) + checkmate::assertInt(dimensions, lower = n.objectives) + checkmate::assertNumber(gamma, na.ok = FALSE, lower = .Machine$double.eps) force(n.objectives) force(dimensions) @@ -68,7 +69,7 @@ makeED2Function = function(dimensions, n.objectives, gamma = 2, theta) { id = paste0("ED2_", dimensions, "d_", n.objectives, "o"), description = "Emmerich and Deutz", fn = fn, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = dimensions, id = "x", lower = rep(0, dimensions), diff --git a/R/mof.MOP1.R b/R/mof.MOP1.R index 2371d664..dcf74852 100644 --- a/R/mof.MOP1.R +++ b/R/mof.MOP1.R @@ -10,6 +10,7 @@ #' Applications, J. J. Grenfenstett, Ed., 1985, pp. 93-100. #' #' @return [\code{smoof_multi_objective_function}] +#' Returns an instance of the MOP1 function as a \code{smoof_multi_objective_function} object. #' @export makeMOP1Function = function() { @@ -24,7 +25,7 @@ makeMOP1Function = function() { id = "MOP1", description = "MOP1 function", fn = fn, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 2L, id = "x", lower = -1e5, diff --git a/R/mof.MOP2.R b/R/mof.MOP2.R index 0bf4781b..7d7a7543 100644 --- a/R/mof.MOP2.R +++ b/R/mof.MOP2.R @@ -5,15 +5,16 @@ #' MOP2 function from Van Valedhuizen's test suite due to Fonseca and Fleming. #' #' @references -#' C. M. Fonseca and P. J. Fleming, "Multiobjective genetic algorithms +#' C. M. Fonseca and P. J. Fleming, "Multi-objective genetic algorithms #' made easy: Selection, sharing and mating restriction," Genetic Algorithms #' in Engineering Systems: Innovations and Applications, pp. 45-52, Sep. 1995. IEE. #' #' @template arg_dimensions #' @return [\code{smoof_multi_objective_function}] +#' Returns an instance of the MOP2 function as a \code{smoof_multi_objective_function} object. #' @export makeMOP2Function = function(dimensions = 2L) { - assertInt(dimensions, lower = 1L) + checkmate::assertInt(dimensions, lower = 1L) force(dimensions) # C implementation @@ -27,7 +28,7 @@ makeMOP2Function = function(dimensions = 2L) { id = sprintf("MOP2-%id-%io", dimensions, 2L), description = "MOP2 function", fn = fn, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = dimensions, id = "x", lower = rep(-4, dimensions), diff --git a/R/mof.MOP3.R b/R/mof.MOP3.R index 4c5cee97..c13f56f1 100644 --- a/R/mof.MOP3.R +++ b/R/mof.MOP3.R @@ -5,7 +5,7 @@ #' MOP3 function from Van Valedhuizen's test suite. #' #' @references -#' C. Poloni, G. Mosetti, and S. Contessi, "Multi objective optimization by +#' C. Poloni, G. Mosetti, and S. Contessi, "Multi-objective optimization by #' GAs: Application to system and component design," in Proc. Comput. #' Methods in Applied Sciences'96: Invited Lectures and Special Technological #' Sessions of the 3rd ECCOMAS Comput. Fluid Dynamics Conf. @@ -13,9 +13,10 @@ #' 1996, pp. 258-264 #' @template arg_dimensions #' @return [\code{smoof_multi_objective_function}] +#' Returns an instance of the MOP3 function as a \code{smoof_multi_objective_function} object. #' @export makeMOP3Function = function(dimensions = 2L) { - assertInt(dimensions, lower = 1L) + checkmate::assertInt(dimensions, lower = 1L) force(dimensions) # C implementation @@ -29,7 +30,7 @@ makeMOP3Function = function(dimensions = 2L) { id = sprintf("MOP3-%id-%io", dimensions, 2L), description = "MOP3 function", fn = fn, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = dimensions, id = "x", lower = rep(-pi, dimensions), diff --git a/R/mof.MOP4.R b/R/mof.MOP4.R index ba650a8a..0837c644 100644 --- a/R/mof.MOP4.R +++ b/R/mof.MOP4.R @@ -11,6 +11,7 @@ #' Problem Solving From Nature. 1st Workshop, PPSN I, pp. 193-197. #' #' @return [\code{smoof_multi_objective_function}] +#' Returns an instance of the MOP4 function as a \code{smoof_multi_objective_function} object. #' @export makeMOP4Function = function() { @@ -25,7 +26,7 @@ makeMOP4Function = function() { id = sprintf("MOP4-%id-%io", 3L, 2L), description = "MOP4 function", fn = fn, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 3L, id = "x", lower = rep(-5, 3L), diff --git a/R/mof.MOP5.R b/R/mof.MOP5.R index c7fde7b8..6ff8630d 100644 --- a/R/mof.MOP5.R +++ b/R/mof.MOP5.R @@ -8,11 +8,12 @@ #' Original box constraints where \eqn{[-3, 3]}. #' #' @references -#' R. Viennet, C. Fonteix, and I. Marc, "Multicriteria optimization using a +#' R. Viennet, C. Fonteix, and I. Marc, "Multi criteria optimization using a #' genetic algorithm for determining a Pareto set," Int. J. Syst. Sci., vol. 27, #' no. 2, pp. 255-260, 1996 #' #' @return [\code{smoof_multi_objective_function}] +#' Returns an instance of the MOP5 function as a \code{smoof_multi_objective_function} object. #' @export makeMOP5Function = function() { @@ -27,7 +28,7 @@ makeMOP5Function = function() { id = sprintf("MOP5-%id-%io", 2L, 3L), description = "MOP5 function", fn = fn, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 2L, id = "x", lower = rep(-30, 2L), diff --git a/R/mof.MOP6.R b/R/mof.MOP6.R index 2cf36b20..d650a815 100644 --- a/R/mof.MOP6.R +++ b/R/mof.MOP6.R @@ -5,6 +5,7 @@ #' MOP6 function from Van Valedhuizen's test suite. #' #' @return [\code{smoof_multi_objective_function}] +#' Returns an instance of the MOP6 function as a \code{smoof_multi_objective_function} object. #' @export makeMOP6Function = function() { @@ -19,7 +20,7 @@ makeMOP6Function = function() { id = sprintf("MOP6-%id-%io", 2L, 2L), description = "MOP6 function", fn = fn, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 2L, id = "x", lower = rep(0, 2L), diff --git a/R/mof.MOP7.R b/R/mof.MOP7.R index 6f304249..f72ac93f 100644 --- a/R/mof.MOP7.R +++ b/R/mof.MOP7.R @@ -5,11 +5,12 @@ #' MOP7 function from Van Valedhuizen's test suite. #' #' @references -#' R. Viennet, C. Fonteix, and I. Marc, "Multicriteria optimization using a +#' R. Viennet, C. Fonteix, and I. Marc, "Multi-criteria optimization using a #' genetic algorithm for determining a Pareto set," Int. J. Syst. Sci., vol. 27, #' no. 2, pp. 255-260, 1996 #' #' @return [\code{smoof_multi_objective_function}] +#' Returns an instance of the MOP7 function as a \code{smoof_multi_objective_function} object. #' @export makeMOP7Function = function() { @@ -24,7 +25,7 @@ makeMOP7Function = function() { id = sprintf("MOP7-%id-%io", 2L, 3L), description = "MOP7 function", fn = fn, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 2L, id = "x", lower = rep(-400, 2L), diff --git a/R/mof.SYMPARTrotated.R b/R/mof.SYMPARTrotated.R index 4e0d9faa..838df08e 100644 --- a/R/mof.SYMPARTrotated.R +++ b/R/mof.SYMPARTrotated.R @@ -1,8 +1,8 @@ #' @title -#' MMF13 Function +#' SYM-PART Rotated Function #' #' @description -#' Test problem from the set of "multimodal multiobjective functions" as for +#' Test problem from the set of "multi-modal multi-objective functions" as for #' instance used in the CEC2019 competition. #' #' @param w [\code{double}(1)]\cr @@ -20,15 +20,17 @@ #' #' @references #' Caitong Yue, Boyang Qu, Kunjie Yu, Jing Liang, and Xiaodong Li, "A novel -#' scalable test problem suite for multimodal multiobjective optimization," in +#' scalable test problem suite for multi-modal multi-objective optimization," in #' Swarm and Evolutionary Computation, Volume 48, August 2019, pp. 62–71, Elsevier. #' @return [\code{smoof_multi_objective_function}] +#' Returns an instance of the SYM-PART Rotated function as a \code{smoof_multi_objective_function} object. +#' #' @export makeSYMPARTrotatedFunction = function(w = pi / 4, a = 1, b = 10, c = 8) { - assertNumber(x = w, finite = TRUE) - assertNumber(x = a, finite = TRUE) - assertNumber(x = b, finite = TRUE) - assertNumber(x = c, finite = TRUE) + checkmate::assertNumber(x = w, finite = TRUE) + checkmate::assertNumber(x = a, finite = TRUE) + checkmate::assertNumber(x = b, finite = TRUE) + checkmate::assertNumber(x = c, finite = TRUE) force(w) force(a) force(b) @@ -46,7 +48,7 @@ makeSYMPARTrotatedFunction = function(w = pi / 4, a = 1, b = 10, c = 8) { id = sprintf("SYMPART-rotated-%id-%io", 2L, n.objectives), description = "SYMPART-rotated function", fn = fn, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 2L, id = "x", lower = rep(-20, 2L), diff --git a/R/mof.SYMPARTsimple.R b/R/mof.SYMPARTsimple.R index b7bc87bb..e54b4f06 100644 --- a/R/mof.SYMPARTsimple.R +++ b/R/mof.SYMPARTsimple.R @@ -1,8 +1,8 @@ #' @title -#' MMF13 Function +#' SYM-PART Simple Function #' #' @description -#' Test problem from the set of "multimodal multiobjective functions" as for +#' Test problem from the set of "multi-modal multi-objective functions" as for #' instance used in the CEC2019 competition. #' #' @param a [\code{double}(1)]\cr @@ -17,14 +17,15 @@ #' #' @references #' Caitong Yue, Boyang Qu, Kunjie Yu, Jing Liang, and Xiaodong Li, "A novel -#' scalable test problem suite for multimodal multiobjective optimization," in +#' scalable test problem suite for multi-modal multi-objective optimization," in #' Swarm and Evolutionary Computation, Volume 48, August 2019, pp. 62–71, Elsevier. #' @return [\code{smoof_multi_objective_function}] +#' Returns an instance of the SYM-PART Simple function as a \code{smoof_multi_objective_function} object. #' @export makeSYMPARTsimpleFunction = function(a = 1, b = 10, c = 8) { - assertNumber(x = a, finite = TRUE) - assertNumber(x = b, finite = TRUE) - assertNumber(x = c, finite = TRUE) + checkmate::assertNumber(x = a, finite = TRUE) + checkmate::assertNumber(x = b, finite = TRUE) + checkmate::assertNumber(x = c, finite = TRUE) force(a) force(b) force(c) @@ -41,7 +42,7 @@ makeSYMPARTsimpleFunction = function(a = 1, b = 10, c = 8) { id = sprintf("SYMPART-simple-%id-%io", 2L, n.objectives), description = "SYMPART-simple function", fn = fn, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 2L, id = "x", lower = rep(-20, 2L), diff --git a/R/mof.WFG1.R b/R/mof.WFG1.R index f41cbf60..4390b603 100644 --- a/R/mof.WFG1.R +++ b/R/mof.WFG1.R @@ -18,6 +18,7 @@ #' Number of distance-related parameters. These will automatically be #' the last \code{l} elements from the input vector. #' @return [\code{smoof_multi_objective_function}] +#' Returns an instance of the WGF1 function as a \code{smoof_multi_objective_function} object. #' @details #' Huband et al. recommend a value of \code{k = 4L} position-related #' parameters for bi-objective problems and \code{k = 2L * (n.objectives - 1L)} @@ -28,7 +29,7 @@ #' #' @export makeWFG1Function = function(n.objectives, k, l) { - assertInt(n.objectives, lower = 2L) + checkmate::assertInt(n.objectives, lower = 2L) force(n.objectives) if (missing(k)) { @@ -38,14 +39,14 @@ makeWFG1Function = function(n.objectives, k, l) { k = 2L * (n.objectives - 1L) } } - assertInt(k, lower = n.objectives - 1L) - assertTRUE(k %% (n.objectives - 1L) == 0L) + checkmate::assertInt(k, lower = n.objectives - 1L) + checkmate::assertTRUE(k %% (n.objectives - 1L) == 0L) force(k) if (missing(l)) { l = 20L } - assertInt(l, lower = 1L) + checkmate::assertInt(l, lower = 1L) force(l) dimensions = k + l @@ -60,7 +61,7 @@ makeWFG1Function = function(n.objectives, k, l) { id = sprintf("WFG1-%id-%io", dimensions, n.objectives), description = "WFG1 function", fn = fn, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = dimensions, id = "x", lower = rep(0, dimensions), diff --git a/R/mof.WFG2.R b/R/mof.WFG2.R index a1c75ef2..d2241ea1 100644 --- a/R/mof.WFG2.R +++ b/R/mof.WFG2.R @@ -19,6 +19,7 @@ #' the last \code{l} elements from the input vector. This value has to #' be a multiple of 2. #' @return [\code{smoof_multi_objective_function}] +#' Returns an instance of the WFG2 function as a \code{smoof_multi_objective_function} object. #' @details #' Huband et al. recommend a value of \code{k = 4L} position-related #' parameters for bi-objective problems and \code{k = 2L * (n.objectives - 1L)} @@ -29,7 +30,7 @@ #' #' @export makeWFG2Function = function(n.objectives, k, l) { - assertInt(n.objectives, lower = 2L) + checkmate::assertInt(n.objectives, lower = 2L) force(n.objectives) if (missing(k)) { @@ -39,15 +40,15 @@ makeWFG2Function = function(n.objectives, k, l) { k = 2L * (n.objectives - 1L) } } - assertInt(k, lower = n.objectives - 1L) - assertTRUE(k %% (n.objectives - 1L) == 0L) + checkmate::assertInt(k, lower = n.objectives - 1L) + checkmate::assertTRUE(k %% (n.objectives - 1L) == 0L) force(k) if (missing(l)) { l = 20L } - assertInt(l, lower = 1L) - assertTRUE(l %% 2 == 0) + checkmate::assertInt(l, lower = 1L) + checkmate::assertTRUE(l %% 2 == 0) force(l) dimensions = k + l @@ -62,7 +63,7 @@ makeWFG2Function = function(n.objectives, k, l) { id = sprintf("WFG2-%id-%io", dimensions, n.objectives), description = "WFG2 function", fn = fn, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = dimensions, id = "x", lower = rep(0, dimensions), diff --git a/R/mof.WFG3.R b/R/mof.WFG3.R index fd356198..b7305cb4 100644 --- a/R/mof.WFG3.R +++ b/R/mof.WFG3.R @@ -19,6 +19,7 @@ #' the last \code{l} elements from the input vector. This value has to #' be a multiple of 2. #' @return [\code{smoof_multi_objective_function}] +#' Returns an instance of the WFG3 function as a \code{smoof_multi_objective_function} object. #' @details #' Huband et al. recommend a value of \code{k = 4L} position-related #' parameters for bi-objective problems and \code{k = 2L * (n.objectives - 1L)} @@ -29,7 +30,7 @@ #' #' @export makeWFG3Function = function(n.objectives, k, l) { - assertInt(n.objectives, lower = 2L) + checkmate::assertInt(n.objectives, lower = 2L) force(n.objectives) if (missing(k)) { @@ -39,15 +40,15 @@ makeWFG3Function = function(n.objectives, k, l) { k = 2L * (n.objectives - 1L) } } - assertInt(k, lower = n.objectives - 1L) - assertTRUE(k %% (n.objectives - 1L) == 0L) + checkmate::assertInt(k, lower = n.objectives - 1L) + checkmate::assertTRUE(k %% (n.objectives - 1L) == 0L) force(k) if (missing(l)) { l = 20L } - assertInt(l, lower = 1L) - assertTRUE(l %% 2 == 0) + checkmate::assertInt(l, lower = 1L) + checkmate::assertTRUE(l %% 2 == 0) force(l) dimensions = k + l @@ -62,7 +63,7 @@ makeWFG3Function = function(n.objectives, k, l) { id = sprintf("WFG3-%id-%io", dimensions, n.objectives), description = "WFG3 function", fn = fn, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = dimensions, id = "x", lower = rep(0, dimensions), diff --git a/R/mof.WFG4.R b/R/mof.WFG4.R index 5824ffe8..f25faa8f 100644 --- a/R/mof.WFG4.R +++ b/R/mof.WFG4.R @@ -18,6 +18,7 @@ #' Number of distance-related parameters. These will automatically be #' the last \code{l} elements from the input vector. #' @return [\code{smoof_multi_objective_function}] +#' Returns an instance of the WFG4 function as a \code{smoof_multi_objective_function} object. #' @details #' Huband et al. recommend a value of \code{k = 4L} position-related #' parameters for bi-objective problems and \code{k = 2L * (n.objectives - 1L)} @@ -28,7 +29,7 @@ #' #' @export makeWFG4Function = function(n.objectives, k, l) { - assertInt(n.objectives, lower = 2L) + checkmate::assertInt(n.objectives, lower = 2L) force(n.objectives) if (missing(k)) { @@ -38,14 +39,14 @@ makeWFG4Function = function(n.objectives, k, l) { k = 2L * (n.objectives - 1L) } } - assertInt(k, lower = n.objectives - 1L) - assertTRUE(k %% (n.objectives - 1L) == 0L) + checkmate::assertInt(k, lower = n.objectives - 1L) + checkmate::assertTRUE(k %% (n.objectives - 1L) == 0L) force(k) if (missing(l)) { l = 20L } - assertInt(l, lower = 1L) + checkmate::assertInt(l, lower = 1L) force(l) dimensions = k + l @@ -60,7 +61,7 @@ makeWFG4Function = function(n.objectives, k, l) { id = sprintf("WFG4-%id-%io", dimensions, n.objectives), description = "WFG4 function", fn = fn, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = dimensions, id = "x", lower = rep(0, dimensions), diff --git a/R/mof.WFG5.R b/R/mof.WFG5.R index f82c4aed..402eae16 100644 --- a/R/mof.WFG5.R +++ b/R/mof.WFG5.R @@ -18,6 +18,7 @@ #' Number of distance-related parameters. These will automatically be #' the last \code{l} elements from the input vector. #' @return [\code{smoof_multi_objective_function}] +#' Returns an instance of the WFG5 function as a \code{smoof_multi_objective_function} object. #' @details #' Huband et al. recommend a value of \code{k = 4L} position-related #' parameters for bi-objective problems and \code{k = 2L * (n.objectives - 1L)} @@ -28,7 +29,7 @@ #' #' @export makeWFG5Function = function(n.objectives, k, l) { - assertInt(n.objectives, lower = 2L) + checkmate::assertInt(n.objectives, lower = 2L) force(n.objectives) if (missing(k)) { @@ -38,14 +39,14 @@ makeWFG5Function = function(n.objectives, k, l) { k = 2L * (n.objectives - 1L) } } - assertInt(k, lower = n.objectives - 1L) - assertTRUE(k %% (n.objectives - 1L) == 0L) + checkmate::assertInt(k, lower = n.objectives - 1L) + checkmate::assertTRUE(k %% (n.objectives - 1L) == 0L) force(k) if (missing(l)) { l = 20L } - assertInt(l, lower = 1L) + checkmate::assertInt(l, lower = 1L) force(l) dimensions = k + l @@ -60,7 +61,7 @@ makeWFG5Function = function(n.objectives, k, l) { id = sprintf("WFG5-%id-%io", dimensions, n.objectives), description = "WFG5 function", fn = fn, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = dimensions, id = "x", lower = rep(0, dimensions), diff --git a/R/mof.WFG6.R b/R/mof.WFG6.R index 9dc1aede..aa0d9783 100644 --- a/R/mof.WFG6.R +++ b/R/mof.WFG6.R @@ -18,6 +18,7 @@ #' Number of distance-related parameters. These will automatically be #' the last \code{l} elements from the input vector. #' @return [\code{smoof_multi_objective_function}] +#' Returns an instance of the WFG6 function as a \code{smoof_multi_objective_function} object. #' @details #' Huband et al. recommend a value of \code{k = 4L} position-related #' parameters for bi-objective problems and \code{k = 2L * (n.objectives - 1L)} @@ -28,7 +29,7 @@ #' #' @export makeWFG6Function = function(n.objectives, k, l) { - assertInt(n.objectives, lower = 2L) + checkmate::assertInt(n.objectives, lower = 2L) force(n.objectives) if (missing(k)) { @@ -38,14 +39,14 @@ makeWFG6Function = function(n.objectives, k, l) { k = 2L * (n.objectives - 1L) } } - assertInt(k, lower = n.objectives - 1L) - assertTRUE(k %% (n.objectives - 1L) == 0L) + checkmate::assertInt(k, lower = n.objectives - 1L) + checkmate::assertTRUE(k %% (n.objectives - 1L) == 0L) force(k) if (missing(l)) { l = 20L } - assertInt(l, lower = 1L) + checkmate::assertInt(l, lower = 1L) force(l) dimensions = k + l @@ -60,7 +61,7 @@ makeWFG6Function = function(n.objectives, k, l) { id = sprintf("WFG6-%id-%io", dimensions, n.objectives), description = "WFG6 function", fn = fn, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = dimensions, id = "x", lower = rep(0, dimensions), diff --git a/R/mof.WFG7.R b/R/mof.WFG7.R index d29238c2..cd7cd9fc 100644 --- a/R/mof.WFG7.R +++ b/R/mof.WFG7.R @@ -18,6 +18,7 @@ #' Number of distance-related parameters. These will automatically be #' the last \code{l} elements from the input vector. #' @return [\code{smoof_multi_objective_function}] +#' Returns an instance of the WFG7 function as a \code{smoof_multi_objective_function} object. #' @details #' Huband et al. recommend a value of \code{k = 4L} position-related #' parameters for bi-objective problems and \code{k = 2L * (n.objectives - 1L)} @@ -28,7 +29,7 @@ #' #' @export makeWFG7Function = function(n.objectives, k, l) { - assertInt(n.objectives, lower = 2L) + checkmate::assertInt(n.objectives, lower = 2L) force(n.objectives) if (missing(k)) { @@ -38,14 +39,14 @@ makeWFG7Function = function(n.objectives, k, l) { k = 2L * (n.objectives - 1L) } } - assertInt(k, lower = n.objectives - 1L) - assertTRUE(k %% (n.objectives - 1L) == 0L) + checkmate::assertInt(k, lower = n.objectives - 1L) + checkmate::assertTRUE(k %% (n.objectives - 1L) == 0L) force(k) if (missing(l)) { l = 20L } - assertInt(l, lower = 1L) + checkmate::assertInt(l, lower = 1L) force(l) dimensions = k + l @@ -60,7 +61,7 @@ makeWFG7Function = function(n.objectives, k, l) { id = sprintf("WFG7-%id-%io", dimensions, n.objectives), description = "WFG7 function", fn = fn, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = dimensions, id = "x", lower = rep(0, dimensions), diff --git a/R/mof.WFG8.R b/R/mof.WFG8.R index c1fe509f..f2bc306f 100644 --- a/R/mof.WFG8.R +++ b/R/mof.WFG8.R @@ -18,6 +18,7 @@ #' Number of distance-related parameters. These will automatically be #' the last \code{l} elements from the input vector. #' @return [\code{smoof_multi_objective_function}] +#' Returns an instance of the WFG8 function as a \code{smoof_multi_objective_function} object. #' @details #' Huband et al. recommend a value of \code{k = 4L} position-related #' parameters for bi-objective problems and \code{k = 2L * (n.objectives - 1L)} @@ -28,7 +29,7 @@ #' #' @export makeWFG8Function = function(n.objectives, k, l) { - assertInt(n.objectives, lower = 2L) + checkmate::assertInt(n.objectives, lower = 2L) force(n.objectives) if (missing(k)) { @@ -38,14 +39,14 @@ makeWFG8Function = function(n.objectives, k, l) { k = 2L * (n.objectives - 1L) } } - assertInt(k, lower = n.objectives - 1L) - assertTRUE(k %% (n.objectives - 1L) == 0L) + checkmate::assertInt(k, lower = n.objectives - 1L) + checkmate::assertTRUE(k %% (n.objectives - 1L) == 0L) force(k) if (missing(l)) { l = 20L } - assertInt(l, lower = 1L) + checkmate::assertInt(l, lower = 1L) force(l) dimensions = k + l @@ -60,7 +61,7 @@ makeWFG8Function = function(n.objectives, k, l) { id = sprintf("WFG8-%id-%io", dimensions, n.objectives), description = "WFG8 function", fn = fn, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = dimensions, id = "x", lower = rep(0, dimensions), diff --git a/R/mof.WFG9.R b/R/mof.WFG9.R index 3586aa2b..943dd1d3 100644 --- a/R/mof.WFG9.R +++ b/R/mof.WFG9.R @@ -18,6 +18,7 @@ #' Number of distance-related parameters. These will automatically be #' the last \code{l} elements from the input vector. #' @return [\code{smoof_multi_objective_function}] +#' Returns an instance of the WFG9 function as a \code{smoof_multi_objective_function} object. #' @details #' Huband et al. recommend a value of \code{k = 4L} position-related #' parameters for bi-objective problems and \code{k = 2L * (n.objectives - 1L)} @@ -28,7 +29,7 @@ #' #' @export makeWFG9Function = function(n.objectives, k, l) { - assertInt(n.objectives, lower = 2L) + checkmate::assertInt(n.objectives, lower = 2L) force(n.objectives) if (missing(k)) { @@ -38,14 +39,14 @@ makeWFG9Function = function(n.objectives, k, l) { k = 2L * (n.objectives - 1L) } } - assertInt(k, lower = n.objectives - 1L) - assertTRUE(k %% (n.objectives - 1L) == 0L) + checkmate::assertInt(k, lower = n.objectives - 1L) + checkmate::assertTRUE(k %% (n.objectives - 1L) == 0L) force(k) if (missing(l)) { l = 20L } - assertInt(l, lower = 1L) + checkmate::assertInt(l, lower = 1L) force(l) dimensions = k + l @@ -60,7 +61,7 @@ makeWFG9Function = function(n.objectives, k, l) { id = sprintf("WFG9-%id-%io", dimensions, n.objectives), description = "WFG9 function", fn = fn, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = dimensions, id = "x", lower = rep(0, dimensions), diff --git a/R/mof.dent.R b/R/mof.dent.R index a8006c80..48a6085f 100644 --- a/R/mof.dent.R +++ b/R/mof.dent.R @@ -1,5 +1,5 @@ #' @title -#' Dent Function +#' Dent Function Generator #' #' @description #' Builds and returns the bi-objective Dent test problem, which is defined as @@ -12,6 +12,7 @@ #' where \eqn{d = \lambda * \exp(-(x_1 - x_2)^2)} and \eqn{\mathbf{x}_i \in [-1.5, 1.5], i = 1, 2}. #' #' @return [\code{smoof_multi_objective_function}] +#' Returns an instance of the Dent function as a \code{smoof_multi_objective_function} object. #' @export makeDentFunction = function() { @@ -33,7 +34,7 @@ makeDentFunction = function() { id = paste0("dent_2d_2o"), description = "Dent Function", fn = fn, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 2L, id = "x", lower = c(-1.5, -1.5), diff --git a/R/mof.dtlz1.R b/R/mof.dtlz1.R index 42833869..a402d60e 100644 --- a/R/mof.dtlz1.R +++ b/R/mof.dtlz1.R @@ -34,10 +34,11 @@ #' @param n.objectives [\code{integer(1)}]\cr #' Number of objectives. #' @return [\code{smoof_multi_objective_function}] +#' Returns an instance of the DTLZ1 family as a \code{smoof_multi_objective_function} object. #' @export makeDTLZ1Function = function(dimensions, n.objectives) { - assertInt(n.objectives, lower = 2L) - assertInt(dimensions, lower = n.objectives) + checkmate::assertInt(n.objectives, lower = 2L) + checkmate::assertInt(dimensions, lower = n.objectives) # Renaming vars here to stick to the notation in the paper # number of decision variables in the last group (see x_m in the paper) @@ -75,7 +76,7 @@ makeDTLZ1Function = function(dimensions, n.objectives) { id = paste0("dtlz1_", dimensions, "d_", n.objectives, "o"), description = "Deb et al.", fn = fn, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = dimensions, id = "x", #FIXME: any box constraints? diff --git a/R/mof.dtlz2.R b/R/mof.dtlz2.R index 40420e50..a92968f2 100644 --- a/R/mof.dtlz2.R +++ b/R/mof.dtlz2.R @@ -39,10 +39,11 @@ #' @param n.objectives [\code{integer(1)}]\cr #' Number of objectives. #' @return [\code{smoof_multi_objective_function}] +#' Returns an instance of the DTLZ2 family as a \code{smoof_multi_objective_function} object. #' @export makeDTLZ2Function = function(dimensions, n.objectives) { - assertInt(n.objectives, lower = 2L) - assertInt(dimensions, lower = n.objectives) + checkmate::assertInt(n.objectives, lower = 2L) + checkmate::assertInt(dimensions, lower = n.objectives) # Renaming n.objectives here to stick to the notation in the paper M = n.objectives @@ -77,7 +78,7 @@ makeDTLZ2Function = function(dimensions, n.objectives) { id = paste0("dtlz2_", dimensions, "d_", n.objectives, "o"), description = "Deb et al.", fn = fn, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = dimensions, id = "x", lower = rep(0, dimensions), diff --git a/R/mof.dtlz3.R b/R/mof.dtlz3.R index 4b5d019c..a5bc730e 100644 --- a/R/mof.dtlz3.R +++ b/R/mof.dtlz3.R @@ -41,10 +41,11 @@ #' @param n.objectives [\code{integer(1)}]\cr #' Number of objectives. #' @return [\code{smoof_multi_objective_function}] +#' Returns an instance of the DTLZ3 family as a \code{smoof_multi_objective_function} object. #' @export makeDTLZ3Function = function(dimensions, n.objectives) { - assertInt(n.objectives, lower = 2L) - assertInt(dimensions, lower = n.objectives) + checkmate::assertInt(n.objectives, lower = 2L) + checkmate::assertInt(dimensions, lower = n.objectives) # Renaming vars here to stick to the notation in the paper # number of decision variables in the last group (see x_m in the paper) @@ -83,7 +84,7 @@ makeDTLZ3Function = function(dimensions, n.objectives) { id = paste0("dtlz3_", dimensions, "d_", n.objectives, "o"), description = "Deb et al.", fn = fn, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = dimensions, id = "x", lower = rep(0, dimensions), diff --git a/R/mof.dtlz4.R b/R/mof.dtlz4.R index edff1789..795f515e 100644 --- a/R/mof.dtlz4.R +++ b/R/mof.dtlz4.R @@ -41,11 +41,12 @@ #' @param alpha [\code{numeric(1)}]\cr #' Optional parameter. Default is 100, which is recommended by Deb et al. #' @return [\code{smoof_multi_objective_function}] +#' Returns an instance of the DTLZ4 family as a \code{smoof_multi_objective_function} object. #' @export makeDTLZ4Function = function(dimensions, n.objectives, alpha = 100) { - assertInt(n.objectives, lower = 2L) - assertInt(dimensions, lower = n.objectives) - assertNumber(alpha) + checkmate::assertInt(n.objectives, lower = 2L) + checkmate::assertInt(dimensions, lower = n.objectives) + checkmate::assertNumber(alpha) # Renaming n.objectives here to stick to the notation in the paper M = n.objectives @@ -81,7 +82,7 @@ makeDTLZ4Function = function(dimensions, n.objectives, alpha = 100) { id = paste0("dtlz4_", dimensions, "d_", n.objectives, "o"), description = "Deb et al.", fn = fn, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = dimensions, id = "x", lower = rep(0, dimensions), diff --git a/R/mof.dtlz5.R b/R/mof.dtlz5.R index d4144809..9098af60 100644 --- a/R/mof.dtlz5.R +++ b/R/mof.dtlz5.R @@ -5,7 +5,7 @@ #' Builds and returns the multi-objective DTLZ5 test problem. This problem #' can be characterized by a disconnected Pareto-optimal front in the search #' space. This introduces a new challenge to evolutionary multi-objective -#' optimizers, i.e., to maintain different subpopulations within the search +#' optimizers, i.e., to maintain different sub-populations within the search #' space to cover the entire Pareto-optimal front. #' #' The DTLZ5 test problem is defined as follows: @@ -50,10 +50,11 @@ #' @param n.objectives [\code{integer(1)}]\cr #' Number of objectives. #' @return [\code{smoof_multi_objective_function}] +#' Returns an instance of the DTLZ5 family as a \code{smoof_multi_objective_function} object. #' @export makeDTLZ5Function = function(dimensions, n.objectives) { - assertInt(n.objectives, lower = 2L) - assertInt(dimensions, lower = n.objectives) + checkmate::assertInt(n.objectives, lower = 2L) + checkmate::assertInt(dimensions, lower = n.objectives) # Renaming n.objectives here to stick to the notation in the paper M = n.objectives @@ -92,7 +93,7 @@ makeDTLZ5Function = function(dimensions, n.objectives) { id = paste0("dtlz5_", dimensions, "d_", n.objectives, "o"), description = "Deb et al.", fn = fn, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = dimensions, id = "x", lower = rep(0, dimensions), diff --git a/R/mof.dtlz6.R b/R/mof.dtlz6.R index 71016df6..ee5f951d 100644 --- a/R/mof.dtlz6.R +++ b/R/mof.dtlz6.R @@ -50,10 +50,11 @@ #' @param n.objectives [\code{integer(1)}]\cr #' Number of objectives. #' @return [\code{smoof_multi_objective_function}] +#' Returns an instance of the DTLZ6 family as a \code{smoof_multi_objective_function} object. #' @export makeDTLZ6Function = function(dimensions, n.objectives) { - assertInt(n.objectives, lower = 2L) - assertInt(dimensions, lower = n.objectives) + checkmate::assertInt(n.objectives, lower = 2L) + checkmate::assertInt(dimensions, lower = n.objectives) # Renaming n.objectives here to stick to the notation in the paper M = n.objectives @@ -92,7 +93,7 @@ makeDTLZ6Function = function(dimensions, n.objectives) { id = paste0("dtlz6_", dimensions, "d_", n.objectives, "o"), description = "Deb et al.", fn = fn, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = dimensions, id = "x", lower = rep(0, dimensions), diff --git a/R/mof.dtlz7.R b/R/mof.dtlz7.R index 0e7670b8..d6e151aa 100644 --- a/R/mof.dtlz7.R +++ b/R/mof.dtlz7.R @@ -5,7 +5,7 @@ #' Builds and returns the multi-objective DTLZ7 test problem. This problem #' can be characterized by a disconnected Pareto-optimal front in the search #' space. This introduces a new challenge to evolutionary multi-objective -#' optimizers, i.e., to maintain different subpopulations within the search +#' optimizers, i.e., to maintain different sub-populations within the search #' space to cover the entire Pareto-optimal front. #' #' The DTLZ7 test problem is defined as follows: @@ -46,10 +46,11 @@ #' @param n.objectives [\code{integer(1)}]\cr #' Number of objectives. #' @return [\code{smoof_multi_objective_function}] +#' Returns an instance of the DTLZ7 family as a \code{smoof_multi_objective_function} object. #' @export makeDTLZ7Function = function(dimensions, n.objectives) { - assertInt(n.objectives, lower = 2L) - assertInt(dimensions, lower = n.objectives) + checkmate::assertInt(n.objectives, lower = 2L) + checkmate::assertInt(dimensions, lower = n.objectives) # Renaming n.objectives here to stick to the notation in the paper M = n.objectives @@ -80,7 +81,7 @@ makeDTLZ7Function = function(dimensions, n.objectives) { id = paste0("dtlz7_", dimensions, "d_", n.objectives, "o"), description = "Deb et al.", fn = fn, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = dimensions, id = "x", lower = rep(0, dimensions), diff --git a/R/mof.gomop.R b/R/mof.gomop.R index a919d8ec..8bf513ed 100644 --- a/R/mof.gomop.R +++ b/R/mof.gomop.R @@ -20,10 +20,11 @@ #' @param funs [\code{list}]\cr #' List of single-objective smoof functions. #' @return [\code{smoof_multi_objective_function}] +#' Returns an instance of the GOMOP function as a \code{smoof_multi_objective_function} object. #' @export makeGOMOPFunction = function(dimensions = 2L, funs = list()) { - dimensions = asCount(dimensions) - assertList(funs, types = "smoof_single_objective_function", min.len = 2L, any.missing = FALSE, all.missing = FALSE) + dimensions = checkmate::asCount(dimensions) + checkmate::assertList(funs, types = "smoof_single_objective_function", min.len = 2L, any.missing = FALSE, all.missing = FALSE) n.objectives = length(funs) funs.dimensions = sapply(funs, getNumberOfParameters) @@ -31,8 +32,8 @@ makeGOMOPFunction = function(dimensions = 2L, funs = list()) { # check compatibility fail = which(funs.dimensions != dimensions) if (length(fail) > 0L) { - stopf("GOMOP: All passed single-objective functions need to have dimension %i, but %i functions (%s) do not.", - dimensions, length(fail), collapse(fail, sep = ", ")) + BBmisc::stopf("GOMOP: All passed single-objective functions need to have dimension %i, but %i functions (%s) do not.", + dimensions, length(fail), BBmisc::collapse(fail, sep = ", ")) } fn = function(x) { @@ -48,11 +49,11 @@ makeGOMOPFunction = function(dimensions = 2L, funs = list()) { } makeMultiObjectiveFunction( - name = sprintf("GOMOP function (%s)", collapse(sapply(funs, getName), sep = ", ")), - id = collapse(sapply(funs, getID), sep = "_"), + name = sprintf("GOMOP function (%s)", BBmisc::collapse(sapply(funs, getName), sep = ", ")), + id = BBmisc::collapse(sapply(funs, getID), sep = "_"), description = "GOMOP function", fn = fn, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = dimensions, id = "x", lower = rep(0, dimensions), diff --git a/R/mof.kursawe.R b/R/mof.kursawe.R index a8d0d938..ef5e0e22 100644 --- a/R/mof.kursawe.R +++ b/R/mof.kursawe.R @@ -21,9 +21,10 @@ #' @param dimensions [\code{integer(1)}]\cr #' Number of decision variables. #' @return [\code{smoof_multi_objective_function}] +#' Returns an instance of the Kursawe function as a \code{smoof_multi_objective_function} object. #' @export makeKursaweFunction = function(dimensions) { - assertInt(dimensions, lower = 2L) + checkmate::assertInt(dimensions, lower = 2L) # C++ implementation fn = function(x) { @@ -36,7 +37,7 @@ makeKursaweFunction = function(dimensions) { id = paste0("kursawe_", dimensions, "d_2o"), description = "Kursawe", fn = fn, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = dimensions, id = "x", lower = rep(-5, dimensions), diff --git a/R/mof.mmf1.R b/R/mof.mmf1.R index 0105844a..ddf97268 100644 --- a/R/mof.mmf1.R +++ b/R/mof.mmf1.R @@ -2,7 +2,7 @@ #' MMF1 Function #' #' @description -#' Test problem from the set of "multimodal multiobjective functions" as for +#' Test problem from the set of "multi-modal multi-objective functions" as for #' instance used in the CEC2019 competition. #' #' @references @@ -10,6 +10,7 @@ #' scalable test problem suite for multimodal multiobjective optimization," in #' Swarm and Evolutionary Computation, Volume 48, August 2019, pp. 62–71, Elsevier. #' @return [\code{smoof_multi_objective_function}] +#' Returns an instance of the MMF1 function as a \code{smoof_multi_objective_function} object. #' @export makeMMF1Function = function() { @@ -25,7 +26,7 @@ makeMMF1Function = function() { id = sprintf("MMF1-%id-%io", 2L, n.objectives), description = "MMF1 function", fn = fn, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 2L, id = "x", lower = c(1, -1), diff --git a/R/mof.mmf10.R b/R/mof.mmf10.R index 978d37ad..77f11d1e 100644 --- a/R/mof.mmf10.R +++ b/R/mof.mmf10.R @@ -2,14 +2,15 @@ #' MMF10 Function #' #' @description -#' Test problem from the set of "multimodal multiobjective functions" as for +#' Test problem from the set of "multi-modal multi-objective functions" as for #' instance used in the CEC2019 competition. #' #' @references #' Caitong Yue, Boyang Qu, Kunjie Yu, Jing Liang, and Xiaodong Li, "A novel -#' scalable test problem suite for multimodal multiobjective optimization," in +#' scalable test problem suite for multi-modal multi-objective optimization," in #' Swarm and Evolutionary Computation, Volume 48, August 2019, pp. 62–71, Elsevier. #' @return [\code{smoof_multi_objective_function}] +#' Returns an instance of the MMF10 function as a \code{smoof_multi_objective_function} object. #' #' @export makeMMF10Function = function() { @@ -25,7 +26,7 @@ makeMMF10Function = function() { id = sprintf("MMF10-%id-%io", 2L, n.objectives), description = "MMF10 function", fn = fn, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 2L, id = "x", lower = rep(0.1, 2L), diff --git a/R/mof.mmf11.R b/R/mof.mmf11.R index 6b8a7a56..2792686b 100644 --- a/R/mof.mmf11.R +++ b/R/mof.mmf11.R @@ -2,22 +2,23 @@ #' MMF11 Function #' #' @description -#' Test problem from the set of "multimodal multiobjective functions" as for +#' Test problem from the set of "multi-modal multi-objective functions" as for #' instance used in the CEC2019 competition. -#' +#' #' @param np [\code{integer}(1)]\cr #' Number of global Pareto sets. In the CEC2019 competition, the organizers used #' \code{np = 2L}. #' #' @references #' Caitong Yue, Boyang Qu, Kunjie Yu, Jing Liang, and Xiaodong Li, "A novel -#' scalable test problem suite for multimodal multiobjective optimization," in +#' scalable test problem suite for multi-modal multi-objective optimization," in #' Swarm and Evolutionary Computation, Volume 48, August 2019, pp. 62–71, Elsevier. #' @return [\code{smoof_multi_objective_function}] +#' Returns an instance of the MMF11 function as a \code{smoof_multi_objective_function} object. #' #' @export makeMMF11Function = function(np = 2L) { - assertInt(x = np, lower = 1L) + checkmate::assertInt(x = np, lower = 1L) force(np) # C implementation @@ -32,7 +33,7 @@ makeMMF11Function = function(np = 2L) { id = sprintf("MMF11-%id-%io", 2L, n.objectives), description = "MMF11 function", fn = fn, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 2L, id = "x", lower = rep(0.1, 2L), diff --git a/R/mof.mmf12.R b/R/mof.mmf12.R index 070795b2..ae425f03 100644 --- a/R/mof.mmf12.R +++ b/R/mof.mmf12.R @@ -2,7 +2,7 @@ #' MMF12 Function #' #' @description -#' Test problem from the set of "multimodal multiobjective functions" as for +#' Test problem from the set of "multi-modal multi-objective functions" as for #' instance used in the CEC2019 competition. #' #' @param np [\code{integer}(1)]\cr @@ -14,14 +14,15 @@ #' #' @references #' Caitong Yue, Boyang Qu, Kunjie Yu, Jing Liang, and Xiaodong Li, "A novel -#' scalable test problem suite for multimodal multiobjective optimization," in +#' scalable test problem suite for multi-modal multi-objective optimization," in #' Swarm and Evolutionary Computation, Volume 48, August 2019, pp. 62–71, Elsevier. #' @return [\code{smoof_multi_objective_function}] +#' Returns an instance of the MMF12 function as a \code{smoof_multi_objective_function} object. #' #' @export makeMMF12Function = function(np = 2L, q = 4L) { - assertInt(x = np, lower = 1L) - assertInt(x = q, lower = 1L) + checkmate::assertInt(x = np, lower = 1L) + checkmate::assertInt(x = q, lower = 1L) force(np) force(q) @@ -37,7 +38,7 @@ makeMMF12Function = function(np = 2L, q = 4L) { id = sprintf("MMF12-%id-%io", 2L, n.objectives), description = "MMF12 function", fn = fn, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 2L, id = "x", lower = rep(0, 2L), diff --git a/R/mof.mmf13.R b/R/mof.mmf13.R index a2afd360..9fee4a7f 100644 --- a/R/mof.mmf13.R +++ b/R/mof.mmf13.R @@ -2,7 +2,7 @@ #' MMF13 Function #' #' @description -#' Test problem from the set of "multimodal multiobjective functions" as for +#' Test problem from the set of "multi-modal multi-objective functions" as for #' instance used in the CEC2019 competition. #' #' @param np [\code{integer}(1)]\cr @@ -11,13 +11,14 @@ #' #' @references #' Caitong Yue, Boyang Qu, Kunjie Yu, Jing Liang, and Xiaodong Li, "A novel -#' scalable test problem suite for multimodal multiobjective optimization," in +#' scalable test problem suite for multi-modal multi-objective optimization," in #' Swarm and Evolutionary Computation, Volume 48, August 2019, pp. 62–71, Elsevier. #' @return [\code{smoof_multi_objective_function}] +#' Returns an instance of the MMF13 function as a \code{smoof_multi_objective_function} object. #' #' @export makeMMF13Function = function(np = 2L) { - assertInt(x = np, lower = 1L) + checkmate::assertInt(x = np, lower = 1L) force(np) # C implementation @@ -32,7 +33,7 @@ makeMMF13Function = function(np = 2L) { id = sprintf("MMF13-%id-%io", 3L, n.objectives), description = "MMF13 function", fn = fn, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 3L, id = "x", lower = rep(0.1, 3L), diff --git a/R/mof.mmf14.R b/R/mof.mmf14.R index 8999b43f..7482b8a9 100644 --- a/R/mof.mmf14.R +++ b/R/mof.mmf14.R @@ -2,7 +2,7 @@ #' MMF14 Function #' #' @description -#' Test problem from the set of "multimodal multiobjective functions" as for +#' Test problem from the set of "multi-modal multi-objective functions" as for #' instance used in the CEC2019 competition. #' #' @param dimensions [\code{integer(1)}]\cr @@ -15,15 +15,16 @@ #' #' @references #' Caitong Yue, Boyang Qu, Kunjie Yu, Jing Liang, and Xiaodong Li, "A novel -#' scalable test problem suite for multimodal multiobjective optimization," in +#' scalable test problem suite for multi-modal multi-objective optimization," in #' Swarm and Evolutionary Computation, Volume 48, August 2019, pp. 62–71, Elsevier. #' @return [\code{smoof_multi_objective_function}] +#' Returns an instance of the MMF14 function as a \code{smoof_multi_objective_function} object. #' #' @export makeMMF14Function = function(dimensions, n.objectives, np = 2L) { - assertInt(n.objectives, lower = 2L) - assertInt(dimensions, lower = n.objectives) - assertInt(x = np, lower = 1L) + checkmate::assertInt(n.objectives, lower = 2L) + checkmate::assertInt(dimensions, lower = n.objectives) + checkmate::assertInt(x = np, lower = 1L) force(np) # Renaming var here to stick to the notation in the paper @@ -41,7 +42,7 @@ makeMMF14Function = function(dimensions, n.objectives, np = 2L) { id = sprintf("MMF14-%id-%io", dimensions, n.objectives), description = "MMF14 function", fn = fn, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = dimensions, id = "x", lower = rep(0, dimensions), diff --git a/R/mof.mmf14a.R b/R/mof.mmf14a.R index 22e8374b..e5fd0380 100644 --- a/R/mof.mmf14a.R +++ b/R/mof.mmf14a.R @@ -2,7 +2,7 @@ #' MMF14a Function #' #' @description -#' Test problem from the set of "multimodal multiobjective functions" as for +#' Test problem from the set of "multi-modal multi-objective functions" as for #' instance used in the CEC2019 competition. #' #' @param dimensions [\code{integer(1)}]\cr @@ -15,15 +15,16 @@ #' #' @references #' Caitong Yue, Boyang Qu, Kunjie Yu, Jing Liang, and Xiaodong Li, "A novel -#' scalable test problem suite for multimodal multiobjective optimization," in +#' scalable test problem suite for multi-modal multi-objective optimization," in #' Swarm and Evolutionary Computation, Volume 48, August 2019, pp. 62–71, Elsevier. #' @return [\code{smoof_multi_objective_function}] +#' Returns an instance of the MMF14a function as a \code{smoof_multi_objective_function} object. #' #' @export makeMMF14aFunction = function(dimensions, n.objectives, np = 2L) { - assertInt(n.objectives, lower = 2L) - assertInt(dimensions, lower = n.objectives) - assertInt(x = np, lower = 1L) + checkmate::assertInt(n.objectives, lower = 2L) + checkmate::assertInt(dimensions, lower = n.objectives) + checkmate::assertInt(x = np, lower = 1L) force(np) # Renaming var here to stick to the notation in the paper @@ -41,7 +42,7 @@ makeMMF14aFunction = function(dimensions, n.objectives, np = 2L) { id = sprintf("MMF14a-%id-%io", dimensions, n.objectives), description = "MMF14a function", fn = fn, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = dimensions, id = "x", lower = rep(0, dimensions), diff --git a/R/mof.mmf15.R b/R/mof.mmf15.R index 70e65a5d..6aa6952c 100644 --- a/R/mof.mmf15.R +++ b/R/mof.mmf15.R @@ -2,7 +2,7 @@ #' MMF15 Function #' #' @description -#' Test problem from the set of "multimodal multiobjective functions" as for +#' Test problem from the set of "multi-modal multi-objective functions" as for #' instance used in the CEC2019 competition. #' #' @param dimensions [\code{integer(1)}]\cr @@ -15,15 +15,16 @@ #' #' @references #' Caitong Yue, Boyang Qu, Kunjie Yu, Jing Liang, and Xiaodong Li, "A novel -#' scalable test problem suite for multimodal multiobjective optimization," in +#' scalable test problem suite for multi-modal multi-objective optimization," in #' Swarm and Evolutionary Computation, Volume 48, August 2019, pp. 62–71, Elsevier. #' @return [\code{smoof_multi_objective_function}] +#' Returns an instance of the MMF15 function as a \code{smoof_multi_objective_function} object. #' #' @export makeMMF15Function = function(dimensions, n.objectives, np = 2L) { - assertInt(n.objectives, lower = 2L) - assertInt(dimensions, lower = n.objectives) - assertInt(x = np, lower = 1L) + checkmate::assertInt(n.objectives, lower = 2L) + checkmate::assertInt(dimensions, lower = n.objectives) + checkmate::assertInt(x = np, lower = 1L) force(np) # Renaming var here to stick to the notation in the paper @@ -41,7 +42,7 @@ makeMMF15Function = function(dimensions, n.objectives, np = 2L) { id = sprintf("MMF15-%id-%io", dimensions, n.objectives), description = "MMF15 function", fn = fn, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = dimensions, id = "x", lower = rep(0, dimensions), diff --git a/R/mof.mmf15a.R b/R/mof.mmf15a.R index ea4a81d8..c97e253e 100644 --- a/R/mof.mmf15a.R +++ b/R/mof.mmf15a.R @@ -2,7 +2,7 @@ #' MMF15a Function #' #' @description -#' Test problem from the set of "multimodal multiobjective functions" as for +#' Test problem from the set of "multi-modal multi-objective functions" as for #' instance used in the CEC2019 competition. #' #' @param dimensions [\code{integer(1)}]\cr @@ -15,15 +15,16 @@ #' #' @references #' Caitong Yue, Boyang Qu, Kunjie Yu, Jing Liang, and Xiaodong Li, "A novel -#' scalable test problem suite for multimodal multiobjective optimization," in +#' scalable test problem suite for multi-modal multi-objective optimization," in #' Swarm and Evolutionary Computation, Volume 48, August 2019, pp. 62–71, Elsevier. #' @return [\code{smoof_multi_objective_function}] +#' Returns an instance of the MMF15a function as a \code{smoof_multi_objective_function} object. #' #' @export makeMMF15aFunction = function(dimensions, n.objectives, np = 2L) { - assertInt(n.objectives, lower = 2L) - assertInt(dimensions, lower = n.objectives) - assertInt(x = np, lower = 1L) + checkmate::assertInt(n.objectives, lower = 2L) + checkmate::assertInt(dimensions, lower = n.objectives) + checkmate::assertInt(x = np, lower = 1L) force(np) # Renaming var here to stick to the notation in the paper @@ -41,7 +42,7 @@ makeMMF15aFunction = function(dimensions, n.objectives, np = 2L) { id = sprintf("MMF15a-%id-%io", dimensions, n.objectives), description = "MMF15a function", fn = fn, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = dimensions, id = "x", lower = rep(0, dimensions), diff --git a/R/mof.mmf1e.R b/R/mof.mmf1e.R index 857a1fcd..d3e91213 100644 --- a/R/mof.mmf1e.R +++ b/R/mof.mmf1e.R @@ -2,7 +2,7 @@ #' MMF1e Function #' #' @description -#' Test problem from the set of "multimodal multiobjective functions" as for +#' Test problem from the set of "multi-modal multi-objective functions" as for #' instance used in the CEC2019 competition. #' #' @param a [\code{double}(1)]\cr @@ -14,10 +14,10 @@ #' scalable test problem suite for multimodal multiobjective optimization," in #' Swarm and Evolutionary Computation, Volume 48, August 2019, pp. 62–71, Elsevier. #' @return [\code{smoof_multi_objective_function}] -#' +#' Returns an instance of the MMF1e function as a \code{smoof_multi_objective_function} object. #' @export makeMMF1eFunction = function(a = exp(1L)) { - assertNumber(a, finite = TRUE) + checkmate::assertNumber(a, finite = TRUE) force(a) # C implementation @@ -32,7 +32,7 @@ makeMMF1eFunction = function(a = exp(1L)) { id = sprintf("MMF1e-%id-%io", 2L, n.objectives), description = "MMF1e function", fn = fn, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 2L, id = "x", lower = c(1, -(a^3)), diff --git a/R/mof.mmf1z.R b/R/mof.mmf1z.R index 0fa6840c..d95f0c47 100644 --- a/R/mof.mmf1z.R +++ b/R/mof.mmf1z.R @@ -2,7 +2,7 @@ #' MMF1z Function #' #' @description -#' Test problem from the set of "multimodal multiobjective functions" as for +#' Test problem from the set of "multi-modal multi-objective functions" as for #' instance used in the CEC2019 competition. #' #' @param k [\code{double}(1)]\cr @@ -11,13 +11,14 @@ #' #' @references #' Caitong Yue, Boyang Qu, Kunjie Yu, Jing Liang, and Xiaodong Li, "A novel -#' scalable test problem suite for multimodal multiobjective optimization," in +#' scalable test problem suite for multi-modal multi-objective optimization," in #' Swarm and Evolutionary Computation, Volume 48, August 2019, pp. 62–71, Elsevier. #' @return [\code{smoof_multi_objective_function}] +#' Returns an instance of the MMF1z function as a \code{smoof_multi_objective_function} object. #' #' @export makeMMF1zFunction = function(k = 3) { - assertNumber(k, finite = TRUE) + checkmate::assertNumber(k, finite = TRUE) force(k) # C implementation @@ -32,7 +33,7 @@ makeMMF1zFunction = function(k = 3) { id = sprintf("MMF1z-%id-%io", 2L, n.objectives), description = "MMF1z function", fn = fn, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 2L, id = "x", lower = c(1, -1), diff --git a/R/mof.mmf2.R b/R/mof.mmf2.R index 22f54647..f9a1d48d 100644 --- a/R/mof.mmf2.R +++ b/R/mof.mmf2.R @@ -2,14 +2,15 @@ #' MMF2 Function #' #' @description -#' Test problem from the set of "multimodal multiobjective functions" as for +#' Test problem from the set of "multi-modal multi-objective functions" as for #' instance used in the CEC2019 competition. #' #' @references #' Caitong Yue, Boyang Qu, Kunjie Yu, Jing Liang, and Xiaodong Li, "A novel -#' scalable test problem suite for multimodal multiobjective optimization," in +#' scalable test problem suite for multi-modal multi-objective optimization," in #' Swarm and Evolutionary Computation, Volume 48, August 2019, pp. 62–71, Elsevier. #' @return [\code{smoof_multi_objective_function}] +#' Returns an instance of the MMF2 function as a \code{smoof_multi_objective_function} object. #' @export makeMMF2Function = function() { # C implementation @@ -24,7 +25,7 @@ makeMMF2Function = function() { id = sprintf("MMF2-%id-%io", 2L, n.objectives), description = "MMF2 function", fn = fn, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 2L, id = "x", lower = rep(0, 2), diff --git a/R/mof.mmf3.R b/R/mof.mmf3.R index de7088af..76b1b461 100644 --- a/R/mof.mmf3.R +++ b/R/mof.mmf3.R @@ -2,14 +2,15 @@ #' MMF3 Function #' #' @description -#' Test problem from the set of "multimodal multiobjective functions" as for +#' Test problem from the set of "multi-modal multi-objective functions" as for #' instance used in the CEC2019 competition. #' #' @references #' Caitong Yue, Boyang Qu, Kunjie Yu, Jing Liang, and Xiaodong Li, "A novel -#' scalable test problem suite for multimodal multiobjective optimization," in +#' scalable test problem suite for multi-modal multi-objective optimization," in #' Swarm and Evolutionary Computation, Volume 48, August 2019, pp. 62–71, Elsevier. #' @return [\code{smoof_multi_objective_function}] +#' Returns an instance of the MMF3 function as a \code{smoof_multi_objective_function} object. #' @export makeMMF3Function = function() { # C implementation @@ -24,7 +25,7 @@ makeMMF3Function = function() { id = sprintf("MMF3-%id-%io", 2L, n.objectives), description = "MMF3 function", fn = fn, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 2L, id = "x", lower = rep(0, 2), diff --git a/R/mof.mmf4.R b/R/mof.mmf4.R index 57776a07..50efe65b 100644 --- a/R/mof.mmf4.R +++ b/R/mof.mmf4.R @@ -2,14 +2,15 @@ #' MMF4 Function #' #' @description -#' Test problem from the set of "multimodal multiobjective functions" as for +#' Test problem from the set of "multi-modal multi-objective functions" as for #' instance used in the CEC2019 competition. #' #' @references #' Caitong Yue, Boyang Qu, Kunjie Yu, Jing Liang, and Xiaodong Li, "A novel -#' scalable test problem suite for multimodal multiobjective optimization," in +#' scalable test problem suite for multi-modal multi-objective optimization," in #' Swarm and Evolutionary Computation, Volume 48, August 2019, pp. 62–71, Elsevier. #' @return [\code{smoof_multi_objective_function}] +#' Returns an instance of the MMF4 function as a \code{smoof_multi_objective_function} object. #' @export makeMMF4Function = function() { # C implementation @@ -24,7 +25,7 @@ makeMMF4Function = function() { id = sprintf("MMF4-%id-%io", 2L, n.objectives), description = "MMF4 function", fn = fn, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 2L, id = "x", lower = c(-1, 0), diff --git a/R/mof.mmf5.R b/R/mof.mmf5.R index f1cd04b3..8ae0d1dd 100644 --- a/R/mof.mmf5.R +++ b/R/mof.mmf5.R @@ -1,15 +1,15 @@ -#' @title #' MMF5 Function #' #' @description -#' Test problem from the set of "multimodal multiobjective functions" as for +#' Test problem from the set of "multi-modal multi-objective functions" as for #' instance used in the CEC2019 competition. #' #' @references #' Caitong Yue, Boyang Qu, Kunjie Yu, Jing Liang, and Xiaodong Li, "A novel -#' scalable test problem suite for multimodal multiobjective optimization," in +#' scalable test problem suite for multi-modal multi-objective optimization," in #' Swarm and Evolutionary Computation, Volume 48, August 2019, pp. 62–71, Elsevier. #' @return [\code{smoof_multi_objective_function}] +#' Returns an instance of the MMF5 function as a \code{smoof_multi_objective_function} object. #' @export makeMMF5Function = function() { # C implementation @@ -24,7 +24,7 @@ makeMMF5Function = function() { id = sprintf("MMF5-%id-%io", 2L, n.objectives), description = "MMF5 function", fn = fn, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 2L, id = "x", lower = c(1, -1), diff --git a/R/mof.mmf6.R b/R/mof.mmf6.R index 1b77ed13..48e2a853 100644 --- a/R/mof.mmf6.R +++ b/R/mof.mmf6.R @@ -2,14 +2,15 @@ #' MMF6 Function #' #' @description -#' Test problem from the set of "multimodal multiobjective functions" as for +#' Test problem from the set of "multi-modal multi-objective functions" as for #' instance used in the CEC2019 competition. #' #' @references #' Caitong Yue, Boyang Qu, Kunjie Yu, Jing Liang, and Xiaodong Li, "A novel -#' scalable test problem suite for multimodal multiobjective optimization," in +#' scalable test problem suite for multi-modal multi-objective optimization," in #' Swarm and Evolutionary Computation, Volume 48, August 2019, pp. 62–71, Elsevier. #' @return [\code{smoof_multi_objective_function}] +#' Returns an instance of the MMF6 function as a \code{smoof_multi_objective_function} object. #' @export makeMMF6Function = function() { # C implementation @@ -24,7 +25,7 @@ makeMMF6Function = function() { id = sprintf("MMF6-%id-%io", 2L, n.objectives), description = "MMF6 function", fn = fn, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 2L, id = "x", lower = c(1, -1), diff --git a/R/mof.mmf7.R b/R/mof.mmf7.R index d9ea1b76..072b3668 100644 --- a/R/mof.mmf7.R +++ b/R/mof.mmf7.R @@ -2,14 +2,15 @@ #' MMF7 Function #' #' @description -#' Test problem from the set of "multimodal multiobjective functions" as for +#' Test problem from the set of "multi-modal multi-objective functions" as for #' instance used in the CEC2019 competition. #' #' @references #' Caitong Yue, Boyang Qu, Kunjie Yu, Jing Liang, and Xiaodong Li, "A novel -#' scalable test problem suite for multimodal multiobjective optimization," in +#' scalable test problem suite for multi-modal multi-objective optimization," in #' Swarm and Evolutionary Computation, Volume 48, August 2019, pp. 62–71, Elsevier. #' @return [\code{smoof_multi_objective_function}] +#' Returns an instance of the MMF7 function as a \code{smoof_multi_objective_function} object. #' @export makeMMF7Function = function() { # C implementation @@ -24,7 +25,7 @@ makeMMF7Function = function() { id = sprintf("MMF7-%id-%io", 2L, n.objectives), description = "MMF7 function", fn = fn, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 2L, id = "x", lower = c(1, -1), diff --git a/R/mof.mmf8.R b/R/mof.mmf8.R index 6a6510e2..b1249386 100644 --- a/R/mof.mmf8.R +++ b/R/mof.mmf8.R @@ -2,14 +2,15 @@ #' MMF8 Function #' #' @description -#' Test problem from the set of "multimodal multiobjective functions" as for +#' Test problem from the set of "multi-modal multi-objective functions" as for #' instance used in the CEC2019 competition. #' #' @references #' Caitong Yue, Boyang Qu, Kunjie Yu, Jing Liang, and Xiaodong Li, "A novel -#' scalable test problem suite for multimodal multiobjective optimization," in +#' scalable test problem suite for multi-modal multi-objective optimization," in #' Swarm and Evolutionary Computation, Volume 48, August 2019, pp. 62–71, Elsevier. #' @return [\code{smoof_multi_objective_function}] +#' Returns an instance of the MMF8 function as a \code{smoof_multi_objective_function} object. #' @export makeMMF8Function = function() { # C implementation @@ -24,7 +25,7 @@ makeMMF8Function = function() { id = sprintf("MMF8-%id-%io", 2L, n.objectives), description = "MMF8 function", fn = fn, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 2L, id = "x", lower = c(-pi, 0), diff --git a/R/mof.mmf9.R b/R/mof.mmf9.R index b328d59e..20fd15a0 100644 --- a/R/mof.mmf9.R +++ b/R/mof.mmf9.R @@ -2,7 +2,7 @@ #' MMF9 Function #' #' @description -#' Test problem from the set of "multimodal multiobjective functions" as for +#' Test problem from the set of "multi-modal multi-objective functions" as for #' instance used in the CEC2019 competition. #' #' @param np [\code{integer}(1)]\cr @@ -11,12 +11,13 @@ #' #' @references #' Caitong Yue, Boyang Qu, Kunjie Yu, Jing Liang, and Xiaodong Li, "A novel -#' scalable test problem suite for multimodal multiobjective optimization," in +#' scalable test problem suite for multi-modal multi-objective optimization," in #' Swarm and Evolutionary Computation, Volume 48, August 2019, pp. 62–71, Elsevier. #' @return [\code{smoof_multi_objective_function}] +#' Returns an instance of the MMF9 function as a \code{smoof_multi_objective_function} object. #' @export makeMMF9Function = function(np = 2L) { - assertInt(x = np, lower = 1L) + checkmate::assertInt(x = np, lower = 1L) force(np) # C implementation @@ -31,7 +32,7 @@ makeMMF9Function = function(np = 2L) { id = sprintf("MMF9-%id-%io", 2L, n.objectives), description = "MMF9 function", fn = fn, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 2L, id = "x", lower = rep(0.1, 2), diff --git a/R/mof.omni.R b/R/mof.omni.R index bc4303e0..0cab1a66 100644 --- a/R/mof.omni.R +++ b/R/mof.omni.R @@ -11,6 +11,7 @@ #' Swarm and Evolutionary Computation, Volume 48, August 2019, pp. 62–71, Elsevier. #' #' @return [\code{smoof_multi_objective_function}] +#' Returns an instance of the Omni function as a \code{smoof_multi_objective_function} object. #' @export makeOmniTestFunction = function() { # C implementation @@ -25,7 +26,7 @@ makeOmniTestFunction = function() { id = sprintf("Omni-test-%id-%io", 2L, n.objectives), description = "Omni test function", fn = fn, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 2L, id = "x", lower = rep(0, 2L), diff --git a/R/mof.sphere.R b/R/mof.sphere.R index a6dbedff..65f53dce 100644 --- a/R/mof.sphere.R +++ b/R/mof.sphere.R @@ -11,13 +11,14 @@ #' @param a [\code{numeric(1)}]\cr #' Shift parameter for the second objective. Default is (0,...,0). #' @return [\code{smoof_multi_objective_function}] +#' Returns an instance of the sphere function as a \code{smoof_multi_objective_function} object. #' @export makeBiSphereFunction = function(dimensions, a = rep(0, dimensions)) { force(dimensions) force(a) - assertInt(dimensions, lower = 2L) - assertNumeric(a, len = dimensions, any.missing = FALSE, all.missing = FALSE) + checkmate::assertInt(dimensions, lower = 2L) + checkmate::assertNumeric(a, len = dimensions, any.missing = FALSE, all.missing = FALSE) # define the two-objective Dent function fn = function(x) { @@ -30,7 +31,7 @@ makeBiSphereFunction = function(dimensions, a = rep(0, dimensions)) { id = paste0("bisphere_", dimensions, "d_2o"), description = "Bi-objective Sphere Function", fn = fn, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = dimensions, id = "x", lower = rep(0, dimensions), diff --git a/R/mof.viennet.R b/R/mof.viennet.R index 22e09927..fc7bcc2c 100644 --- a/R/mof.viennet.R +++ b/R/mof.viennet.R @@ -12,10 +12,11 @@ #' with box constraints \eqn{-3 \leq \mathbf{x}_1, \mathbf{x}_2 \leq 3}. #' #' @references -#' Viennet, R. (1996). Multicriteria optimization using a genetic algorithm for determining the +#' Viennet, R. (1996). Multi-criteria optimization using a genetic algorithm for determining the #' Pareto set. International Journal of Systems Science 27 (2), 255-260. #' #' @return [\code{smoof_multi_objective_function}] +#' Returns an instance of the Viennet function as a \code{smoof_multi_objective_function} object. #' @export makeViennetFunction = function() { @@ -30,7 +31,7 @@ makeViennetFunction = function() { id = "viennet", description = "Viennet function", fn = fn, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 2L, id = "x", lower = rep(-3, 2L), diff --git a/R/mof.zdt1.R b/R/mof.zdt1.R index 88854021..82f5b6e0 100644 --- a/R/mof.zdt1.R +++ b/R/mof.zdt1.R @@ -11,15 +11,16 @@ #' \deqn{g(\mathbf{x}) = 1 + \frac{9}{m - 1} \sum_{i = 2}^m \mathbf{x}_i, h(f_1, g) = 1 - \sqrt{\frac{f_1}{g}}} #' and \eqn{\mathbf{x}_i \in [0,1], i = 1, \ldots, m} #' -#' @references E. Zitzler, K. Deb, and L. Thiele. Comparison of Multiobjective +#' @references E. Zitzler, K. Deb, and L. Thiele. Comparison of Multi-objective #' Evolutionary Algorithms: Empirical Results. Evolutionary Computation, 8(2):173-195, 2000 #' #' @param dimensions [\code{integer(1)}]\cr #' Number of decision variables. #' @return [\code{smoof_multi_objective_function}] +#' Returns an instance of the ZDT1 function as a \code{smoof_multi_objective_function} object. #' @export makeZDT1Function = function(dimensions) { - assertInt(dimensions, lower = 2L) + checkmate::assertInt(dimensions, lower = 2L) force(dimensions) # define the two-objective ZDT1 function @@ -38,7 +39,7 @@ makeZDT1Function = function(dimensions) { id = paste0("zdt1_", dimensions, "d_2o"), description = "Zitzler et al. function N. 1", fn = fn, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = dimensions, id = "x", lower = rep(0, dimensions), diff --git a/R/mof.zdt2.R b/R/mof.zdt2.R index 870e4ef2..bcd607e9 100644 --- a/R/mof.zdt2.R +++ b/R/mof.zdt2.R @@ -3,7 +3,7 @@ #' #' @description #' Builds and returns the two-objective ZDT2 test problem. The function is -#' nonconvex and resembles the ZDT1 function. For \eqn{m} objective it +#' non-convex and resembles the ZDT1 function. For \eqn{m} objective it #' is defined as follows #' \deqn{f(\mathbf{x}) = \left(f_1(\mathbf{x}_1), f_2(\mathbf{x})\right)} #' with @@ -12,15 +12,17 @@ #' \deqn{g(\mathbf{x}) = 1 + \frac{9}{m - 1} \sum_{i = 2}^m \mathbf{x}_i, h(f_1, g) = 1 - \left(\frac{f_1}{g}\right)^2} #' and \eqn{\mathbf{x}_i \in [0,1], i = 1, \ldots, m} #' -#' @references E. Zitzler, K. Deb, and L. Thiele. Comparison of Multiobjective +#' @references E. Zitzler, K. Deb, and L. Thiele. Comparison of Multi-objective #' Evolutionary Algorithms: Empirical Results. Evolutionary Computation, 8(2):173-195, 2000 #' #' @param dimensions [\code{integer(1)}]\cr #' Number of decision variables. #' @return [\code{smoof_multi_objective_function}] +#' Returns an instance of the ZDT2 function as a \code{smoof_multi_objective_function} object. +#' #' @export makeZDT2Function = function(dimensions) { - assertInt(dimensions, lower = 2L) + checkmate::assertInt(dimensions, lower = 2L) force(dimensions) # define the two-objective ZDT1 function @@ -39,7 +41,7 @@ makeZDT2Function = function(dimensions) { id = paste0("zdt2_", dimensions, "d_2o"), description = "Zitzler et al. function N. 2", fn = fn, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = dimensions, id = "x", lower = rep(0, dimensions), diff --git a/R/mof.zdt3.R b/R/mof.zdt3.R index 5828cf87..57ff9013 100644 --- a/R/mof.zdt3.R +++ b/R/mof.zdt3.R @@ -14,15 +14,17 @@ #' by the sine term in the \eqn{h} function (see above). The front consists of #' multiple convex parts. #' -#' @references E. Zitzler, K. Deb, and L. Thiele. Comparison of Multiobjective +#' @references E. Zitzler, K. Deb, and L. Thiele. Comparison of Multi-objective #' Evolutionary Algorithms: Empirical Results. Evolutionary Computation, 8(2):173-195, 2000 #' #' @param dimensions [\code{integer(1)}]\cr #' Number of decision variables. #' @return [\code{smoof_multi_objective_function}] +#' Returns an instance of the ZDT3 function as a \code{smoof_multi_objective_function} object. +#' #' @export makeZDT3Function = function(dimensions) { - assertInt(dimensions, lower = 2L) + checkmate::assertInt(dimensions, lower = 2L) force(dimensions) # define the two-objective ZDT1 function @@ -41,7 +43,7 @@ makeZDT3Function = function(dimensions) { id = paste0("zdt3_", dimensions, "d_2o"), description = "Zitzler et al. Function N. 3", fn = fn, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = dimensions, id = "x", lower = rep(0, dimensions), diff --git a/R/mof.zdt4.R b/R/mof.zdt4.R index 191afc57..af42a5dd 100644 --- a/R/mof.zdt4.R +++ b/R/mof.zdt4.R @@ -11,17 +11,18 @@ #' \deqn{g(\mathbf{x}) = 1 + 10 (m - 1) + \sum_{i = 2}^{m} (\mathbf{x}_i^2 - 10\cos(4\pi\mathbf{x}_i)), h(f_1, g) = 1 - \sqrt{\frac{f_1(\mathbf{x})}{g(\mathbf{x})}}} #' and \eqn{\mathbf{x}_i \in [0,1], i = 1, \ldots, m}. #' This function has many Pareto-optimal fronts and is thus suited to test the -#' algorithms ability to tackle multimodal problems. +#' algorithms ability to tackle multi-modal problems. #' -#' @references E. Zitzler, K. Deb, and L. Thiele. Comparison of Multiobjective +#' @references E. Zitzler, K. Deb, and L. Thiele. Comparison of Multi-objective #' Evolutionary Algorithms: Empirical Results. Evolutionary Computation, 8(2):173-195, 2000 #' #' @param dimensions [\code{integer(1)}]\cr #' Number of decision variables. #' @return [\code{smoof_multi_objective_function}] +#' Returns an instance of the ZDT4 function as a \code{smoof_multi_objective_function} object. #' @export makeZDT4Function = function(dimensions) { - assertInt(dimensions, lower = 2L) + checkmate::assertInt(dimensions, lower = 2L) force(dimensions) # define the two-objective ZDT1 function @@ -40,7 +41,7 @@ makeZDT4Function = function(dimensions) { id = paste0("zdt4_", dimensions, "d_2o"), description = "Zitzler et al. Function N. 4", fn = fn, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = dimensions, id = "x", lower = rep(0, dimensions), diff --git a/R/mof.zdt6.R b/R/mof.zdt6.R index aed9788d..1819cd68 100644 --- a/R/mof.zdt6.R +++ b/R/mof.zdt6.R @@ -10,19 +10,20 @@ #' where #' \deqn{g(\mathbf{x}) = 1 + 9 \left(\frac{\sum_{i = 2}^{m}\mathbf{x}_i}{m - 1}\right)^{0.25}, h(f_1, g) = 1 - \left(\frac{f_1(\mathbf{x})}{g(\mathbf{x})}\right)^2} #' and \eqn{\mathbf{x}_i \in [0,1], i = 1, \ldots, m}. -#' This function introduced two difficulities (see reference): +#' This function introduced two difficulties (see reference): #' 1. the density of solutions decreases with the closeness to the Pareto-optimal front and -#' 2. the Pareto-optimal solutions are nonuniformly distributed along the front. +#' 2. the Pareto-optimal solutions are non-uniformly distributed along the front. #' -#' @references E. Zitzler, K. Deb, and L. Thiele. Comparison of Multiobjective +#' @references E. Zitzler, K. Deb, and L. Thiele. Comparison of Multi-objective #' Evolutionary Algorithms: Empirical Results. Evolutionary Computation, 8(2):173-195, 2000 #' #' @param dimensions [\code{integer(1)}]\cr #' Number of decision variables. #' @return [\code{smoof_multi_objective_function}] +#' Returns an instance of the ZDT6 function as a \code{smoof_multi_objective_function} object. #' @export makeZDT6Function = function(dimensions) { - assertInt(dimensions, lower = 2L) + checkmate::assertInt(dimensions, lower = 2L) force(dimensions) # define the two-objective ZDT1 function @@ -41,7 +42,7 @@ makeZDT6Function = function(dimensions) { id = paste0("zdt6_", dimensions, "d_2o"), description = "Zitzler et al. Function N. 6", fn = fn, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = dimensions, id = "x", lower = rep(0, dimensions), diff --git a/R/plot.autoplot.R b/R/plot.autoplot.R index 75e9cdaf..fb60943e 100644 --- a/R/plot.autoplot.R +++ b/R/plot.autoplot.R @@ -5,12 +5,12 @@ #' This function expects a smoof function and returns a ggplot object depicting #' the function landscape. The output depends highly on the decision space of the #' smoof function or more technically on the \code{\link[ParamHelpers]{ParamSet}} -#' of the function. The following destinctions regarding the parameter types are +#' of the function. The following distinctions regarding the parameter types are #' made. In case of a single numeric parameter a simple line plot is drawn. For #' two numeric parameters or a single numeric vector parameter of length 2 either a #' contour plot or a heatmap (or a combination of both depending on the choice #' of additional parameters) is depicted. If there are both up to two numeric -#' and at least one discrete vector parameter, ggplot facetting is used to +#' and at least one discrete vector parameter, ggplot faceting is used to #' generate subplots of the above-mentioned types for all combinations of discrete #' parameters. #' @@ -82,10 +82,10 @@ #' # or hide the legend #' pl + ggtitle("My fancy function") + theme(legend.position = "none") #' @export -autoplot.smoof_function = function(object, +ggplot2::autoplot.smoof_function = function(object, ..., show.optimum = FALSE, - main = getName(x), + main = berryFunctions::getName(x), render.levels = FALSE, render.contours = TRUE, log.scale = FALSE, @@ -94,18 +94,18 @@ autoplot.smoof_function = function(object, x = object checkPlotFunParams(x) - assertFlag(show.optimum) - assertString(main, na.ok = TRUE) - length.out = convertInteger(length.out) - assertInt(length.out, lower = 10L) - assertFlag(render.levels) - assertFlag(render.contours) - assertFlag(log.scale) + checkmate::assertFlag(show.optimum) + checkmate::assertString(main, na.ok = TRUE) + length.out = BBmisc::convertInteger(length.out) + checkmate::assertInt(length.out, lower = 10L) + checkmate::assertFlag(render.levels) + checkmate::assertFlag(render.contours) + checkmate::assertFlag(log.scale) par.set = ParamHelpers::getParamSet(x) - par.types = getParamTypes(par.set, df.cols = TRUE, with.nr = TRUE) - par.types.count = getParamTypeCounts(par.set) - par.names = getParamIds(par.set, with.nr = TRUE, repeated = TRUE) + par.types = ParamHelpers::getParamTypes(par.set, df.cols = TRUE, with.nr = TRUE) + par.types.count = ParamHelpers::getParamTypeCounts(par.set) + par.names = ParamHelpers::getParamIds(par.set, with.nr = TRUE, repeated = TRUE) n.pars = length(par.names) # determine IDs of numeric and factor-like parameters @@ -117,15 +117,15 @@ autoplot.smoof_function = function(object, n.discrete = length(discrete.idx) if (n.pars > 6L) { - stopf("At most 4D funtions with mixed parameter spaces can be visualized.") + BBmisc::stopf("At most 4D funtions with mixed parameter spaces can be visualized.") } if (par.types.count$numeric > 2L || (par.types.count$discrete + par.types.count$logical) > 4L) { - stopf("Not possible to plot this combination of parameters.") + BBmisc::stopf("Not possible to plot this combination of parameters.") } if (n.numeric > 1L && !(render.levels || render.contours)) { - stopf("For functions with 2 numeric parameters one of render.levels or render.contours needs to be TRUE.") + BBmisc::stopf("For functions with 2 numeric parameters one of render.levels or render.contours needs to be TRUE.") } grid = generateDataframeForGGPlot2(x, length.out) @@ -140,23 +140,23 @@ autoplot.smoof_function = function(object, } if (n.numeric == 1L) { - pl = ggplot(grid, aes_string(x = par.names[numeric.idx], y = "y")) + geom_line() + pl = ggplot2::ggplot(grid, aes_string(x = par.names[numeric.idx], y = "y")) + geom_line() } if (n.numeric == 2L) { - pl = ggplot(grid, aes_string(x = par.names[numeric.idx[1L]], y = par.names[numeric.idx[2L]])) + pl = ggplot2::ggplot(grid, aes_string(x = par.names[numeric.idx[1L]], y = par.names[numeric.idx[2L]])) if (render.levels) { if (!requireNamespace("RColorBrewer", quietly = TRUE)) - stopf("For render.levels=TRUE the package \"RColorBrewer\" is required.") + BBmisc::stopf("For render.levels=TRUE the package \"RColorBrewer\" is required.") # nice color palette for render.levels # see http://learnr.wordpress.com/2009/07/20/ggplot2-version-of-figures-in-lattice-multivariate-data-visualization-with-r-part-6/ brewer.div = colorRampPalette(RColorBrewer::brewer.pal(11, "Spectral"), interpolate = "spline") - pl = pl + geom_raster(aes_string(fill = "y")) - pl = pl + scale_fill_gradientn(colours = brewer.div(200)) + pl = pl + ggplot2::geom_raster(aes_string(fill = "y")) + pl = pl + ggplot2::scale_fill_gradientn(colours = brewer.div(200)) } if (render.contours) { - pl = pl + stat_contour(aes_string(z = "y"), colour = "gray", alpha = 0.8) + pl = pl + ggplot2::stat_contour(aes_string(z = "y"), colour = "gray", alpha = 0.8) } } @@ -174,41 +174,41 @@ autoplot.smoof_function = function(object, # add labeller (otherwise we only see the values but the user has no clue # about which values belong to which parameter) - pl = pl + facet_grid(formula, labeller = labeller(.rows = label_both, .cols = label_both)) + pl = pl + ggpplot2::facet_grid(formula, ggplot2::labeller = ggplot2::labeller(.rows = label_both, .cols = label_both)) } if (show.optimum && (hasGlobalOptimum(x) || hasLocalOptimum(x))) { # get optima coordinates in a nice data.frame opt.df = getOptimaDf(x) if (n.numeric == 1L) { - pl = pl + geom_point(opt.df, mapping = aes_string(x = par.names[numeric.idx[1L]], y = "y", colour = "optima", shape = "optima")) + pl = pl + ggplot2::geom_point(opt.df, mapping = aes_string(x = par.names[numeric.idx[1L]], y = "y", colour = "optima", shape = "optima")) } else { - pl = pl + geom_point(opt.df, mapping = aes_string(x = par.names[numeric.idx[1L]], y = par.names[numeric.idx[2L]], colour = "optima", shape = "optima")) + pl = pl + ggplot2::geom_point(opt.df, mapping = aes_string(x = par.names[numeric.idx[1L]], y = par.names[numeric.idx[2L]], colour = "optima", shape = "optima")) # opt.df$y = round(opt.df$y, digits = 2L) # pl = pl + geom_text(opt.df, mapping = aes_string(x = par.names[numeric.idx[1L]], y = par.names[numeric.idx[2L]], label = "y")) } } # add title - title = coalesce(main, getName(x)) - pl = pl + ggtitle(title) + title = BBmisc::coalesce(main, berryFunctions::getName(x)) + pl = pl + ggplot2::ggtitle(title) # cosmetic stuff - pl = pl + theme(legend.position = "top") + pl = pl + ggplot2::theme(legend.position = "top") return(pl) } #' @export -autoplot.smoof_wrapped_function = function(object, +ggplot2::autoplot.smoof_wrapped_function = function(object, ..., show.optimum = FALSE, - main = getName(object), + main = berryFunctions::getName(object), render.levels = FALSE, render.contours = TRUE, log.scale = FALSE, length.out = 50L) { - autoplot( + ggplot2::autoplot( getWrappedFunction(object), ..., show.optimum = show.optimum, diff --git a/R/plot.helpers.R b/R/plot.helpers.R index 2aac8f2d..a09d0206 100644 --- a/R/plot.helpers.R +++ b/R/plot.helpers.R @@ -1,12 +1,15 @@ -# @title -# Get data.frame of optima. -# -# @description -# Returns data frame of global / local optima for ggplot. -# -# @param fn [\code{smoof_function}]\cr -# Smoof function. -# @return [\code{data.frame}] +#' @title +#' Get Data Frame of optima. +#' +#' @description +#' This function returns data frame of global / local optima for visualization using ggplot. +#' +#' @param fn [\code{smoof_function}]\cr +#' Smoof function. +#' @return [\code{data.frame}] +#' A data frame containing information about the optima. +#' +#' @export getOptimaDf = function(fn) { df = data.frame() # local optima first since the global opt is a local opt as well and @@ -44,8 +47,8 @@ getOptimaDf = function(fn) { # @return [\code{data.frame}] generateDataframeForGGPlot = function(fn, sequences, par.set) { data = do.call(expand.grid, sequences) - colnames(data) = getParamIds(par.set, with.nr = TRUE, repeated = TRUE) - data.as.list = dfRowsToList(par.set = par.set, df = data) + colnames(data) = ParamHelpers::getParamIds(par.set, with.nr = TRUE, repeated = TRUE) + data.as.list = BBmisc::dfRowsToList(par.set = par.set, df = data) data[["y"]] = sapply(data.as.list, function(data.row) { if (violatesConstraints(fn, unlist(data.row))) { return(NA) @@ -71,7 +74,7 @@ generateDataframeForGGPlot = function(fn, sequences, par.set) { generateDataframeForGGPlot2 = function(fun, length.out = 50L) { # extract a bunch of parameter information par.set = ParamHelpers::getParamSet(fun) - par.types = getParamTypes(par.set) + par.types = ParamHelpers::getParamTypes(par.set) pars = par.set$pars n.pars = length(pars) @@ -128,12 +131,12 @@ generateDataframeForGGPlot2 = function(fun, length.out = 50L) { # finally build the grid grid = do.call(expand.grid, values) - colnames(grid) = getParamIds(par.set, with.nr = TRUE, repeated = TRUE) + colnames(grid) = ParamHelpers::getParamIds(par.set, with.nr = TRUE, repeated = TRUE) # now compute the function values and append #FIXME: check if one of the parameters is named "y" - grid2 = dfRowsToList(par.set = par.set, df = grid, enforce.col.types = TRUE) + grid2 = BBmisc::dfRowsToList(par.set = par.set, df = grid, enforce.col.types = TRUE) grid[, "y"] = sapply(grid2, fun) return(grid) @@ -167,7 +170,7 @@ checkPlotFunParams = function(x) { # } if (isMultiobjective(x)) { - stopf("Plotting of multiobjective functions not possible.") + BBmisc::stopf("Plotting of multiobjective functions not possible.") } } @@ -182,14 +185,14 @@ getInternalPlotFunction = function(x, mapping) { n.params = getNumberOfParameters(x) par.set = ParamHelpers::getParamSet(x) - if (isNumeric(par.set, include.int = FALSE)) { + if (ParamHelpers::isNumeric(par.set, include.int = FALSE)) { if (n.params == 1L) { return(mapping[["1Dnumeric"]]) } else { return(mapping[["2Dnumeric"]]) } - } else if (hasDiscrete(par.set) & hasNumeric(par.set, include.int = FALSE)) { + } else if (ParamHelpers::hasDiscrete(par.set) & ParamHelpers::hasNumeric(par.set, include.int = FALSE)) { return(mapping[["2DMixed"]]) } - stopf("This type of function cannot be plotted.") + BBmisc::stopf("This type of function cannot be plotted.") } diff --git a/R/plot.plot.R b/R/plot.plot.R index 7539967b..a44ccfb4 100644 --- a/R/plot.plot.R +++ b/R/plot.plot.R @@ -1,4 +1,8 @@ +#' @title #' Generate ggplot2 object. +#' +#' @description +#' This function generates a ggplot2 object for visualization. #' #' @param x [\code{smoof_function}]\cr #' Function. @@ -39,18 +43,18 @@ plot.smoof_wrapped_function = function(x, ...) { #' @export plot1DNumeric = function(x, show.optimum = FALSE, - main = getName(x), n.samples = 500L, ...) { + main = berryFunctions::getName(x), n.samples = 500L, ...) { - assertFlag(show.optimum, na.ok = TRUE) - assertString(main, na.ok = TRUE) - assertInt(n.samples, lower = 10L) + checkmate::assertFlag(show.optimum, na.ok = TRUE) + checkmate::assertString(main, na.ok = TRUE) + checkmate::assertInt(n.samples, lower = 10L) par.set = ParamHelpers::getParamSet(x) - par.name = getParamIds(par.set) + par.name = ParamHelpers::getParamIds(par.set) # get lower and upper bounds - lower = getBounds(bound = getLower(par.set), default = -10L) - upper = getBounds(bound = getUpper(par.set), default = 10L) + lower = getBounds(bound = ParamHelpers::getLower(par.set), default = -10L) + upper = getBounds(bound = ParamHelpers::getUpper(par.set), default = 10L) data = generateDataframeForGGPlot(fn = x, sequences = list(seq(lower, upper, length.out = n.samples)), par.set = par.set) @@ -91,20 +95,20 @@ plot1DNumeric = function(x, #' @return Nothing #' @export plot2DNumeric = function(x, - show.optimum = FALSE, main = getName(x), + show.optimum = FALSE, main = berryFunctions::getName(x), render.levels = FALSE, render.contours = TRUE, n.samples = 100L, ...) { - assertFlag(show.optimum) - assertString(main, na.ok = TRUE) - assertFlag(render.levels) - assertFlag(render.contours) + checkmate::assertFlag(show.optimum) + checkmate::assertString(main, na.ok = TRUE) + checkmate::assertFlag(render.levels) + checkmate::assertFlag(render.contours) par.set = ParamHelpers::getParamSet(x) - par.names = getParamIds(par.set, with.nr = TRUE, repeated = TRUE) + par.names = ParamHelpers::getParamIds(par.set, with.nr = TRUE, repeated = TRUE) - lower = getBounds(bound = getLower(par.set), default = -10L) - upper = getBounds(bound = getUpper(par.set), default = 10L) + lower = getBounds(bound = ParamHelpers::getLower(par.set), default = -10L) + upper = getBounds(bound = ParamHelpers::getUpper(par.set), default = 10L) sequence.x1 = seq(lower[1], upper[1], length.out = n.samples) sequence.x2 = seq(lower[2], upper[2], length.out = n.samples) @@ -116,11 +120,11 @@ plot2DNumeric = function(x, dim(z) = c(n.samples, n.samples) if (render.levels) { - jet.colors = colorRampPalette(c("#00007F", "blue", "#007FFF", "cyan", + sommer::jet.colors = colorRampPalette(c("#00007F", "blue", "#007FFF", "cyan", "#7FFF7F", "yellow", "#FF7F00", "red", "#7F0000")) image(x = sequence.x1, y = sequence.x2, z = z, xlab = par.names[1], ylab = par.names[2], main = main, - col = jet.colors(100L), ...) + col = sommer::jet.colors(100L), ...) } if (render.contours) { contour(x = sequence.x1, y = sequence.x2, z = z, diff --git a/R/plot3D.R b/R/plot3D.R index 92ce12cc..50bad396 100644 --- a/R/plot3D.R +++ b/R/plot3D.R @@ -1,5 +1,9 @@ +#' @title #' Surface plot of two-dimensional test function. -#' +#' +#' @description +#' This function generates a surface plot of a two-dimensional smoof function. +#' #' @param x [\code{smoof_function}]\cr #' Two-dimensional snoof function. #' @param length.out [\code{integer(1)}]\cr @@ -11,11 +15,11 @@ #' String describing the package to use for 3D visualization. #' At the moment \dQuote{plot3D} (package \pkg{plot3D}) and #' \dQuote{plotly} (package \pkg{plotly}) are supported. -#' The latter opens a highly interactive plot in a web brower +#' The latter opens a highly interactive plot in a web browser #' and is thus suited well to explore a function by hand. #' Default is \dQuote{plot3D}. #' @param ... [any]\cr -#' Furhter parameters passed to method used for visualization +#' Further parameters passed to method used for visualization #' (which is determined by the \code{package} argument. #' @examples #' library(plot3D) @@ -31,26 +35,26 @@ #' } #' @export plot3D = function(x, length.out = 100L, package = "plot3D", ...) { - assertClass(x, "smoof_function") - assertInt(length.out, lower = 10L) - assertChoice(package, choices = c("plot3D", "plotly")) + checkmate::assertClass(x, "smoof_function") + checkmate::assertInt(length.out, lower = 10L) + checkmate::assertChoice(package, choices = c("plot3D", "plotly")) if (!requireNamespace(package, quietly = TRUE)) - stopf("Package \"%s\" needed for this function to work.", package) + BBmisc::stopf("Package \"%s\" needed for this function to work.", package) obj.fn = x n = getNumberOfParameters(obj.fn) par.set = ParamHelpers::getParamSet(obj.fn) if (n != 2L) { - stopf("Surface plots are possible only for 2D numeric functions, but your function expects %i parameters.", n) + BBmisc::stopf("Surface plots are possible only for 2D numeric functions, but your function expects %i parameters.", n) } - if (!isNumeric(par.set, include.int = FALSE)) { - stopf("Surface plots are possible only for 2D numeric functions, but your function expects non-numeric parameters.") + if (!ParamHelpers::isNumeric(par.set, include.int = FALSE)) { + BBmisc::stopf("Surface plots are possible only for 2D numeric functions, but your function expects non-numeric parameters.") } # build z[i, j] = f(x[i], y[j]) matrix - lower = getLower(par.set) - upper = getUpper(par.set) + lower = ParamHelpers::getLower(par.set) + upper = ParamHelpers::getUpper(par.set) x = seq(lower[1], upper[1], length.out = length.out) y = seq(lower[2], upper[2], length.out = length.out) grid = expand.grid(x, y) diff --git a/R/smoof.R b/R/smoof.R index 79845e62..dbeed8d8 100644 --- a/R/smoof.R +++ b/R/smoof.R @@ -11,8 +11,8 @@ #' \eqn{f_i : S \subseteq \mathbf{R}^d \to \mathbf{R} , i = 1, \ldots, m} being an #' objective-function, the goal in \emph{Global Optimization (GO)} is to find the best #' solution \eqn{\mathbf{x}^* \in S}. The set \eqn{S} is termed the \emph{set of -#' feasible soluations}. In the case of only a single objective function \eqn{f}, -#' - which we want to restrict ourself in this brief description - the goal is to +#' feasible solutions}. In the case of only a single objective function \eqn{f}, +#' - which we want to restrict ourselves in this brief description - the goal is to #' minimize the objective, i. e., \deqn{\min_{\mathbf{x}} f(\mathbf{x}).} #' Sometimes we may be interested in maximizing the objective function value, but #' since \eqn{min(f(\mathbf{x})) = -\min(-f(\mathbf{x}))}, we do not have to tackle diff --git a/R/smoof_function.R b/R/smoof_function.R index 89b93ec6..a7869dbd 100644 --- a/R/smoof_function.R +++ b/R/smoof_function.R @@ -15,14 +15,14 @@ #' \item{noisy [\code{logical(1)}]}{Boolean indicating whether the function is noisy or not.} #' \item{fn.mean [\code{function}]}{Optional true mean function in case of a noisy objective function.} #' \item{minimize [\code{logical(1)}]}{Logical vector of length \code{n.objectives} indicating which objectives shall -#' be minimzed/maximized.} +#' be minimized/maximized.} #' \item{vectorized [\code{logical(1)}]}{Can the handle \dQuote{vector} input, i. e., does it accept matrix of #' parameters?} #' \item{constraint.fn [\code{function}]}{Optional function which returns a logical vector with each component indicating #' whether the corresponding constraint is violated.} #' } #' -#' Futhermore, single-objective function may contain additional parameters with information on +#' Furthermore, single-objective function may contain additional parameters with information on #' local and/or global optima as well as characterizing tags. #' \describe{ #' \item{tags [\code{character}]}{Optional character vector of tags or keywords.} @@ -32,7 +32,7 @@ #' \item{global.opt.value [\code{numeric}]}{Function values of local optima.} #' } #' -#' Currenlty tagging is not possible for multi-objective functions. The only additional attribute may be +#' Currently tagging is not possible for multi-objective functions. The only additional attribute may be #' a reference point: #' \describe{ #' \item{ref.point [\code{numeric}]}{Optional reference point of length \code{n.objectives}}. diff --git a/R/snof.R b/R/snof.R index 78939628..f8ec4536 100644 --- a/R/snof.R +++ b/R/snof.R @@ -48,16 +48,16 @@ snof = function(name = NULL, local.opt.params = NULL, local.opt.values = NULL) { - assertString(par.id, null.ok = TRUE) - par.len = asCount(par.len) + checkmate::assertString(par.id, null.ok = TRUE) + par.len = checkmate::asCount(par.len) # furhter checks are performed by ParamHelpers if (is.null(par.lower)) par.lower = -Inf if (is.null(par.upper)) par.upper = Inf - assertNumeric(par.lower, min.len = 1L) - assertNumeric(par.upper, min.len = 1L) + checkmate::assertNumeric(par.lower, min.len = 1L) + checkmate::assertNumeric(par.upper, min.len = 1L) makeSingleObjectiveFunction( name = name, @@ -70,7 +70,7 @@ snof = function(name = NULL, fn.mean = fn.mean, minimize = minimize, constraint.fn = constraint.fn, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = par.len, id = par.id, lower = par.lower, diff --git a/R/sof.ackley.R b/R/sof.ackley.R index 849c510d..fb79f8b3 100644 --- a/R/sof.ackley.R +++ b/R/sof.ackley.R @@ -1,11 +1,16 @@ +#' @title #' Ackley Function #' +#' @description #' Also known as \dQuote{Ackley's Path Function}. -#' Multimodal test function with its global optimum in the center of the defintion +#' Multi-modal test function with its global optimum in the center of the definition #' space. The implementation is based on the formula #' \deqn{f(\mathbf{x}) = -a \cdot \exp\left(-b \cdot \sqrt{\left(\frac{1}{n} \sum_{i=1}^{n} \mathbf{x}_i\right)}\right) - \exp\left(\frac{1}{n} \sum_{i=1}^{n} \cos(c \cdot \mathbf{x}_i)\right),} #' with \eqn{a = 20}, \eqn{b = 0.2} and \eqn{c = 2\pi}. The feasible region is #' given by the box constraints \eqn{\mathbf{x}_i \in [-32.768, 32.768]}. +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Ackley Function. #' #' @references Ackley, D. H.: A connectionist machine for genetic hillclimbing. #' Boston: Kluwer Academic Publishers, 1987. @@ -14,7 +19,7 @@ #' @template ret_smoof_single #' @export makeAckleyFunction = function(dimensions) { - assertCount(dimensions) + checkmate::assertCount(dimensions) force(dimensions) makeSingleObjectiveFunction( name = paste(dimensions, "-d Ackley Function", sep = ""), @@ -29,7 +34,7 @@ makeAckleyFunction = function(dimensions) { e = mean(cos(c * x)) -a * exp(-b * sqrt(d)) - exp(e) + a + exp(1) }, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = dimensions, id = "x", lower = -32.768, diff --git a/R/sof.adjiman.R b/R/sof.adjiman.R index 771cd8d3..170004d5 100644 --- a/R/sof.adjiman.R +++ b/R/sof.adjiman.R @@ -1,8 +1,17 @@ +#' @title #' Adjiman function #' +#' @description #' This two-dimensional multimodal test function follows the formula #' \deqn{f(\mathbf{x}) = \cos(\mathbf{x}_1)\sin(\mathbf{x}_2) - \frac{\mathbf{x}_1}{(\mathbf{x}_2^2 + 1)}} #' with \eqn{\mathbf{x}_1 \in [-1, 2], \mathbf{x}_2 \in [2, 1]}. +#' +#' @param +#' A numeric vector of length 2 representing the input coordinates. +#' \code{x[1]} should be in the range [-1, 2], and \code{x[2]} should be in the range [2, 1]. +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Adjiman Function. #' #' @references C. S. Adjiman, S. Sallwig, C. A. Flouda, A. Neumaier, A Global Optimization #' Method, aBB for General Twice-Differentiable NLPs-1, Theoretical Advances, Computers @@ -18,7 +27,7 @@ makeAdjimanFunction = function() { checkNumericInput(x, 2L) cos(x[1]) * sin(x[2]) - x[1] / (x[2]^2 + 1) }, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 2L, id = "x", lower = c(-1, -1), diff --git a/R/sof.alpine01.R b/R/sof.alpine01.R index 41c48c91..4fdfb035 100644 --- a/R/sof.alpine01.R +++ b/R/sof.alpine01.R @@ -1,8 +1,13 @@ +#' @title #' Alpine01 function #' -#' Highly multimodal single-objective optimization test function. It is defined +#' @description +#' Highly multi-modal single-objective optimization test function. It is defined #' as \deqn{f(\mathbf{x}) = \sum_{i = 1}^{n} |\mathbf{x}_i \sin(\mathbf{x}_i) + 0.1\mathbf{x}_i|} #' with box constraints \eqn{\mathbf{x}_i \in [-10, 10]} for \eqn{i = 1, \ldots, n}. +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Alpine01 Function. #' #' @references S. Rahnamyan, H. R. Tizhoosh, N. M. M. Salama, A Novel Population #' Initialization Method for Accelerating Evolutionary Algorithms, Computers and @@ -12,7 +17,7 @@ #' @template ret_smoof_single #' @export makeAlpine01Function = function(dimensions) { - assertCount(dimensions) + checkmate::assertCount(dimensions) force(dimensions) makeSingleObjectiveFunction( name = paste(dimensions, "-d Alpine01 Function", sep = ""), @@ -21,7 +26,7 @@ makeAlpine01Function = function(dimensions) { checkNumericInput(x, dimensions) sum(abs(x * sin(x) + 0.1 * x)) }, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = dimensions, id = "x", lower = rep(-10, dimensions), diff --git a/R/sof.alpine02.R b/R/sof.alpine02.R index 87c68c7b..37990669 100644 --- a/R/sof.alpine02.R +++ b/R/sof.alpine02.R @@ -1,9 +1,14 @@ +#' @title #' Alpine02 function -#' -#' Another multimodal optimization test function. The implementation is based on +#' +#' @description +#' Another multi-modal optimization test function. The implementation is based on #' the formula #' \deqn{f(\mathbf{x}) = \prod_{i = 1}^{n} \sqrt{\mathbf{x}_i}\sin(\mathbf{x}_i)} #' with \eqn{\mathbf{x}_i \in [0, 10]} for \eqn{i = 1, \ldots, n}. +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Alpine02 Function. #' #' @references M. Clerc, The Swarm and the Queen, Towards a Deterministic and #' Adaptive Particle Swarm Optimization, IEEE Congress on Evolutionary Computation, @@ -13,7 +18,7 @@ #' @template ret_smoof_single #' @export makeAlpine02Function = function(dimensions) { - assertCount(dimensions) + checkmate::assertCount(dimensions) force(dimensions) makeSingleObjectiveFunction( name = paste(dimensions, "-d Alpine N. 2 Function", sep = ""), @@ -22,7 +27,7 @@ makeAlpine02Function = function(dimensions) { checkNumericInput(x, dimensions) prod(sqrt(x) * sin(x)) }, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = dimensions, id = "x", lower = rep(0, dimensions), diff --git a/R/sof.aluffi-pentini.R b/R/sof.aluffi-pentini.R index fb3663dc..429357b2 100644 --- a/R/sof.aluffi-pentini.R +++ b/R/sof.aluffi-pentini.R @@ -18,7 +18,7 @@ makeAluffiPentiniFunction = function() { checkNumericInput(x, 2L) 0.25 * x[1]^4 - 0.5 * x[1]^2 + 0.1 * x[1] + 0.5 * x[2]^2 }, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 2L, id = "x", lower = c(-10, -10), diff --git a/R/sof.bartels.conn.R b/R/sof.bartels.conn.R index ab3b6889..5540dfc1 100644 --- a/R/sof.bartels.conn.R +++ b/R/sof.bartels.conn.R @@ -1,8 +1,13 @@ +#' @title #' Bartels Conn Function -#' +#' +#' @description #' The Bartels Conn Function is defined as #' \deqn{f(\mathbf{x}) = |\mathbf{x}_1^2 + \mathbf{x}_2^2 + \mathbf{x}_1\mathbf{x}_2| + |\sin(\mathbf{x}_1)| + |\cos(\mathbf{x})|} #' subject to \eqn{\mathbf{x}_i \in [-500, 500]} for \eqn{i = 1, 2}. +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Bartels Conn Function. #' #' @template ret_smoof_single #' @export @@ -14,7 +19,7 @@ makeBartelsConnFunction = function() { checkNumericInput(x, 2L) abs(x[1]^2 + x[2]^2 + x[1] * x[2]) + abs(sin(x[1])) + abs(cos(x[2])) }, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 2L, id = "x", lower = c(-500, -500), diff --git a/R/sof.beale.R b/R/sof.beale.R index c10d8b62..74001729 100644 --- a/R/sof.beale.R +++ b/R/sof.beale.R @@ -1,11 +1,16 @@ +#' @title #' Beale Function #' -#' Multimodal single-objective test function for optimization. It is based on +#' @description +#' Multi-modal single-objective test function for optimization. It is based on #' the mathematic formula #' \deqn{f(\mathbf{x}) = (1.5 - \mathbf{x}_1 + \mathbf{x}_1\mathbf{x}_2)^2 + (2.25 - \mathbf{x}_1 + \mathbf{x}_1\mathbf{x}_2^2)^2 + (2.625 - \mathbf{x}_1 + \mathbf{x}_1\mathbf{x}_2^3)^2} #' usually evaluated within the bounds \eqn{\mathbf{x}_i \in [-4.5, 4.5], i = 1, 2}. -#' The function has a flat but multimodal region aroung the single global optimum +#' The function has a flat but multi-modal region around the single global optimum #' and large peaks in the edges of its definition space. +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Beale Function. #' #' @template ret_smoof_single #' @export @@ -20,7 +25,7 @@ makeBealeFunction = function() { c = b * x[2] (1.5 - x[1] + a)^2 + (2.25 - x[1] + b)^2 + (2.625 - x[1] + c)^2 }, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 2L, id = "x", lower = c(-4.5, -4.5), diff --git a/R/sof.bent.cigar.R b/R/sof.bent.cigar.R index b274ad3f..f1b8c30b 100644 --- a/R/sof.bent.cigar.R +++ b/R/sof.bent.cigar.R @@ -1,8 +1,13 @@ +#' @title #' Bent-Cigar Function #' +#' @description #' Scalable test function \eqn{f} with #' \deqn{f(\mathbf{x}) = x_1^2 + 10^6 \sum_{i = 2}^{n} x_i^2} #' subject to \eqn{-100 \leq \mathbf{x}_i \leq 100} for \eqn{i = 1, \ldots, n}. +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Bent-Cigar Function. #' #' @references See \url{https://al-roomi.org/benchmarks/unconstrained/n-dimensions/164-bent-cigar-function}. #' @@ -10,7 +15,7 @@ #' @template ret_smoof_single #' @export makeBentCigarFunction = function(dimensions) { - assertCount(dimensions) + checkmate::assertCount(dimensions) force(dimensions) makeSingleObjectiveFunction( name = "Bent-Cigar Function", @@ -19,7 +24,7 @@ makeBentCigarFunction = function(dimensions) { checkNumericInput(x, dimensions) x[1]^2 + 1e+06 * sum(x[2:dimensions]^2) }, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = dimensions, id = "x", lower = rep(-100, dimensions), diff --git a/R/sof.bird.R b/R/sof.bird.R index f279a1d8..c9550516 100644 --- a/R/sof.bird.R +++ b/R/sof.bird.R @@ -1,9 +1,14 @@ +#' @title #' Bird Function #' -#' Multimodal single-objective test function. The implementation is based on the +#' @description +#' Multi-modal single-objective test function. The implementation is based on the #' mathematical formulation #' \deqn{f(\mathbf{x}) = (\mathbf{x}_1 - \mathbf{x}_2)^2 + \exp((1 - \sin(\mathbf{x}_1))^2)\cos(\mathbf{x}_2) + \exp((1 - \cos(\mathbf{x}_2))^2)\sin(\mathbf{x}_1).} #' The function is restricted to two dimensions with \eqn{\mathbf{x}_i \in [-2\pi, 2\pi], i = 1, 2.} +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Bird Function. #' #' @references S. K. Mishra, Global Optimization By Differential Evolution and #' Particle Swarm Methods: Evaluation On Some Benchmark Functions, Munich Research @@ -22,7 +27,7 @@ makeBirdFunction = function() { c = exp((1 - cos(x[2]))^2) * sin(x[1]) return(a + b + c) }, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 2L, id = "x", lower = c(-2 * pi, -2 * pi), diff --git a/R/sof.bohachevsky.n1.R b/R/sof.bohachevsky.n1.R index 0dc51e1a..bd92e371 100644 --- a/R/sof.bohachevsky.n1.R +++ b/R/sof.bohachevsky.n1.R @@ -1,10 +1,15 @@ +#' @title #' Bohachevsky function N. 1 #' -#' Highly multimodal single-objective test function. The mathematical formula is +#' @description +#' Highly multi-modal single-objective test function. The mathematical formula is #' given by #' \deqn{f(\mathbf{x}) = \sum_{i = 1}^{n - 1} (\mathbf{x}_i^2 + 2 \mathbf{x}_{i + 1}^2 - 0.3\cos(3\pi\mathbf{x}_i) - 0.4\cos(4\pi\mathbf{x}_{i + 1}) + 0.7)} #' with box-constraints \eqn{\mathbf{x}_i \in [-100, 100]} for \eqn{i = 1, \ldots, n}. -#' The multimodality will be visible by \dQuote{zooming in} in the plot. +#' The multi-modality will be visible by \dQuote{zooming in} in the plot. +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Bohachevsky Function. #' #' @references I. O. Bohachevsky, M. E. Johnson, M. L. Stein, General Simulated #' Annealing for Function Optimization, Technometrics, vol. 28, no. 3, pp. 209-217, 1986. @@ -13,7 +18,7 @@ #' @template ret_smoof_single #' @export makeBohachevskyN1Function = function(dimensions) { - assertCount(dimensions) + checkmate::assertCount(dimensions) force(dimensions) makeSingleObjectiveFunction( name = paste(dimensions, "-d Bohachevsky Function N. 1", sep = ""), @@ -23,7 +28,7 @@ makeBohachevskyN1Function = function(dimensions) { i = 1:(length(x) - 1) sum(x[i]^2 + 2 * x[i + 1]^2 - 0.3 * cos(3 * pi * x[i]) - 0.4 * cos(4 * pi * x[i + 1]) + 0.7) }, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = dimensions, id = "x", lower = rep(-15, dimensions), diff --git a/R/sof.booth.R b/R/sof.booth.R index c46bafd5..860cfe15 100644 --- a/R/sof.booth.R +++ b/R/sof.booth.R @@ -1,8 +1,13 @@ +#' @title #' Booth Function #' +#' @description #' This function is based on the formula #' \deqn{f(\mathbf{x}) = (\mathbf{x}_1 + 2\mathbf{x}_2 - 7)^2 + (2\mathbf{x}_1 + \mathbf{x}_2 - 5)^2} #' subject to \eqn{\mathbf{x}_i \in [-10, 10], i = 1, 2}. +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Booth Function. #' #' @template ret_smoof_single #' @export @@ -14,7 +19,7 @@ makeBoothFunction = function() { checkNumericInput(x, 2L) (x[1] + 2 * x[2] - 7)^2 + (2 * x[1] + x[2] - 5)^2 }, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 2L, id = "x", lower = c(-10, -10), diff --git a/R/sof.branin.R b/R/sof.branin.R index a5e29c97..ab47d8c6 100644 --- a/R/sof.branin.R +++ b/R/sof.branin.R @@ -1,10 +1,15 @@ +#' @title #' Branin RCOS function #' +#' @description #' Popular 2-dimensional single-objective test function based on the formula: #' \deqn{f(\mathbf{x}) = a \left(\mathbf{x}_2 - b \mathbf{x}_1^2 + c \mathbf{x_1} - d\right)^2 + e\left(1 - f\right)\cos(\mathbf{x}_1) + e,} #' where \eqn{a = 1, b = \frac{5.1}{4\pi^2}, c = \frac{5}{\pi}, d = 6, e = 10} and #' \eqn{f = \frac{1}{8\pi}}. The box constraints are given by \eqn{\mathbf{x}_1 \in [-5, 10]} #' and \eqn{\mathbf{x}_2 \in [0, 15]}. The function has three global minima. +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Brainin RCOS Function. #' #' @references F. H. Branin. Widely convergent method for finding #' multiple solutions of simultaneous nonlinear equations. @@ -31,7 +36,7 @@ makeBraninFunction = function() { f = 1 / (8 * pi) return (a * (x[2] - b * x[1]^2 + c * x[1] - d)^2 + e * (1 - f) * cos(x[1]) + e) }, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 2L, id = "x", lower = c(-5, 0), diff --git a/R/sof.brent.R b/R/sof.brent.R index 9def5619..2b335926 100644 --- a/R/sof.brent.R +++ b/R/sof.brent.R @@ -1,8 +1,13 @@ +#' @title #' Brent Function #' +#' @description #' Single-objective two-dimensional test function. The formula is given as #' \deqn{f(\mathbf{x}) = (\mathbf{x}_1 + 10)^2 + (\mathbf{x}_2 + 10)^2 + exp(-\mathbf{x}_1^2 - \mathbf{x}_2^2)} #' subject to the constraints \eqn{\mathbf{x}_i \in [-10, 10], i = 1, 2.} +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Brent Function. #' #' @references F. H. Branin Jr., Widely Convergent Method of Finding Multiple #' Solutions of Simul- taneous Nonlinear Equations, IBM Journal of Research and @@ -18,7 +23,7 @@ makeBrentFunction = function() { checkNumericInput(x, 2L) (x[1] + 10)^2 + (x[2] + 10)^2 + exp(-x[1]^2 - x[2]^2) }, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 2L, id = "x", lower = c(-10, -10), diff --git a/R/sof.brown.R b/R/sof.brown.R index 41005c48..98b7f607 100644 --- a/R/sof.brown.R +++ b/R/sof.brown.R @@ -1,9 +1,14 @@ +#' @title #' Brown Function #' -#' This function belongs the the unimodal single-objective test functions. The +#' @description +#' This function belongs the the uni-modal single-objective test functions. The #' function is forumlated as #' \deqn{f(\mathbf{x}) = \sum_{i = 1}^{n} (\mathbf{x}_i^2)^{(\mathbf{x}_{i + 1} + 1)} + (\mathbf{x}_{i + 1})^{(\mathbf{x}_i + 1)}} #' subject to \eqn{\mathbf{x}_i \in [-1, 4]} for \eqn{i = 1, \ldots, n}. +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Brown Function. #' #' @references O. Begambre, J. E. Laier, A hybrid Particle Swarm Optimization - #' Simplex Algorithm (PSOS) for Structural Damage Identification, Journal of @@ -13,7 +18,7 @@ #' @template ret_smoof_single #' @export makeBrownFunction = function(dimensions) { - assertCount(dimensions) + checkmate::assertCount(dimensions) force(dimensions) makeSingleObjectiveFunction( name = "Brown Function", @@ -25,7 +30,7 @@ makeBrownFunction = function(dimensions) { b = x[i + 1]^2 sum(a^(b + 1) + b^(a + 1)) }, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = dimensions, id = "x", lower = rep(-1, dimensions), diff --git a/R/sof.bukin.n2.R b/R/sof.bukin.n2.R index 71ab5408..4d3f274a 100644 --- a/R/sof.bukin.n2.R +++ b/R/sof.bukin.n2.R @@ -1,8 +1,13 @@ +#' @title #' Bukin function N. 2 #' -#' Muldimodal, non-scalable, continous optimization test function given by: +#' @description +#' Multi-modal, non-scalable, continuous optimization test function given by: #' \deqn{f(\mathbf{x}) = 100 (\mathbf{x}_2 - 0.01 * \mathbf{x}_1^2 + 1) + 0.01 (\mathbf{x}_1 + 10)^2} #' subject to \eqn{\mathbf{x}_1 \in [-15, -5]} and \eqn{\mathbf{x}_2 \in [-3, 3]}. +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Bukin N.2 Function. #' #' @references Z. K. Silagadze, Finding Two-Dimensional Peaks, Physics of Particles #' and Nuclei Letters, vol. 4, no. 1, pp. 73-80, 2007. @@ -19,7 +24,7 @@ makeBukinN2Function = function() { checkNumericInput(x, 2L) 100 * (x[2]^2 - 0.01 * x[1]^2 + 1) + 0.01 * (x[1] + 10)^2 }, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 2L, id = "x", lower = c(-15, -3), diff --git a/R/sof.bukin.n4.R b/R/sof.bukin.n4.R index e7b58460..ac833fd6 100644 --- a/R/sof.bukin.n4.R +++ b/R/sof.bukin.n4.R @@ -1,8 +1,13 @@ +#' @title #' Bukin function N. 4 -#' -#' Second continous Bukin function test function. The formula is given by +#' +#' @description +#' Second continuous Bukin function test function. The formula is given by #' \deqn{f(\mathbf{x}) = 100 \mathbf{x}_2^2 + 0.01 * ||\mathbf{x}_1 +10||} #' and the box constraints \eqn{mathbf{x}_1 \in [-15, 5], \mathbf{x}_2 \in [-3, 3]}. +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Bukin N.4 Function. #' #' @references Z. K. Silagadze, Finding Two-Dimesnional Peaks, Physics of Particles #' and Nuclei Letters, vol. 4, no. 1, pp. 73-80, 2007. @@ -19,7 +24,7 @@ makeBukinN4Function = function() { checkNumericInput(x, 2L) 100 * x[2]^2 + 0.01 * abs(x[1] + 10) }, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 2L, id = "x", lower = c(-15, -3), diff --git a/R/sof.bukin.n6.R b/R/sof.bukin.n6.R index 33ad252f..cde68ddb 100644 --- a/R/sof.bukin.n6.R +++ b/R/sof.bukin.n6.R @@ -1,11 +1,16 @@ +#' @title #' Bukin function N. 6 #' +#' @description #' Beside Bukin N. 2 and N. 4 this is the last \dQuote{Bukin family} function. #' It is given by the formula #' \deqn{f(\mathbf{x}) = 100 \sqrt{||\mathbf{x}_2 - 0.01 \mathbf{x}_1^2||} + 0.01 ||\mathbf{x}_1 + 10||} #' and the box constraints \eqn{mathbf{x}_1 \in [-15, 5], \mathbf{x}_2 \in [-3, 3]}. +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Bukin N.6 Function. #' -#' @references Z. K. Silagadze, Finding Two-Dimesnional Peaks, Physics of Particles +#' @references Z. K. Silagadze, Finding Two-Dimensional Peaks, Physics of Particles #' and Nuclei Letters, vol. 4, no. 1, pp. 73-80, 2007. #' #' @seealso \code{\link{makeBukinN2Function}}, \code{\link{makeBukinN4Function}} @@ -20,7 +25,7 @@ makeBukinN6Function = function() { checkNumericInput(x, 2L) 100 * sqrt(abs(x[2] - 0.01 * x[1]^2)) + 0.01 * abs(x[1] + 10) }, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 2L, id = "x", lower = c(-15, -3), diff --git a/R/sof.carrom.table.R b/R/sof.carrom.table.R index eea946f4..b09d1e1e 100644 --- a/R/sof.carrom.table.R +++ b/R/sof.carrom.table.R @@ -1,8 +1,13 @@ +#' @title #' Carrom Table Function #' +#' @description #' This function is defined as follows: #' \deqn{f(\mathbf{x}) = -\frac{1}{30} \left((\cos(\mathbf{x}_1)\exp(|1 - ((\mathbf{x}_1^2 + \mathbf{x}_2^2)^{0.5} / \pi)^2)|\right).} #' The box-constraints are given by \eqn{\mathbf{x}_i \in [-10, 10], i = 1, 2}. +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Carrom Table Function. #' #' @references S. K. Mishra, Global Optimization By Differential Evolution and #' Particle Swarm Methods: Evaluation On Some Benchmark Functions, Munich @@ -18,7 +23,7 @@ makeCarromTableFunction = function() { checkNumericInput(x, 2L) (-1 / 30) * exp(2 * abs(1 - (sqrt(x[1]^2 + x[2]^2) / pi))) * cos(x[1])^2 * cos(x[2])^2 }, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 2L, id = "x", lower = c(-10, -10), diff --git a/R/sof.chichinadze.R b/R/sof.chichinadze.R index 98b7eda3..573d7914 100644 --- a/R/sof.chichinadze.R +++ b/R/sof.chichinadze.R @@ -1,8 +1,13 @@ +#' @title #' Chichinadze Function #' +#' @description #' Continuous single-objective test function \eqn{f} with #' \deqn{f(\mathbf{x}) = \mathbf{x}_1^2 - 12 \mathbf{x}_1 + 11 + 10\cos(0.5\pi\mathbf{x}_1) + 8\sin(2.5\pi\mathbf{x}_1) - (0.25)^{0.5}\exp(-0.5(\mathbf{x}_2 - 0.5)^2)} #' with \eqn{-30 \leq \mathbf{x}_i \leq 30, i = 1, 2}. +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Chichinadze Function. #' #' @template ret_smoof_single #' @export @@ -14,7 +19,7 @@ makeChichinadzeFunction = function() { checkNumericInput(x, 2L) x[1]^2 - 12 * x[1] + 11 + 10 * cos(pi * 0.5 * x[1]) + 8 * sin(5 * pi * x[1]) - exp(-0.5 * (x[2] - 0.5)^2) / sqrt(5) }, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 2L, id = "x", lower = c(-30, -30), diff --git a/R/sof.chung.reynolds.R b/R/sof.chung.reynolds.R index 7a981994..c83a415b 100644 --- a/R/sof.chung.reynolds.R +++ b/R/sof.chung.reynolds.R @@ -1,18 +1,23 @@ +#' @title #' Chung Reynolds Function #' -#' The defintion is given by +#' @description +#' The definition is given by #' \deqn{f(\mathbf{x}) = \left(\sum_{i=1}^{n} \mathbf{x}_i^2\right)^2} #' with box-constraings \eqn{\mathbf{x}_i \in [-100, 100], i = 1, \ldots, n}. +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Chung Reynolds Function. #' #' @references C. J. Chung, R. G. Reynolds, CAEP: An Evolution-Based Tool for -#' Real-Valued Func- tion Optimization Using Cultural Algorithms, International -#' Journal on Artificial In- telligence Tool, vol. 7, no. 3, pp. 239-291, 1998. +#' Real-Valued Function Optimization Using Cultural Algorithms, International +#' Journal on Artificial Intelligence Tool, vol. 7, no. 3, pp. 239-291, 1998. #' #' @template arg_dimensions #' @template ret_smoof_single #' @export makeChungReynoldsFunction = function(dimensions) { - assertCount(dimensions) + checkmate::assertCount(dimensions) force(dimensions) makeSingleObjectiveFunction( name = paste(dimensions, "-d Chung Reynolds Function", sep = ""), @@ -21,7 +26,7 @@ makeChungReynoldsFunction = function(dimensions) { checkNumericInput(x, dimensions) sum(x^2)^2 }, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = dimensions, id = "x", lower = rep(-100, dimensions), diff --git a/R/sof.complex.R b/R/sof.complex.R index 0d18cfc2..6b7b7013 100644 --- a/R/sof.complex.R +++ b/R/sof.complex.R @@ -3,6 +3,9 @@ #' @description Two-dimensional test function based on the formula #' \deqn{f(\mathbf{x}) = (x_1^3 - 3 x_1 x_2^2 - 1)^2 + (3 x_2 x_1^2 - x_2^3)^2} #' with \eqn{\mathbf{x}_1, \mathbf{x}_2 \in [-2, 2]}. +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Complex Function. #' #' @references See \url{https://al-roomi.org/benchmarks/unconstrained/2-dimensions/43-complex-function}. #' @@ -16,7 +19,7 @@ makeComplexFunction = function() { checkNumericInput(x, 2L) (x[1]^3 - 3 * x[1] * x[2]^2 - 1)^2 + (3 * x[2] * x[1]^2 - x[2]^3)^2 }, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 2L, id = "x", lower = c(-2, -2), diff --git a/R/sof.cosine.mixture.R b/R/sof.cosine.mixture.R index 2ecfe9d2..5f28769c 100644 --- a/R/sof.cosine.mixture.R +++ b/R/sof.cosine.mixture.R @@ -1,8 +1,13 @@ +#' @title #' Cosine Mixture Function #' +#' @description #' Single-objective test function based on the formula #' \deqn{f(\mathbf{x}) = -0.1 \sum_{i = 1}^{n} \cos(5\pi\mathbf{x}_i) - \sum_{i = 1}^{n} \mathbf{x}_i^2} #' subject to \eqn{\mathbf{x}_i \in [-1, 1]} for \eqn{i = 1, \ldots, n}. +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Cosine Mixture Function. #' #' @references M. M. Ali, C. Khompatraporn, Z. B. Zabinsky, A Numerical Evaluation #' of Several Stochastic Algorithms on Selected Continuous Global Optimization @@ -12,7 +17,7 @@ #' @template ret_smoof_single #' @export makeCosineMixtureFunction = function(dimensions) { - assertCount(dimensions) + checkmate::assertCount(dimensions) force(dimensions) makeSingleObjectiveFunction( name = "Cosine Mixture Function", @@ -23,7 +28,7 @@ makeCosineMixtureFunction = function(dimensions) { b = sum(x^2) (a - b) }, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = dimensions, id = "x", lower = rep(-1, dimensions), diff --git a/R/sof.cross.in.tray.R b/R/sof.cross.in.tray.R index 4d590087..35e96f06 100644 --- a/R/sof.cross.in.tray.R +++ b/R/sof.cross.in.tray.R @@ -1,8 +1,13 @@ +#' @title #' Cross-In-Tray Function #' +#' @description #' Non-scalable, two-dimensional test function for numerical optimization with #' \deqn{f(\mathbf{x}) = -0.0001\left(|\sin(\mathbf{x}_1\mathbf{x}_2\exp(|100 - [(\mathbf{x}_1^2 + \mathbf{x}_2^2)]^{0.5} / \pi|)| + 1\right)^{0.1}} #' subject to \eqn{\mathbf{x}_i \in [-15, 15]} for \eqn{i = 1, 2}. +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Cross-In-Tray Function. #' #' @references S. K. Mishra, Global Optimization By Differential Evolution and #' Particle Swarm Methods: Evaluation On Some Benchmark Functions, Munich @@ -19,7 +24,7 @@ makeCrossInTrayFunction = function() { a = exp(abs(100 - (sqrt(x[1]^2 + x[2]^2) / pi))) -0.0001 * (abs(a * sin(x[1]) * sin(x[2])) + 1)^(0.1) }, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 2L, id = "x", lower = c(-15, -15), diff --git a/R/sof.cube.R b/R/sof.cube.R index b8a065ea..a852924b 100644 --- a/R/sof.cube.R +++ b/R/sof.cube.R @@ -1,8 +1,13 @@ +#' @title #' Cube Function -#' +#' +#' @description #' The Cube Function is defined as follows: #' \deqn{f(\mathbf{x}) = 100 (\mathbf{x}_2 - \mathbf{x}_1^3)^2 + (1 - \mathbf{x}_1)^2.} #' The box-constraints are given by \eqn{\mathbf{x}_i \in [-10, 10], i = 1, 2.} +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Cube Function. #' #' @references A. Lavi, T. P. Vogel (eds), Recent Advances in Optimization #' Techniques, John Wliley & Sons, 1966. @@ -17,7 +22,7 @@ makeCubeFunction = function() { checkNumericInput(x, 2L) 100 * (x[2] - x[1]^3)^2 + (1 - x[1])^2 }, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 2L, id = "x", lower = c(-10, -10), diff --git a/R/sof.deckkers.aarts.R b/R/sof.deckkers.aarts.R index 76c3f212..be47ddd1 100644 --- a/R/sof.deckkers.aarts.R +++ b/R/sof.deckkers.aarts.R @@ -1,9 +1,14 @@ +#' @title #' Deckkers-Aarts Function #' +#' @description #' This continuous single-objective test function is defined by the formula #' \deqn{f(\mathbf{x}) = 10^5\mathbf{x}_1^2 + \mathbf{x}_2^2 - (\mathbf{x}_1^2 + \mathbf{x}_2^2)^2 + 10^{-5} (\mathbf{x}_1^2 + \mathbf{x}_2^2)^4} #' with the bounding box \eqn{-20 \leq \mathbf{x}_i \leq 20} for \eqn{i = 1, 2}. #' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Deckkers-Aarts Function. +#' #' @references M. M. Ali, C. Khompatraporn, Z. B. Zabinsky, A Numerical Evaluation #' of Several Stochastic Algorithms on Selected Continuous Global Optimization #' Test Problems, Journal of Global Optimization, vol. 31, pp. 635-672, 2005. @@ -20,7 +25,7 @@ makeDeckkersAartsFunction = function() { b = x[2]^2 1e+05 * a + b - (a + b)^2 + 1e-05 * (a + b)^4 }, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 2L, id = "x", lower = c(-20, -20), diff --git a/R/sof.deflected.corrugated.spring.R b/R/sof.deflected.corrugated.spring.R index 4ea115e8..88a3ffb9 100644 --- a/R/sof.deflected.corrugated.spring.R +++ b/R/sof.deflected.corrugated.spring.R @@ -14,12 +14,16 @@ #' @param alpha [\code{numeric(1)}]\cr #' Parameter. #' Default is 5. +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Deflected Corrugated Spring Function. +#' #' @template ret_smoof_single #' @export makeDeflectedCorrugatedSpringFunction = function(dimensions, K = 5, alpha = 5) { - assertCount(dimensions) - assertNumber(K) - assertNumber(alpha) + checkmate::assertCount(dimensions) + checkmate::assertNumber(K) + checkmate::assertNumber(alpha) force(K) force(alpha) @@ -35,7 +39,7 @@ makeDeflectedCorrugatedSpringFunction = function(dimensions, K = 5, alpha = 5) { sa = sum(a) 0.1 * sa - cos(K * sqrt(sa)) }, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = dimensions, id = "x", lower = rep(0, dimensions), diff --git a/R/sof.dixon.price.R b/R/sof.dixon.price.R index 9e60f031..e4a3bc23 100644 --- a/R/sof.dixon.price.R +++ b/R/sof.dixon.price.R @@ -1,8 +1,13 @@ +#' @title #' Dixon-Price Function #' +#' @description #' Dixon and Price defined the function #' \deqn{f(\mathbf{x}) = (\mathbf{x}_1 - 1)^2 + \sum_{i = 1}^{n} i (2\mathbf{x}_i^2 - \mathbf{x}_{i - 1})} #' subject to \eqn{\mathbf{x}_i \in [-10, 10]} for \eqn{i = 1, \ldots, n}. +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Dixon-Price Function. #' #' @references L. C. W. Dixon, R. C. Price, The Truncated Newton Method for #' Sparse Unconstrained Optimisation Using Automatic Differentiation, Journal of @@ -12,7 +17,7 @@ #' @template ret_smoof_single #' @export makeDixonPriceFunction = function(dimensions) { - assertCount(dimensions) + checkmate::assertCount(dimensions) i = 1:dimensions force(dimensions) global.opt.params = 2^((-1) * (2^i - 2) / 2^i) @@ -26,7 +31,7 @@ makeDixonPriceFunction = function(dimensions) { b = sum(i * (2 * x[i]^2 - x[i - 1])^2) return(a + b) }, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = dimensions, id = "x", lower = rep(-10, dimensions), diff --git a/R/sof.double.sum.R b/R/sof.double.sum.R index 13aa055d..8b919367 100644 --- a/R/sof.double.sum.R +++ b/R/sof.double.sum.R @@ -1,8 +1,13 @@ +#' @title #' Double-Sum Function #' +#' @description #' Also known as the rotated hyper-ellipsoid function. The formula is given by #' \deqn{f(\mathbf{x}) = \sum_{i=1}^n \left( \sum_{j=1}^{i} \mathbf{x}_j \right)^2} #' with \eqn{\mathbf{x}_i \in [-65.536, 65.536], i = 1, \ldots, n}. +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Double-Sum Function. #' #' @references H.-P. Schwefel. Evolution and Optimum Seeking. #' John Wiley & Sons, New York, 1995. @@ -11,7 +16,7 @@ #' @template ret_smoof_single #' @export makeDoubleSumFunction = function(dimensions) { - assertCount(dimensions) + checkmate::assertCount(dimensions) force(dimensions) makeSingleObjectiveFunction( name = paste(dimensions, "-d Double-Sum Function", sep = ""), @@ -21,7 +26,7 @@ makeDoubleSumFunction = function(dimensions) { # this is faster than the soobench C implementation sum(cumsum(x)^2) }, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = dimensions, id = "x", lower = rep(-65.536, dimensions), diff --git a/R/sof.drop.wave.R b/R/sof.drop.wave.R index 08a4337e..2d47fc7e 100644 --- a/R/sof.drop.wave.R +++ b/R/sof.drop.wave.R @@ -1,14 +1,19 @@ +#' @title #' Generalized Drop-Wave Function #' -#' Multimodal single-objective function following the formula: +#' @description +#' Multi-modal single-objective function following the formula: #' \deqn{\mathbf{x} = -\frac{1 + \cos(\sqrt{\sum_{i = 1}^{n} \mathbf{x}_i^2})}{2 + 0.5 \sum_{i = 1}^{n} \mathbf{x}_i^2}} #' with \eqn{\mathbf{x}_i \in [-5.12, 5.12], i = 1, \ldots, n}. +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Generalized Drop-Wave Function. #' #' @template arg_dimensions #' @template ret_smoof_single #' @export makeGeneralizedDropWaveFunction = function(dimensions = 2L) { - assertCount(dimensions) + checkmate::assertCount(dimensions) force(dimensions) makeSingleObjectiveFunction( name = paste(dimensions, "-d Generelized Drop-Wave Function", sep = ""), @@ -18,7 +23,7 @@ makeGeneralizedDropWaveFunction = function(dimensions = 2L) { a = sum(x^2) -(1 + cos(12 * sqrt(a))) / (0.5 * a + 2) }, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = dimensions, id = "x", lower = rep(-5.12, dimensions), diff --git a/R/sof.easom.R b/R/sof.easom.R index b4189562..f3ad37bd 100644 --- a/R/sof.easom.R +++ b/R/sof.easom.R @@ -1,10 +1,15 @@ +#' @title #' Easom Function #' -#' Unimodal function with its global optimum in the center of the search space. +#' @description +#' Uni-modal function with its global optimum in the center of the search space. #' The attraction area of the global optimum is very small in relation to the #' search space: #' \deqn{f(\mathbf{x}) = -\cos(\mathbf{x}_1)\cos(\mathbf{x}_2)\exp\left(-\left((\mathbf{x}_1 - \pi)^2 + (\mathbf{x}_2 - pi)^2\right)\right)} #' with \eqn{\mathbf{x}_i \in [-100, 100], i = 1,2.} +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Easom Function. #' #' @references Easom, E. E.: A survey of global optimization techniques. M. Eng. #' thesis, University of Louisville, Louisville, KY, 1990. @@ -19,7 +24,7 @@ makeEasomFunction = function() { checkNumericInput(x, 2L) -cos(x[1]) * cos(x[2]) * exp(-((x[1] - pi)^2 + (x[2] - pi)^2)) }, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 2L, id = "x", lower = c(-100, -100), diff --git a/R/sof.eggcrate.R b/R/sof.eggcrate.R index 44e5d03b..13e78ed8 100644 --- a/R/sof.eggcrate.R +++ b/R/sof.eggcrate.R @@ -1,8 +1,13 @@ +#' @title #' Egg Crate Function #' +#' @description #' This single-objective function follows the definition #' \deqn{f(\mathbf{x}) = \mathbf{x}_1^2 + \mathbf{x}_2^2 + 25(\sin^2(\mathbf{x}_1) + \sin^2(\mathbf{x}_2))} #' with \eqn{\mathbf{x}_i \in [-5, 5]} for \eqn{i = 1, 2}. +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Egg Crate Function. #' #' @template ret_smoof_single #' @export @@ -14,7 +19,7 @@ makeEggCrateFunction = function() { checkNumericInput(x, 2L) x[1]^2 + x[2]^2 + 25 * (sin(x[1])^2 + sin(x[2])^2) }, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 2L, id = "x", lower = c(-5, -5), diff --git a/R/sof.eggholder.R b/R/sof.eggholder.R index a897ce3c..7ec0154a 100644 --- a/R/sof.eggholder.R +++ b/R/sof.eggholder.R @@ -1,9 +1,14 @@ +#' @title #' Egg Holder function #' +#' @description #' The Egg Holder function is a difficult to optimize function based on the #' definition #' \deqn{f(\mathbf{x}) = \sum_{i = 1}^{n-1} \left[-(\mathbf{x}_{i + 1} + 47)\sin\sqrt{|\mathbf{x}_{i + 1} + 0.5 \mathbf{x}_{i} + 47|} - \mathbf{x}_i\sin(\sqrt{|\mathbf{x}_i - (\mathbf{x}_{i + 1} - 47)|})\right]} #' subject to \eqn{-512 \leq \mathbf{x}_i \leq 512} for \eqn{i = 1, \ldots, n}. +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Egg Holder Function. #' #' @template ret_smoof_single #' @export diff --git a/R/sof.el.attar.vidyasagar.dutta.R b/R/sof.el.attar.vidyasagar.dutta.R index 7fe33f0e..2461970a 100644 --- a/R/sof.el.attar.vidyasagar.dutta.R +++ b/R/sof.el.attar.vidyasagar.dutta.R @@ -1,12 +1,17 @@ +#' @title #' El-Attar-Vidyasagar-Dutta Function #' +#' @description #' This function is based on the formula #' \deqn{f(\mathbf{x}) = (\mathbf{x}_1^2 + \mathbf{x}_2 - 10)^2 + (\mathbf{x}_1 + \mathbf{x}_2^2 - 7)^2 + (\mathbf{x}_1^2 + \mathbf{x}_2^3 - 1)^2} #' subject to \eqn{\mathbf{x}_i \in [-500, 500], i = 1, 2}. +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the El-Attar-Vidyasagar-Dutta Function. #' #' @references R. A. El-Attar, M. Vidyasagar, S. R. K. Dutta, An Algorithm for -#' II-norm Minimiza- tion With Application to Nonlinear II-approximation, SIAM -#' Journal on Numverical Analysis, vol. 16, no. 1, pp. 70-86, 1979. +#' II-norm Minimization With Application to Nonlinear II-approximation, SIAM +#' Journal on Numerical Analysis, vol. 16, no. 1, pp. 70-86, 1979. #' #' @template ret_smoof_single #' @export @@ -18,7 +23,7 @@ makeElAttarVidyasagarDuttaFunction = function() { checkNumericInput(x, 2L) (x[1]^2 + x[2] - 10)^2 + (x[1] + x[2]^2 - 7)^2 + (x[1]^2 + x[2]^3 - 1)^2 }, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 2L, id = "x", lower = c(-100, -100), diff --git a/R/sof.engvall.R b/R/sof.engvall.R index 574c0e8f..d905ffcb 100644 --- a/R/sof.engvall.R +++ b/R/sof.engvall.R @@ -3,6 +3,9 @@ #' @description Two-dimensional test function based on the formula #' \deqn{f(\mathbf{x}) = (x_1^4 + x_2^4 + 2 x_1^2 x_2^2 - 4 x_1 + 3} #' with \eqn{\mathbf{x}_1, \mathbf{x}_2 \in [-2000, 2000]}. +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Complex Function. #' #' @references See \url{https://al-roomi.org/benchmarks/unconstrained/2-dimensions/116-engvall-s-function}. #' @@ -16,7 +19,7 @@ makeEngvallFunction = function() { checkNumericInput(x, 2L) x[1]^4 + x[2]^4 + 2 * x[1]^2 * x[2]^2 - 4 * x[1] + 3 }, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 2L, id = "x", lower = c(-2000, -2000), diff --git a/R/sof.exponential.R b/R/sof.exponential.R index 4c1bc332..f5d5530e 100644 --- a/R/sof.exponential.R +++ b/R/sof.exponential.R @@ -1,8 +1,13 @@ +#' @title #' Exponential Function #' +#' @description #' This scalable test function is based on the definition #' \deqn{f(\mathbf{x}) = -\exp\left(-0.5 \sum_{i = 1}^{n} \mathbf{x}_i^2\right)} #' with the box-constraints \eqn{\mathbf{x}_i \in [-1, 1], i = 1, \ldots, n}. +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Exponential Function. #' #' @references S. Rahnamyan, H. R. Tizhoosh, N. M. M. Salama, Opposition-Based #' Differential Evolution (ODE) with Variable Jumping Rate, IEEE Sympousim @@ -12,7 +17,7 @@ #' @template ret_smoof_single #' @export makeExponentialFunction = function(dimensions) { - assertCount(dimensions) + checkmate::assertCount(dimensions) force(dimensions) makeSingleObjectiveFunction( name = paste(dimensions, "-d Exponential Function", sep = ""), @@ -21,7 +26,7 @@ makeExponentialFunction = function(dimensions) { checkNumericInput(x, dimensions) -exp(-0.5 * sum(x^2)) }, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = dimensions, id = "x", lower = rep(-1, dimensions), diff --git a/R/sof.freudenstein.roth.R b/R/sof.freudenstein.roth.R index fb1ed0eb..c49b8508 100644 --- a/R/sof.freudenstein.roth.R +++ b/R/sof.freudenstein.roth.R @@ -1,8 +1,13 @@ +#' @title #' Freudenstein Roth Function #' +#' @description #' This test function is based on the formula #' \deqn{f(\mathbf{x}) = (\mathbf{x}_1 - 13 + ((5 - \mathbf{x}_2)\mathbf{x}_2 - 2)\mathbf{x}_2)^2 + (\mathbf{x}_1 - 29 + ((\mathbf{x}_2 + 1)\mathbf{x}_2 - 14)\mathbf{x}_2)^2} #' subject to \eqn{\mathbf{x}_i \in [-10, 10], i = 1, 2}. +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Freundstein-Roth Function. #' #' @references S. S. Rao, Engineering Optimization: Theory and Practice, #' John Wiley & Sons, 2009. @@ -17,7 +22,7 @@ makeFreudensteinRothFunction = function() { checkNumericInput(x, 2L) (x[1] - 13 + ((5 - x[2]) * x[2] - 2) * x[2])^2 + (x[1] - 29 + ((x[2] + 1) * x[2] - 14) * x[2])^2 }, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 2L, id = "x", lower = c(-10, -10), diff --git a/R/sof.giunta.R b/R/sof.giunta.R index f98b8286..adbe5d44 100644 --- a/R/sof.giunta.R +++ b/R/sof.giunta.R @@ -1,8 +1,13 @@ +#' @title #' Giunta Function #' -#' Multimodal test function based on the definition +#' @description +#' Multi-modal test function based on the definition #' \deqn{f(\mathbf{x}) = 0.6 + \sum_{i = 1}^{n} \left[\sin(\frac{16}{15} \mathbf{x}_i - 1) + \sin^2(\frac{16}{15}\mathbf{x}_i - 1) + \frac{1}{50} \sin(4(\frac{16}{15}\mathbf{x}_i - 1))\right]} #' with box-constraints \eqn{\mathbf{x}_i \in [-1, 1]} for \eqn{i = 1, \ldots, n}. +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Giunta Function. #' #' @references S. K. Mishra, Global Optimization By Differential Evolution and #' Particle Swarm Methods: Evaluation On Some Benchmark Functions, Munich @@ -21,7 +26,7 @@ makeGiuntaFunction = function() { b = sin(a) 0.6 + sum(b + b^2 + 0.02 * sin(4 * a)) }, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 2L, id = "x", lower = rep(-1, 2), diff --git a/R/sof.goldstein.price.R b/R/sof.goldstein.price.R index e6be4cbe..d726db36 100644 --- a/R/sof.goldstein.price.R +++ b/R/sof.goldstein.price.R @@ -1,9 +1,14 @@ +#' @title #' Goldstein-Price Function #' +#' @description #' Two-dimensional test function for global optimization. The implementation #' follows the formula: #' \deqn{f(\mathbf{x}) = \left(1 + (\mathbf{x}_1 + \mathbf{x}_2 + 1)^2 \cdot (19 - 14\mathbf{x}_1 + 3\mathbf{x}_1^2 - 14\mathbf{x}_2 + 6\mathbf{x}_1\mathbf{x}_2 + 3\mathbf{x}_2^2)\right)\\ \qquad \cdot \left(30 + (2\mathbf{x}_1 - 3\mathbf{x}_2)^2 \cdot (18 - 32\mathbf{x}_1 + 12\mathbf{x}_1^2 + 48\mathbf{x}_2 - 36\mathbf{x}_1\mathbf{x}_2 + 27\mathbf{x}_2^2)\right)} #' with \eqn{\mathbf{x}_i \in [-2, 2], i = 1, 2}. +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Goldstein-Price Function. #' #' @references Goldstein, A. A. and Price, I. F.: On descent from local minima. #' Math. Comput., Vol. 25, No. 115, 1971. @@ -23,7 +28,7 @@ makeGoldsteinPriceFunction = function() { b = 30 + (2 * x[1] - 3 * x[2])^2 * (18 - 32 * x[1] + 12 * xx1 + 48 * x[2] - 36 * xx12 + 27 * xx2) return (a * b) }, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 2L, id = "x", lower = c(-2, -2), diff --git a/R/sof.griewank.R b/R/sof.griewank.R index a7d08938..fb00df2e 100644 --- a/R/sof.griewank.R +++ b/R/sof.griewank.R @@ -1,9 +1,14 @@ +#' @title #' Griewank Function #' -#' Highly multimodal function with a lot of regularly distributed local minima. +#' @description +#' Highly multi-modal function with a lot of regularly distributed local minima. #' The corresponding formula is: #' \deqn{f(\mathbf{x}) = \sum_{i=1}^{n} \frac{\mathbf{x}_i^2}{4000} - \prod_{i=1}^{n} \cos\left(\frac{\mathbf{x}_i}{\sqrt{i}}\right) + 1} #' subject to \eqn{\mathbf{x}_i \in [-100, 100], i = 1, \ldots, n}. +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Griewank Function. #' #' @references A. O. Griewank, Generalized Descent for Global Optimization, #' Journal of Optimization Theory and Applications, vol. 34, no. 1, @@ -13,7 +18,7 @@ #' @template ret_smoof_single #' @export makeGriewankFunction = function(dimensions) { - assertCount(dimensions) + checkmate::assertCount(dimensions) force(dimensions) makeSingleObjectiveFunction( name = paste(dimensions, "-d Griewank Function", sep = ""), @@ -24,7 +29,7 @@ makeGriewankFunction = function(dimensions) { b = prod(cos(x / sqrt(1:length(x)))) return(a - b + 1) }, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = dimensions, id = "x", lower = rep(-100, dimensions), diff --git a/R/sof.hansen.R b/R/sof.hansen.R index dc341517..db4ccadc 100644 --- a/R/sof.hansen.R +++ b/R/sof.hansen.R @@ -1,8 +1,13 @@ +#' @title #' Hansen Function #' +#' @description #' Test function with multiple global optima based on the definition #' \deqn{f(\mathbf{x}) = \sum_{i = 1}^{4} (i + 1)\cos(i\mathbf{x}_1 + i - 1) \sum_{j = 1}^{4} (j + 1)\cos((j + 2) \mathbf{x}_2 + j + 1)} #' subject to \eqn{\mathbf{x}_i \in [-10, 10], i = 1, 2}. +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Hansen Function. #' #' @references C. Fraley, Software Performances on Nonlinear lems, Technical #' Report no. STAN-CS-89-1244, Computer Science, Stanford University, 1989. @@ -20,7 +25,7 @@ makeHansenFunction = function() { b = sum((j + 1) * cos((j + 2) * x[2] + j + 1)) return (a * b) }, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 2L, id = "x", lower = c(-10, -10), diff --git a/R/sof.hartmann.R b/R/sof.hartmann.R index 208cb999..66a7082f 100644 --- a/R/sof.hartmann.R +++ b/R/sof.hartmann.R @@ -1,6 +1,8 @@ +#' @title #' Hartmann Function #' -#' Unimodal single-objective test function with six local minima. +#' @description +#' Uni-modal single-objective test function with six local minima. #' The implementation is based on the mathematical formulation #' \deqn{f(x) = - \sum_{i=1}^4 \alpha_i \ exp \left(-\sum_{j=1}^6 A_{ij}(x_j-P_{ij})^2 \right)}, where #' \deqn{\alpha = (1.0, 1.2, 3.0, 3.2)^T, \\ @@ -18,6 +20,9 @@ #' \end{array} \right)} #' The function is restricted to six dimensions with \eqn{\mathbf{x}_i \in [0,1], i = 1, \ldots, 6.} #' The function is not normalized in contrast to some benchmark applications in the literature. +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Hartmann Function. #' #' @references Picheny, V., Wagner, T., & Ginsbourger, D. (2012). A benchmark #' of kriging-based infill criteria for noisy optimization. @@ -26,7 +31,7 @@ #' @template ret_smoof_single #' @export makeHartmannFunction = function(dimensions) { - assertChoice(dimensions, c(3L, 4L, 6L)) + checkmate::assertChoice(dimensions, c(3L, 4L, 6L)) force(dimensions) i = seq_len(dimensions) @@ -73,7 +78,7 @@ makeHartmannFunction = function(dimensions) { inner = rowSums(A[, i] * (x.mat - P[, i])^2) -sum(alpha * exp(-inner)) }, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = dimensions, id = "x", lower = 0, diff --git a/R/sof.himmelblau.R b/R/sof.himmelblau.R index 5be79bcf..8d486452 100644 --- a/R/sof.himmelblau.R +++ b/R/sof.himmelblau.R @@ -1,8 +1,13 @@ +#' @title #' Himmelblau Function #' -#' Two-dimensional test function based on the function defintion +#' @description +#' Two-dimensional test function based on the function definition #' \deqn{f(\mathbf{x}) = (\mathbf{x}_1^2 + \mathbf{x}_2 - 11)^2 + (\mathbf{x}_1 + \mathbf{x}_2^2 - 7)^2} -#' with box-constraings \eqn{\mathbf{x}_i \in [-5, 5], i = 1, 2}. +#' with box-constraints \eqn{\mathbf{x}_i \in [-5, 5], i = 1, 2}. +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Himmelblau Function. #' #' @references D. M. Himmelblau, Applied Nonlinear Programming, McGraw-Hill, 1972. #' @@ -16,7 +21,7 @@ makeHimmelblauFunction = function() { checkNumericInput(x, 2L) (x[1]^2 + x[2] - 11)^2 + (x[1] + x[2]^2 - 7)^2 }, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 2L, id = "x", lower = c(-5, -5), diff --git a/R/sof.holder.table.n1.R b/R/sof.holder.table.n1.R index f939f4e5..5e186e8a 100644 --- a/R/sof.holder.table.n1.R +++ b/R/sof.holder.table.n1.R @@ -1,8 +1,13 @@ +#' @title #' Holder Table function N. 1 -#' -#' This multimodal function is defined as +#' +#' @description +#' This multi-modal function is defined as #' \deqn{f(\mathbf{x}) = -\left|\cos(\mathbf{x}_1)\cos(\mathbf{x}_2)\exp(|1 - \sqrt{\mathbf{x}_1 + \mathbf{x}_2}/\pi|)\right|} #' with box-constraints \eqn{\mathbf{x}_i \in [-10, 10], i = 1, 2}. +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Holder Table function N. 1 Function. #' #' @references S. K. Mishra, Global Optimization By Differential Evolution and #' Particle Swarm Methods: Evaluation On Some Benchmark Functions, Munich @@ -20,7 +25,7 @@ makeHolderTableN1Function = function() { checkNumericInput(x, 2L) -abs(cos(x[1]) * cos(x[2]) * exp(abs(1 - sqrt(x[1]^2 + x[2]^2) / 3.1415))) }, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 2L, id = "x", lower = c(-10, -10), diff --git a/R/sof.holder.table.n2.R b/R/sof.holder.table.n2.R index 787e8543..10f1bda0 100644 --- a/R/sof.holder.table.n2.R +++ b/R/sof.holder.table.n2.R @@ -1,8 +1,13 @@ +#' @title #' Holder Table function N. 2 #' -#' This multimodal function is defined as +#' @description +#' This multi-modal function is defined as #' \deqn{f(\mathbf{x}) = -\left|\sin(\mathbf{x}_1)\cos(\mathbf{x}_2)\exp(|1 - \sqrt{\mathbf{x}_1 + \mathbf{x}_2}/\pi|)\right|} #' with box-constraints \eqn{\mathbf{x}_i \in [-10, 10], i = 1, 2}. +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Holder Table function N. 2 Function. #' #' @references S. K. Mishra, Global Optimization By Differential Evolution and #' Particle Swarm Methods: Evaluation On Some Benchmark Functions, Munich @@ -20,7 +25,7 @@ makeHolderTableN2Function = function() { checkNumericInput(x, 2L) -abs(sin(x[1]) * cos(x[2]) * exp(abs(1 - sqrt(x[1]^2 + x[2]^2) / 3.1415))) }, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 2L, id = "x", lower = c(-10, -10), diff --git a/R/sof.hosaki.R b/R/sof.hosaki.R index fd613ee5..0e45afd3 100644 --- a/R/sof.hosaki.R +++ b/R/sof.hosaki.R @@ -1,8 +1,13 @@ +#' @title #' Hosaki Function #' +#' @description #' Two-dimensional test function \eqn{f} with #' \deqn{f(\mathbf{x}) = (1 - 8 \mathbf{x}_1 + 7 \mathbf{x}_1^2 - 7/3 \mathbf{x}_1^3 + 1/4 \mathbf{x}_1^4)\mathbf{x}_2^2e^{-\mathbf{x}_2}} #' subject to \eqn{0 \leq \mathbf{x}_1 \leq 5} and \eqn{0 \leq \mathbf{x}_2 \leq 6}. +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Hosaki Function. #' #' @references G. A. Bekey, M. T. Ung, A Comparative Evaluation of Two Global #' Search Algorithms, IEEE Transaction on Systems, Man and Cybernetics, vol. 4, @@ -18,7 +23,7 @@ makeHosakiFunction = function() { checkNumericInput(x, 2L) (1 - 8 * x[1] + 7 * x[1]^2 - 7 * x[1]^3 / 3 + 0.25 * x[1]^4) * x[2]^2 * exp(-x[2]) }, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 2L, id = "x", lower = c(0, 0), diff --git a/R/sof.hyper.ellipsoid.R b/R/sof.hyper.ellipsoid.R index 1fe4a09a..b35af389 100644 --- a/R/sof.hyper.ellipsoid.R +++ b/R/sof.hyper.ellipsoid.R @@ -1,13 +1,18 @@ +#' @title #' Hyper-Ellipsoid function #' -#' Unimodal, convex test function similar to the Sphere function (see \code{\link{makeSphereFunction}}). +#' @description +#' Uni-modal, convex test function similar to the Sphere function (see \code{\link{makeSphereFunction}}). #' Calculated via the formula: \deqn{f(\mathbf{x}) = \sum_{i=1}^{n} i \cdot \mathbf{x}_i.} +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Hyper-Ellipsoid Function. #' #' @template arg_dimensions #' @template ret_smoof_single #' @export makeHyperEllipsoidFunction = function(dimensions) { - assertCount(dimensions) + checkmate::assertCount(dimensions) force(dimensions) makeSingleObjectiveFunction( name = paste(dimensions, "-d Hyper-Ellipsoid function", sep = ""), @@ -18,7 +23,7 @@ makeHyperEllipsoidFunction = function(dimensions) { n = length(x) sum(1:n * x^2) }, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = dimensions, id = "x", lower = rep(-5.12, dimensions), diff --git a/R/sof.jennrichsampson.R b/R/sof.jennrichsampson.R index db301eff..99131c9f 100644 --- a/R/sof.jennrichsampson.R +++ b/R/sof.jennrichsampson.R @@ -3,6 +3,9 @@ #' @description Two-dimensional test function based on the formula #' \deqn{f(\mathbf{x}) = \sum_{i=1}^{10} \left[2 + 2i - (e^{ix_1} + e^{ix_2})\right]^2} #' with \eqn{\mathbf{x}_1, \mathbf{x}_2 \in [-1, 1]}. +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Jennrich-Sampson Function. #' #' @references See \url{https://al-roomi.org/benchmarks/unconstrained/2-dimensions/134-jennrich-sampson-s-function}. #' @@ -17,7 +20,7 @@ makeJennrichSampsonFunction = function() { i = 1:10 sum((2 + 2 * i - (exp(i * x[1]) + exp(i * x[2])))^2) }, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 2L, id = "x", lower = c(-1, -1), diff --git a/R/sof.judge.R b/R/sof.judge.R index c61f8160..078f5a59 100644 --- a/R/sof.judge.R +++ b/R/sof.judge.R @@ -1,9 +1,14 @@ -#' @title Judge function. +#' @title +#' Judge function. #' -#' @description Two-dimensional test function based on the formula +#' @description +#' Two-dimensional test function based on the formula #' \deqn{f(\mathbf{x}) = \sum_{i=1}^{20} \left[(x_1 + B_i x_2 + C_i x_2^2) - A_i\right]^2} #' with \eqn{\mathbf{x}_1, \mathbf{x}_2 \in [-10, 10]}. For details on \eqn{A, B, C} #' see the referenced website. +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Judge Function. #' #' @references See \url{https://al-roomi.org/benchmarks/unconstrained/2-dimensions/133-judge-s-function}. #' @@ -21,7 +26,7 @@ makeJudgeFunction = function() { i = 1:20 sum(((x[1] + B * x[2] + C * x[2]^2) - A)^2) }, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 2L, id = "x", lower = c(-10, -10), diff --git a/R/sof.keane.R b/R/sof.keane.R index e0d81d72..b414752d 100644 --- a/R/sof.keane.R +++ b/R/sof.keane.R @@ -1,9 +1,14 @@ +#' @title #' Keane Function #' -#' Two-dimensional test function based on the defintion +#' @description +#' Two-dimensional test function based on the definition #' \deqn{f(\mathbf{x}) = \frac{\sin^2(\mathbf{x}_1 - \mathbf{x}_2)\sin^2(\mathbf{x}_1 + \mathbf{x}_2)}{\sqrt{\mathbf{x}_1^2 + \mathbf{x}_2^2}}.} #' The domain of definition is bounded by the box constraints #' \eqn{\mathbf{x}_i \in [0, 10], i = 1, 2}. +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Keane Function. #' #' @template ret_smoof_single #' @export @@ -17,7 +22,7 @@ makeKeaneFunction = function() { b = sqrt(x[1]^2 + x[2]^2) return (a / b) }, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 2L, id = "x", lower = c(0, 0), diff --git a/R/sof.kearfott.R b/R/sof.kearfott.R index de15cfcb..e72ec11b 100644 --- a/R/sof.kearfott.R +++ b/R/sof.kearfott.R @@ -1,8 +1,13 @@ -#' @title Kearfott function. +#' @title +#' Kearfott function. #' -#' @description Two-dimensional test function based on the formula +#' @description +#' Two-dimensional test function based on the formula #' \deqn{f(\mathbf{x}) = (x_1^2 + x_2^2 - 2)^2 + (x_1^2 - x_2^2 - 1)^2} #' with \eqn{\mathbf{x}_1, \mathbf{x}_2 \in [-3, 4]}. +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Kearfott Function. #' #' @references See \url{https://al-roomi.org/benchmarks/unconstrained/2-dimensions/59-kearfott-s-function}. #' @@ -16,7 +21,7 @@ makeKearfottFunction = function() { checkNumericInput(x, 2L) (x[1]^2 + x[2]^2 - 2)^2 + (x[1]^2 - x[2]^2 - 1)^2 }, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 2L, id = "x", lower = c(-3, -3), diff --git a/R/sof.leon.R b/R/sof.leon.R index 15dda770..53013012 100644 --- a/R/sof.leon.R +++ b/R/sof.leon.R @@ -1,8 +1,13 @@ +#' @title #' Leon Function #' -#' The function is based on the defintion +#' @description +#' The function is based on the definition #' \deqn{f(\mathbf{x}) = 100 (\mathbf{x}_2 - \mathbf{x}_1^2)^2 + (1 - \mathbf{x}_1)^2}. #' Box-constraints: \eqn{\mathbf{x}_i \in [-1.2, 1.2]} for \eqn{i = 1, 2}. +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Leon Function. #' #' @references A. Lavi, T. P. Vogel (eds), Recent Advances in Optimization #' Techniques, John Wliley & Sons, 1966. @@ -17,7 +22,7 @@ makeLeonFunction = function() { checkNumericInput(x, 2L) 100 * (x[2] - x[1]^2)^2 + (1 - x[1])^2 }, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 2L, id = "x", lower = c(-1.2, -1.2), diff --git a/R/sof.matyas.R b/R/sof.matyas.R index 815ab70c..f5fa1b9d 100644 --- a/R/sof.matyas.R +++ b/R/sof.matyas.R @@ -1,8 +1,13 @@ +#' @title #' Matyas Function #' -#' Two-dimensional, unimodal test function +#' @description +#' Two-dimensional, uni-modal test function #' \deqn{f(\mathbf{x}) = 0.26 (\mathbf{x}_1^2 + \mathbf{x}_2^2) - 0.48\mathbf{x}_1\mathbf{x}_2} #' subject to \eqn{\mathbf{x}_i \in [-10, 10], i = 1, 2}. +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Matyas Function. #' #' @references A.-R. Hedar, Global Optimization Test Problems. #' @@ -16,7 +21,7 @@ makeMatyasFunction = function() { checkNumericInput(x, 2L) 0.26 * (x[1]^2 + x[2]^2) - 0.48 * x[1] * x[2] }, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 2L, id = "x", lower = c(-10, -10), diff --git a/R/sof.mccormick.R b/R/sof.mccormick.R index f0b3ded5..836d584b 100644 --- a/R/sof.mccormick.R +++ b/R/sof.mccormick.R @@ -1,8 +1,13 @@ +#' @title #' McCormick Function #' -#' Two-dimensional, multimodal test function. The defintion is given by +#' @description +#' Two-dimensional, multi-modal test function. The definition is given by #' \deqn{f(\mathbf{x}) = \sin(\mathbf{x}_1 + \mathbf{x}_2) + (\mathbf{x}_1 - \mathbf{x}_2)^2 - 1.5 \mathbf{x}_1 + 2.5 \mathbf{x}_2 + 1} #' subject to \eqn{\mathbf{x}_1 \in [-1.5, 4], \mathbf{x}_2 \in [-3, 3]}. +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the McCormick Function. #' #' @references F. A. Lootsma (ed.), Numerical Methods for Non-Linear #' Optimization, Academic Press, 1972. @@ -17,7 +22,7 @@ makeMcCormickFunction = function() { checkNumericInput(x, 2L) sin(x[1] + x[2]) + (x[1] - x[2])^2 - 1.5 * x[1] + 2.5 * x[2] + 1 }, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 2L, id = "x", lower = c(-1.5, -3), diff --git a/R/sof.michalewicz.R b/R/sof.michalewicz.R index 88197f13..e3e2c2b1 100644 --- a/R/sof.michalewicz.R +++ b/R/sof.michalewicz.R @@ -1,10 +1,15 @@ +#' @title #' Michalewicz Function #' -#' Highly multimodal single-objective test function with \eqn{n!} local minima +#' @description +#' Highly multi-modal single-objective test function with \eqn{n!} local minima #' with the formula: #' \deqn{f(\mathbf{x}) = -\sum_{i=1}^{n} \sin(\mathbf{x}_i) \cdot \left(\sin\left(\frac{i \cdot \mathbf{x}_i}{\pi}\right)\right)^{2m}.} #' The recommended value \eqn{m = 10}, which is used as a default in the #' implementation. +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Michalewicz Function. #' #' @note The location of the global optimum s varying based on both #' the dimension and \eqn{m} parameter and is thus not provided in the @@ -19,8 +24,8 @@ #' @template ret_smoof_single #' @export makeMichalewiczFunction = function(dimensions, m = 10) { - assertCount(dimensions) - assertNumber(m) + checkmate::assertCount(dimensions) + checkmate::assertNumber(m) force(m) makeSingleObjectiveFunction( name = paste(dimensions, "-d Michalewicz Function (m = ", m, ")", sep = ""), @@ -30,7 +35,7 @@ makeMichalewiczFunction = function(dimensions, m = 10) { i = 1:length(x) (-1) * sum(sin(x) * (sin((i * x^2) / pi)^(2 * m))) }, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = dimensions, id = "x", lower = rep(0, dimensions), diff --git a/R/sof.modrastrigin.R b/R/sof.modrastrigin.R index 3c3eddb8..00cf361e 100644 --- a/R/sof.modrastrigin.R +++ b/R/sof.modrastrigin.R @@ -1,12 +1,17 @@ +#' @title #' Rastrigin Function #' +#' @description #' A modified version of the Rastrigin function following the formula: #' \deqn{f(\mathbf{x}) = \sum_{i=1}^{n} 10\left(1 + \cos(2\pi k_i \mathbf{x}_i)\right) + 2 k_i \mathbf{x}_i^2.} #' The box-constraints are given by \eqn{\mathbf{x}_i \in [0, 1]} for #' \eqn{i = 1, \ldots, n} and \eqn{k} is a numerical vector. Deb et al. (see references) #' use, e.g., \eqn{k = (2, 2, 3, 4)} for \eqn{n = 4}. See the reference for details. +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Rastrigin Function. #' -#' @references Kalyanmoy Deb and Amit Saha. Multimodal optimization using a bi- +#' @references Kalyanmoy Deb and Amit Saha. Multi-modal optimization using a bi- #' objective evolutionary algorithm. Evolutionary Computation, 20(1):27-62, 2012. #' #' @template arg_dimensions @@ -16,7 +21,7 @@ #' @template ret_smoof_single #' @export makeModifiedRastriginFunction = function(dimensions, k = rep(1, dimensions)) { - assertCount(dimensions) + checkmate::assertCount(dimensions) force(dimensions) makeSingleObjectiveFunction( name = sprintf("%i-d Modified Rastrigin Function", dimensions), @@ -26,7 +31,7 @@ makeModifiedRastriginFunction = function(dimensions, k = rep(1, dimensions)) { n = length(x) sum(10 * (1 + cos(2 * pi * k * x)) + 2 * k * x^2) }, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = dimensions, id = "x", lower = rep(0, dimensions), diff --git a/R/sof.mpm2.R b/R/sof.mpm2.R index 64eea103..cbfba6d2 100644 --- a/R/sof.mpm2.R +++ b/R/sof.mpm2.R @@ -19,6 +19,7 @@ #' environment. However, evaluation in R is faster, especially if multiple #' MPM2 functions are used in a multi-objective setting. #' @return [\code{smoof_single_objective_function}] +#' An object of class \code{SingleObjectiveFunction}, representing the Multiple peaks model 2 Function. #' @examples #' \dontrun{ #' fn = makeMPM2Function(n.peaks = 10L, dimensions = 2L, @@ -47,15 +48,15 @@ makeMPM2Function = function(n.peaks, dimensions, topology, seed, rotated = TRUE, # n.peaks = 1L; dimensions = 2L; topology = "funnel"; seed = 3L; rotated = TRUE; peak.shape = "ellipse" # do some sanity checks - n.peaks = convertInteger(n.peaks) - dimensions = convertInteger(dimensions) - seed = convertInteger(seed) - assertInt(n.peaks, lower = 1L) - assertInt(dimensions, lower = 1L) - assertChoice(topology, choices = c("random", "funnel")) - assertInt(seed, lower = 1L) - assertLogical(rotated, any.missing = FALSE) - assertChoice(peak.shape, choices = c("ellipse", "sphere")) + n.peaks = BBmisc::convertInteger(n.peaks) + dimensions = BBmisc::convertInteger(dimensions) + seed = BBmisc::convertInteger(seed) + checkmate::assertInt(n.peaks, lower = 1L) + checkmate::assertInt(dimensions, lower = 1L) + checkmate::assertChoice(topology, choices = c("random", "funnel")) + checkmate::assertInt(seed, lower = 1L) + checkmate::assertLogical(rotated, any.missing = FALSE) + checkmate::assertChoice(peak.shape, choices = c("ellipse", "sphere")) # touch vars force(n.peaks) @@ -66,7 +67,7 @@ makeMPM2Function = function(n.peaks, dimensions, topology, seed, rotated = TRUE, force(peak.shape) # build parameter set (bounds are [0, 1]^d) - par.set = makeNumericParamSet("x", len = dimensions, lower = 0, upper = 1) + par.set = ParammHelpers::makeNumericParamSet("x", len = dimensions, lower = 0, upper = 1) # import reticulate namespace BBmisc::requirePackages("_reticulate", why = "smoof::makeMultiplePeaksModel2Function") diff --git a/R/sof.periodic.R b/R/sof.periodic.R index c38e6eed..e1d60a8e 100644 --- a/R/sof.periodic.R +++ b/R/sof.periodic.R @@ -1,8 +1,13 @@ +#' @title #' Periodic Function #' +#' @description #' Single-objective two-dimensional test function. The formula is given as #' \deqn{f(\mathbf{x}) = 1 + \sin^2(\mathbf{x}_1) + \sin^2(\mathbf{x}_2) - 0.1e^{-(\mathbf{x}_1^2 + \mathbf{x}_2^2)}} #' subject to the constraints \eqn{\mathbf{x}_i \in [-10, 10], i = 1, 2.} +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Periodic Function. #' #' @references M. M. Ali, C. Khompatraporn, Z. B. Zabinsky, A Numerical #' Evaluation of Several Stochastic Algorithms on Selected Continuous Global @@ -19,7 +24,7 @@ makePeriodicFunction = function() { checkNumericInput(x, 2L) 1 + sin(x[1])^2 + sin(x[2])^2 - 0.1 * exp(-x[1]^2 - x[2]^2) }, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 2L, id = "x", lower = c(-10, -10), diff --git a/R/sof.powell.sum.R b/R/sof.powell.sum.R index 1ac6741a..1c79015f 100644 --- a/R/sof.powell.sum.R +++ b/R/sof.powell.sum.R @@ -1,8 +1,13 @@ +#' @title #' Powell-Sum Function #' +#' @description #' The formula that underlies the implementation is given by #' \deqn{f(\mathbf{x}) = \sum_{i=1}^n |\mathbf{x}_i|^{i+1}} #' with \eqn{\mathbf{x}_i \in [-1, 1], i = 1, \ldots, n}. +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Powell-Sum Function. #' #' @references S. Rahnamyan, H. R. Tizhoosh, N. M. M. Salama, A Novel Population #' Initialization Method for Accelerating Evolutionary Algorithms, Computers and @@ -12,7 +17,7 @@ #' @template ret_smoof_single #' @export makePowellSumFunction = function(dimensions) { - assertCount(dimensions) + checkmate::assertCount(dimensions) force(dimensions) makeSingleObjectiveFunction( name = paste(dimensions, "-d Powell-Sum Function", sep = ""), @@ -22,7 +27,7 @@ makePowellSumFunction = function(dimensions) { a = (1:length(x)) + 1L sum(abs(x)^a) }, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = dimensions, id = "x", lower = rep(-1, dimensions), diff --git a/R/sof.price.n1.R b/R/sof.price.n1.R index 28161c7c..1a9464ad 100644 --- a/R/sof.price.n1.R +++ b/R/sof.price.n1.R @@ -1,11 +1,16 @@ +#' @title #' Price Function N. 1 #' -#' Second function by Price. The implementation is based on the defintion +#' @description +#' Second function by Price. The implementation is based on the definition #' \deqn{f(\mathbf{x}) = (|\mathbf{x}_1| - 5)^2 + (|\mathbf{x}_2 - 5)^2} #' subject to \eqn{\mathbf{x}_i \in [-500, 500], i = 1, 2}. +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Price N. 1 Function. #' #' @references W. L. Price, A Controlled Random Search Procedure for Global -#' Optimisation, Computer journal, vol. 20, no. 4, pp. 367-370, 1977. +#' Optimization, Computer journal, vol. 20, no. 4, pp. 367-370, 1977. #' #' @seealso \code{\link{makePriceN2Function}}, \code{\link{makePriceN4Function}} #' @@ -19,7 +24,7 @@ makePriceN1Function = function() { checkNumericInput(x, 2L) sum((abs(x) - 5)^2) }, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 2L, id = "x", lower = c(-500, -500), diff --git a/R/sof.price.n2.R b/R/sof.price.n2.R index 27c05b9e..661ced2b 100644 --- a/R/sof.price.n2.R +++ b/R/sof.price.n2.R @@ -1,8 +1,13 @@ +#' @title #' Price Function N. 2 -#' +#' +#' @description #' Second function by Price. The implementation is based on the defintion #' \deqn{f(\mathbf{x}) = 1 + \sin^2(\mathbf{x}_1) + \sin^2(\mathbf{x}_2) - 0.1 \exp(-\mathbf{x}^2 - \mathbf{x}_2^2)} #' subject to \eqn{\mathbf{x}_i \in [-10, 10], i = 1, 2}. +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Price N. 2 Function. #' #' @references W. L. Price, A Controlled Random Search Procedure for Global #' Optimisation, Computer journal, vol. 20, no. 4, pp. 367-370, 1977. @@ -19,7 +24,7 @@ makePriceN2Function = function() { checkNumericInput(x, 2L) 1 + sin(x[1])^2 + sin(x[2])^2 - 0.1 * exp(-x[1]^2 - x[2]^2) }, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 2L, id = "x", lower = c(-10, -10), diff --git a/R/sof.price.n4.R b/R/sof.price.n4.R index 6074b669..8dffd107 100644 --- a/R/sof.price.n4.R +++ b/R/sof.price.n4.R @@ -1,8 +1,13 @@ +#' @title #' Price Function N. 4 #' -#' Fourth function by Price. The implementation is based on the defintion +#' @description +#' Fourth function by Price. The implementation is based on the definition #' \deqn{f(\mathbf{x}) = (2\mathbf{x}_1^3 \mathbf{x}_2 - \mathbf{x}_2^3)^2 + (6\mathbf{x}_1 - \mathbf{x}_2^2 + \mathbf{x}_2)^2} #' subject to \eqn{\mathbf{x}_i \in [-500, 500]}. +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Price N. 4 Function. #' #' @references W. L. Price, A Controlled Random Search Procedure for Global #' Optimisation, Computer journal, vol. 20, no. 4, pp. 367-370, 1977. @@ -19,7 +24,7 @@ makePriceN4Function = function() { checkNumericInput(x, 2L) (2 * x[1]^3 * x[2] - x[2]^3)^2 + (6 * x[1] - x[2]^2 + x[2])^2 }, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 2L, id = "x", lower = c(-500, -500), diff --git a/R/sof.rastrigin.R b/R/sof.rastrigin.R index de016a92..4bf68f44 100644 --- a/R/sof.rastrigin.R +++ b/R/sof.rastrigin.R @@ -1,11 +1,16 @@ +#' @title #' Rastrigin Function #' +#' @description #' One of the most popular single-objective test functions consists of many -#' local optima and is thus highly multimodal with a global structure. +#' local optima and is thus highly multi-modal with a global structure. #' The implementation follows the formula #' \deqn{f(\mathbf{x}) = 10n + \sum_{i=1}^{n} \left(\mathbf{x}_i^2 - 10 \cos(2\pi \mathbf{x}_i)\right).} #' The box-constraints are given by \eqn{\mathbf{x}_i \in [-5.12, 5.12]} for #' \eqn{i = 1, \ldots, n}. +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Rastrigin Function. #' #' @references L. A. Rastrigin. Extremal control systems. Theoretical Foundations #' of Engineering Cybernetics Series. Nauka, Moscow, 1974. @@ -14,7 +19,7 @@ #' @template ret_smoof_single #' @export makeRastriginFunction = function(dimensions) { - assertCount(dimensions) + checkmate::assertCount(dimensions) force(dimensions) makeSingleObjectiveFunction( name = paste(dimensions, "-d Rastrigin Function", sep = ""), @@ -24,7 +29,7 @@ makeRastriginFunction = function(dimensions) { n = length(x) 10 * n + sum(x^2 - 10 * cos(2 * pi * x)) }, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = dimensions, id = "x", lower = rep(-5.12, dimensions), diff --git a/R/sof.rosenbrock.R b/R/sof.rosenbrock.R index fa3bc695..1a47e0eb 100644 --- a/R/sof.rosenbrock.R +++ b/R/sof.rosenbrock.R @@ -1,5 +1,7 @@ +#' @title #' Rosenbrock Function #' +#' @description #' Also known as the \dQuote{De Jong's function 2} or the \dQuote{(Rosenbrock) #' banana/valley function} due to its shape. The global optimum is located within #' a large flat valley and thus it is hard for optimization algorithms to find it. @@ -7,6 +9,9 @@ #' \deqn{f(\mathbf{x}) = \sum_{i=1}^{n-1} 100 \cdot (\mathbf{x}_{i+1} - \mathbf{x}_i^2)^2 + (1 - \mathbf{x}_i)^2.} #' The domain is given by the constraints \eqn{\mathbf{x}_i \in [-30, 30], i = 1, \ldots, n}. #' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Rosenbrock Function. +#' #' @references H. H. Rosenbrock, An Automatic Method for Finding the Greatest or #' least Value of a Function, Computer Journal, vol. 3, no. 3, pp. 175-184, 1960. #' @@ -14,7 +19,7 @@ #' @template ret_smoof_single #' @export makeRosenbrockFunction = function(dimensions) { - assertInt(dimensions, lower = 2) + checkmate::assertInt(dimensions, lower = 2) force(dimensions) makeSingleObjectiveFunction( name = paste(dimensions, "-d Rosenbrock Function", sep = ""), @@ -24,7 +29,7 @@ makeRosenbrockFunction = function(dimensions) { i = seq_len(length(x) - 1L) sum(100 * (x[i]^2 - x[i + 1])^2 + (x[i] - 1)^2) }, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = dimensions, id = "x", lower = rep(-5, dimensions), diff --git a/R/sof.schaffer.function.2.R b/R/sof.schaffer.function.2.R index bd8fb1fb..7571bfff 100644 --- a/R/sof.schaffer.function.2.R +++ b/R/sof.schaffer.function.2.R @@ -1,8 +1,13 @@ +#' @title #' Modified Schaffer Function N. 2 #' -#' Second function by Schaffer. The defintion is given by the formula +#' @description +#' Second function by Schaffer. The definition is given by the formula #' \deqn{f(\mathbf{x}) = 0.5 + \frac{\sin^2(\mathbf{x}_1^2 - \mathbf{x}_2^2) - 0.5}{(1 + 0.001(\mathbf{x}_1^2 + \mathbf{x}_2^2))^2}} #' subject to \eqn{\mathbf{x}_i \in [-100, 100], i = 1, 2}. +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Modified Schaffer N. 2 Function. #' #' @references S. K. Mishra, Some New Test Functions For Global Optimization #' And Performance of Repulsive Particle Swarm Method. @@ -19,7 +24,7 @@ makeSchafferN2Function = function() { b = x[2]^2 0.5 + (sin(a - b)^2 - 0.5) / (1 + 0.001 * (a + b))^2 }, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 2L, id = "x", lower = c(-100, -100), diff --git a/R/sof.schaffer.function.4.R b/R/sof.schaffer.function.4.R index f339d24c..346b1243 100644 --- a/R/sof.schaffer.function.4.R +++ b/R/sof.schaffer.function.4.R @@ -1,8 +1,13 @@ +#' @title #' Schaffer Function N. 4 -#' -#' Second function by Schaffer. The defintion is given by the formula +#' +#' @description +#' Second function by Schaffer. The definition is given by the formula #' \deqn{f(\mathbf{x}) = 0.5 + \frac{\cos^2(sin(|\mathbf{x}_1^2 - \mathbf{x}_2^2|)) - 0.5}{(1 + 0.001(\mathbf{x}_1^2 + \mathbf{x}_2^2))^2}} #' subject to \eqn{\mathbf{x}_i \in [-100, 100], i = 1, 2}. +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Schaffer N. 4 Function. #' #' @references S. K. Mishra, Some New Test Functions For Global Optimization #' And Performance of Repulsive Particle Swarm Method. @@ -19,7 +24,7 @@ makeSchafferN4Function = function() { b = x[2]^2 0.5 + (cos(sin(abs(a - b)))^2 - 0.5) / (1 + 0.001 * (a + b))^2 }, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 2L, id = "x", lower = c(-100, -100), diff --git a/R/sof.schwefel.R b/R/sof.schwefel.R index 2843b8f5..554e2986 100644 --- a/R/sof.schwefel.R +++ b/R/sof.schwefel.R @@ -1,10 +1,15 @@ +#' @title #' Schwefel function #' -#' Highly multimodal test function. The cursial thing about this function is, that +#' @description +#' Highly multi-modal test function. The crucial thing about this function is, that #' the global optimum is far away from the next best local optimum. #' The function is computed via: #' \deqn{f(\mathbf{x}) = \sum_{i=1}^{n} -\mathbf{x}_i \sin\left(\sqrt(|\mathbf{x}_i|)\right)} #' with \eqn{\mathbf{x}_i \in [-500, 500], i = 1, \ldots, n.} +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Schwefel Function. #' #' @references Schwefel, H.-P.: Numerical optimization of computer models. #' Chichester: Wiley & Sons, 1981. @@ -13,7 +18,7 @@ #' @template ret_smoof_single #' @export makeSchwefelFunction = function(dimensions) { - assertCount(dimensions) + checkmate::assertCount(dimensions) force(dimensions) makeSingleObjectiveFunction( name = paste(dimensions, "-d Schwefel function", sep = ""), @@ -22,7 +27,7 @@ makeSchwefelFunction = function(dimensions) { checkNumericInput(x, dimensions) sum(-x * sin(sqrt(abs(x)))) }, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = dimensions, id = "x", lower = rep(-500, dimensions), diff --git a/R/sof.shekel.R b/R/sof.shekel.R index 6b2faa9d..dd1fe3ed 100644 --- a/R/sof.shekel.R +++ b/R/sof.shekel.R @@ -1,19 +1,25 @@ -#' @title Shekel functions +#' @title +#' Shekel functions #' -#' @description Single-objective test function based on the formula +#' @description +#' Single-objective test function based on the formula #' \deqn{f(\mathbf{x}) = -\sum_{i=1}^{m} \left(\sum_{j=1}^{4} (x_j - C_{ji})^2 + \beta_{i}\right)^{-1}}. #' Here, \eqn{m \in \{5, 7, 10\}} defines the number of local optima, \eqn{C} is a \eqn{4 x 10} matrix #' and \eqn{\beta = \frac{1}{10}(1, 1, 2, 2, 4, 4, 6, 3, 7, 5, 5)} is a vector. See \url{https://www.sfu.ca/~ssurjano/shekel.html} -#' for a defintion of \eqn{C}. +#' for a definition of \eqn{C}. #' #' @param m [\code{numeric(1)}]\cr #' Integer parameter (defines the number of local optima). #' Possible values are 5, 7 or 10. +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Shekel Functions. +#' #' @template ret_smoof_single #' @export makeShekelFunction = function(m) { if (m %nin% c(5, 7, 10)) - stopf("Shekel function only defined for m = 5, 7, 10, but not %i.", m) + BBmisc::stopf("Shekel function only defined for m = 5, 7, 10, but not %i.", m) force(m) @@ -50,7 +56,7 @@ makeShekelFunction = function(m) { name = sprintf("4-d Shekel%i function", m), id = sprintf("shekel_4d_m%i", m), fn = fn, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 4L, id = "x", lower = rep(0, 4L), diff --git a/R/sof.shubert.R b/R/sof.shubert.R index 239c8837..7d0c4f11 100644 --- a/R/sof.shubert.R +++ b/R/sof.shubert.R @@ -1,8 +1,13 @@ +#' @title #' Shubert Function #' -#' The defintion of this two-dimensional function is given by +#' @description +#' The definition of this two-dimensional function is given by #' \deqn{f(\mathbf{x}) = \prod_{i = 1}^{2} \left(\sum_{j = 1}^{5} \cos((j + 1)\mathbf{x}_i + j\right)} #' subject to \eqn{\mathbf{x}_i \in [-10, 10], i = 1, 2}. +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Shubert Function. #' #' @references J. P. Hennart (ed.), Numerical Analysis, Proc. 3rd AS Workshop, #' Lecture Notes in Mathematics, vol. 90, Springer, 1982. diff --git a/R/sof.six.hump.camel.back.function.R b/R/sof.six.hump.camel.back.function.R index 4291726a..99d9fefb 100644 --- a/R/sof.six.hump.camel.back.function.R +++ b/R/sof.six.hump.camel.back.function.R @@ -1,10 +1,15 @@ +#' @title #' Three-Hump Camel Function #' +#' @description #' Two dimensional single-objective test function with six local minima oh which #' two are global. The surface is similar to the back of a camel. That is why it #' is called Camel function. The implementation is based on the formula: #' \deqn{f(\mathbf{x}) = \left(4 - 2.1\mathbf{x}_1^2 + \mathbf{x}_1^{0.75}\right)\mathbf{x}_1^2 + \mathbf{x}_1 \mathbf{x}_2 + \left(-4 + 4\mathbf{x}_2^2\right)\mathbf{x}_2^2} #' with box constraints \eqn{\mathbf{x}_1 \in [-3, 3]} and \eqn{\mathbf{x}_2 \in [-2, 2]}. +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Three-Hump Camel Function. #' #' @references Dixon, L. C. W. and Szego, G. P.: The optimization problem: An introduction. #' In: Towards Global Optimization II, New York: North Holland, 1978. diff --git a/R/sof.sphere.R b/R/sof.sphere.R index bdcb8e14..bfc233f8 100644 --- a/R/sof.sphere.R +++ b/R/sof.sphere.R @@ -1,9 +1,14 @@ +#' @title #' Sphere Function #' +#' @description #' Also known as the the \dQuote{De Jong function 1}. Convex, continous function #' calculated via the formula #' \deqn{f(\mathbf{x}) = \sum_{i=1}^{n} \mathbf{x}_i^2} -#' with box-constraings \eqn{\mathbf{x}_i \in [-5.12, 5.12], i = 1, \ldots, n}. +#' with box-constraints \eqn{\mathbf{x}_i \in [-5.12, 5.12], i = 1, \ldots, n}. +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Sphere Function. #' #' @references M. A. Schumer, K. Steiglitz, Adaptive Step Size Random Search, #' IEEE Transactions on Automatic Control. vol. 13, no. 3, pp. 270-276, 1968. diff --git a/R/sof.styblinski.tang.R b/R/sof.styblinski.tang.R index b8922286..c55a0af0 100644 --- a/R/sof.styblinski.tang.R +++ b/R/sof.styblinski.tang.R @@ -1,8 +1,13 @@ +#' @title #' Styblinkski-Tang function #' -#' This function is based on the defintion +#' @description +#' This function is based on the definition #' \deqn{f(\mathbf{x}) = \frac{1}{2} \sum_{i = 1}^{2} (\mathbf{x}_i^4 - 16 \mathbf{x}_i^2 + 5\mathbf{x}_i)} #' with box-constraints given by \eqn{\mathbf{x}_i \in [-5, 5], i = 1, 2}. +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Styblinkski-Tang Function. #' #' @references Z. K. Silagadze, Finding Two-Dimesnional Peaks, Physics of #' Particles and Nuclei Letters, vol. 4, no. 1, pp. 73-80, 2007. @@ -20,7 +25,7 @@ makeStyblinkskiTangFunction = function() { b = a^2 return(0.5 * sum(b - 16 * a + 5 * x)) }, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 2L, id = "x", lower = rep(-5, 2L), diff --git a/R/sof.sum.of.different.powers.R b/R/sof.sum.of.different.powers.R index 3be8763d..f427e3e4 100644 --- a/R/sof.sum.of.different.powers.R +++ b/R/sof.sum.of.different.powers.R @@ -1,6 +1,8 @@ +#' @title #' Sum of Different Squares Function #' -#' Simple unimodal test function similar to the Sphere and Hyper-Ellipsoidal functions. +#' @description +#' Simple uni-modal test function similar to the Sphere and Hyper-Ellipsoidal functions. #' Formula: #' \deqn{f(\mathbf{x}) = \sum_{i=1}^{n} |\mathbf{x}_i|^{i+1}.} #' @@ -8,7 +10,7 @@ #' @template ret_smoof_single #' @export makeSumOfDifferentSquaresFunction = function(dimensions) { - assertCount(dimensions) + checkmate::assertCount(dimensions) force(dimensions) makeSingleObjectiveFunction( name = paste(dimensions, "-d Sum of Different Squares Function", sep = ""), @@ -18,7 +20,7 @@ makeSumOfDifferentSquaresFunction = function(dimensions) { n = length(x) sum(abs(x)^(1:n + 1)) }, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = dimensions, id = "x", lower = rep(-1, dimensions), diff --git a/R/sof.swiler2014.R b/R/sof.swiler2014.R index 348cbcf5..b5941bc9 100644 --- a/R/sof.swiler2014.R +++ b/R/sof.swiler2014.R @@ -20,13 +20,13 @@ makeSwiler2014Function = function() { name = "Swiler2014 Function", id = paste0("swiler2014_3d"), fn = function(x) { - assertList(x) + checkmate::assertList(x) x1 = x$x1 x2 = x$x2 x3 = x$x3 - assertChoice(x1, choices = c("1", "2", "3", "4", "5")) - assertNumber(x2, lower = 0, upper = 1) - assertNumber(x3, lower = 0, upper = 1) + checkmate::assertChoice(x1, choices = c("1", "2", "3", "4", "5")) + checkmate::assertNumber(x2, lower = 0, upper = 1) + checkmate::assertNumber(x3, lower = 0, upper = 1) a = sin(2 * pi * x3 - pi) b = 7 * sin(2 * pi * x2 - pi)^2 @@ -36,10 +36,10 @@ makeSwiler2014Function = function() { val = a + b + fac * sin(2 * pi * x3 - pi) return(val) }, - par.set = makeParamSet( - makeDiscreteParam("x1", values = c("1", "2", "3", "4", "5")), - makeNumericParam("x2", lower = 0, upper = 1), - makeNumericParam("x3", lower = 0, upper = 1) + par.set = ParamHelpers::makeParamSet( + ParamHelpers::makeDiscreteParam("x1", values = c("1", "2", "3", "4", "5")), + ParamHelpers::makeNumericParam("x2", lower = 0, upper = 1), + ParamHelpers::makeNumericParam("x3", lower = 0, upper = 1) ), tags = attr(makeSwiler2014Function, "tags"), has.simple.signature = FALSE diff --git a/R/sof.three.hump.camel.R b/R/sof.three.hump.camel.R index df4759e9..3bd47ca2 100644 --- a/R/sof.three.hump.camel.R +++ b/R/sof.three.hump.camel.R @@ -1,11 +1,16 @@ +#' @title #' Three-Hump Camel Function #' +#' @description #' This two-dimensional function is based on the defintion #' \deqn{f(\mathbf{x}) = 2 \mathbf{x}_1^2 - 1.05 \mathbf{x}_1^4 + \frac{\mathbf{x}_1^6}{6} + \mathbf{x}_1\mathbf{x}_2 + \mathbf{x}_2^2} #' subject to \eqn{-5 \leq \mathbf{x}_i \leq 5}. +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Three-Hump Camel Function. #' #' @references F. H. Branin Jr., Widely Convergent Method of Finding Multiple -#' Solutions of Simul- taneous Nonlinear Equations, IBM Journal of Research +#' Solutions of Simultaneous Nonlinear Equations, IBM Journal of Research #' and Development, vol. 16, no. 5, pp. 504-522, 1972. #' #' @template ret_smoof_single @@ -15,10 +20,10 @@ makeThreeHumpCamelFunction = function() { name = "Three-Hump Camel Function", id = "threeHumpCamel_2d", fn = function(x) { - assertNumeric(x, len = 2L, any.missing = FALSE, all.missing = FALSE) + checkmate::assertNumeric(x, len = 2L, any.missing = FALSE, all.missing = FALSE) 2 * x[1]^2 - 1.05 * x[1]^4 + (x[1]^6) / 6 + x[1] * x[2] + x[2]^2 }, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 2L, id = "x", lower = c(-5, -5), diff --git a/R/sof.trecanni.R b/R/sof.trecanni.R index 6a983b52..84765c41 100644 --- a/R/sof.trecanni.R +++ b/R/sof.trecanni.R @@ -1,10 +1,15 @@ +#' @title #' Trecanni Function #' -#' The Trecanni function belongs to the unimodal test functions. It is based +#' @description +#' The Trecanni function belongs to the uni-modal test functions. It is based #' on the formula #' \deqn{f(\mathbf(x)) = \mathbf(x)_1^4 - 4 \mathbf(x)_1^3 + 4 \mathbf(x)_1 + \mathbf(x)_2^2.} #' The box-constraints \eqn{\mathbf{x}_i \in [-5, 5], i = 1, 2} define the -#' domain of defintion. +#' domain of definition. +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Trecanni Function. #' #' @references L. C. W. Dixon, G. P. Szego (eds.), Towards Global Optimization 2, #' Elsevier, 1978. @@ -19,7 +24,7 @@ makeTrecanniFunction = function() { checkNumericInput(x, 2L) x[1]^4 + 4 * (x[1]^3 + x[1]^2) + x[2]^2 }, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 2L, id = "x", lower = c(-5, -5), diff --git a/R/sof.vincent.R b/R/sof.vincent.R index 0b2438fd..07cfddc1 100644 --- a/R/sof.vincent.R +++ b/R/sof.vincent.R @@ -1,19 +1,24 @@ +#' @title #' Inverted Vincent Function #' +#' @description #' Single-objective test function based on the formula #' \deqn{f(\mathbf{x}) = \frac{1}{n} \sum_{i = 1}^{n} \sin(10 \log(\mathbf{x}_i))} #' subject to \eqn{\mathbf{x}_i \in [0.25, 10]} for \eqn{i = 1, \ldots, n}. #' #' @references Xiadong Li, Andries Engelbrecht, and Michael G. Epitropakis. Benchmark #' functions for CEC2013 special session and competition on niching methods for -#' multimodal function optimization. Technical report, RMIT University, Evolutionary +#' multi-modal function optimization. Technical report, RMIT University, Evolutionary #' Computation and Machine Learning Group, Australia, 2013. +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Inverted Vincent Function. #' #' @template arg_dimensions #' @template ret_smoof_single #' @export makeInvertedVincentFunction = function(dimensions) { - assertCount(dimensions) + checkmate::assertCount(dimensions) force(dimensions) makeSingleObjectiveFunction( name = "Inverted Vincent Function", @@ -22,7 +27,7 @@ makeInvertedVincentFunction = function(dimensions) { checkNumericInput(x, dimensions) sum(sin(10 * log(x))) / length(x) }, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = dimensions, id = "x", lower = rep(0.25, dimensions), diff --git a/R/sof.zettl.R b/R/sof.zettl.R index 7227993c..3e6322e6 100644 --- a/R/sof.zettl.R +++ b/R/sof.zettl.R @@ -1,8 +1,13 @@ +#' @title #' Zettl Function #' -#' The unimodal Zettl Function is based on the defintion +#' @description +#' The uni-modal Zettl Function is based on the definition #' \deqn{f(\mathbf{x}) = (\mathbf{x}_1^2 + \mathbf{x}_2^2 - 2\mathbf{x}_1)^2 + 0.25 \mathbf{x}_1} #' with box-constraints \eqn{\mathbf{x}_i \in [-5, 10], i = 1, 2}. +#' +#' @return +#' An object of class \code{SingleObjectiveFunction}, representing the Zettl Function. #' #' @references H. P. Schwefel, Evolution and Optimum Seeking, John Wiley Sons, 1995. #' @@ -16,7 +21,7 @@ makeZettlFunction = function() { checkNumericInput(x, 2L) (x[1]^2 + x[2]^2 - 2 * x[1])^2 + 0.25 * x[1] }, - par.set = makeNumericParamSet( + par.set = ParamHelpers::makeNumericParamSet( len = 2L, id = "x", lower = c(-5, -5), diff --git a/R/violatesConstraints.R b/R/violatesConstraints.R index 69a5ab46..7daadd54 100644 --- a/R/violatesConstraints.R +++ b/R/violatesConstraints.R @@ -6,7 +6,7 @@ #' @return [\code{logical(1)}] #' @export violatesConstraints = function(fn, values) { - assertClass(fn, "smoof_function") + checkmate::assertClass(fn, "smoof_function") if (hasOtherConstraints(fn)) { constraint.fn = attr(fn, "constraint.fn") return(!all(constraint.fn(values))) diff --git a/R/visualizeParetoOptimalFront.R b/R/visualizeParetoOptimalFront.R index 7905bbcf..ee7777bc 100644 --- a/R/visualizeParetoOptimalFront.R +++ b/R/visualizeParetoOptimalFront.R @@ -17,17 +17,20 @@ #' #' # Alternatively we can pass some more algorithm parameters to the NSGA2 algorithm #' vis = visualizeParetoOptimalFront(fn, popsize = 1000L) +#' #' @return [\code{\link[ggplot2]{ggplot}}] +#' Returns a ggplot object representing the Pareto-optimal front visualization. +#' #' @export visualizeParetoOptimalFront = function(fn, ...) { n.objectives = getNumberOfObjectives(fn) if (!isMultiobjective(fn)) { - stopf("Visualization of approximated Pareto-optimal front only possible fo multi-objective + BBmisc::stopf("Visualization of approximated Pareto-optimal front only possible fo multi-objective functions with two objectives at the moment.") } if (!requireNamespace("mco", quietly = TRUE)) - stopf("Package \"mco\" needed for this function to work.") + BBmisc::stopf("Package \"mco\" needed for this function to work.") par.set = ParamHelpers::getParamSet(fn) @@ -35,8 +38,8 @@ visualizeParetoOptimalFront = function(fn, ...) { res = mco::nsga2(fn, idim = getNumberOfParameters(fn), odim = n.objectives, - lower.bounds = getLower(par.set), - upper.bounds = getUpper(par.set), + lower.bounds = ParamHelpers::getLower(par.set), + upper.bounds = ParamHelpers::getUpper(par.set), ... ) eff.points = res$value[res$pareto.optimal, ] @@ -45,10 +48,10 @@ visualizeParetoOptimalFront = function(fn, ...) { eff.points = as.data.frame(eff.points) colnames(eff.points) = c("f1", "f2") - pl = ggplot(eff.points, mapping = aes_string(x = "f1", y = "f2")) - pl = pl + geom_line(colour = "darkgray") - pl = pl + xlab(expression(f[1])) + ylab(expression(f[2])) - pl = pl + ggtitle(sprintf("Objective space with shape of Pareto-optimal\n - front for the bi-criteria %s", getName(fn))) + pl = ggplot2::ggplot(eff.points, mapping = ggplot2::aes_string(x = "f1", y = "f2")) + pl = pl + ggplot2::geom_line(colour = "darkgray") + pl = pl + ggplot2::xlab(expression(f[1])) + ggplot2::ylab(expression(f[2])) + pl = pl + ggplot2::ggtitle(sprintf("Objective space with shape of Pareto-optimal\n + front for the bi-criteria %s", berryFunctions::getName(fn))) return(pl) } From 9d157255424360843eda1505dc15aedf64ab4b69 Mon Sep 17 00:00:00 2001 From: Harshit Purohit <71263771+Titanx9-exe@users.noreply.github.com> Date: Mon, 12 Feb 2024 15:06:40 +0100 Subject: [PATCH 2/4] New fixes inclluding some errors in devtools::check --- DESCRIPTION | 3 +- NAMESPACE | 2 + R/plot.autoplot.R | 18 ++--- man/addCountingWrapper.Rd | 5 +- man/addLoggingWrapper.Rd | 3 +- man/autoplot.smoof_function.Rd | 6 +- man/computeExpectedRunningTime.Rd | 4 +- man/conversion.Rd | 5 +- man/doesCountEvaluations.Rd | 3 +- man/filterFunctionsByTags.Rd | 2 +- man/getAvailableTags.Rd | 3 +- man/getDescription.Rd | 5 +- man/getGlobalOptimum.Rd | 6 +- man/getID.Rd | 6 +- man/getLoggedValues.Rd | 8 +-- man/getLowerBoxConstraints.Rd | 5 +- man/getMeanFunction.Rd | 5 +- man/getName.Rd | 5 +- man/getNumberOfEvaluations.Rd | 5 +- man/getNumberOfObjectives.Rd | 5 +- man/getNumberOfParameters.Rd | 5 +- man/getOptimaDf.Rd | 19 ++++++ man/getRefPoint.Rd | 1 + man/getTags.Rd | 5 +- man/getWrappedFunction.Rd | 1 + man/hasConstraints.Rd | 1 + man/hasGlobalOptimum.Rd | 5 +- man/hasTags.Rd | 3 +- man/isMultiobjective.Rd | 2 +- man/isNoisy.Rd | 1 + man/isSingleobjective.Rd | 2 +- man/isSmoofFunction.Rd | 1 + man/isVectorized.Rd | 5 +- man/isWrappedSmoofFunction.Rd | 1 + man/makeAckleyFunction.Rd | 4 +- man/makeAdjimanFunction.Rd | 6 ++ man/makeAlpine01Function.Rd | 4 +- man/makeAlpine02Function.Rd | 4 +- man/makeBBOBFunction.Rd | 4 +- man/makeBK1Function.Rd | 4 +- man/makeBartelsConnFunction.Rd | 2 + man/makeBealeFunction.Rd | 6 +- man/makeBentCigarFunction.Rd | 2 + man/makeBiObjBBOBFunction.Rd | 5 +- man/makeBiSphereFunction.Rd | 1 + man/makeBirdFunction.Rd | 4 +- man/makeBohachevskyN1Function.Rd | 6 +- man/makeBoothFunction.Rd | 2 + man/makeBraninFunction.Rd | 2 + man/makeBrentFunction.Rd | 2 + man/makeBrownFunction.Rd | 4 +- man/makeBukinN2Function.Rd | 4 +- man/makeBukinN4Function.Rd | 4 +- man/makeBukinN6Function.Rd | 4 +- man/makeCarromTableFunction.Rd | 2 + man/makeChichinadzeFunction.Rd | 2 + man/makeChungReynoldsFunction.Rd | 8 ++- man/makeComplexFunction.Rd | 2 + man/makeCosineMixtureFunction.Rd | 2 + man/makeCrossInTrayFunction.Rd | 2 + man/makeCubeFunction.Rd | 2 + man/makeDTLZ1Function.Rd | 1 + man/makeDTLZ2Function.Rd | 1 + man/makeDTLZ3Function.Rd | 1 + man/makeDTLZ4Function.Rd | 1 + man/makeDTLZ5Function.Rd | 3 +- man/makeDTLZ6Function.Rd | 1 + man/makeDTLZ7Function.Rd | 3 +- man/makeDeckkersAartsFunction.Rd | 2 + man/makeDeflectedCorrugatedSpringFunction.Rd | 2 + man/makeDentFunction.Rd | 3 +- man/makeDixonPriceFunction.Rd | 2 + man/makeDoubleSumFunction.Rd | 2 + man/makeED1Function.Rd | 1 + man/makeED2Function.Rd | 1 + man/makeEasomFunction.Rd | 4 +- man/makeEggCrateFunction.Rd | 2 + man/makeEggholderFunction.Rd | 2 + man/makeElAttarVidyasagarDuttaFunction.Rd | 6 +- man/makeEngvallFunction.Rd | 2 + man/makeExponentialFunction.Rd | 2 + man/makeFreudensteinRothFunction.Rd | 2 + man/makeFunctionsByName.Rd | 1 + man/makeGOMOPFunction.Rd | 1 + man/makeGeneralizedDropWaveFunction.Rd | 4 +- man/makeGiuntaFunction.Rd | 4 +- man/makeGoldsteinPriceFunction.Rd | 2 + man/makeGriewankFunction.Rd | 4 +- man/makeHansenFunction.Rd | 2 + man/makeHartmannFunction.Rd | 4 +- man/makeHimmelblauFunction.Rd | 6 +- man/makeHolderTableN1Function.Rd | 4 +- man/makeHolderTableN2Function.Rd | 4 +- man/makeHosakiFunction.Rd | 2 + man/makeHyperEllipsoidFunction.Rd | 4 +- man/makeInvertedVincentFunction.Rd | 4 +- man/makeJennrichSampsonFunction.Rd | 2 + man/makeJudgeFunction.Rd | 2 + man/makeKeaneFunction.Rd | 4 +- man/makeKearfottFunction.Rd | 2 + man/makeKursaweFunction.Rd | 1 + man/makeLeonFunction.Rd | 4 +- man/makeMMF10Function.Rd | 5 +- man/makeMMF11Function.Rd | 5 +- man/makeMMF12Function.Rd | 5 +- man/makeMMF13Function.Rd | 5 +- man/makeMMF14Function.Rd | 5 +- man/makeMMF14aFunction.Rd | 5 +- man/makeMMF15Function.Rd | 5 +- man/makeMMF15aFunction.Rd | 5 +- man/makeMMF1Function.Rd | 3 +- man/makeMMF1eFunction.Rd | 3 +- man/makeMMF1zFunction.Rd | 5 +- man/makeMMF2Function.Rd | 5 +- man/makeMMF3Function.Rd | 5 +- man/makeMMF4Function.Rd | 5 +- man/makeMMF5Function.Rd | 5 +- man/makeMMF6Function.Rd | 5 +- man/makeMMF7Function.Rd | 5 +- man/makeMMF8Function.Rd | 5 +- man/makeMMF9Function.Rd | 5 +- man/makeMOP1Function.Rd | 1 + man/makeMOP2Function.Rd | 3 +- man/makeMOP3Function.Rd | 3 +- man/makeMOP4Function.Rd | 1 + man/makeMOP5Function.Rd | 3 +- man/makeMOP6Function.Rd | 1 + man/makeMOP7Function.Rd | 3 +- man/makeMPM2Function.Rd | 1 + man/makeMatyasFunction.Rd | 4 +- man/makeMcCormickFunction.Rd | 4 +- man/makeMichalewiczFunction.Rd | 4 +- man/makeModifiedRastriginFunction.Rd | 4 +- man/makeMultiObjectiveFunction.Rd | 2 +- man/makeNKFunction.Rd | 1 + man/makeObjectiveFunction.Rd | 71 ++++++++++++++++++++ man/makeOmniTestFunction.Rd | 1 + man/makePeriodicFunction.Rd | 2 + man/makePowellSumFunction.Rd | 2 + man/makePriceN1Function.Rd | 6 +- man/makePriceN2Function.Rd | 2 + man/makePriceN4Function.Rd | 4 +- man/makeRastriginFunction.Rd | 4 +- man/makeRosenbrockFunction.Rd | 2 + man/makeSYMPARTrotatedFunction.Rd | 7 +- man/makeSYMPARTsimpleFunction.Rd | 7 +- man/makeSchafferN2Function.Rd | 4 +- man/makeSchafferN4Function.Rd | 4 +- man/makeSchwefelFunction.Rd | 4 +- man/makeShekelFunction.Rd | 4 +- man/makeShubertFunction.Rd | 4 +- man/makeSixHumpCamelFunction.Rd | 2 + man/makeSphereFunction.Rd | 4 +- man/makeStyblinkskiTangFunction.Rd | 4 +- man/makeSumOfDifferentSquaresFunction.Rd | 2 +- man/makeThreeHumpCamelFunction.Rd | 4 +- man/makeTrecanniFunction.Rd | 6 +- man/makeUFFunction.Rd | 2 +- man/makeViennetFunction.Rd | 3 +- man/makeWFG1Function.Rd | 1 + man/makeWFG2Function.Rd | 1 + man/makeWFG3Function.Rd | 1 + man/makeWFG4Function.Rd | 1 + man/makeWFG5Function.Rd | 1 + man/makeWFG6Function.Rd | 1 + man/makeWFG7Function.Rd | 1 + man/makeWFG8Function.Rd | 1 + man/makeWFG9Function.Rd | 1 + man/makeZDT1Function.Rd | 3 +- man/makeZDT2Function.Rd | 5 +- man/makeZDT3Function.Rd | 3 +- man/makeZDT4Function.Rd | 5 +- man/makeZDT6Function.Rd | 7 +- man/makeZettlFunction.Rd | 4 +- man/mnof.Rd | 8 ++- man/plot.smoof_function.Rd | 2 +- man/plot1DNumeric.Rd | 2 +- man/plot2DNumeric.Rd | 2 +- man/plot3D.Rd | 6 +- man/smoof-package.Rd | 4 +- man/smoof_function.Rd | 6 +- man/visualizeParetoOptimalFront.Rd | 2 + src/RcppExports.cpp | 26 +++---- 183 files changed, 531 insertions(+), 199 deletions(-) create mode 100644 man/getOptimaDf.Rd create mode 100644 man/makeObjectiveFunction.Rd diff --git a/DESCRIPTION b/DESCRIPTION index 37f97865..da9c9a4c 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -36,7 +36,8 @@ Depends: Imports: BBmisc (>= 1.6), ggplot2 (>= 2.2.1), - Rcpp (>= 0.11.0) + Rcpp (>= 0.11.0), + editrules Suggests: testthat, MASS, diff --git a/NAMESPACE b/NAMESPACE index 17ab1992..963d142c 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -88,6 +88,7 @@ export(getName) export(getNumberOfEvaluations) export(getNumberOfObjectives) export(getNumberOfParameters) +export(getOptimaDf) export(getRefPoint) export(getTags) export(getUpperBoxConstraints) @@ -208,6 +209,7 @@ export(makeMichalewiczFunction) export(makeModifiedRastriginFunction) export(makeMultiObjectiveFunction) export(makeNKFunction) +export(makeObjectiveFunction) export(makeOmniTestFunction) export(makePeriodicFunction) export(makePowellSumFunction) diff --git a/R/plot.autoplot.R b/R/plot.autoplot.R index fb60943e..58d8cf37 100644 --- a/R/plot.autoplot.R +++ b/R/plot.autoplot.R @@ -82,7 +82,7 @@ #' # or hide the legend #' pl + ggtitle("My fancy function") + theme(legend.position = "none") #' @export -ggplot2::autoplot.smoof_function = function(object, + autoplot.smoof_function = function(object, ..., show.optimum = FALSE, main = berryFunctions::getName(x), @@ -140,10 +140,10 @@ ggplot2::autoplot.smoof_function = function(object, } if (n.numeric == 1L) { - pl = ggplot2::ggplot(grid, aes_string(x = par.names[numeric.idx], y = "y")) + geom_line() + pl = ggplot2::ggplot(grid, ggplot2::aes_string(x = par.names[numeric.idx], y = "y")) + geom_line() } if (n.numeric == 2L) { - pl = ggplot2::ggplot(grid, aes_string(x = par.names[numeric.idx[1L]], y = par.names[numeric.idx[2L]])) + pl = ggplot2::ggplot(grid, ggplot2::aes_string(x = par.names[numeric.idx[1L]], y = par.names[numeric.idx[2L]])) if (render.levels) { if (!requireNamespace("RColorBrewer", quietly = TRUE)) @@ -152,11 +152,11 @@ ggplot2::autoplot.smoof_function = function(object, # see http://learnr.wordpress.com/2009/07/20/ggplot2-version-of-figures-in-lattice-multivariate-data-visualization-with-r-part-6/ brewer.div = colorRampPalette(RColorBrewer::brewer.pal(11, "Spectral"), interpolate = "spline") - pl = pl + ggplot2::geom_raster(aes_string(fill = "y")) + pl = pl + ggplot2::geom_raster(ggplot2::aes_string(fill = "y")) pl = pl + ggplot2::scale_fill_gradientn(colours = brewer.div(200)) } if (render.contours) { - pl = pl + ggplot2::stat_contour(aes_string(z = "y"), colour = "gray", alpha = 0.8) + pl = pl + ggplot2::stat_contour(ggplot2::aes_string(z = "y"), colour = "gray", alpha = 0.8) } } @@ -174,16 +174,16 @@ ggplot2::autoplot.smoof_function = function(object, # add labeller (otherwise we only see the values but the user has no clue # about which values belong to which parameter) - pl = pl + ggpplot2::facet_grid(formula, ggplot2::labeller = ggplot2::labeller(.rows = label_both, .cols = label_both)) + pl = pl + ggplot2::facet_grid(formula, labeller = labeller(.rows = ggplot2::label_both, .cols = ggplot2::label_both)) } if (show.optimum && (hasGlobalOptimum(x) || hasLocalOptimum(x))) { # get optima coordinates in a nice data.frame opt.df = getOptimaDf(x) if (n.numeric == 1L) { - pl = pl + ggplot2::geom_point(opt.df, mapping = aes_string(x = par.names[numeric.idx[1L]], y = "y", colour = "optima", shape = "optima")) + pl = pl + ggplot2::geom_point(opt.df, mapping = ggplot2::aes_string(x = par.names[numeric.idx[1L]], y = "y", colour = "optima", shape = "optima")) } else { - pl = pl + ggplot2::geom_point(opt.df, mapping = aes_string(x = par.names[numeric.idx[1L]], y = par.names[numeric.idx[2L]], colour = "optima", shape = "optima")) + pl = pl + ggplot2::geom_point(opt.df, mapping = ggplot2::aes_string(x = par.names[numeric.idx[1L]], y = par.names[numeric.idx[2L]], colour = "optima", shape = "optima")) # opt.df$y = round(opt.df$y, digits = 2L) # pl = pl + geom_text(opt.df, mapping = aes_string(x = par.names[numeric.idx[1L]], y = par.names[numeric.idx[2L]], label = "y")) } @@ -200,7 +200,7 @@ ggplot2::autoplot.smoof_function = function(object, } #' @export -ggplot2::autoplot.smoof_wrapped_function = function(object, +autoplot.smoof_wrapped_function = function(object, ..., show.optimum = FALSE, main = berryFunctions::getName(object), diff --git a/man/addCountingWrapper.Rd b/man/addCountingWrapper.Rd index 0a2a521f..f69931da 100644 --- a/man/addCountingWrapper.Rd +++ b/man/addCountingWrapper.Rd @@ -12,6 +12,7 @@ Smoof function which should be wrapped.} } \value{ [\code{smoof_counting_function}] + The function that includes the counting feature. } \description{ This is a counting wrapper for a \code{smoof_function}, i.e., the returned function @@ -23,10 +24,10 @@ values and finally passes down the argument to the wrapped \code{smoof_function} fn = makeBBOBFunction(dimensions = 2L, fid = 1L, iid = 1L) fn = addCountingWrapper(fn) -# we get a value of 0 since the function has not been called yet +# We get a value of 0 since the function has not been called yet print(getNumberOfEvaluations(fn)) -# now call the function 10 times consecutively +# Now call the function 10 times consecutively for (i in seq(10L)) { fn(runif(2)) } diff --git a/man/addLoggingWrapper.Rd b/man/addLoggingWrapper.Rd index dda9cd02..6481df70 100644 --- a/man/addLoggingWrapper.Rd +++ b/man/addLoggingWrapper.Rd @@ -24,11 +24,12 @@ Default is 100. I.e., there is space reserved for 100 function evaluations. In case of an overflow (i.e., more function evaluations than space reserved) the data structures are re-initialized by adding space for another \code{size} evaluations. This comes handy if you know the number of function evaluations (or at least -an upper bound thereof) a-priori and may serve to reduce the time complextity +an upper bound thereof) a-priori and may serve to reduce the time complexity of logging values.} } \value{ [\code{smoof_logging_function}] + The function with an added logging capability. } \description{ Often it is desired and useful to store the optimization path, i.e., the evaluated diff --git a/man/autoplot.smoof_function.Rd b/man/autoplot.smoof_function.Rd index bb3166a9..da53c9e5 100644 --- a/man/autoplot.smoof_function.Rd +++ b/man/autoplot.smoof_function.Rd @@ -8,7 +8,7 @@ object, ..., show.optimum = FALSE, - main = getName(x), + main = berryFunctions::getName(x), render.levels = FALSE, render.contours = TRUE, log.scale = FALSE, @@ -57,12 +57,12 @@ Default is 50.} This function expects a smoof function and returns a ggplot object depicting the function landscape. The output depends highly on the decision space of the smoof function or more technically on the \code{\link[ParamHelpers]{ParamSet}} -of the function. The following destinctions regarding the parameter types are +of the function. The following distinctions regarding the parameter types are made. In case of a single numeric parameter a simple line plot is drawn. For two numeric parameters or a single numeric vector parameter of length 2 either a contour plot or a heatmap (or a combination of both depending on the choice of additional parameters) is depicted. If there are both up to two numeric -and at least one discrete vector parameter, ggplot facetting is used to +and at least one discrete vector parameter, ggplot faceting is used to generate subplots of the above-mentioned types for all combinations of discrete parameters. } diff --git a/man/computeExpectedRunningTime.Rd b/man/computeExpectedRunningTime.Rd index b2185dc2..1b6ced70 100644 --- a/man/computeExpectedRunningTime.Rd +++ b/man/computeExpectedRunningTime.Rd @@ -18,7 +18,7 @@ Vector containing the number of function evaluations.} \item{fun.success.runs}{[\code{logical}]\cr Boolean vector indicating which algorithm runs were successful, -i. e., which runs reached the desired target value. Default is \code{NULL}.} +i.e., which runs reached the desired target value. Default is \code{NULL}.} \item{fun.reached.target.values}{[\code{numeric} | \code{NULL}]\cr Numeric vector with the objective values reached in the runs. Default is @@ -48,7 +48,7 @@ The functions can be called in two different ways \details{ The Expected Running Time (ERT) is one of the most popular performance measures in optimization. It is defined as the expected number of function -evaluations needed to reach a given precision level, i. e., to reach a certain +evaluations needed to reach a given precision level, i.e., to reach a certain objective value for the first time. } \references{ diff --git a/man/conversion.Rd b/man/conversion.Rd index c2b3daf1..cd1c88aa 100644 --- a/man/conversion.Rd +++ b/man/conversion.Rd @@ -16,14 +16,15 @@ Smoof function.} } \value{ [\code{smoof_function}] + Converted smoof function } \description{ We can minimize f by maximizing -f. The majority of predefined objective functions -in \pkg{smoof} should be minimized by default. However, there is a handful of +in \pkg{smoof} should be minimized by default. However, there are a handful of functions, e.g., Keane or Alpine02, which shall be maximized by default. For benchmarking studies it might be beneficial to inverse the direction. The functions \code{convertToMaximization} and \code{convertToMinimization} -do exactly that keeping the attributes. +do exactly that, keeping the attributes. } \note{ Both functions will quit with an error if multi-objective functions are passed. diff --git a/man/doesCountEvaluations.Rd b/man/doesCountEvaluations.Rd index d15da07d..473b7c25 100644 --- a/man/doesCountEvaluations.Rd +++ b/man/doesCountEvaluations.Rd @@ -12,9 +12,10 @@ Arbitrary R object.} } \value{ \code{logical(1)} + \code{TRUE} if the function counts its evaluations, \code{FALSE} otherwise. } \description{ -In this case the function is of type \code{smoof_counting_function} or it +In this case, the function is of type \code{smoof_counting_function} or it is further wrapped by another wrapper. This function then checks recursively, if there is a counting wrapper. } diff --git a/man/filterFunctionsByTags.Rd b/man/filterFunctionsByTags.Rd index 706f6c53..e4fe4dd4 100644 --- a/man/filterFunctionsByTags.Rd +++ b/man/filterFunctionsByTags.Rd @@ -23,7 +23,7 @@ Default is \code{FALSE}.} \description{ Single objective functions can be tagged, e.g., as unimodal. Searching for all functions with a specific tag by hand is tedious. The \code{filterFunctionsByTags} -function helps to filter all single objective smoof function. +function helps to filter all single objective smoof functions. } \examples{ # list all functions which are unimodal diff --git a/man/getAvailableTags.Rd b/man/getAvailableTags.Rd index c09ced35..adb0e5e0 100644 --- a/man/getAvailableTags.Rd +++ b/man/getAvailableTags.Rd @@ -8,10 +8,11 @@ getAvailableTags() } \value{ [\code{character}] + Character vector of all the possible tags } \description{ Test function are frequently distinguished by characteristic high-level properties, -e.g., unimodal or multimodal, continuous or discontinuous, separable or non-separable. +e.g., uni-modal or multi-modal, continuous or discontinuous, separable or non-separable. The \pkg{smoof} package offers the possibility to associate a set of properties, termed \dQuote{tags} to a \code{smoof_function}. This helper function returns a character vector of all possible tags. diff --git a/man/getDescription.Rd b/man/getDescription.Rd index 78a10cd8..e1386ddd 100644 --- a/man/getDescription.Rd +++ b/man/getDescription.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/getDescription.R \name{getDescription} \alias{getDescription} -\title{Return the description of the function.} +\title{Returns the description of the function.} \usage{ getDescription(fn) } @@ -12,7 +12,8 @@ Objective function.} } \value{ [\code{character(1)}] + A character string representing the description of the function. } \description{ -Return the description of the function. +Returns the description of the function. } diff --git a/man/getGlobalOptimum.Rd b/man/getGlobalOptimum.Rd index 10057e98..e3859251 100644 --- a/man/getGlobalOptimum.Rd +++ b/man/getGlobalOptimum.Rd @@ -13,9 +13,9 @@ Objective function.} \value{ [\code{list}] List containing the following entries: \itemize{ - \item{param [\code{list}]}{Named list of parameter value(s).} - \item{value [\code{numeric(1)}]}{Optimal value.} - \item{is.minimum [\code{logical(1)}]}{Is the global optimum a minimum or maximum?} + \item{param [\code{list}]} {Named list of parameter value(s).} + \item{value [\code{numeric(1)}]} {Optimal value.} + \item{is.minimum [\code{logical(1)}]} {Is the global optimum a minimum or maximum?} } } \description{ diff --git a/man/getID.Rd b/man/getID.Rd index 6c6fa872..328c816e 100644 --- a/man/getID.Rd +++ b/man/getID.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/getID.R \name{getID} \alias{getID} -\title{Return the ID / short name of the function or \code{NA} if no ID is set.} +\title{Returns the ID / short name of the function.} \usage{ getID(fn) } @@ -11,8 +11,8 @@ getID(fn) Objective function.} } \value{ -[\code{character(1)}] or \code{NA} +[\code{character(1)}] ID / short name or \code{NA} } \description{ -Return the ID / short name of the function or \code{NA} if no ID is set. +Returns the ID / short name of the function or \code{NA} if no ID is set. } diff --git a/man/getLoggedValues.Rd b/man/getLoggedValues.Rd index bf490e7b..398cba3e 100644 --- a/man/getLoggedValues.Rd +++ b/man/getLoggedValues.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/getLoggedValues.R \name{getLoggedValues} \alias{getLoggedValues} -\title{Extract logged values of a function wrapped by a logging wrapper.} +\title{Extracts the logged values of a function wrapped by a logging wrapper.} \usage{ getLoggedValues(fn, compact = FALSE) } @@ -20,12 +20,12 @@ Wrap all logged values in a single data frame? Default is \code{FALSE}.} \describe{ \item{pars}{Data frame of parameter values, i.e., x-values or the empty data frame if x-values were not logged.} - \item{obj.vals}{Numeric vector of objective vals in the single-objective - case respectively a matrix of objective vals for multi-objective functions.} + \item{obj.vals}{Numeric vector of objective values in the single-objective + case respectively a matrix of objective values for multi-objective functions.} } } \description{ -Extract logged values of a function wrapped by a logging wrapper. +Extracts the logged values of a function wrapped by a logging wrapper. } \seealso{ \code{\link{addLoggingWrapper}} diff --git a/man/getLowerBoxConstraints.Rd b/man/getLowerBoxConstraints.Rd index c002e0c0..12885adf 100644 --- a/man/getLowerBoxConstraints.Rd +++ b/man/getLowerBoxConstraints.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/getBoxConstraints.R \name{getLowerBoxConstraints} \alias{getLowerBoxConstraints} -\title{Return lower box constaints.} +\title{Returns lower box constraints for a Smoof function.} \usage{ getLowerBoxConstraints(fn) } @@ -12,7 +12,8 @@ Objective function.} } \value{ [\code{numeric}] + Numeric vector representing the lower box constraints } \description{ -Return lower box constaints. +Returns lower box constraints for a Smoof function. } diff --git a/man/getMeanFunction.Rd b/man/getMeanFunction.Rd index 714f554c..5b2d2ef1 100644 --- a/man/getMeanFunction.Rd +++ b/man/getMeanFunction.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/getMeanFunction.R \name{getMeanFunction} \alias{getMeanFunction} -\title{Return the true mean function in the noisy case.} +\title{Returns the true mean function in the noisy case.} \usage{ getMeanFunction(fn) } @@ -12,7 +12,8 @@ Objective function.} } \value{ [\code{function}] + True mean function in the noisy case. } \description{ -Return the true mean function in the noisy case. +Returns the true mean function in the noisy case. } diff --git a/man/getName.Rd b/man/getName.Rd index a1d0f546..74339cff 100644 --- a/man/getName.Rd +++ b/man/getName.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/getName.R \name{getName} \alias{getName} -\title{Return the name of the function.} +\title{Returns the name of the function.} \usage{ getName(fn) } @@ -12,7 +12,8 @@ Objective function.} } \value{ [\code{character(1)}] + The name of the function. } \description{ -Return the name of the function. +Returns the name of the function. } diff --git a/man/getNumberOfEvaluations.Rd b/man/getNumberOfEvaluations.Rd index 41256c41..aa81dbcc 100644 --- a/man/getNumberOfEvaluations.Rd +++ b/man/getNumberOfEvaluations.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/getNumberOfEvaluations.R \name{getNumberOfEvaluations} \alias{getNumberOfEvaluations} -\title{Return the number of function evaluations performed by the wrapped +\title{Returns the number of function evaluations performed by the wrapped \code{smoof_function}.} \usage{ getNumberOfEvaluations(fn) @@ -13,8 +13,9 @@ Wrapped \code{smoof_function}.} } \value{ [\code{integer(1)}] + The number of function evaluations. } \description{ -Return the number of function evaluations performed by the wrapped +Returns the number of function evaluations performed by the wrapped \code{smoof_function}. } diff --git a/man/getNumberOfObjectives.Rd b/man/getNumberOfObjectives.Rd index 12b12090..1c1251f0 100644 --- a/man/getNumberOfObjectives.Rd +++ b/man/getNumberOfObjectives.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/getNumberOfObjectives.R \name{getNumberOfObjectives} \alias{getNumberOfObjectives} -\title{Determine the number of objectives.} +\title{Determines the number of objectives.} \usage{ getNumberOfObjectives(fn) } @@ -12,7 +12,8 @@ Objective function.} } \value{ [\code{integer(1)}] + The number of objectives. } \description{ -Determine the number of objectives. +Determines the number of objectives. } diff --git a/man/getNumberOfParameters.Rd b/man/getNumberOfParameters.Rd index b77aca12..4045bf00 100644 --- a/man/getNumberOfParameters.Rd +++ b/man/getNumberOfParameters.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/getNumberOfParameters.R \name{getNumberOfParameters} \alias{getNumberOfParameters} -\title{Determine the number of parameters.} +\title{Determines the number of parameters.} \usage{ getNumberOfParameters(fn) } @@ -12,7 +12,8 @@ Objective function.} } \value{ [\code{integer(1)}] + The number of parameters. } \description{ -Determine the number of parameters. +Determines the number of parameters. } diff --git a/man/getOptimaDf.Rd b/man/getOptimaDf.Rd new file mode 100644 index 00000000..68d99075 --- /dev/null +++ b/man/getOptimaDf.Rd @@ -0,0 +1,19 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/plot.helpers.R +\name{getOptimaDf} +\alias{getOptimaDf} +\title{Get Data Frame of optima.} +\usage{ +getOptimaDf(fn) +} +\arguments{ +\item{fn}{[\code{smoof_function}]\cr +Smoof function.} +} +\value{ +[\code{data.frame}] +A data frame containing information about the optima. +} +\description{ +This function returns data frame of global / local optima for visualization using ggplot. +} diff --git a/man/getRefPoint.Rd b/man/getRefPoint.Rd index 3f3385ad..18033f86 100644 --- a/man/getRefPoint.Rd +++ b/man/getRefPoint.Rd @@ -12,6 +12,7 @@ Objective function.} } \value{ [\code{numeric}] + The reference point. } \description{ Returns the reference point of a multi-objective function. diff --git a/man/getTags.Rd b/man/getTags.Rd index 961ad769..3294b2ac 100644 --- a/man/getTags.Rd +++ b/man/getTags.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/getTags.R \name{getTags} \alias{getTags} -\title{Returns vector of associated tags.} +\title{Returns the vector of associated tags.} \usage{ getTags(fn) } @@ -12,7 +12,8 @@ Objective function.} } \value{ [\code{character}] + Vector of associated tags. } \description{ -Returns vector of associated tags. +Returns the vector of associated tags. } diff --git a/man/getWrappedFunction.Rd b/man/getWrappedFunction.Rd index e1f005ee..014ee6c1 100644 --- a/man/getWrappedFunction.Rd +++ b/man/getWrappedFunction.Rd @@ -17,6 +17,7 @@ Function may be wrapped with multiple wrappers. If \code{deepest} is set to } \value{ [\code{function}] + The extracted wrapped function. } \description{ The \pkg{smoof} package offers means to let a function log its evaluations or diff --git a/man/hasConstraints.Rd b/man/hasConstraints.Rd index b2565e9a..98f940b1 100644 --- a/man/hasConstraints.Rd +++ b/man/hasConstraints.Rd @@ -12,6 +12,7 @@ Objective function.} } \value{ [\code{logical(1)}] + \code{TRUE} if the function has constraints, \code{FALSE} otherwise. } \description{ Checks whether the objective function has constraints. diff --git a/man/hasGlobalOptimum.Rd b/man/hasGlobalOptimum.Rd index 2f4735cc..be236cbd 100644 --- a/man/hasGlobalOptimum.Rd +++ b/man/hasGlobalOptimum.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/hasGlobalOptimum.R \name{hasGlobalOptimum} \alias{hasGlobalOptimum} -\title{Checks whether global optimum is known.} +\title{Checks whether the global optimum is known.} \usage{ hasGlobalOptimum(fn) } @@ -12,7 +12,8 @@ Objective function.} } \value{ [\code{logical(1)}] + \code{TRUE} if the global optimum is known, \code{FALSE} otherwise. } \description{ -Checks whether global optimum is known. +Checks whether the global optimum is known. } diff --git a/man/hasTags.Rd b/man/hasTags.Rd index 07ceebcb..d8cf3478 100644 --- a/man/hasTags.Rd +++ b/man/hasTags.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/hasTags.R \name{hasTags} \alias{hasTags} -\title{Check if function has assigend special tags.} +\title{Checks if the function has assigned special tags.} \usage{ hasTags(fn, tags) } @@ -15,6 +15,7 @@ Vector of tags/properties to check \code{fn} for.} } \value{ [\code{logical(1)}] + Logical vector indicating the presence of specified tags. } \description{ Each single-objective smoof function has tags assigned to it (see diff --git a/man/isMultiobjective.Rd b/man/isMultiobjective.Rd index f49ca4bb..9d9a2b1b 100644 --- a/man/isMultiobjective.Rd +++ b/man/isMultiobjective.Rd @@ -11,7 +11,7 @@ isMultiobjective(fn) Objective function.} } \value{ -[\code{logical(1)}] \code{TRUE} if function is multi-objective. +[\code{logical(1)}] \code{TRUE} if function is multi-objective, \code{FALSE} otherwise. } \description{ Checks whether the given function is multi-objective. diff --git a/man/isNoisy.Rd b/man/isNoisy.Rd index 2a89d875..3febefce 100644 --- a/man/isNoisy.Rd +++ b/man/isNoisy.Rd @@ -12,6 +12,7 @@ Objective function.} } \value{ [\code{logical(1)}] + \code{TRUE} if the function is noisy, \code{FALSE} otherwise. } \description{ Checks whether the given function is noisy. diff --git a/man/isSingleobjective.Rd b/man/isSingleobjective.Rd index 2cca0f4e..d4b4a113 100644 --- a/man/isSingleobjective.Rd +++ b/man/isSingleobjective.Rd @@ -11,7 +11,7 @@ isSingleobjective(fn) Objective function.} } \value{ -[\code{logical(1)}] \code{TRUE} if function is single-objective. +[\code{logical(1)}] \code{TRUE} if function is single-objective, \code{FALSE} otherwise. } \description{ Checks whether the given function is single-objective. diff --git a/man/isSmoofFunction.Rd b/man/isSmoofFunction.Rd index 77286922..c22c6f31 100644 --- a/man/isSmoofFunction.Rd +++ b/man/isSmoofFunction.Rd @@ -13,6 +13,7 @@ Arbitrary R object.} } \value{ [\code{logical(1)}] + \code{TRUE} if the object is a SMOOF function or wrapped function, \code{FALSE} otherwise. } \description{ Checks whether the given object is a \code{smoof_function} or a diff --git a/man/isVectorized.Rd b/man/isVectorized.Rd index 395da036..ab0cf131 100644 --- a/man/isVectorized.Rd +++ b/man/isVectorized.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/isVectorized.R \name{isVectorized} \alias{isVectorized} -\title{Checks whether the given function accept \dQuote{vectorized} input.} +\title{Checks whether the given function accepts \dQuote{vectorized} input.} \usage{ isVectorized(fn) } @@ -12,7 +12,8 @@ Objective function.} } \value{ [\code{logical(1)}] + \code{TRUE} if the function accepts vectorized input, \code{FALSE} otherwise. } \description{ -Checks whether the given function accept \dQuote{vectorized} input. +Checks whether the given function accepts \dQuote{vectorized} input. } diff --git a/man/isWrappedSmoofFunction.Rd b/man/isWrappedSmoofFunction.Rd index 9c8b03c3..9501083b 100644 --- a/man/isWrappedSmoofFunction.Rd +++ b/man/isWrappedSmoofFunction.Rd @@ -12,6 +12,7 @@ Arbitrary R object.} } \value{ [\code{logical(1)}] + \code{TRUE} if the object is a SMOOF wrapped function, \code{FALSE} otherwise. } \description{ Checks whether the function is of type \code{smoof_wrapped_function}. diff --git a/man/makeAckleyFunction.Rd b/man/makeAckleyFunction.Rd index c2d58dcd..d2b4b731 100644 --- a/man/makeAckleyFunction.Rd +++ b/man/makeAckleyFunction.Rd @@ -11,11 +11,13 @@ makeAckleyFunction(dimensions) Size of corresponding parameter space.} } \value{ +An object of class \code{SingleObjectiveFunction}, representing the Ackley Function. + [\code{smoof_single_objective_function}] } \description{ Also known as \dQuote{Ackley's Path Function}. -Multimodal test function with its global optimum in the center of the defintion +Multi-modal test function with its global optimum in the center of the definition space. The implementation is based on the formula \deqn{f(\mathbf{x}) = -a \cdot \exp\left(-b \cdot \sqrt{\left(\frac{1}{n} \sum_{i=1}^{n} \mathbf{x}_i\right)}\right) - \exp\left(\frac{1}{n} \sum_{i=1}^{n} \cos(c \cdot \mathbf{x}_i)\right),} with \eqn{a = 20}, \eqn{b = 0.2} and \eqn{c = 2\pi}. The feasible region is diff --git a/man/makeAdjimanFunction.Rd b/man/makeAdjimanFunction.Rd index 0d4e449c..a0a0f7ad 100644 --- a/man/makeAdjimanFunction.Rd +++ b/man/makeAdjimanFunction.Rd @@ -6,7 +6,13 @@ \usage{ makeAdjimanFunction() } +\arguments{ +\item{A}{numeric vector of length 2 representing the input coordinates. +\code{x[1]} should be in the range [-1, 2], and \code{x[2]} should be in the range [2, 1].} +} \value{ +An object of class \code{SingleObjectiveFunction}, representing the Adjiman Function. + [\code{smoof_single_objective_function}] } \description{ diff --git a/man/makeAlpine01Function.Rd b/man/makeAlpine01Function.Rd index 32aa7c6d..4d4d0e54 100644 --- a/man/makeAlpine01Function.Rd +++ b/man/makeAlpine01Function.Rd @@ -11,10 +11,12 @@ makeAlpine01Function(dimensions) Size of corresponding parameter space.} } \value{ +An object of class \code{SingleObjectiveFunction}, representing the Alpine01 Function. + [\code{smoof_single_objective_function}] } \description{ -Highly multimodal single-objective optimization test function. It is defined +Highly multi-modal single-objective optimization test function. It is defined as \deqn{f(\mathbf{x}) = \sum_{i = 1}^{n} |\mathbf{x}_i \sin(\mathbf{x}_i) + 0.1\mathbf{x}_i|} with box constraints \eqn{\mathbf{x}_i \in [-10, 10]} for \eqn{i = 1, \ldots, n}. } diff --git a/man/makeAlpine02Function.Rd b/man/makeAlpine02Function.Rd index bebe0a8a..26990df6 100644 --- a/man/makeAlpine02Function.Rd +++ b/man/makeAlpine02Function.Rd @@ -11,10 +11,12 @@ makeAlpine02Function(dimensions) Size of corresponding parameter space.} } \value{ +An object of class \code{SingleObjectiveFunction}, representing the Alpine02 Function. + [\code{smoof_single_objective_function}] } \description{ -Another multimodal optimization test function. The implementation is based on +Another multi-modal optimization test function. The implementation is based on the formula \deqn{f(\mathbf{x}) = \prod_{i = 1}^{n} \sqrt{\mathbf{x}_i}\sin(\mathbf{x}_i)} with \eqn{\mathbf{x}_i \in [0, 10]} for \eqn{i = 1, \ldots, n}. diff --git a/man/makeBBOBFunction.Rd b/man/makeBBOBFunction.Rd index 0623470c..f599765c 100644 --- a/man/makeBBOBFunction.Rd +++ b/man/makeBBOBFunction.Rd @@ -2,8 +2,7 @@ % Please edit documentation in R/makeBBOBFunction.R \name{makeBBOBFunction} \alias{makeBBOBFunction} -\title{Generator for the noiseless function set of the real-parameter Black-Box -Optimization Benchmarking (BBOB).} +\title{Generator for noiseless function set of the real-parameter BBOB.} \usage{ makeBBOBFunction(dimensions, fid, iid) } @@ -19,6 +18,7 @@ Instance identifier. Integer value greater than or equal 1.} } \value{ [\code{smoof_single_objective_function}] + Noiseless function from the BBOB benchmark. } \description{ Generator for the noiseless function set of the real-parameter Black-Box diff --git a/man/makeBK1Function.Rd b/man/makeBK1Function.Rd index 1d5686a6..9995693c 100644 --- a/man/makeBK1Function.Rd +++ b/man/makeBK1Function.Rd @@ -8,9 +8,11 @@ makeBK1Function() } \value{ [\code{smoof_multi_objective_function}] + Returns an instance of the BK1 function as a \code{smoof_multi_objective_function} object. } \description{ -... +Generates the BK1 function, a multi-objective optimization test function. The BK1 function +is commonly used in benchmarking studies for evaluating the performance of optimization algorithms. } \references{ ... diff --git a/man/makeBartelsConnFunction.Rd b/man/makeBartelsConnFunction.Rd index ae31aade..d985eb2a 100644 --- a/man/makeBartelsConnFunction.Rd +++ b/man/makeBartelsConnFunction.Rd @@ -7,6 +7,8 @@ makeBartelsConnFunction() } \value{ +An object of class \code{SingleObjectiveFunction}, representing the Bartels Conn Function. + [\code{smoof_single_objective_function}] } \description{ diff --git a/man/makeBealeFunction.Rd b/man/makeBealeFunction.Rd index 12c2b27f..0899508d 100644 --- a/man/makeBealeFunction.Rd +++ b/man/makeBealeFunction.Rd @@ -7,13 +7,15 @@ makeBealeFunction() } \value{ +An object of class \code{SingleObjectiveFunction}, representing the Beale Function. + [\code{smoof_single_objective_function}] } \description{ -Multimodal single-objective test function for optimization. It is based on +Multi-modal single-objective test function for optimization. It is based on the mathematic formula \deqn{f(\mathbf{x}) = (1.5 - \mathbf{x}_1 + \mathbf{x}_1\mathbf{x}_2)^2 + (2.25 - \mathbf{x}_1 + \mathbf{x}_1\mathbf{x}_2^2)^2 + (2.625 - \mathbf{x}_1 + \mathbf{x}_1\mathbf{x}_2^3)^2} usually evaluated within the bounds \eqn{\mathbf{x}_i \in [-4.5, 4.5], i = 1, 2}. -The function has a flat but multimodal region aroung the single global optimum +The function has a flat but multi-modal region around the single global optimum and large peaks in the edges of its definition space. } diff --git a/man/makeBentCigarFunction.Rd b/man/makeBentCigarFunction.Rd index 665c98f2..c9263ddd 100644 --- a/man/makeBentCigarFunction.Rd +++ b/man/makeBentCigarFunction.Rd @@ -11,6 +11,8 @@ makeBentCigarFunction(dimensions) Size of corresponding parameter space.} } \value{ +An object of class \code{SingleObjectiveFunction}, representing the Bent-Cigar Function. + [\code{smoof_single_objective_function}] } \description{ diff --git a/man/makeBiObjBBOBFunction.Rd b/man/makeBiObjBBOBFunction.Rd index 3df37ba9..c9b48906 100644 --- a/man/makeBiObjBBOBFunction.Rd +++ b/man/makeBiObjBBOBFunction.Rd @@ -2,9 +2,7 @@ % Please edit documentation in R/makeBiObjBBOBFunction.R \name{makeBiObjBBOBFunction} \alias{makeBiObjBBOBFunction} -\title{Generator for the function set of the real-parameter Bi-Objective -Black-Box Optimization Benchmarking (BBOB) with Function IDs 1-55, as well as -its extended version (bbob-biobj-ext) with Function IDs 1-92.} +\title{Generate Bi-Objective Function from the Real-Parameter Bi-Objective Black-Box Optimization Benchmarking (BBOB)} \usage{ makeBiObjBBOBFunction(dimensions, fid, iid) } @@ -20,6 +18,7 @@ Instance identifier. Integer value greater than or equal 1.} } \value{ [\code{smoof_multi_objective_function}] + Bi-objective function from the BBOB benchmark. } \description{ Generator for the function set of the real-parameter Bi-Objective diff --git a/man/makeBiSphereFunction.Rd b/man/makeBiSphereFunction.Rd index 4c0eaf92..6b095a2b 100644 --- a/man/makeBiSphereFunction.Rd +++ b/man/makeBiSphereFunction.Rd @@ -15,6 +15,7 @@ Shift parameter for the second objective. Default is (0,...,0).} } \value{ [\code{smoof_multi_objective_function}] + Returns an instance of the sphere function as a \code{smoof_multi_objective_function} object. } \description{ Builds and returns the bi-objective Sphere test problem: diff --git a/man/makeBirdFunction.Rd b/man/makeBirdFunction.Rd index 2cc3683b..5d81bf72 100644 --- a/man/makeBirdFunction.Rd +++ b/man/makeBirdFunction.Rd @@ -7,10 +7,12 @@ makeBirdFunction() } \value{ +An object of class \code{SingleObjectiveFunction}, representing the Bird Function. + [\code{smoof_single_objective_function}] } \description{ -Multimodal single-objective test function. The implementation is based on the +Multi-modal single-objective test function. The implementation is based on the mathematical formulation \deqn{f(\mathbf{x}) = (\mathbf{x}_1 - \mathbf{x}_2)^2 + \exp((1 - \sin(\mathbf{x}_1))^2)\cos(\mathbf{x}_2) + \exp((1 - \cos(\mathbf{x}_2))^2)\sin(\mathbf{x}_1).} The function is restricted to two dimensions with \eqn{\mathbf{x}_i \in [-2\pi, 2\pi], i = 1, 2.} diff --git a/man/makeBohachevskyN1Function.Rd b/man/makeBohachevskyN1Function.Rd index cc582155..e6b4403c 100644 --- a/man/makeBohachevskyN1Function.Rd +++ b/man/makeBohachevskyN1Function.Rd @@ -11,14 +11,16 @@ makeBohachevskyN1Function(dimensions) Size of corresponding parameter space.} } \value{ +An object of class \code{SingleObjectiveFunction}, representing the Bohachevsky Function. + [\code{smoof_single_objective_function}] } \description{ -Highly multimodal single-objective test function. The mathematical formula is +Highly multi-modal single-objective test function. The mathematical formula is given by \deqn{f(\mathbf{x}) = \sum_{i = 1}^{n - 1} (\mathbf{x}_i^2 + 2 \mathbf{x}_{i + 1}^2 - 0.3\cos(3\pi\mathbf{x}_i) - 0.4\cos(4\pi\mathbf{x}_{i + 1}) + 0.7)} with box-constraints \eqn{\mathbf{x}_i \in [-100, 100]} for \eqn{i = 1, \ldots, n}. -The multimodality will be visible by \dQuote{zooming in} in the plot. +The multi-modality will be visible by \dQuote{zooming in} in the plot. } \references{ I. O. Bohachevsky, M. E. Johnson, M. L. Stein, General Simulated diff --git a/man/makeBoothFunction.Rd b/man/makeBoothFunction.Rd index a3716ed6..0344bcf4 100644 --- a/man/makeBoothFunction.Rd +++ b/man/makeBoothFunction.Rd @@ -7,6 +7,8 @@ makeBoothFunction() } \value{ +An object of class \code{SingleObjectiveFunction}, representing the Booth Function. + [\code{smoof_single_objective_function}] } \description{ diff --git a/man/makeBraninFunction.Rd b/man/makeBraninFunction.Rd index d23d43e2..f71316bf 100644 --- a/man/makeBraninFunction.Rd +++ b/man/makeBraninFunction.Rd @@ -7,6 +7,8 @@ makeBraninFunction() } \value{ +An object of class \code{SingleObjectiveFunction}, representing the Brainin RCOS Function. + [\code{smoof_single_objective_function}] } \description{ diff --git a/man/makeBrentFunction.Rd b/man/makeBrentFunction.Rd index 0bde7dfe..87fadb5c 100644 --- a/man/makeBrentFunction.Rd +++ b/man/makeBrentFunction.Rd @@ -7,6 +7,8 @@ makeBrentFunction() } \value{ +An object of class \code{SingleObjectiveFunction}, representing the Brent Function. + [\code{smoof_single_objective_function}] } \description{ diff --git a/man/makeBrownFunction.Rd b/man/makeBrownFunction.Rd index daaacb3a..1eac585b 100644 --- a/man/makeBrownFunction.Rd +++ b/man/makeBrownFunction.Rd @@ -11,10 +11,12 @@ makeBrownFunction(dimensions) Size of corresponding parameter space.} } \value{ +An object of class \code{SingleObjectiveFunction}, representing the Brown Function. + [\code{smoof_single_objective_function}] } \description{ -This function belongs the the unimodal single-objective test functions. The +This function belongs the the uni-modal single-objective test functions. The function is forumlated as \deqn{f(\mathbf{x}) = \sum_{i = 1}^{n} (\mathbf{x}_i^2)^{(\mathbf{x}_{i + 1} + 1)} + (\mathbf{x}_{i + 1})^{(\mathbf{x}_i + 1)}} subject to \eqn{\mathbf{x}_i \in [-1, 4]} for \eqn{i = 1, \ldots, n}. diff --git a/man/makeBukinN2Function.Rd b/man/makeBukinN2Function.Rd index a65eadea..d4582f53 100644 --- a/man/makeBukinN2Function.Rd +++ b/man/makeBukinN2Function.Rd @@ -7,10 +7,12 @@ makeBukinN2Function() } \value{ +An object of class \code{SingleObjectiveFunction}, representing the Bukin N.2 Function. + [\code{smoof_single_objective_function}] } \description{ -Muldimodal, non-scalable, continous optimization test function given by: +Multi-modal, non-scalable, continuous optimization test function given by: \deqn{f(\mathbf{x}) = 100 (\mathbf{x}_2 - 0.01 * \mathbf{x}_1^2 + 1) + 0.01 (\mathbf{x}_1 + 10)^2} subject to \eqn{\mathbf{x}_1 \in [-15, -5]} and \eqn{\mathbf{x}_2 \in [-3, 3]}. } diff --git a/man/makeBukinN4Function.Rd b/man/makeBukinN4Function.Rd index 119145ed..cda5d3b7 100644 --- a/man/makeBukinN4Function.Rd +++ b/man/makeBukinN4Function.Rd @@ -7,10 +7,12 @@ makeBukinN4Function() } \value{ +An object of class \code{SingleObjectiveFunction}, representing the Bukin N.4 Function. + [\code{smoof_single_objective_function}] } \description{ -Second continous Bukin function test function. The formula is given by +Second continuous Bukin function test function. The formula is given by \deqn{f(\mathbf{x}) = 100 \mathbf{x}_2^2 + 0.01 * ||\mathbf{x}_1 +10||} and the box constraints \eqn{mathbf{x}_1 \in [-15, 5], \mathbf{x}_2 \in [-3, 3]}. } diff --git a/man/makeBukinN6Function.Rd b/man/makeBukinN6Function.Rd index 7173b1d8..cc7a1bd8 100644 --- a/man/makeBukinN6Function.Rd +++ b/man/makeBukinN6Function.Rd @@ -7,6 +7,8 @@ makeBukinN6Function() } \value{ +An object of class \code{SingleObjectiveFunction}, representing the Bukin N.6 Function. + [\code{smoof_single_objective_function}] } \description{ @@ -16,7 +18,7 @@ It is given by the formula and the box constraints \eqn{mathbf{x}_1 \in [-15, 5], \mathbf{x}_2 \in [-3, 3]}. } \references{ -Z. K. Silagadze, Finding Two-Dimesnional Peaks, Physics of Particles +Z. K. Silagadze, Finding Two-Dimensional Peaks, Physics of Particles and Nuclei Letters, vol. 4, no. 1, pp. 73-80, 2007. } \seealso{ diff --git a/man/makeCarromTableFunction.Rd b/man/makeCarromTableFunction.Rd index 3d06e321..d43b74cc 100644 --- a/man/makeCarromTableFunction.Rd +++ b/man/makeCarromTableFunction.Rd @@ -7,6 +7,8 @@ makeCarromTableFunction() } \value{ +An object of class \code{SingleObjectiveFunction}, representing the Carrom Table Function. + [\code{smoof_single_objective_function}] } \description{ diff --git a/man/makeChichinadzeFunction.Rd b/man/makeChichinadzeFunction.Rd index b9b309ca..a42e02fc 100644 --- a/man/makeChichinadzeFunction.Rd +++ b/man/makeChichinadzeFunction.Rd @@ -7,6 +7,8 @@ makeChichinadzeFunction() } \value{ +An object of class \code{SingleObjectiveFunction}, representing the Chichinadze Function. + [\code{smoof_single_objective_function}] } \description{ diff --git a/man/makeChungReynoldsFunction.Rd b/man/makeChungReynoldsFunction.Rd index 423e95f0..2de71c45 100644 --- a/man/makeChungReynoldsFunction.Rd +++ b/man/makeChungReynoldsFunction.Rd @@ -11,15 +11,17 @@ makeChungReynoldsFunction(dimensions) Size of corresponding parameter space.} } \value{ +An object of class \code{SingleObjectiveFunction}, representing the Chung Reynolds Function. + [\code{smoof_single_objective_function}] } \description{ -The defintion is given by +The definition is given by \deqn{f(\mathbf{x}) = \left(\sum_{i=1}^{n} \mathbf{x}_i^2\right)^2} with box-constraings \eqn{\mathbf{x}_i \in [-100, 100], i = 1, \ldots, n}. } \references{ C. J. Chung, R. G. Reynolds, CAEP: An Evolution-Based Tool for -Real-Valued Func- tion Optimization Using Cultural Algorithms, International -Journal on Artificial In- telligence Tool, vol. 7, no. 3, pp. 239-291, 1998. +Real-Valued Function Optimization Using Cultural Algorithms, International +Journal on Artificial Intelligence Tool, vol. 7, no. 3, pp. 239-291, 1998. } diff --git a/man/makeComplexFunction.Rd b/man/makeComplexFunction.Rd index 3f99be52..75acb8d8 100644 --- a/man/makeComplexFunction.Rd +++ b/man/makeComplexFunction.Rd @@ -7,6 +7,8 @@ makeComplexFunction() } \value{ +An object of class \code{SingleObjectiveFunction}, representing the Complex Function. + [\code{smoof_single_objective_function}] } \description{ diff --git a/man/makeCosineMixtureFunction.Rd b/man/makeCosineMixtureFunction.Rd index 34283835..8a2e155a 100644 --- a/man/makeCosineMixtureFunction.Rd +++ b/man/makeCosineMixtureFunction.Rd @@ -11,6 +11,8 @@ makeCosineMixtureFunction(dimensions) Size of corresponding parameter space.} } \value{ +An object of class \code{SingleObjectiveFunction}, representing the Cosine Mixture Function. + [\code{smoof_single_objective_function}] } \description{ diff --git a/man/makeCrossInTrayFunction.Rd b/man/makeCrossInTrayFunction.Rd index 51948c68..6a94cdc4 100644 --- a/man/makeCrossInTrayFunction.Rd +++ b/man/makeCrossInTrayFunction.Rd @@ -7,6 +7,8 @@ makeCrossInTrayFunction() } \value{ +An object of class \code{SingleObjectiveFunction}, representing the Cross-In-Tray Function. + [\code{smoof_single_objective_function}] } \description{ diff --git a/man/makeCubeFunction.Rd b/man/makeCubeFunction.Rd index 13c9af23..6db07180 100644 --- a/man/makeCubeFunction.Rd +++ b/man/makeCubeFunction.Rd @@ -7,6 +7,8 @@ makeCubeFunction() } \value{ +An object of class \code{SingleObjectiveFunction}, representing the Cube Function. + [\code{smoof_single_objective_function}] } \description{ diff --git a/man/makeDTLZ1Function.Rd b/man/makeDTLZ1Function.Rd index cfa3b8ff..75e3708c 100644 --- a/man/makeDTLZ1Function.Rd +++ b/man/makeDTLZ1Function.Rd @@ -15,6 +15,7 @@ Number of objectives.} } \value{ [\code{smoof_multi_objective_function}] + Returns an instance of the DTLZ1 family as a \code{smoof_multi_objective_function} object. } \description{ Builds and returns the multi-objective DTLZ1 test problem. diff --git a/man/makeDTLZ2Function.Rd b/man/makeDTLZ2Function.Rd index b7c6735a..e49baf54 100644 --- a/man/makeDTLZ2Function.Rd +++ b/man/makeDTLZ2Function.Rd @@ -15,6 +15,7 @@ Number of objectives.} } \value{ [\code{smoof_multi_objective_function}] + Returns an instance of the DTLZ2 family as a \code{smoof_multi_objective_function} object. } \description{ Builds and returns the multi-objective DTLZ2 test problem. diff --git a/man/makeDTLZ3Function.Rd b/man/makeDTLZ3Function.Rd index a5694db8..ac494242 100644 --- a/man/makeDTLZ3Function.Rd +++ b/man/makeDTLZ3Function.Rd @@ -15,6 +15,7 @@ Number of objectives.} } \value{ [\code{smoof_multi_objective_function}] + Returns an instance of the DTLZ3 family as a \code{smoof_multi_objective_function} object. } \description{ Builds and returns the multi-objective DTLZ3 test problem. The formula diff --git a/man/makeDTLZ4Function.Rd b/man/makeDTLZ4Function.Rd index a25616b8..25f3804e 100644 --- a/man/makeDTLZ4Function.Rd +++ b/man/makeDTLZ4Function.Rd @@ -18,6 +18,7 @@ Optional parameter. Default is 100, which is recommended by Deb et al.} } \value{ [\code{smoof_multi_objective_function}] + Returns an instance of the DTLZ4 family as a \code{smoof_multi_objective_function} object. } \description{ Builds and returns the multi-objective DTLZ4 test problem. It is a slight diff --git a/man/makeDTLZ5Function.Rd b/man/makeDTLZ5Function.Rd index 1b962d1e..70567938 100644 --- a/man/makeDTLZ5Function.Rd +++ b/man/makeDTLZ5Function.Rd @@ -15,12 +15,13 @@ Number of objectives.} } \value{ [\code{smoof_multi_objective_function}] + Returns an instance of the DTLZ5 family as a \code{smoof_multi_objective_function} object. } \description{ Builds and returns the multi-objective DTLZ5 test problem. This problem can be characterized by a disconnected Pareto-optimal front in the search space. This introduces a new challenge to evolutionary multi-objective -optimizers, i.e., to maintain different subpopulations within the search +optimizers, i.e., to maintain different sub-populations within the search space to cover the entire Pareto-optimal front. The DTLZ5 test problem is defined as follows: diff --git a/man/makeDTLZ6Function.Rd b/man/makeDTLZ6Function.Rd index 41866237..a995ec11 100644 --- a/man/makeDTLZ6Function.Rd +++ b/man/makeDTLZ6Function.Rd @@ -15,6 +15,7 @@ Number of objectives.} } \value{ [\code{smoof_multi_objective_function}] + Returns an instance of the DTLZ6 family as a \code{smoof_multi_objective_function} object. } \description{ Builds and returns the multi-objective DTLZ6 test problem. This problem diff --git a/man/makeDTLZ7Function.Rd b/man/makeDTLZ7Function.Rd index e603ba72..c5fc0cce 100644 --- a/man/makeDTLZ7Function.Rd +++ b/man/makeDTLZ7Function.Rd @@ -15,12 +15,13 @@ Number of objectives.} } \value{ [\code{smoof_multi_objective_function}] + Returns an instance of the DTLZ7 family as a \code{smoof_multi_objective_function} object. } \description{ Builds and returns the multi-objective DTLZ7 test problem. This problem can be characterized by a disconnected Pareto-optimal front in the search space. This introduces a new challenge to evolutionary multi-objective -optimizers, i.e., to maintain different subpopulations within the search +optimizers, i.e., to maintain different sub-populations within the search space to cover the entire Pareto-optimal front. The DTLZ7 test problem is defined as follows: diff --git a/man/makeDeckkersAartsFunction.Rd b/man/makeDeckkersAartsFunction.Rd index 1bb551be..888c015b 100644 --- a/man/makeDeckkersAartsFunction.Rd +++ b/man/makeDeckkersAartsFunction.Rd @@ -7,6 +7,8 @@ makeDeckkersAartsFunction() } \value{ +An object of class \code{SingleObjectiveFunction}, representing the Deckkers-Aarts Function. + [\code{smoof_single_objective_function}] } \description{ diff --git a/man/makeDeflectedCorrugatedSpringFunction.Rd b/man/makeDeflectedCorrugatedSpringFunction.Rd index 2a356804..bdce2bb7 100644 --- a/man/makeDeflectedCorrugatedSpringFunction.Rd +++ b/man/makeDeflectedCorrugatedSpringFunction.Rd @@ -19,6 +19,8 @@ Parameter. Default is 5.} } \value{ +An object of class \code{SingleObjectiveFunction}, representing the Deflected Corrugated Spring Function. + [\code{smoof_single_objective_function}] } \description{ diff --git a/man/makeDentFunction.Rd b/man/makeDentFunction.Rd index 1e40038d..04dac2dd 100644 --- a/man/makeDentFunction.Rd +++ b/man/makeDentFunction.Rd @@ -2,12 +2,13 @@ % Please edit documentation in R/mof.dent.R \name{makeDentFunction} \alias{makeDentFunction} -\title{Dent Function} +\title{Dent Function Generator} \usage{ makeDentFunction() } \value{ [\code{smoof_multi_objective_function}] + Returns an instance of the Dent function as a \code{smoof_multi_objective_function} object. } \description{ Builds and returns the bi-objective Dent test problem, which is defined as diff --git a/man/makeDixonPriceFunction.Rd b/man/makeDixonPriceFunction.Rd index 78514a3e..688a133b 100644 --- a/man/makeDixonPriceFunction.Rd +++ b/man/makeDixonPriceFunction.Rd @@ -11,6 +11,8 @@ makeDixonPriceFunction(dimensions) Size of corresponding parameter space.} } \value{ +An object of class \code{SingleObjectiveFunction}, representing the Dixon-Price Function. + [\code{smoof_single_objective_function}] } \description{ diff --git a/man/makeDoubleSumFunction.Rd b/man/makeDoubleSumFunction.Rd index fbf5c30f..8eb99ad8 100644 --- a/man/makeDoubleSumFunction.Rd +++ b/man/makeDoubleSumFunction.Rd @@ -11,6 +11,8 @@ makeDoubleSumFunction(dimensions) Size of corresponding parameter space.} } \value{ +An object of class \code{SingleObjectiveFunction}, representing the Double-Sum Function. + [\code{smoof_single_objective_function}] } \description{ diff --git a/man/makeED1Function.Rd b/man/makeED1Function.Rd index 58c29d8b..448759c4 100644 --- a/man/makeED1Function.Rd +++ b/man/makeED1Function.Rd @@ -22,6 +22,7 @@ The default is \code{theta = (pi/2) * x} (with \code{x} being the point from the } \value{ [\code{smoof_multi_objective_function}] + Returns an instance of the ED1 function as a \code{smoof_multi_objective_function} object. } \description{ Builds and returns the multi-objective ED1 test problem. diff --git a/man/makeED2Function.Rd b/man/makeED2Function.Rd index 53ce5e36..8504c09d 100644 --- a/man/makeED2Function.Rd +++ b/man/makeED2Function.Rd @@ -22,6 +22,7 @@ The default is \code{theta = (pi/2) * x} (with \code{x} being the point from the } \value{ [\code{smoof_multi_objective_function}] + Returns an instance of the ED2 function as a \code{smoof_multi_objective_function} object. } \description{ Builds and returns the multi-objective ED2 test problem. diff --git a/man/makeEasomFunction.Rd b/man/makeEasomFunction.Rd index 1596d83a..667ca04c 100644 --- a/man/makeEasomFunction.Rd +++ b/man/makeEasomFunction.Rd @@ -7,10 +7,12 @@ makeEasomFunction() } \value{ +An object of class \code{SingleObjectiveFunction}, representing the Easom Function. + [\code{smoof_single_objective_function}] } \description{ -Unimodal function with its global optimum in the center of the search space. +Uni-modal function with its global optimum in the center of the search space. The attraction area of the global optimum is very small in relation to the search space: \deqn{f(\mathbf{x}) = -\cos(\mathbf{x}_1)\cos(\mathbf{x}_2)\exp\left(-\left((\mathbf{x}_1 - \pi)^2 + (\mathbf{x}_2 - pi)^2\right)\right)} diff --git a/man/makeEggCrateFunction.Rd b/man/makeEggCrateFunction.Rd index 9b34c635..8a5b9df5 100644 --- a/man/makeEggCrateFunction.Rd +++ b/man/makeEggCrateFunction.Rd @@ -7,6 +7,8 @@ makeEggCrateFunction() } \value{ +An object of class \code{SingleObjectiveFunction}, representing the Egg Crate Function. + [\code{smoof_single_objective_function}] } \description{ diff --git a/man/makeEggholderFunction.Rd b/man/makeEggholderFunction.Rd index 26a6fa16..2b22839a 100644 --- a/man/makeEggholderFunction.Rd +++ b/man/makeEggholderFunction.Rd @@ -7,6 +7,8 @@ makeEggholderFunction() } \value{ +An object of class \code{SingleObjectiveFunction}, representing the Egg Holder Function. + [\code{smoof_single_objective_function}] } \description{ diff --git a/man/makeElAttarVidyasagarDuttaFunction.Rd b/man/makeElAttarVidyasagarDuttaFunction.Rd index 4601d0ee..8565e09b 100644 --- a/man/makeElAttarVidyasagarDuttaFunction.Rd +++ b/man/makeElAttarVidyasagarDuttaFunction.Rd @@ -7,6 +7,8 @@ makeElAttarVidyasagarDuttaFunction() } \value{ +An object of class \code{SingleObjectiveFunction}, representing the El-Attar-Vidyasagar-Dutta Function. + [\code{smoof_single_objective_function}] } \description{ @@ -16,6 +18,6 @@ subject to \eqn{\mathbf{x}_i \in [-500, 500], i = 1, 2}. } \references{ R. A. El-Attar, M. Vidyasagar, S. R. K. Dutta, An Algorithm for -II-norm Minimiza- tion With Application to Nonlinear II-approximation, SIAM -Journal on Numverical Analysis, vol. 16, no. 1, pp. 70-86, 1979. +II-norm Minimization With Application to Nonlinear II-approximation, SIAM +Journal on Numerical Analysis, vol. 16, no. 1, pp. 70-86, 1979. } diff --git a/man/makeEngvallFunction.Rd b/man/makeEngvallFunction.Rd index 4fff9bc5..a7348530 100644 --- a/man/makeEngvallFunction.Rd +++ b/man/makeEngvallFunction.Rd @@ -7,6 +7,8 @@ makeEngvallFunction() } \value{ +An object of class \code{SingleObjectiveFunction}, representing the Complex Function. + [\code{smoof_single_objective_function}] } \description{ diff --git a/man/makeExponentialFunction.Rd b/man/makeExponentialFunction.Rd index 92e332ac..90c8db88 100644 --- a/man/makeExponentialFunction.Rd +++ b/man/makeExponentialFunction.Rd @@ -11,6 +11,8 @@ makeExponentialFunction(dimensions) Size of corresponding parameter space.} } \value{ +An object of class \code{SingleObjectiveFunction}, representing the Exponential Function. + [\code{smoof_single_objective_function}] } \description{ diff --git a/man/makeFreudensteinRothFunction.Rd b/man/makeFreudensteinRothFunction.Rd index f81675f8..f126e8f2 100644 --- a/man/makeFreudensteinRothFunction.Rd +++ b/man/makeFreudensteinRothFunction.Rd @@ -7,6 +7,8 @@ makeFreudensteinRothFunction() } \value{ +An object of class \code{SingleObjectiveFunction}, representing the Freundstein-Roth Function. + [\code{smoof_single_objective_function}] } \description{ diff --git a/man/makeFunctionsByName.Rd b/man/makeFunctionsByName.Rd index 2a134a66..595d0cb1 100644 --- a/man/makeFunctionsByName.Rd +++ b/man/makeFunctionsByName.Rd @@ -16,6 +16,7 @@ Further arguments passed to generator.} } \value{ [\code{smoof_function}] + Smoof function generated based on the specified names and arguments. } \description{ This function is especially useful in combination with diff --git a/man/makeGOMOPFunction.Rd b/man/makeGOMOPFunction.Rd index 34067a2a..1cd3c743 100644 --- a/man/makeGOMOPFunction.Rd +++ b/man/makeGOMOPFunction.Rd @@ -15,6 +15,7 @@ List of single-objective smoof functions.} } \value{ [\code{smoof_multi_objective_function}] + Returns an instance of the GOMOP function as a \code{smoof_multi_objective_function} object. } \description{ Construct a multi-objective function by putting together multiple single-objective diff --git a/man/makeGeneralizedDropWaveFunction.Rd b/man/makeGeneralizedDropWaveFunction.Rd index 97a7f179..698113f4 100644 --- a/man/makeGeneralizedDropWaveFunction.Rd +++ b/man/makeGeneralizedDropWaveFunction.Rd @@ -11,10 +11,12 @@ makeGeneralizedDropWaveFunction(dimensions = 2L) Size of corresponding parameter space.} } \value{ +An object of class \code{SingleObjectiveFunction}, representing the Generalized Drop-Wave Function. + [\code{smoof_single_objective_function}] } \description{ -Multimodal single-objective function following the formula: +Multi-modal single-objective function following the formula: \deqn{\mathbf{x} = -\frac{1 + \cos(\sqrt{\sum_{i = 1}^{n} \mathbf{x}_i^2})}{2 + 0.5 \sum_{i = 1}^{n} \mathbf{x}_i^2}} with \eqn{\mathbf{x}_i \in [-5.12, 5.12], i = 1, \ldots, n}. } diff --git a/man/makeGiuntaFunction.Rd b/man/makeGiuntaFunction.Rd index 8d6d5dd5..5bf63637 100644 --- a/man/makeGiuntaFunction.Rd +++ b/man/makeGiuntaFunction.Rd @@ -7,10 +7,12 @@ makeGiuntaFunction() } \value{ +An object of class \code{SingleObjectiveFunction}, representing the Giunta Function. + [\code{smoof_single_objective_function}] } \description{ -Multimodal test function based on the definition +Multi-modal test function based on the definition \deqn{f(\mathbf{x}) = 0.6 + \sum_{i = 1}^{n} \left[\sin(\frac{16}{15} \mathbf{x}_i - 1) + \sin^2(\frac{16}{15}\mathbf{x}_i - 1) + \frac{1}{50} \sin(4(\frac{16}{15}\mathbf{x}_i - 1))\right]} with box-constraints \eqn{\mathbf{x}_i \in [-1, 1]} for \eqn{i = 1, \ldots, n}. } diff --git a/man/makeGoldsteinPriceFunction.Rd b/man/makeGoldsteinPriceFunction.Rd index 2e84cad6..73b73b67 100644 --- a/man/makeGoldsteinPriceFunction.Rd +++ b/man/makeGoldsteinPriceFunction.Rd @@ -7,6 +7,8 @@ makeGoldsteinPriceFunction() } \value{ +An object of class \code{SingleObjectiveFunction}, representing the Goldstein-Price Function. + [\code{smoof_single_objective_function}] } \description{ diff --git a/man/makeGriewankFunction.Rd b/man/makeGriewankFunction.Rd index e039932e..922db95f 100644 --- a/man/makeGriewankFunction.Rd +++ b/man/makeGriewankFunction.Rd @@ -11,10 +11,12 @@ makeGriewankFunction(dimensions) Size of corresponding parameter space.} } \value{ +An object of class \code{SingleObjectiveFunction}, representing the Griewank Function. + [\code{smoof_single_objective_function}] } \description{ -Highly multimodal function with a lot of regularly distributed local minima. +Highly multi-modal function with a lot of regularly distributed local minima. The corresponding formula is: \deqn{f(\mathbf{x}) = \sum_{i=1}^{n} \frac{\mathbf{x}_i^2}{4000} - \prod_{i=1}^{n} \cos\left(\frac{\mathbf{x}_i}{\sqrt{i}}\right) + 1} subject to \eqn{\mathbf{x}_i \in [-100, 100], i = 1, \ldots, n}. diff --git a/man/makeHansenFunction.Rd b/man/makeHansenFunction.Rd index 838b293d..fb1f09a3 100644 --- a/man/makeHansenFunction.Rd +++ b/man/makeHansenFunction.Rd @@ -7,6 +7,8 @@ makeHansenFunction() } \value{ +An object of class \code{SingleObjectiveFunction}, representing the Hansen Function. + [\code{smoof_single_objective_function}] } \description{ diff --git a/man/makeHartmannFunction.Rd b/man/makeHartmannFunction.Rd index b8d0ba52..2090881a 100644 --- a/man/makeHartmannFunction.Rd +++ b/man/makeHartmannFunction.Rd @@ -11,10 +11,12 @@ makeHartmannFunction(dimensions) Size of corresponding parameter space.} } \value{ +An object of class \code{SingleObjectiveFunction}, representing the Hartmann Function. + [\code{smoof_single_objective_function}] } \description{ -Unimodal single-objective test function with six local minima. +Uni-modal single-objective test function with six local minima. The implementation is based on the mathematical formulation \deqn{f(x) = - \sum_{i=1}^4 \alpha_i \ exp \left(-\sum_{j=1}^6 A_{ij}(x_j-P_{ij})^2 \right)}, where \deqn{\alpha = (1.0, 1.2, 3.0, 3.2)^T, \\ diff --git a/man/makeHimmelblauFunction.Rd b/man/makeHimmelblauFunction.Rd index 262d1869..7eea4ed2 100644 --- a/man/makeHimmelblauFunction.Rd +++ b/man/makeHimmelblauFunction.Rd @@ -7,12 +7,14 @@ makeHimmelblauFunction() } \value{ +An object of class \code{SingleObjectiveFunction}, representing the Himmelblau Function. + [\code{smoof_single_objective_function}] } \description{ -Two-dimensional test function based on the function defintion +Two-dimensional test function based on the function definition \deqn{f(\mathbf{x}) = (\mathbf{x}_1^2 + \mathbf{x}_2 - 11)^2 + (\mathbf{x}_1 + \mathbf{x}_2^2 - 7)^2} -with box-constraings \eqn{\mathbf{x}_i \in [-5, 5], i = 1, 2}. +with box-constraints \eqn{\mathbf{x}_i \in [-5, 5], i = 1, 2}. } \references{ D. M. Himmelblau, Applied Nonlinear Programming, McGraw-Hill, 1972. diff --git a/man/makeHolderTableN1Function.Rd b/man/makeHolderTableN1Function.Rd index 17704d3f..534731e4 100644 --- a/man/makeHolderTableN1Function.Rd +++ b/man/makeHolderTableN1Function.Rd @@ -7,10 +7,12 @@ makeHolderTableN1Function() } \value{ +An object of class \code{SingleObjectiveFunction}, representing the Holder Table function N. 1 Function. + [\code{smoof_single_objective_function}] } \description{ -This multimodal function is defined as +This multi-modal function is defined as \deqn{f(\mathbf{x}) = -\left|\cos(\mathbf{x}_1)\cos(\mathbf{x}_2)\exp(|1 - \sqrt{\mathbf{x}_1 + \mathbf{x}_2}/\pi|)\right|} with box-constraints \eqn{\mathbf{x}_i \in [-10, 10], i = 1, 2}. } diff --git a/man/makeHolderTableN2Function.Rd b/man/makeHolderTableN2Function.Rd index a1d0ff71..ca16957e 100644 --- a/man/makeHolderTableN2Function.Rd +++ b/man/makeHolderTableN2Function.Rd @@ -7,10 +7,12 @@ makeHolderTableN2Function() } \value{ +An object of class \code{SingleObjectiveFunction}, representing the Holder Table function N. 2 Function. + [\code{smoof_single_objective_function}] } \description{ -This multimodal function is defined as +This multi-modal function is defined as \deqn{f(\mathbf{x}) = -\left|\sin(\mathbf{x}_1)\cos(\mathbf{x}_2)\exp(|1 - \sqrt{\mathbf{x}_1 + \mathbf{x}_2}/\pi|)\right|} with box-constraints \eqn{\mathbf{x}_i \in [-10, 10], i = 1, 2}. } diff --git a/man/makeHosakiFunction.Rd b/man/makeHosakiFunction.Rd index d45eccb8..cf8ad87d 100644 --- a/man/makeHosakiFunction.Rd +++ b/man/makeHosakiFunction.Rd @@ -7,6 +7,8 @@ makeHosakiFunction() } \value{ +An object of class \code{SingleObjectiveFunction}, representing the Hosaki Function. + [\code{smoof_single_objective_function}] } \description{ diff --git a/man/makeHyperEllipsoidFunction.Rd b/man/makeHyperEllipsoidFunction.Rd index 3332d6c9..6877c981 100644 --- a/man/makeHyperEllipsoidFunction.Rd +++ b/man/makeHyperEllipsoidFunction.Rd @@ -11,9 +11,11 @@ makeHyperEllipsoidFunction(dimensions) Size of corresponding parameter space.} } \value{ +An object of class \code{SingleObjectiveFunction}, representing the Hyper-Ellipsoid Function. + [\code{smoof_single_objective_function}] } \description{ -Unimodal, convex test function similar to the Sphere function (see \code{\link{makeSphereFunction}}). +Uni-modal, convex test function similar to the Sphere function (see \code{\link{makeSphereFunction}}). Calculated via the formula: \deqn{f(\mathbf{x}) = \sum_{i=1}^{n} i \cdot \mathbf{x}_i.} } diff --git a/man/makeInvertedVincentFunction.Rd b/man/makeInvertedVincentFunction.Rd index e6c2c9b6..39feb3fe 100644 --- a/man/makeInvertedVincentFunction.Rd +++ b/man/makeInvertedVincentFunction.Rd @@ -11,6 +11,8 @@ makeInvertedVincentFunction(dimensions) Size of corresponding parameter space.} } \value{ +An object of class \code{SingleObjectiveFunction}, representing the Inverted Vincent Function. + [\code{smoof_single_objective_function}] } \description{ @@ -21,6 +23,6 @@ subject to \eqn{\mathbf{x}_i \in [0.25, 10]} for \eqn{i = 1, \ldots, n}. \references{ Xiadong Li, Andries Engelbrecht, and Michael G. Epitropakis. Benchmark functions for CEC2013 special session and competition on niching methods for -multimodal function optimization. Technical report, RMIT University, Evolutionary +multi-modal function optimization. Technical report, RMIT University, Evolutionary Computation and Machine Learning Group, Australia, 2013. } diff --git a/man/makeJennrichSampsonFunction.Rd b/man/makeJennrichSampsonFunction.Rd index 47d96b61..733b7c60 100644 --- a/man/makeJennrichSampsonFunction.Rd +++ b/man/makeJennrichSampsonFunction.Rd @@ -7,6 +7,8 @@ makeJennrichSampsonFunction() } \value{ +An object of class \code{SingleObjectiveFunction}, representing the Jennrich-Sampson Function. + [\code{smoof_single_objective_function}] } \description{ diff --git a/man/makeJudgeFunction.Rd b/man/makeJudgeFunction.Rd index e288ef02..f45b65c3 100644 --- a/man/makeJudgeFunction.Rd +++ b/man/makeJudgeFunction.Rd @@ -7,6 +7,8 @@ makeJudgeFunction() } \value{ +An object of class \code{SingleObjectiveFunction}, representing the Judge Function. + [\code{smoof_single_objective_function}] } \description{ diff --git a/man/makeKeaneFunction.Rd b/man/makeKeaneFunction.Rd index 357ec370..95b01372 100644 --- a/man/makeKeaneFunction.Rd +++ b/man/makeKeaneFunction.Rd @@ -7,10 +7,12 @@ makeKeaneFunction() } \value{ +An object of class \code{SingleObjectiveFunction}, representing the Keane Function. + [\code{smoof_single_objective_function}] } \description{ -Two-dimensional test function based on the defintion +Two-dimensional test function based on the definition \deqn{f(\mathbf{x}) = \frac{\sin^2(\mathbf{x}_1 - \mathbf{x}_2)\sin^2(\mathbf{x}_1 + \mathbf{x}_2)}{\sqrt{\mathbf{x}_1^2 + \mathbf{x}_2^2}}.} The domain of definition is bounded by the box constraints \eqn{\mathbf{x}_i \in [0, 10], i = 1, 2}. diff --git a/man/makeKearfottFunction.Rd b/man/makeKearfottFunction.Rd index 2437c320..c2f98629 100644 --- a/man/makeKearfottFunction.Rd +++ b/man/makeKearfottFunction.Rd @@ -7,6 +7,8 @@ makeKearfottFunction() } \value{ +An object of class \code{SingleObjectiveFunction}, representing the Kearfott Function. + [\code{smoof_single_objective_function}] } \description{ diff --git a/man/makeKursaweFunction.Rd b/man/makeKursaweFunction.Rd index bfb6468e..1d0e5c23 100644 --- a/man/makeKursaweFunction.Rd +++ b/man/makeKursaweFunction.Rd @@ -12,6 +12,7 @@ Number of decision variables.} } \value{ [\code{smoof_multi_objective_function}] + Returns an instance of the Kursawe function as a \code{smoof_multi_objective_function} object. } \description{ Builds and returns the bi-objective Kursawe test problem. diff --git a/man/makeLeonFunction.Rd b/man/makeLeonFunction.Rd index 1eb4162d..895420c1 100644 --- a/man/makeLeonFunction.Rd +++ b/man/makeLeonFunction.Rd @@ -7,10 +7,12 @@ makeLeonFunction() } \value{ +An object of class \code{SingleObjectiveFunction}, representing the Leon Function. + [\code{smoof_single_objective_function}] } \description{ -The function is based on the defintion +The function is based on the definition \deqn{f(\mathbf{x}) = 100 (\mathbf{x}_2 - \mathbf{x}_1^2)^2 + (1 - \mathbf{x}_1)^2}. Box-constraints: \eqn{\mathbf{x}_i \in [-1.2, 1.2]} for \eqn{i = 1, 2}. } diff --git a/man/makeMMF10Function.Rd b/man/makeMMF10Function.Rd index 80e466e2..2ab41302 100644 --- a/man/makeMMF10Function.Rd +++ b/man/makeMMF10Function.Rd @@ -8,13 +8,14 @@ makeMMF10Function() } \value{ [\code{smoof_multi_objective_function}] +Returns an instance of the MMF10 function as a \code{smoof_multi_objective_function} object. } \description{ -Test problem from the set of "multimodal multiobjective functions" as for +Test problem from the set of "multi-modal multi-objective functions" as for instance used in the CEC2019 competition. } \references{ Caitong Yue, Boyang Qu, Kunjie Yu, Jing Liang, and Xiaodong Li, "A novel -scalable test problem suite for multimodal multiobjective optimization," in +scalable test problem suite for multi-modal multi-objective optimization," in Swarm and Evolutionary Computation, Volume 48, August 2019, pp. 62–71, Elsevier. } diff --git a/man/makeMMF11Function.Rd b/man/makeMMF11Function.Rd index 64a1390c..c007067e 100644 --- a/man/makeMMF11Function.Rd +++ b/man/makeMMF11Function.Rd @@ -13,13 +13,14 @@ Number of global Pareto sets. In the CEC2019 competition, the organizers used } \value{ [\code{smoof_multi_objective_function}] +Returns an instance of the MMF11 function as a \code{smoof_multi_objective_function} object. } \description{ -Test problem from the set of "multimodal multiobjective functions" as for +Test problem from the set of "multi-modal multi-objective functions" as for instance used in the CEC2019 competition. } \references{ Caitong Yue, Boyang Qu, Kunjie Yu, Jing Liang, and Xiaodong Li, "A novel -scalable test problem suite for multimodal multiobjective optimization," in +scalable test problem suite for multi-modal multi-objective optimization," in Swarm and Evolutionary Computation, Volume 48, August 2019, pp. 62–71, Elsevier. } diff --git a/man/makeMMF12Function.Rd b/man/makeMMF12Function.Rd index 1ba15e24..946ed144 100644 --- a/man/makeMMF12Function.Rd +++ b/man/makeMMF12Function.Rd @@ -17,13 +17,14 @@ the organizers used \code{q = 4L}.} } \value{ [\code{smoof_multi_objective_function}] +Returns an instance of the MMF12 function as a \code{smoof_multi_objective_function} object. } \description{ -Test problem from the set of "multimodal multiobjective functions" as for +Test problem from the set of "multi-modal multi-objective functions" as for instance used in the CEC2019 competition. } \references{ Caitong Yue, Boyang Qu, Kunjie Yu, Jing Liang, and Xiaodong Li, "A novel -scalable test problem suite for multimodal multiobjective optimization," in +scalable test problem suite for multi-modal multi-objective optimization," in Swarm and Evolutionary Computation, Volume 48, August 2019, pp. 62–71, Elsevier. } diff --git a/man/makeMMF13Function.Rd b/man/makeMMF13Function.Rd index bb876424..5cd98e4f 100644 --- a/man/makeMMF13Function.Rd +++ b/man/makeMMF13Function.Rd @@ -13,13 +13,14 @@ Number of global Pareto sets. In the CEC2019 competition, the organizers used } \value{ [\code{smoof_multi_objective_function}] +Returns an instance of the MMF13 function as a \code{smoof_multi_objective_function} object. } \description{ -Test problem from the set of "multimodal multiobjective functions" as for +Test problem from the set of "multi-modal multi-objective functions" as for instance used in the CEC2019 competition. } \references{ Caitong Yue, Boyang Qu, Kunjie Yu, Jing Liang, and Xiaodong Li, "A novel -scalable test problem suite for multimodal multiobjective optimization," in +scalable test problem suite for multi-modal multi-objective optimization," in Swarm and Evolutionary Computation, Volume 48, August 2019, pp. 62–71, Elsevier. } diff --git a/man/makeMMF14Function.Rd b/man/makeMMF14Function.Rd index 90189a9c..19e29330 100644 --- a/man/makeMMF14Function.Rd +++ b/man/makeMMF14Function.Rd @@ -19,13 +19,14 @@ Number of global Pareto sets. In the CEC2019 competition, the organizers used } \value{ [\code{smoof_multi_objective_function}] +Returns an instance of the MMF14 function as a \code{smoof_multi_objective_function} object. } \description{ -Test problem from the set of "multimodal multiobjective functions" as for +Test problem from the set of "multi-modal multi-objective functions" as for instance used in the CEC2019 competition. } \references{ Caitong Yue, Boyang Qu, Kunjie Yu, Jing Liang, and Xiaodong Li, "A novel -scalable test problem suite for multimodal multiobjective optimization," in +scalable test problem suite for multi-modal multi-objective optimization," in Swarm and Evolutionary Computation, Volume 48, August 2019, pp. 62–71, Elsevier. } diff --git a/man/makeMMF14aFunction.Rd b/man/makeMMF14aFunction.Rd index 7edef43e..d5e1010e 100644 --- a/man/makeMMF14aFunction.Rd +++ b/man/makeMMF14aFunction.Rd @@ -19,13 +19,14 @@ Number of global Pareto sets. In the CEC2019 competition, the organizers used } \value{ [\code{smoof_multi_objective_function}] +Returns an instance of the MMF14a function as a \code{smoof_multi_objective_function} object. } \description{ -Test problem from the set of "multimodal multiobjective functions" as for +Test problem from the set of "multi-modal multi-objective functions" as for instance used in the CEC2019 competition. } \references{ Caitong Yue, Boyang Qu, Kunjie Yu, Jing Liang, and Xiaodong Li, "A novel -scalable test problem suite for multimodal multiobjective optimization," in +scalable test problem suite for multi-modal multi-objective optimization," in Swarm and Evolutionary Computation, Volume 48, August 2019, pp. 62–71, Elsevier. } diff --git a/man/makeMMF15Function.Rd b/man/makeMMF15Function.Rd index 2eaf9524..dba696fe 100644 --- a/man/makeMMF15Function.Rd +++ b/man/makeMMF15Function.Rd @@ -19,13 +19,14 @@ Number of global Pareto sets. In the CEC2019 competition, the organizers used } \value{ [\code{smoof_multi_objective_function}] +Returns an instance of the MMF15 function as a \code{smoof_multi_objective_function} object. } \description{ -Test problem from the set of "multimodal multiobjective functions" as for +Test problem from the set of "multi-modal multi-objective functions" as for instance used in the CEC2019 competition. } \references{ Caitong Yue, Boyang Qu, Kunjie Yu, Jing Liang, and Xiaodong Li, "A novel -scalable test problem suite for multimodal multiobjective optimization," in +scalable test problem suite for multi-modal multi-objective optimization," in Swarm and Evolutionary Computation, Volume 48, August 2019, pp. 62–71, Elsevier. } diff --git a/man/makeMMF15aFunction.Rd b/man/makeMMF15aFunction.Rd index 730527af..e048bf37 100644 --- a/man/makeMMF15aFunction.Rd +++ b/man/makeMMF15aFunction.Rd @@ -19,13 +19,14 @@ Number of global Pareto sets. In the CEC2019 competition, the organizers used } \value{ [\code{smoof_multi_objective_function}] +Returns an instance of the MMF15a function as a \code{smoof_multi_objective_function} object. } \description{ -Test problem from the set of "multimodal multiobjective functions" as for +Test problem from the set of "multi-modal multi-objective functions" as for instance used in the CEC2019 competition. } \references{ Caitong Yue, Boyang Qu, Kunjie Yu, Jing Liang, and Xiaodong Li, "A novel -scalable test problem suite for multimodal multiobjective optimization," in +scalable test problem suite for multi-modal multi-objective optimization," in Swarm and Evolutionary Computation, Volume 48, August 2019, pp. 62–71, Elsevier. } diff --git a/man/makeMMF1Function.Rd b/man/makeMMF1Function.Rd index ed42316c..8c5b2b8a 100644 --- a/man/makeMMF1Function.Rd +++ b/man/makeMMF1Function.Rd @@ -8,9 +8,10 @@ makeMMF1Function() } \value{ [\code{smoof_multi_objective_function}] + Returns an instance of the MMF1 function as a \code{smoof_multi_objective_function} object. } \description{ -Test problem from the set of "multimodal multiobjective functions" as for +Test problem from the set of "multi-modal multi-objective functions" as for instance used in the CEC2019 competition. } \references{ diff --git a/man/makeMMF1eFunction.Rd b/man/makeMMF1eFunction.Rd index f7bd98e3..8929aa69 100644 --- a/man/makeMMF1eFunction.Rd +++ b/man/makeMMF1eFunction.Rd @@ -13,9 +13,10 @@ Parametrizable factor. In the CEC2019 competition, the organizers used } \value{ [\code{smoof_multi_objective_function}] + Returns an instance of the MMF1e function as a \code{smoof_multi_objective_function} object. } \description{ -Test problem from the set of "multimodal multiobjective functions" as for +Test problem from the set of "multi-modal multi-objective functions" as for instance used in the CEC2019 competition. } \references{ diff --git a/man/makeMMF1zFunction.Rd b/man/makeMMF1zFunction.Rd index 05a5a310..d7a18043 100644 --- a/man/makeMMF1zFunction.Rd +++ b/man/makeMMF1zFunction.Rd @@ -13,13 +13,14 @@ Parametrizable factor. In the CEC2019 competition, the organizers used } \value{ [\code{smoof_multi_objective_function}] +Returns an instance of the MMF1z function as a \code{smoof_multi_objective_function} object. } \description{ -Test problem from the set of "multimodal multiobjective functions" as for +Test problem from the set of "multi-modal multi-objective functions" as for instance used in the CEC2019 competition. } \references{ Caitong Yue, Boyang Qu, Kunjie Yu, Jing Liang, and Xiaodong Li, "A novel -scalable test problem suite for multimodal multiobjective optimization," in +scalable test problem suite for multi-modal multi-objective optimization," in Swarm and Evolutionary Computation, Volume 48, August 2019, pp. 62–71, Elsevier. } diff --git a/man/makeMMF2Function.Rd b/man/makeMMF2Function.Rd index f02025a0..bd36733c 100644 --- a/man/makeMMF2Function.Rd +++ b/man/makeMMF2Function.Rd @@ -8,13 +8,14 @@ makeMMF2Function() } \value{ [\code{smoof_multi_objective_function}] + Returns an instance of the MMF2 function as a \code{smoof_multi_objective_function} object. } \description{ -Test problem from the set of "multimodal multiobjective functions" as for +Test problem from the set of "multi-modal multi-objective functions" as for instance used in the CEC2019 competition. } \references{ Caitong Yue, Boyang Qu, Kunjie Yu, Jing Liang, and Xiaodong Li, "A novel -scalable test problem suite for multimodal multiobjective optimization," in +scalable test problem suite for multi-modal multi-objective optimization," in Swarm and Evolutionary Computation, Volume 48, August 2019, pp. 62–71, Elsevier. } diff --git a/man/makeMMF3Function.Rd b/man/makeMMF3Function.Rd index 0a1fe3e5..77c8322d 100644 --- a/man/makeMMF3Function.Rd +++ b/man/makeMMF3Function.Rd @@ -8,13 +8,14 @@ makeMMF3Function() } \value{ [\code{smoof_multi_objective_function}] + Returns an instance of the MMF3 function as a \code{smoof_multi_objective_function} object. } \description{ -Test problem from the set of "multimodal multiobjective functions" as for +Test problem from the set of "multi-modal multi-objective functions" as for instance used in the CEC2019 competition. } \references{ Caitong Yue, Boyang Qu, Kunjie Yu, Jing Liang, and Xiaodong Li, "A novel -scalable test problem suite for multimodal multiobjective optimization," in +scalable test problem suite for multi-modal multi-objective optimization," in Swarm and Evolutionary Computation, Volume 48, August 2019, pp. 62–71, Elsevier. } diff --git a/man/makeMMF4Function.Rd b/man/makeMMF4Function.Rd index f5215c31..e9720f22 100644 --- a/man/makeMMF4Function.Rd +++ b/man/makeMMF4Function.Rd @@ -8,13 +8,14 @@ makeMMF4Function() } \value{ [\code{smoof_multi_objective_function}] + Returns an instance of the MMF4 function as a \code{smoof_multi_objective_function} object. } \description{ -Test problem from the set of "multimodal multiobjective functions" as for +Test problem from the set of "multi-modal multi-objective functions" as for instance used in the CEC2019 competition. } \references{ Caitong Yue, Boyang Qu, Kunjie Yu, Jing Liang, and Xiaodong Li, "A novel -scalable test problem suite for multimodal multiobjective optimization," in +scalable test problem suite for multi-modal multi-objective optimization," in Swarm and Evolutionary Computation, Volume 48, August 2019, pp. 62–71, Elsevier. } diff --git a/man/makeMMF5Function.Rd b/man/makeMMF5Function.Rd index 4acd64db..8cd45392 100644 --- a/man/makeMMF5Function.Rd +++ b/man/makeMMF5Function.Rd @@ -8,13 +8,14 @@ makeMMF5Function() } \value{ [\code{smoof_multi_objective_function}] + Returns an instance of the MMF5 function as a \code{smoof_multi_objective_function} object. } \description{ -Test problem from the set of "multimodal multiobjective functions" as for +Test problem from the set of "multi-modal multi-objective functions" as for instance used in the CEC2019 competition. } \references{ Caitong Yue, Boyang Qu, Kunjie Yu, Jing Liang, and Xiaodong Li, "A novel -scalable test problem suite for multimodal multiobjective optimization," in +scalable test problem suite for multi-modal multi-objective optimization," in Swarm and Evolutionary Computation, Volume 48, August 2019, pp. 62–71, Elsevier. } diff --git a/man/makeMMF6Function.Rd b/man/makeMMF6Function.Rd index 38fe4107..1121741b 100644 --- a/man/makeMMF6Function.Rd +++ b/man/makeMMF6Function.Rd @@ -8,13 +8,14 @@ makeMMF6Function() } \value{ [\code{smoof_multi_objective_function}] + Returns an instance of the MMF6 function as a \code{smoof_multi_objective_function} object. } \description{ -Test problem from the set of "multimodal multiobjective functions" as for +Test problem from the set of "multi-modal multi-objective functions" as for instance used in the CEC2019 competition. } \references{ Caitong Yue, Boyang Qu, Kunjie Yu, Jing Liang, and Xiaodong Li, "A novel -scalable test problem suite for multimodal multiobjective optimization," in +scalable test problem suite for multi-modal multi-objective optimization," in Swarm and Evolutionary Computation, Volume 48, August 2019, pp. 62–71, Elsevier. } diff --git a/man/makeMMF7Function.Rd b/man/makeMMF7Function.Rd index 87f60a56..2b3e967d 100644 --- a/man/makeMMF7Function.Rd +++ b/man/makeMMF7Function.Rd @@ -8,13 +8,14 @@ makeMMF7Function() } \value{ [\code{smoof_multi_objective_function}] + Returns an instance of the MMF7 function as a \code{smoof_multi_objective_function} object. } \description{ -Test problem from the set of "multimodal multiobjective functions" as for +Test problem from the set of "multi-modal multi-objective functions" as for instance used in the CEC2019 competition. } \references{ Caitong Yue, Boyang Qu, Kunjie Yu, Jing Liang, and Xiaodong Li, "A novel -scalable test problem suite for multimodal multiobjective optimization," in +scalable test problem suite for multi-modal multi-objective optimization," in Swarm and Evolutionary Computation, Volume 48, August 2019, pp. 62–71, Elsevier. } diff --git a/man/makeMMF8Function.Rd b/man/makeMMF8Function.Rd index be948a6b..030eaadd 100644 --- a/man/makeMMF8Function.Rd +++ b/man/makeMMF8Function.Rd @@ -8,13 +8,14 @@ makeMMF8Function() } \value{ [\code{smoof_multi_objective_function}] + Returns an instance of the MMF8 function as a \code{smoof_multi_objective_function} object. } \description{ -Test problem from the set of "multimodal multiobjective functions" as for +Test problem from the set of "multi-modal multi-objective functions" as for instance used in the CEC2019 competition. } \references{ Caitong Yue, Boyang Qu, Kunjie Yu, Jing Liang, and Xiaodong Li, "A novel -scalable test problem suite for multimodal multiobjective optimization," in +scalable test problem suite for multi-modal multi-objective optimization," in Swarm and Evolutionary Computation, Volume 48, August 2019, pp. 62–71, Elsevier. } diff --git a/man/makeMMF9Function.Rd b/man/makeMMF9Function.Rd index 5e44d5d2..e3105acd 100644 --- a/man/makeMMF9Function.Rd +++ b/man/makeMMF9Function.Rd @@ -13,13 +13,14 @@ Number of global Pareto sets. In the CEC2019 competition, the organizers used } \value{ [\code{smoof_multi_objective_function}] + Returns an instance of the MMF9 function as a \code{smoof_multi_objective_function} object. } \description{ -Test problem from the set of "multimodal multiobjective functions" as for +Test problem from the set of "multi-modal multi-objective functions" as for instance used in the CEC2019 competition. } \references{ Caitong Yue, Boyang Qu, Kunjie Yu, Jing Liang, and Xiaodong Li, "A novel -scalable test problem suite for multimodal multiobjective optimization," in +scalable test problem suite for multi-modal multi-objective optimization," in Swarm and Evolutionary Computation, Volume 48, August 2019, pp. 62–71, Elsevier. } diff --git a/man/makeMOP1Function.Rd b/man/makeMOP1Function.Rd index 883730ad..03999dfd 100644 --- a/man/makeMOP1Function.Rd +++ b/man/makeMOP1Function.Rd @@ -8,6 +8,7 @@ makeMOP1Function() } \value{ [\code{smoof_multi_objective_function}] + Returns an instance of the MOP1 function as a \code{smoof_multi_objective_function} object. } \description{ MOP1 function from Van Valedhuizen's test suite. diff --git a/man/makeMOP2Function.Rd b/man/makeMOP2Function.Rd index c9b7d697..b25b2298 100644 --- a/man/makeMOP2Function.Rd +++ b/man/makeMOP2Function.Rd @@ -12,12 +12,13 @@ Size of corresponding parameter space.} } \value{ [\code{smoof_multi_objective_function}] + Returns an instance of the MOP2 function as a \code{smoof_multi_objective_function} object. } \description{ MOP2 function from Van Valedhuizen's test suite due to Fonseca and Fleming. } \references{ -C. M. Fonseca and P. J. Fleming, "Multiobjective genetic algorithms +C. M. Fonseca and P. J. Fleming, "Multi-objective genetic algorithms made easy: Selection, sharing and mating restriction," Genetic Algorithms in Engineering Systems: Innovations and Applications, pp. 45-52, Sep. 1995. IEE. } diff --git a/man/makeMOP3Function.Rd b/man/makeMOP3Function.Rd index e67a4029..d6e56025 100644 --- a/man/makeMOP3Function.Rd +++ b/man/makeMOP3Function.Rd @@ -12,12 +12,13 @@ Size of corresponding parameter space.} } \value{ [\code{smoof_multi_objective_function}] +Returns an instance of the MOP3 function as a \code{smoof_multi_objective_function} object. } \description{ MOP3 function from Van Valedhuizen's test suite. } \references{ -C. Poloni, G. Mosetti, and S. Contessi, "Multi objective optimization by +C. Poloni, G. Mosetti, and S. Contessi, "Multi-objective optimization by GAs: Application to system and component design," in Proc. Comput. Methods in Applied Sciences'96: Invited Lectures and Special Technological Sessions of the 3rd ECCOMAS Comput. Fluid Dynamics Conf. diff --git a/man/makeMOP4Function.Rd b/man/makeMOP4Function.Rd index 5b9f5865..94e8a3e3 100644 --- a/man/makeMOP4Function.Rd +++ b/man/makeMOP4Function.Rd @@ -8,6 +8,7 @@ makeMOP4Function() } \value{ [\code{smoof_multi_objective_function}] + Returns an instance of the MOP4 function as a \code{smoof_multi_objective_function} object. } \description{ MOP4 function from Van Valedhuizen's test suite based on Kursawe. diff --git a/man/makeMOP5Function.Rd b/man/makeMOP5Function.Rd index f01c316e..5c55d5c9 100644 --- a/man/makeMOP5Function.Rd +++ b/man/makeMOP5Function.Rd @@ -8,6 +8,7 @@ makeMOP5Function() } \value{ [\code{smoof_multi_objective_function}] + Returns an instance of the MOP5 function as a \code{smoof_multi_objective_function} object. } \description{ MOP5 function from Van Valedhuizen's test suite. @@ -16,7 +17,7 @@ MOP5 function from Van Valedhuizen's test suite. Original box constraints where \eqn{[-3, 3]}. } \references{ -R. Viennet, C. Fonteix, and I. Marc, "Multicriteria optimization using a +R. Viennet, C. Fonteix, and I. Marc, "Multi criteria optimization using a genetic algorithm for determining a Pareto set," Int. J. Syst. Sci., vol. 27, no. 2, pp. 255-260, 1996 } diff --git a/man/makeMOP6Function.Rd b/man/makeMOP6Function.Rd index 6d52b12e..c490e340 100644 --- a/man/makeMOP6Function.Rd +++ b/man/makeMOP6Function.Rd @@ -8,6 +8,7 @@ makeMOP6Function() } \value{ [\code{smoof_multi_objective_function}] + Returns an instance of the MOP6 function as a \code{smoof_multi_objective_function} object. } \description{ MOP6 function from Van Valedhuizen's test suite. diff --git a/man/makeMOP7Function.Rd b/man/makeMOP7Function.Rd index a71e0e06..f5de10a0 100644 --- a/man/makeMOP7Function.Rd +++ b/man/makeMOP7Function.Rd @@ -8,12 +8,13 @@ makeMOP7Function() } \value{ [\code{smoof_multi_objective_function}] + Returns an instance of the MOP7 function as a \code{smoof_multi_objective_function} object. } \description{ MOP7 function from Van Valedhuizen's test suite. } \references{ -R. Viennet, C. Fonteix, and I. Marc, "Multicriteria optimization using a +R. Viennet, C. Fonteix, and I. Marc, "Multi-criteria optimization using a genetic algorithm for determining a Pareto set," Int. J. Syst. Sci., vol. 27, no. 2, pp. 255-260, 1996 } diff --git a/man/makeMPM2Function.Rd b/man/makeMPM2Function.Rd index 335c66e4..177603b6 100644 --- a/man/makeMPM2Function.Rd +++ b/man/makeMPM2Function.Rd @@ -43,6 +43,7 @@ MPM2 functions are used in a multi-objective setting.} } \value{ [\code{smoof_single_objective_function}] + An object of class \code{SingleObjectiveFunction}, representing the Multiple peaks model 2 Function. } \description{ Generator for function with multiple peaks following the multiple peaks model 2. diff --git a/man/makeMatyasFunction.Rd b/man/makeMatyasFunction.Rd index 9c54e47f..214fd258 100644 --- a/man/makeMatyasFunction.Rd +++ b/man/makeMatyasFunction.Rd @@ -7,10 +7,12 @@ makeMatyasFunction() } \value{ +An object of class \code{SingleObjectiveFunction}, representing the Matyas Function. + [\code{smoof_single_objective_function}] } \description{ -Two-dimensional, unimodal test function +Two-dimensional, uni-modal test function \deqn{f(\mathbf{x}) = 0.26 (\mathbf{x}_1^2 + \mathbf{x}_2^2) - 0.48\mathbf{x}_1\mathbf{x}_2} subject to \eqn{\mathbf{x}_i \in [-10, 10], i = 1, 2}. } diff --git a/man/makeMcCormickFunction.Rd b/man/makeMcCormickFunction.Rd index f1950687..e10b9914 100644 --- a/man/makeMcCormickFunction.Rd +++ b/man/makeMcCormickFunction.Rd @@ -7,10 +7,12 @@ makeMcCormickFunction() } \value{ +An object of class \code{SingleObjectiveFunction}, representing the McCormick Function. + [\code{smoof_single_objective_function}] } \description{ -Two-dimensional, multimodal test function. The defintion is given by +Two-dimensional, multi-modal test function. The definition is given by \deqn{f(\mathbf{x}) = \sin(\mathbf{x}_1 + \mathbf{x}_2) + (\mathbf{x}_1 - \mathbf{x}_2)^2 - 1.5 \mathbf{x}_1 + 2.5 \mathbf{x}_2 + 1} subject to \eqn{\mathbf{x}_1 \in [-1.5, 4], \mathbf{x}_2 \in [-3, 3]}. } diff --git a/man/makeMichalewiczFunction.Rd b/man/makeMichalewiczFunction.Rd index 26418797..70f64451 100644 --- a/man/makeMichalewiczFunction.Rd +++ b/man/makeMichalewiczFunction.Rd @@ -14,10 +14,12 @@ Size of corresponding parameter space.} \dQuote{Steepness} parameter.} } \value{ +An object of class \code{SingleObjectiveFunction}, representing the Michalewicz Function. + [\code{smoof_single_objective_function}] } \description{ -Highly multimodal single-objective test function with \eqn{n!} local minima +Highly multi-modal single-objective test function with \eqn{n!} local minima with the formula: \deqn{f(\mathbf{x}) = -\sum_{i=1}^{n} \sin(\mathbf{x}_i) \cdot \left(\sin\left(\frac{i \cdot \mathbf{x}_i}{\pi}\right)\right)^{2m}.} The recommended value \eqn{m = 10}, which is used as a default in the diff --git a/man/makeModifiedRastriginFunction.Rd b/man/makeModifiedRastriginFunction.Rd index 647c3bbe..696fcec6 100644 --- a/man/makeModifiedRastriginFunction.Rd +++ b/man/makeModifiedRastriginFunction.Rd @@ -15,6 +15,8 @@ Vector of numerical values of length \code{dimensions}. Default is \code{rep(1, dimensions)}} } \value{ +An object of class \code{SingleObjectiveFunction}, representing the Rastrigin Function. + [\code{smoof_single_objective_function}] } \description{ @@ -25,6 +27,6 @@ The box-constraints are given by \eqn{\mathbf{x}_i \in [0, 1]} for use, e.g., \eqn{k = (2, 2, 3, 4)} for \eqn{n = 4}. See the reference for details. } \references{ -Kalyanmoy Deb and Amit Saha. Multimodal optimization using a bi- +Kalyanmoy Deb and Amit Saha. Multi-modal optimization using a bi- objective evolutionary algorithm. Evolutionary Computation, 20(1):27-62, 2012. } diff --git a/man/makeMultiObjectiveFunction.Rd b/man/makeMultiObjectiveFunction.Rd index 32271a1d..f5df1db7 100644 --- a/man/makeMultiObjectiveFunction.Rd +++ b/man/makeMultiObjectiveFunction.Rd @@ -70,7 +70,7 @@ are met or not. Default is \code{NULL}, which means, that there are no constrain beside possible box constraints defined via the \code{par.set} argument.} \item{ref.point}{[\code{numeric}]\cr -Optional reference point in the objective space, e.g., for hypervolume computation.} +Optional reference point in the objective space, e.g., for hyper-volume computation.} } \value{ [\code{function}] Target function with additional stuff attached as attributes. diff --git a/man/makeNKFunction.Rd b/man/makeNKFunction.Rd index 4b4e9bba..92618632 100644 --- a/man/makeNKFunction.Rd +++ b/man/makeNKFunction.Rd @@ -17,6 +17,7 @@ If a single value is passed a homogeneous NK-landscape is generated, i.e. } \value{ [\code{smoof_single_objective_function}] + NK-landscape function. } \description{ Generate a single-objective NK-landscape. NK-landscapes are combinatorial diff --git a/man/makeObjectiveFunction.Rd b/man/makeObjectiveFunction.Rd new file mode 100644 index 00000000..160869e0 --- /dev/null +++ b/man/makeObjectiveFunction.Rd @@ -0,0 +1,71 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/makeObjectiveFunction.R +\name{makeObjectiveFunction} +\alias{makeObjectiveFunction} +\title{Internal generator for function of smoof type.} +\usage{ +makeObjectiveFunction( + name = NULL, + id = NULL, + description = NULL, + fn, + has.simple.signature = TRUE, + par.set, + n.objectives = NULL, + noisy = FALSE, + fn.mean = NULL, + minimize = NULL, + vectorized = FALSE, + constraint.fn = NULL +) +} +\arguments{ +\item{name}{[\code{character(1)}]\cr +Optional function name used e.g. in plots.} + +\item{description}{[\code{character(1)} | \code{NULL}]\cr +Optional function description.} + +\item{fn}{[\code{function}]\cr +Target function.} + +\item{has.simple.signature}{[\code{logical(1)}]\cr +Set this to \code{TRUE} if the target function expects a vector as input and \code{FALSE} +if it expects a named list of values. The latter is needed if the function depends on mixed +parameters. Default is \code{TRUE}.} + +\item{par.set}{[\code{\link[ParamHelpers]{ParamSet}}]\cr +Parameter set describing different aspects of the target function parameters, i. e., +names, lower and/or upper bounds, types and so on. See \code{\link[ParamHelpers]{makeParamSet}} +for further information.} + +\item{n.objectives}{[\code{integer(1)}]\cr +Number of objectives of the multi-objective function.} + +\item{noisy}{[\code{logical(1)}]\cr +Is the function noisy? Defaults to \code{FALSE}.} + +\item{fn.mean}{[\code{function}]\cr +Optional true mean function in case of a noisy objective function. This functions should + have the same mean as \code{fn}.} + +\item{minimize}{[\code{logical}]\cr + Logical vector of length \code{n.objectives} indicating which objectives shall + be minimized/maximized. +The default is \code{TRUE} \code{n.objectives} times.} + +\item{vectorized}{[\code{logical(1)}]\cr +Can the handle \dQuote{vector} input, i. e., does it accept matrix of +parameters? Default is \code{FALSE}.} + +\item{constraint.fn}{[\code{function | NULL}]\cr +Function which returns a logical vector indicating which indicates whether certain conditions +are met or not. Default is \code{NULL}, which means, that there are no constraints (beside possible) +box constraints defined via the \code{par.set} argument.} +} +\value{ +[\code{function}] Target function with additional stuff attached as attributes. +} +\description{ +Internal generator for function of smoof type. +} diff --git a/man/makeOmniTestFunction.Rd b/man/makeOmniTestFunction.Rd index 538edb19..20e425b1 100644 --- a/man/makeOmniTestFunction.Rd +++ b/man/makeOmniTestFunction.Rd @@ -8,6 +8,7 @@ makeOmniTestFunction() } \value{ [\code{smoof_multi_objective_function}] + Returns an instance of the Omni function as a \code{smoof_multi_objective_function} object. } \description{ Test problem from the set of "multimodal multiobjective functions" as for diff --git a/man/makePeriodicFunction.Rd b/man/makePeriodicFunction.Rd index a6d07893..894c9342 100644 --- a/man/makePeriodicFunction.Rd +++ b/man/makePeriodicFunction.Rd @@ -7,6 +7,8 @@ makePeriodicFunction() } \value{ +An object of class \code{SingleObjectiveFunction}, representing the Periodic Function. + [\code{smoof_single_objective_function}] } \description{ diff --git a/man/makePowellSumFunction.Rd b/man/makePowellSumFunction.Rd index 1d909380..f0010def 100644 --- a/man/makePowellSumFunction.Rd +++ b/man/makePowellSumFunction.Rd @@ -11,6 +11,8 @@ makePowellSumFunction(dimensions) Size of corresponding parameter space.} } \value{ +An object of class \code{SingleObjectiveFunction}, representing the Powell-Sum Function. + [\code{smoof_single_objective_function}] } \description{ diff --git a/man/makePriceN1Function.Rd b/man/makePriceN1Function.Rd index 3fe6bb34..43b42fa2 100644 --- a/man/makePriceN1Function.Rd +++ b/man/makePriceN1Function.Rd @@ -7,16 +7,18 @@ makePriceN1Function() } \value{ +An object of class \code{SingleObjectiveFunction}, representing the Price N. 1 Function. + [\code{smoof_single_objective_function}] } \description{ -Second function by Price. The implementation is based on the defintion +Second function by Price. The implementation is based on the definition \deqn{f(\mathbf{x}) = (|\mathbf{x}_1| - 5)^2 + (|\mathbf{x}_2 - 5)^2} subject to \eqn{\mathbf{x}_i \in [-500, 500], i = 1, 2}. } \references{ W. L. Price, A Controlled Random Search Procedure for Global -Optimisation, Computer journal, vol. 20, no. 4, pp. 367-370, 1977. +Optimization, Computer journal, vol. 20, no. 4, pp. 367-370, 1977. } \seealso{ \code{\link{makePriceN2Function}}, \code{\link{makePriceN4Function}} diff --git a/man/makePriceN2Function.Rd b/man/makePriceN2Function.Rd index c0ab108f..26ff2ac5 100644 --- a/man/makePriceN2Function.Rd +++ b/man/makePriceN2Function.Rd @@ -7,6 +7,8 @@ makePriceN2Function() } \value{ +An object of class \code{SingleObjectiveFunction}, representing the Price N. 2 Function. + [\code{smoof_single_objective_function}] } \description{ diff --git a/man/makePriceN4Function.Rd b/man/makePriceN4Function.Rd index a8801c9d..74c2a604 100644 --- a/man/makePriceN4Function.Rd +++ b/man/makePriceN4Function.Rd @@ -7,10 +7,12 @@ makePriceN4Function() } \value{ +An object of class \code{SingleObjectiveFunction}, representing the Price N. 4 Function. + [\code{smoof_single_objective_function}] } \description{ -Fourth function by Price. The implementation is based on the defintion +Fourth function by Price. The implementation is based on the definition \deqn{f(\mathbf{x}) = (2\mathbf{x}_1^3 \mathbf{x}_2 - \mathbf{x}_2^3)^2 + (6\mathbf{x}_1 - \mathbf{x}_2^2 + \mathbf{x}_2)^2} subject to \eqn{\mathbf{x}_i \in [-500, 500]}. } diff --git a/man/makeRastriginFunction.Rd b/man/makeRastriginFunction.Rd index 0c0b873f..8d2fb815 100644 --- a/man/makeRastriginFunction.Rd +++ b/man/makeRastriginFunction.Rd @@ -11,11 +11,13 @@ makeRastriginFunction(dimensions) Size of corresponding parameter space.} } \value{ +An object of class \code{SingleObjectiveFunction}, representing the Rastrigin Function. + [\code{smoof_single_objective_function}] } \description{ One of the most popular single-objective test functions consists of many -local optima and is thus highly multimodal with a global structure. +local optima and is thus highly multi-modal with a global structure. The implementation follows the formula \deqn{f(\mathbf{x}) = 10n + \sum_{i=1}^{n} \left(\mathbf{x}_i^2 - 10 \cos(2\pi \mathbf{x}_i)\right).} The box-constraints are given by \eqn{\mathbf{x}_i \in [-5.12, 5.12]} for diff --git a/man/makeRosenbrockFunction.Rd b/man/makeRosenbrockFunction.Rd index 49b5c420..db951da0 100644 --- a/man/makeRosenbrockFunction.Rd +++ b/man/makeRosenbrockFunction.Rd @@ -11,6 +11,8 @@ makeRosenbrockFunction(dimensions) Size of corresponding parameter space.} } \value{ +An object of class \code{SingleObjectiveFunction}, representing the Rosenbrock Function. + [\code{smoof_single_objective_function}] } \description{ diff --git a/man/makeSYMPARTrotatedFunction.Rd b/man/makeSYMPARTrotatedFunction.Rd index ff2504e3..4ae8d791 100644 --- a/man/makeSYMPARTrotatedFunction.Rd +++ b/man/makeSYMPARTrotatedFunction.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/mof.SYMPARTrotated.R \name{makeSYMPARTrotatedFunction} \alias{makeSYMPARTrotatedFunction} -\title{MMF13 Function} +\title{SYM-PART Rotated Function} \usage{ makeSYMPARTrotatedFunction(w = pi/4, a = 1, b = 10, c = 8) } @@ -25,13 +25,14 @@ Parametrizable factor. In the CEC2019 competition, the organizers used } \value{ [\code{smoof_multi_objective_function}] + Returns an instance of the SYM-PART Rotated function as a \code{smoof_multi_objective_function} object. } \description{ -Test problem from the set of "multimodal multiobjective functions" as for +Test problem from the set of "multi-modal multi-objective functions" as for instance used in the CEC2019 competition. } \references{ Caitong Yue, Boyang Qu, Kunjie Yu, Jing Liang, and Xiaodong Li, "A novel -scalable test problem suite for multimodal multiobjective optimization," in +scalable test problem suite for multi-modal multi-objective optimization," in Swarm and Evolutionary Computation, Volume 48, August 2019, pp. 62–71, Elsevier. } diff --git a/man/makeSYMPARTsimpleFunction.Rd b/man/makeSYMPARTsimpleFunction.Rd index 2e32598f..cf42559a 100644 --- a/man/makeSYMPARTsimpleFunction.Rd +++ b/man/makeSYMPARTsimpleFunction.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/mof.SYMPARTsimple.R \name{makeSYMPARTsimpleFunction} \alias{makeSYMPARTsimpleFunction} -\title{MMF13 Function} +\title{SYM-PART Simple Function} \usage{ makeSYMPARTsimpleFunction(a = 1, b = 10, c = 8) } @@ -21,13 +21,14 @@ Parametrizable factor. In the CEC2019 competition, the organizers used } \value{ [\code{smoof_multi_objective_function}] + Returns an instance of the SYM-PART Simple function as a \code{smoof_multi_objective_function} object. } \description{ -Test problem from the set of "multimodal multiobjective functions" as for +Test problem from the set of "multi-modal multi-objective functions" as for instance used in the CEC2019 competition. } \references{ Caitong Yue, Boyang Qu, Kunjie Yu, Jing Liang, and Xiaodong Li, "A novel -scalable test problem suite for multimodal multiobjective optimization," in +scalable test problem suite for multi-modal multi-objective optimization," in Swarm and Evolutionary Computation, Volume 48, August 2019, pp. 62–71, Elsevier. } diff --git a/man/makeSchafferN2Function.Rd b/man/makeSchafferN2Function.Rd index 586b03a3..58ffd3db 100644 --- a/man/makeSchafferN2Function.Rd +++ b/man/makeSchafferN2Function.Rd @@ -7,10 +7,12 @@ makeSchafferN2Function() } \value{ +An object of class \code{SingleObjectiveFunction}, representing the Modified Schaffer N. 2 Function. + [\code{smoof_single_objective_function}] } \description{ -Second function by Schaffer. The defintion is given by the formula +Second function by Schaffer. The definition is given by the formula \deqn{f(\mathbf{x}) = 0.5 + \frac{\sin^2(\mathbf{x}_1^2 - \mathbf{x}_2^2) - 0.5}{(1 + 0.001(\mathbf{x}_1^2 + \mathbf{x}_2^2))^2}} subject to \eqn{\mathbf{x}_i \in [-100, 100], i = 1, 2}. } diff --git a/man/makeSchafferN4Function.Rd b/man/makeSchafferN4Function.Rd index a331f420..e74d449e 100644 --- a/man/makeSchafferN4Function.Rd +++ b/man/makeSchafferN4Function.Rd @@ -7,10 +7,12 @@ makeSchafferN4Function() } \value{ +An object of class \code{SingleObjectiveFunction}, representing the Schaffer N. 4 Function. + [\code{smoof_single_objective_function}] } \description{ -Second function by Schaffer. The defintion is given by the formula +Second function by Schaffer. The definition is given by the formula \deqn{f(\mathbf{x}) = 0.5 + \frac{\cos^2(sin(|\mathbf{x}_1^2 - \mathbf{x}_2^2|)) - 0.5}{(1 + 0.001(\mathbf{x}_1^2 + \mathbf{x}_2^2))^2}} subject to \eqn{\mathbf{x}_i \in [-100, 100], i = 1, 2}. } diff --git a/man/makeSchwefelFunction.Rd b/man/makeSchwefelFunction.Rd index 71e2f412..bbe7f9b5 100644 --- a/man/makeSchwefelFunction.Rd +++ b/man/makeSchwefelFunction.Rd @@ -11,10 +11,12 @@ makeSchwefelFunction(dimensions) Size of corresponding parameter space.} } \value{ +An object of class \code{SingleObjectiveFunction}, representing the Schwefel Function. + [\code{smoof_single_objective_function}] } \description{ -Highly multimodal test function. The cursial thing about this function is, that +Highly multi-modal test function. The crucial thing about this function is, that the global optimum is far away from the next best local optimum. The function is computed via: \deqn{f(\mathbf{x}) = \sum_{i=1}^{n} -\mathbf{x}_i \sin\left(\sqrt(|\mathbf{x}_i|)\right)} diff --git a/man/makeShekelFunction.Rd b/man/makeShekelFunction.Rd index 6be51442..68d77747 100644 --- a/man/makeShekelFunction.Rd +++ b/man/makeShekelFunction.Rd @@ -12,6 +12,8 @@ Integer parameter (defines the number of local optima). Possible values are 5, 7 or 10.} } \value{ +An object of class \code{SingleObjectiveFunction}, representing the Shekel Functions. + [\code{smoof_single_objective_function}] } \description{ @@ -19,5 +21,5 @@ Single-objective test function based on the formula \deqn{f(\mathbf{x}) = -\sum_{i=1}^{m} \left(\sum_{j=1}^{4} (x_j - C_{ji})^2 + \beta_{i}\right)^{-1}}. Here, \eqn{m \in \{5, 7, 10\}} defines the number of local optima, \eqn{C} is a \eqn{4 x 10} matrix and \eqn{\beta = \frac{1}{10}(1, 1, 2, 2, 4, 4, 6, 3, 7, 5, 5)} is a vector. See \url{https://www.sfu.ca/~ssurjano/shekel.html} -for a defintion of \eqn{C}. +for a definition of \eqn{C}. } diff --git a/man/makeShubertFunction.Rd b/man/makeShubertFunction.Rd index 04fd5f9e..43e99b47 100644 --- a/man/makeShubertFunction.Rd +++ b/man/makeShubertFunction.Rd @@ -7,10 +7,12 @@ makeShubertFunction() } \value{ +An object of class \code{SingleObjectiveFunction}, representing the Shubert Function. + [\code{smoof_single_objective_function}] } \description{ -The defintion of this two-dimensional function is given by +The definition of this two-dimensional function is given by \deqn{f(\mathbf{x}) = \prod_{i = 1}^{2} \left(\sum_{j = 1}^{5} \cos((j + 1)\mathbf{x}_i + j\right)} subject to \eqn{\mathbf{x}_i \in [-10, 10], i = 1, 2}. } diff --git a/man/makeSixHumpCamelFunction.Rd b/man/makeSixHumpCamelFunction.Rd index 8e4d5efa..8c17e47d 100644 --- a/man/makeSixHumpCamelFunction.Rd +++ b/man/makeSixHumpCamelFunction.Rd @@ -7,6 +7,8 @@ makeSixHumpCamelFunction() } \value{ +An object of class \code{SingleObjectiveFunction}, representing the Three-Hump Camel Function. + [\code{smoof_single_objective_function}] } \description{ diff --git a/man/makeSphereFunction.Rd b/man/makeSphereFunction.Rd index 87302573..3c74ba2f 100644 --- a/man/makeSphereFunction.Rd +++ b/man/makeSphereFunction.Rd @@ -11,13 +11,15 @@ makeSphereFunction(dimensions) Size of corresponding parameter space.} } \value{ +An object of class \code{SingleObjectiveFunction}, representing the Sphere Function. + [\code{smoof_single_objective_function}] } \description{ Also known as the the \dQuote{De Jong function 1}. Convex, continous function calculated via the formula \deqn{f(\mathbf{x}) = \sum_{i=1}^{n} \mathbf{x}_i^2} -with box-constraings \eqn{\mathbf{x}_i \in [-5.12, 5.12], i = 1, \ldots, n}. +with box-constraints \eqn{\mathbf{x}_i \in [-5.12, 5.12], i = 1, \ldots, n}. } \references{ M. A. Schumer, K. Steiglitz, Adaptive Step Size Random Search, diff --git a/man/makeStyblinkskiTangFunction.Rd b/man/makeStyblinkskiTangFunction.Rd index c97e2a63..fae24569 100644 --- a/man/makeStyblinkskiTangFunction.Rd +++ b/man/makeStyblinkskiTangFunction.Rd @@ -7,10 +7,12 @@ makeStyblinkskiTangFunction() } \value{ +An object of class \code{SingleObjectiveFunction}, representing the Styblinkski-Tang Function. + [\code{smoof_single_objective_function}] } \description{ -This function is based on the defintion +This function is based on the definition \deqn{f(\mathbf{x}) = \frac{1}{2} \sum_{i = 1}^{2} (\mathbf{x}_i^4 - 16 \mathbf{x}_i^2 + 5\mathbf{x}_i)} with box-constraints given by \eqn{\mathbf{x}_i \in [-5, 5], i = 1, 2}. } diff --git a/man/makeSumOfDifferentSquaresFunction.Rd b/man/makeSumOfDifferentSquaresFunction.Rd index 6935d0c9..3202b58b 100644 --- a/man/makeSumOfDifferentSquaresFunction.Rd +++ b/man/makeSumOfDifferentSquaresFunction.Rd @@ -14,7 +14,7 @@ Size of corresponding parameter space.} [\code{smoof_single_objective_function}] } \description{ -Simple unimodal test function similar to the Sphere and Hyper-Ellipsoidal functions. +Simple uni-modal test function similar to the Sphere and Hyper-Ellipsoidal functions. Formula: \deqn{f(\mathbf{x}) = \sum_{i=1}^{n} |\mathbf{x}_i|^{i+1}.} } diff --git a/man/makeThreeHumpCamelFunction.Rd b/man/makeThreeHumpCamelFunction.Rd index adf26807..f809749f 100644 --- a/man/makeThreeHumpCamelFunction.Rd +++ b/man/makeThreeHumpCamelFunction.Rd @@ -7,6 +7,8 @@ makeThreeHumpCamelFunction() } \value{ +An object of class \code{SingleObjectiveFunction}, representing the Three-Hump Camel Function. + [\code{smoof_single_objective_function}] } \description{ @@ -16,6 +18,6 @@ subject to \eqn{-5 \leq \mathbf{x}_i \leq 5}. } \references{ F. H. Branin Jr., Widely Convergent Method of Finding Multiple -Solutions of Simul- taneous Nonlinear Equations, IBM Journal of Research +Solutions of Simultaneous Nonlinear Equations, IBM Journal of Research and Development, vol. 16, no. 5, pp. 504-522, 1972. } diff --git a/man/makeTrecanniFunction.Rd b/man/makeTrecanniFunction.Rd index 7785f578..7cdc9540 100644 --- a/man/makeTrecanniFunction.Rd +++ b/man/makeTrecanniFunction.Rd @@ -7,14 +7,16 @@ makeTrecanniFunction() } \value{ +An object of class \code{SingleObjectiveFunction}, representing the Trecanni Function. + [\code{smoof_single_objective_function}] } \description{ -The Trecanni function belongs to the unimodal test functions. It is based +The Trecanni function belongs to the uni-modal test functions. It is based on the formula \deqn{f(\mathbf(x)) = \mathbf(x)_1^4 - 4 \mathbf(x)_1^3 + 4 \mathbf(x)_1 + \mathbf(x)_2^2.} The box-constraints \eqn{\mathbf{x}_i \in [-5, 5], i = 1, 2} define the -domain of defintion. +domain of definition. } \references{ L. C. W. Dixon, G. P. Szego (eds.), Towards Global Optimization 2, diff --git a/man/makeUFFunction.Rd b/man/makeUFFunction.Rd index a94f3dae..8a3a5f1c 100644 --- a/man/makeUFFunction.Rd +++ b/man/makeUFFunction.Rd @@ -20,7 +20,7 @@ Instance identifier. Integer value between 1 and 10.} Generator for the functions UF1, ..., UF10 of the CEC 2009. } \note{ -The implementation is based on the original CPP implemenation by Qingfu +The implementation is based on the original CPP implementation by Qingfu Zhang, Aimin Zhou, Shizheng Zhaoy, Ponnuthurai Nagaratnam Suganthany, Wudong Liu and Santosh Tiwar. } diff --git a/man/makeViennetFunction.Rd b/man/makeViennetFunction.Rd index 02449f8c..3909979d 100644 --- a/man/makeViennetFunction.Rd +++ b/man/makeViennetFunction.Rd @@ -8,6 +8,7 @@ makeViennetFunction() } \value{ [\code{smoof_multi_objective_function}] + Returns an instance of the Viennet function as a \code{smoof_multi_objective_function} object. } \description{ The Viennet test problem VNT is designed for three objectives only. It has @@ -20,6 +21,6 @@ with with box constraints \eqn{-3 \leq \mathbf{x}_1, \mathbf{x}_2 \leq 3}. } \references{ -Viennet, R. (1996). Multicriteria optimization using a genetic algorithm for determining the +Viennet, R. (1996). Multi-criteria optimization using a genetic algorithm for determining the Pareto set. International Journal of Systems Science 27 (2), 255-260. } diff --git a/man/makeWFG1Function.Rd b/man/makeWFG1Function.Rd index 6bf164d8..e4c455a3 100644 --- a/man/makeWFG1Function.Rd +++ b/man/makeWFG1Function.Rd @@ -21,6 +21,7 @@ the last \code{l} elements from the input vector.} } \value{ [\code{smoof_multi_objective_function}] + Returns an instance of the WGF1 function as a \code{smoof_multi_objective_function} object. } \description{ First test problem from the "Walking Fish Group" problem generator toolkit. diff --git a/man/makeWFG2Function.Rd b/man/makeWFG2Function.Rd index c833a857..c4be1478 100644 --- a/man/makeWFG2Function.Rd +++ b/man/makeWFG2Function.Rd @@ -22,6 +22,7 @@ be a multiple of 2.} } \value{ [\code{smoof_multi_objective_function}] + Returns an instance of the WFG2 function as a \code{smoof_multi_objective_function} object. } \description{ Second test problem from the "Walking Fish Group" problem generator toolkit. diff --git a/man/makeWFG3Function.Rd b/man/makeWFG3Function.Rd index b8391163..4951a680 100644 --- a/man/makeWFG3Function.Rd +++ b/man/makeWFG3Function.Rd @@ -22,6 +22,7 @@ be a multiple of 2.} } \value{ [\code{smoof_multi_objective_function}] + Returns an instance of the WFG3 function as a \code{smoof_multi_objective_function} object. } \description{ Third test problem from the "Walking Fish Group" problem generator toolkit. diff --git a/man/makeWFG4Function.Rd b/man/makeWFG4Function.Rd index 63e125af..267e42d7 100644 --- a/man/makeWFG4Function.Rd +++ b/man/makeWFG4Function.Rd @@ -21,6 +21,7 @@ the last \code{l} elements from the input vector.} } \value{ [\code{smoof_multi_objective_function}] + Returns an instance of the WFG4 function as a \code{smoof_multi_objective_function} object. } \description{ Fourth test problem from the "Walking Fish Group" problem generator toolkit. diff --git a/man/makeWFG5Function.Rd b/man/makeWFG5Function.Rd index 0cb48b9a..79e2a7f4 100644 --- a/man/makeWFG5Function.Rd +++ b/man/makeWFG5Function.Rd @@ -21,6 +21,7 @@ the last \code{l} elements from the input vector.} } \value{ [\code{smoof_multi_objective_function}] + Returns an instance of the WFG5 function as a \code{smoof_multi_objective_function} object. } \description{ Fifth test problem from the "Walking Fish Group" problem generator toolkit. diff --git a/man/makeWFG6Function.Rd b/man/makeWFG6Function.Rd index 6578c9b6..74aa9313 100644 --- a/man/makeWFG6Function.Rd +++ b/man/makeWFG6Function.Rd @@ -21,6 +21,7 @@ the last \code{l} elements from the input vector.} } \value{ [\code{smoof_multi_objective_function}] + Returns an instance of the WFG6 function as a \code{smoof_multi_objective_function} object. } \description{ Sixth test problem from the "Walking Fish Group" problem generator toolkit. diff --git a/man/makeWFG7Function.Rd b/man/makeWFG7Function.Rd index 649cbd43..890c09af 100644 --- a/man/makeWFG7Function.Rd +++ b/man/makeWFG7Function.Rd @@ -21,6 +21,7 @@ the last \code{l} elements from the input vector.} } \value{ [\code{smoof_multi_objective_function}] + Returns an instance of the WFG7 function as a \code{smoof_multi_objective_function} object. } \description{ Seventh test problem from the "Walking Fish Group" problem generator toolkit. diff --git a/man/makeWFG8Function.Rd b/man/makeWFG8Function.Rd index 83c44a56..c11f13c1 100644 --- a/man/makeWFG8Function.Rd +++ b/man/makeWFG8Function.Rd @@ -21,6 +21,7 @@ the last \code{l} elements from the input vector.} } \value{ [\code{smoof_multi_objective_function}] + Returns an instance of the WFG8 function as a \code{smoof_multi_objective_function} object. } \description{ Eighth test problem from the "Walking Fish Group" problem generator toolkit. diff --git a/man/makeWFG9Function.Rd b/man/makeWFG9Function.Rd index 21794dcf..f4656441 100644 --- a/man/makeWFG9Function.Rd +++ b/man/makeWFG9Function.Rd @@ -21,6 +21,7 @@ the last \code{l} elements from the input vector.} } \value{ [\code{smoof_multi_objective_function}] + Returns an instance of the WFG9 function as a \code{smoof_multi_objective_function} object. } \description{ Ninth test problem from the "Walking Fish Group" problem generator toolkit. diff --git a/man/makeZDT1Function.Rd b/man/makeZDT1Function.Rd index 4042ac5a..d5518292 100644 --- a/man/makeZDT1Function.Rd +++ b/man/makeZDT1Function.Rd @@ -12,6 +12,7 @@ Number of decision variables.} } \value{ [\code{smoof_multi_objective_function}] + Returns an instance of the ZDT1 function as a \code{smoof_multi_objective_function} object. } \description{ Builds and returns the two-objective ZDT1 test problem. For \eqn{m} objective it @@ -24,6 +25,6 @@ where and \eqn{\mathbf{x}_i \in [0,1], i = 1, \ldots, m} } \references{ -E. Zitzler, K. Deb, and L. Thiele. Comparison of Multiobjective +E. Zitzler, K. Deb, and L. Thiele. Comparison of Multi-objective Evolutionary Algorithms: Empirical Results. Evolutionary Computation, 8(2):173-195, 2000 } diff --git a/man/makeZDT2Function.Rd b/man/makeZDT2Function.Rd index e078a58a..be0cdd22 100644 --- a/man/makeZDT2Function.Rd +++ b/man/makeZDT2Function.Rd @@ -12,10 +12,11 @@ Number of decision variables.} } \value{ [\code{smoof_multi_objective_function}] + Returns an instance of the ZDT2 function as a \code{smoof_multi_objective_function} object. } \description{ Builds and returns the two-objective ZDT2 test problem. The function is -nonconvex and resembles the ZDT1 function. For \eqn{m} objective it +non-convex and resembles the ZDT1 function. For \eqn{m} objective it is defined as follows \deqn{f(\mathbf{x}) = \left(f_1(\mathbf{x}_1), f_2(\mathbf{x})\right)} with @@ -25,6 +26,6 @@ where and \eqn{\mathbf{x}_i \in [0,1], i = 1, \ldots, m} } \references{ -E. Zitzler, K. Deb, and L. Thiele. Comparison of Multiobjective +E. Zitzler, K. Deb, and L. Thiele. Comparison of Multi-objective Evolutionary Algorithms: Empirical Results. Evolutionary Computation, 8(2):173-195, 2000 } diff --git a/man/makeZDT3Function.Rd b/man/makeZDT3Function.Rd index de65a92e..e110d9c1 100644 --- a/man/makeZDT3Function.Rd +++ b/man/makeZDT3Function.Rd @@ -12,6 +12,7 @@ Number of decision variables.} } \value{ [\code{smoof_multi_objective_function}] + Returns an instance of the ZDT3 function as a \code{smoof_multi_objective_function} object. } \description{ Builds and returns the two-objective ZDT3 test problem. For \eqn{m} objective it @@ -27,6 +28,6 @@ by the sine term in the \eqn{h} function (see above). The front consists of multiple convex parts. } \references{ -E. Zitzler, K. Deb, and L. Thiele. Comparison of Multiobjective +E. Zitzler, K. Deb, and L. Thiele. Comparison of Multi-objective Evolutionary Algorithms: Empirical Results. Evolutionary Computation, 8(2):173-195, 2000 } diff --git a/man/makeZDT4Function.Rd b/man/makeZDT4Function.Rd index 2366b7a1..7410a685 100644 --- a/man/makeZDT4Function.Rd +++ b/man/makeZDT4Function.Rd @@ -12,6 +12,7 @@ Number of decision variables.} } \value{ [\code{smoof_multi_objective_function}] + Returns an instance of the ZDT4 function as a \code{smoof_multi_objective_function} object. } \description{ Builds and returns the two-objective ZDT4 test problem. For \eqn{m} objective it @@ -23,9 +24,9 @@ where \deqn{g(\mathbf{x}) = 1 + 10 (m - 1) + \sum_{i = 2}^{m} (\mathbf{x}_i^2 - 10\cos(4\pi\mathbf{x}_i)), h(f_1, g) = 1 - \sqrt{\frac{f_1(\mathbf{x})}{g(\mathbf{x})}}} and \eqn{\mathbf{x}_i \in [0,1], i = 1, \ldots, m}. This function has many Pareto-optimal fronts and is thus suited to test the -algorithms ability to tackle multimodal problems. +algorithms ability to tackle multi-modal problems. } \references{ -E. Zitzler, K. Deb, and L. Thiele. Comparison of Multiobjective +E. Zitzler, K. Deb, and L. Thiele. Comparison of Multi-objective Evolutionary Algorithms: Empirical Results. Evolutionary Computation, 8(2):173-195, 2000 } diff --git a/man/makeZDT6Function.Rd b/man/makeZDT6Function.Rd index c7a0a2c5..0a472d32 100644 --- a/man/makeZDT6Function.Rd +++ b/man/makeZDT6Function.Rd @@ -12,6 +12,7 @@ Number of decision variables.} } \value{ [\code{smoof_multi_objective_function}] + Returns an instance of the ZDT6 function as a \code{smoof_multi_objective_function} object. } \description{ Builds and returns the two-objective ZDT6 test problem. For \eqn{m} objective it @@ -22,11 +23,11 @@ with where \deqn{g(\mathbf{x}) = 1 + 9 \left(\frac{\sum_{i = 2}^{m}\mathbf{x}_i}{m - 1}\right)^{0.25}, h(f_1, g) = 1 - \left(\frac{f_1(\mathbf{x})}{g(\mathbf{x})}\right)^2} and \eqn{\mathbf{x}_i \in [0,1], i = 1, \ldots, m}. -This function introduced two difficulities (see reference): +This function introduced two difficulties (see reference): 1. the density of solutions decreases with the closeness to the Pareto-optimal front and -2. the Pareto-optimal solutions are nonuniformly distributed along the front. +2. the Pareto-optimal solutions are non-uniformly distributed along the front. } \references{ -E. Zitzler, K. Deb, and L. Thiele. Comparison of Multiobjective +E. Zitzler, K. Deb, and L. Thiele. Comparison of Multi-objective Evolutionary Algorithms: Empirical Results. Evolutionary Computation, 8(2):173-195, 2000 } diff --git a/man/makeZettlFunction.Rd b/man/makeZettlFunction.Rd index 37e5f647..07abc48c 100644 --- a/man/makeZettlFunction.Rd +++ b/man/makeZettlFunction.Rd @@ -7,10 +7,12 @@ makeZettlFunction() } \value{ +An object of class \code{SingleObjectiveFunction}, representing the Zettl Function. + [\code{smoof_single_objective_function}] } \description{ -The unimodal Zettl Function is based on the defintion +The uni-modal Zettl Function is based on the definition \deqn{f(\mathbf{x}) = (\mathbf{x}_1^2 + \mathbf{x}_2^2 - 2\mathbf{x}_1)^2 + 0.25 \mathbf{x}_1} with box-constraints \eqn{\mathbf{x}_i \in [-5, 10], i = 1, 2}. } diff --git a/man/mnof.Rd b/man/mnof.Rd index 11fb7222..5c3c462c 100644 --- a/man/mnof.Rd +++ b/man/mnof.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/mnof.R \name{mnof} \alias{mnof} -\title{Helper function to create numeric multi-objective optimization test function.} +\title{Helper function to create a numeric multi-objective optimization test function.} \usage{ mnof( name = NULL, @@ -79,7 +79,11 @@ are met or not. Default is \code{NULL}, which means, that there are no constrain beside possible box constraints defined via the \code{par.set} argument.} \item{ref.point}{[\code{numeric}]\cr -Optional reference point in the objective space, e.g., for hypervolume computation.} +Optional reference point in the objective space, e.g., for hyper-volume computation.} +} +\value{ +[\code{smoof_multi_objective_function}] + Returns a numeric multi-objective optimization test function created using the provided parameters. } \description{ This is a simplifying wrapper around \code{\link{makeMultiObjectiveFunction}}. diff --git a/man/plot.smoof_function.Rd b/man/plot.smoof_function.Rd index 8f2a83ee..2b6aa97f 100644 --- a/man/plot.smoof_function.Rd +++ b/man/plot.smoof_function.Rd @@ -17,5 +17,5 @@ Further parameters passed to the corresponding plot functions.} Nothing } \description{ -Generate ggplot2 object. +This function generates a ggplot2 object for visualization. } diff --git a/man/plot1DNumeric.Rd b/man/plot1DNumeric.Rd index 55b61b44..bbab00cf 100644 --- a/man/plot1DNumeric.Rd +++ b/man/plot1DNumeric.Rd @@ -7,7 +7,7 @@ plot1DNumeric( x, show.optimum = FALSE, - main = getName(x), + main = berryFunctions::getName(x), n.samples = 500L, ... ) diff --git a/man/plot2DNumeric.Rd b/man/plot2DNumeric.Rd index 4b4acd07..12eb3989 100644 --- a/man/plot2DNumeric.Rd +++ b/man/plot2DNumeric.Rd @@ -7,7 +7,7 @@ plot2DNumeric( x, show.optimum = FALSE, - main = getName(x), + main = berryFunctions::getName(x), render.levels = FALSE, render.contours = TRUE, n.samples = 100L, diff --git a/man/plot3D.Rd b/man/plot3D.Rd index ab98c7ed..9bd69fc7 100644 --- a/man/plot3D.Rd +++ b/man/plot3D.Rd @@ -20,16 +20,16 @@ the drawing can take quite a lot of time. Default is \code{100}.} String describing the package to use for 3D visualization. At the moment \dQuote{plot3D} (package \pkg{plot3D}) and \dQuote{plotly} (package \pkg{plotly}) are supported. -The latter opens a highly interactive plot in a web brower +The latter opens a highly interactive plot in a web browser and is thus suited well to explore a function by hand. Default is \dQuote{plot3D}.} \item{...}{[any]\cr -Furhter parameters passed to method used for visualization +Further parameters passed to method used for visualization (which is determined by the \code{package} argument.} } \description{ -Surface plot of two-dimensional test function. +This function generates a surface plot of a two-dimensional smoof function. } \examples{ library(plot3D) diff --git a/man/smoof-package.Rd b/man/smoof-package.Rd index 30c600b6..db7b1597 100644 --- a/man/smoof-package.Rd +++ b/man/smoof-package.Rd @@ -17,8 +17,8 @@ Given a set of criteria \eqn{\mathcal{F} = \{f_1, \ldots, f_m\}} with each \eqn{f_i : S \subseteq \mathbf{R}^d \to \mathbf{R} , i = 1, \ldots, m} being an objective-function, the goal in \emph{Global Optimization (GO)} is to find the best solution \eqn{\mathbf{x}^* \in S}. The set \eqn{S} is termed the \emph{set of -feasible soluations}. In the case of only a single objective function \eqn{f}, -- which we want to restrict ourself in this brief description - the goal is to +feasible solutions}. In the case of only a single objective function \eqn{f}, +- which we want to restrict ourselves in this brief description - the goal is to minimize the objective, i. e., \deqn{\min_{\mathbf{x}} f(\mathbf{x}).} Sometimes we may be interested in maximizing the objective function value, but since \eqn{min(f(\mathbf{x})) = -\min(-f(\mathbf{x}))}, we do not have to tackle diff --git a/man/smoof_function.Rd b/man/smoof_function.Rd index 9b946c8c..5a164be5 100644 --- a/man/smoof_function.Rd +++ b/man/smoof_function.Rd @@ -20,14 +20,14 @@ or code{smoof_multi_objective_function}. Both single- and multi-objective functi \item{noisy [\code{logical(1)}]}{Boolean indicating whether the function is noisy or not.} \item{fn.mean [\code{function}]}{Optional true mean function in case of a noisy objective function.} \item{minimize [\code{logical(1)}]}{Logical vector of length \code{n.objectives} indicating which objectives shall - be minimzed/maximized.} + be minimized/maximized.} \item{vectorized [\code{logical(1)}]}{Can the handle \dQuote{vector} input, i. e., does it accept matrix of parameters?} \item{constraint.fn [\code{function}]}{Optional function which returns a logical vector with each component indicating whether the corresponding constraint is violated.} } -Futhermore, single-objective function may contain additional parameters with information on +Furthermore, single-objective function may contain additional parameters with information on local and/or global optima as well as characterizing tags. \describe{ \item{tags [\code{character}]}{Optional character vector of tags or keywords.} @@ -37,7 +37,7 @@ local and/or global optima as well as characterizing tags. \item{global.opt.value [\code{numeric}]}{Function values of local optima.} } -Currenlty tagging is not possible for multi-objective functions. The only additional attribute may be +Currently tagging is not possible for multi-objective functions. The only additional attribute may be a reference point: \describe{ \item{ref.point [\code{numeric}]}{Optional reference point of length \code{n.objectives}}. diff --git a/man/visualizeParetoOptimalFront.Rd b/man/visualizeParetoOptimalFront.Rd index ff0ad90b..215e7f7b 100644 --- a/man/visualizeParetoOptimalFront.Rd +++ b/man/visualizeParetoOptimalFront.Rd @@ -15,6 +15,7 @@ Arguments passed to \code{\link[mco]{nsga2}}.} } \value{ [\code{\link[ggplot2]{ggplot}}] +Returns a ggplot object representing the Pareto-optimal front visualization. } \description{ Quickly visualize the Pareto-optimal front of a bi-criteria objective @@ -28,4 +29,5 @@ vis = visualizeParetoOptimalFront(fn) # Alternatively we can pass some more algorithm parameters to the NSGA2 algorithm vis = visualizeParetoOptimalFront(fn, popsize = 1000L) + } diff --git a/src/RcppExports.cpp b/src/RcppExports.cpp index 5597f60e..e55942d1 100644 --- a/src/RcppExports.cpp +++ b/src/RcppExports.cpp @@ -530,18 +530,18 @@ BEGIN_RCPP END_RCPP } -RcppExport SEXP evaluateBBOBFunctionCPP(SEXP, SEXP, SEXP, SEXP); -RcppExport SEXP evaluateUFFunction(SEXP, SEXP, SEXP); -RcppExport SEXP getOptimumForBBOBFunctionCPP(SEXP, SEXP, SEXP); -RcppExport SEXP mof_MOP1(SEXP); -RcppExport SEXP mof_MOP2(SEXP); -RcppExport SEXP mof_MOP3(SEXP); -RcppExport SEXP mof_MOP4(SEXP); -RcppExport SEXP mof_MOP5(SEXP); -RcppExport SEXP mof_MOP6(SEXP); -RcppExport SEXP mof_MOP7(SEXP); -RcppExport SEXP mof_bk1(SEXP); -RcppExport SEXP mof_viennet(SEXP); +RcppExport SEXP evaluateBBOBFunctionCPP(void *, void *, void *, void *); +RcppExport SEXP evaluateUFFunction(void *, void *, void *); +RcppExport SEXP getOptimumForBBOBFunctionCPP(void *, void *, void *); +RcppExport SEXP mof_bk1(void *); +RcppExport SEXP mof_MOP1(void *); +RcppExport SEXP mof_MOP2(void *); +RcppExport SEXP mof_MOP3(void *); +RcppExport SEXP mof_MOP4(void *); +RcppExport SEXP mof_MOP5(void *); +RcppExport SEXP mof_MOP6(void *); +RcppExport SEXP mof_MOP7(void *); +RcppExport SEXP mof_viennet(void *); static const R_CallMethodDef CallEntries[] = { {"_smoof_dtlz_1", (DL_FUNC) &_smoof_dtlz_1, 2}, @@ -589,6 +589,7 @@ static const R_CallMethodDef CallEntries[] = { {"evaluateBBOBFunctionCPP", (DL_FUNC) &evaluateBBOBFunctionCPP, 4}, {"evaluateUFFunction", (DL_FUNC) &evaluateUFFunction, 3}, {"getOptimumForBBOBFunctionCPP", (DL_FUNC) &getOptimumForBBOBFunctionCPP, 3}, + {"mof_bk1", (DL_FUNC) &mof_bk1, 1}, {"mof_MOP1", (DL_FUNC) &mof_MOP1, 1}, {"mof_MOP2", (DL_FUNC) &mof_MOP2, 1}, {"mof_MOP3", (DL_FUNC) &mof_MOP3, 1}, @@ -596,7 +597,6 @@ static const R_CallMethodDef CallEntries[] = { {"mof_MOP5", (DL_FUNC) &mof_MOP5, 1}, {"mof_MOP6", (DL_FUNC) &mof_MOP6, 1}, {"mof_MOP7", (DL_FUNC) &mof_MOP7, 1}, - {"mof_bk1", (DL_FUNC) &mof_bk1, 1}, {"mof_viennet", (DL_FUNC) &mof_viennet, 1}, {NULL, NULL, 0} }; From 93346f2a3279d8fb32074eeb767e1ec7be09c1c6 Mon Sep 17 00:00:00 2001 From: Harshit Purohit <71263771+Titanx9-exe@users.noreply.github.com> Date: Mon, 12 Feb 2024 15:16:33 +0100 Subject: [PATCH 3/4] Replaced editrules with ParamHelpers --- DESCRIPTION | 1 - R/makeSingleObjectiveFunction.R | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index da9c9a4c..8af73f31 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -37,7 +37,6 @@ Imports: BBmisc (>= 1.6), ggplot2 (>= 2.2.1), Rcpp (>= 0.11.0), - editrules Suggests: testthat, MASS, diff --git a/R/makeSingleObjectiveFunction.R b/R/makeSingleObjectiveFunction.R index 68dd89a6..982f2a3f 100644 --- a/R/makeSingleObjectiveFunction.R +++ b/R/makeSingleObjectiveFunction.R @@ -178,7 +178,7 @@ preprocessOptima = function(opt.params, fn, par.set, type) { # check if the passed parameters are indeed within the feasible region lapply(1:nrow(opt.params), function(i) { - if (!editrules::isFeasible(par.set, ParamHelpers::dfRowToList(opt.params, par.set, i))) { + if (!ParamHelpers::isFeasible(par.set, ParamHelpers::dfRowToList(opt.params, par.set, i))) { BBmisc::stopf("%s optimum out of bounds.", type) } }) From 24eadef6e96e83f4e320e64a91a04d9d40f6d1f7 Mon Sep 17 00:00:00 2001 From: Harshit Purohit <71263771+Titanx9-exe@users.noreply.github.com> Date: Wed, 14 Feb 2024 21:28:58 +0100 Subject: [PATCH 4/4] Fixed all the errors devtools::check() gives no errors or warnings. --- R/makeObjectiveFunction.R | 8 +++++--- R/makeSingleObjectiveFunction.R | 2 +- R/plot.autoplot.R | 6 +++--- R/plot.helpers.R | 4 ++-- R/plot.plot.R | 8 ++++---- R/sof.adjiman.R | 6 +----- R/sof.mpm2.R | 2 +- R/visualizeParetoOptimalFront.R | 2 +- man/autoplot.smoof_function.Rd | 2 +- man/makeAdjimanFunction.Rd | 6 +----- man/makeObjectiveFunction.Rd | 9 ++++++--- man/plot1DNumeric.Rd | 2 +- man/plot2DNumeric.Rd | 2 +- 13 files changed, 28 insertions(+), 31 deletions(-) diff --git a/R/makeObjectiveFunction.R b/R/makeObjectiveFunction.R index db163831..2349fb61 100644 --- a/R/makeObjectiveFunction.R +++ b/R/makeObjectiveFunction.R @@ -1,7 +1,9 @@ #' Internal generator for function of smoof type. #' #' @param name [\code{character(1)}]\cr -#' Optional function name used e.g. in plots. +#' Optional function name used e.g. in plots. +#' @param id [\code{character(1)}]\cr +#' Optional identifier for the function #' @param description [\code{character(1)} | \code{NULL}]\cr #' Optional function description. #' @param fn [\code{function}]\cr @@ -19,12 +21,12 @@ #' @param noisy [\code{logical(1)}]\cr #' Is the function noisy? Defaults to \code{FALSE}. #' @param fn.mean [\code{function}]\cr -#' Optional true mean function in case of a noisy objective function. This functions should +#' Optional true mean function in case of a noisy objective function. This functions should #' have the same mean as \code{fn}. #' @param minimize [\code{logical}]\cr #' Logical vector of length \code{n.objectives} indicating which objectives shall #' be minimized/maximized. -#' The default is \code{TRUE} \code{n.objectives} times. +#' The default is \code{TRUE} \code{n.objectives} times. #' @param vectorized [\code{logical(1)}]\cr #' Can the handle \dQuote{vector} input, i. e., does it accept matrix of #' parameters? Default is \code{FALSE}. diff --git a/R/makeSingleObjectiveFunction.R b/R/makeSingleObjectiveFunction.R index 982f2a3f..93129835 100644 --- a/R/makeSingleObjectiveFunction.R +++ b/R/makeSingleObjectiveFunction.R @@ -110,7 +110,7 @@ makeSingleObjectiveFunction = function( if (is.null(local.opt.values) && !is.null(local.opt.params)) { # print(local.opt.params) # print(par.set) - local.opt.params2 = BBmisc::dfRowsToList(df = local.opt.params, par.set = par.set, enforce.col.types = TRUE) + local.opt.params2 = ParamHelpers::dfRowsToList(df = local.opt.params, par.set = par.set, enforce.col.types = TRUE) local.opt.values = sapply(local.opt.params2, smoof.fn) } diff --git a/R/plot.autoplot.R b/R/plot.autoplot.R index 58d8cf37..1ecf29a6 100644 --- a/R/plot.autoplot.R +++ b/R/plot.autoplot.R @@ -85,7 +85,7 @@ autoplot.smoof_function = function(object, ..., show.optimum = FALSE, - main = berryFunctions::getName(x), + main = getName(x), render.levels = FALSE, render.contours = TRUE, log.scale = FALSE, @@ -190,7 +190,7 @@ } # add title - title = BBmisc::coalesce(main, berryFunctions::getName(x)) + title = BBmisc::coalesce(main, getName(x)) pl = pl + ggplot2::ggtitle(title) # cosmetic stuff @@ -203,7 +203,7 @@ autoplot.smoof_wrapped_function = function(object, ..., show.optimum = FALSE, - main = berryFunctions::getName(object), + main = getName(object), render.levels = FALSE, render.contours = TRUE, log.scale = FALSE, diff --git a/R/plot.helpers.R b/R/plot.helpers.R index a09d0206..d455e74d 100644 --- a/R/plot.helpers.R +++ b/R/plot.helpers.R @@ -48,7 +48,7 @@ getOptimaDf = function(fn) { generateDataframeForGGPlot = function(fn, sequences, par.set) { data = do.call(expand.grid, sequences) colnames(data) = ParamHelpers::getParamIds(par.set, with.nr = TRUE, repeated = TRUE) - data.as.list = BBmisc::dfRowsToList(par.set = par.set, df = data) + data.as.list = ParamHelpers::dfRowsToList(par.set = par.set, df = data) data[["y"]] = sapply(data.as.list, function(data.row) { if (violatesConstraints(fn, unlist(data.row))) { return(NA) @@ -136,7 +136,7 @@ generateDataframeForGGPlot2 = function(fun, length.out = 50L) { # now compute the function values and append #FIXME: check if one of the parameters is named "y" - grid2 = BBmisc::dfRowsToList(par.set = par.set, df = grid, enforce.col.types = TRUE) + grid2 = ParamHelpers::dfRowsToList(par.set = par.set, df = grid, enforce.col.types = TRUE) grid[, "y"] = sapply(grid2, fun) return(grid) diff --git a/R/plot.plot.R b/R/plot.plot.R index a44ccfb4..d7708c8d 100644 --- a/R/plot.plot.R +++ b/R/plot.plot.R @@ -43,7 +43,7 @@ plot.smoof_wrapped_function = function(x, ...) { #' @export plot1DNumeric = function(x, show.optimum = FALSE, - main = berryFunctions::getName(x), n.samples = 500L, ...) { + main = getName(x), n.samples = 500L, ...) { checkmate::assertFlag(show.optimum, na.ok = TRUE) checkmate::assertString(main, na.ok = TRUE) @@ -95,7 +95,7 @@ plot1DNumeric = function(x, #' @return Nothing #' @export plot2DNumeric = function(x, - show.optimum = FALSE, main = berryFunctions::getName(x), + show.optimum = FALSE, main = getName(x), render.levels = FALSE, render.contours = TRUE, n.samples = 100L, ...) { @@ -120,11 +120,11 @@ plot2DNumeric = function(x, dim(z) = c(n.samples, n.samples) if (render.levels) { - sommer::jet.colors = colorRampPalette(c("#00007F", "blue", "#007FFF", "cyan", + jet.colors = colorRampPalette(c("#00007F", "blue", "#007FFF", "cyan", "#7FFF7F", "yellow", "#FF7F00", "red", "#7F0000")) image(x = sequence.x1, y = sequence.x2, z = z, xlab = par.names[1], ylab = par.names[2], main = main, - col = sommer::jet.colors(100L), ...) + col = jet.colors(100L), ...) } if (render.contours) { contour(x = sequence.x1, y = sequence.x2, z = z, diff --git a/R/sof.adjiman.R b/R/sof.adjiman.R index 170004d5..f5a3cccb 100644 --- a/R/sof.adjiman.R +++ b/R/sof.adjiman.R @@ -2,14 +2,10 @@ #' Adjiman function #' #' @description -#' This two-dimensional multimodal test function follows the formula +#' This two-dimensional multi-modal test function follows the formula #' \deqn{f(\mathbf{x}) = \cos(\mathbf{x}_1)\sin(\mathbf{x}_2) - \frac{\mathbf{x}_1}{(\mathbf{x}_2^2 + 1)}} #' with \eqn{\mathbf{x}_1 \in [-1, 2], \mathbf{x}_2 \in [2, 1]}. #' -#' @param -#' A numeric vector of length 2 representing the input coordinates. -#' \code{x[1]} should be in the range [-1, 2], and \code{x[2]} should be in the range [2, 1]. -#' #' @return #' An object of class \code{SingleObjectiveFunction}, representing the Adjiman Function. #' diff --git a/R/sof.mpm2.R b/R/sof.mpm2.R index cbfba6d2..068682a6 100644 --- a/R/sof.mpm2.R +++ b/R/sof.mpm2.R @@ -67,7 +67,7 @@ makeMPM2Function = function(n.peaks, dimensions, topology, seed, rotated = TRUE, force(peak.shape) # build parameter set (bounds are [0, 1]^d) - par.set = ParammHelpers::makeNumericParamSet("x", len = dimensions, lower = 0, upper = 1) + par.set = ParamHelpers::makeNumericParamSet("x", len = dimensions, lower = 0, upper = 1) # import reticulate namespace BBmisc::requirePackages("_reticulate", why = "smoof::makeMultiplePeaksModel2Function") diff --git a/R/visualizeParetoOptimalFront.R b/R/visualizeParetoOptimalFront.R index ee7777bc..bc22884e 100644 --- a/R/visualizeParetoOptimalFront.R +++ b/R/visualizeParetoOptimalFront.R @@ -52,6 +52,6 @@ visualizeParetoOptimalFront = function(fn, ...) { pl = pl + ggplot2::geom_line(colour = "darkgray") pl = pl + ggplot2::xlab(expression(f[1])) + ggplot2::ylab(expression(f[2])) pl = pl + ggplot2::ggtitle(sprintf("Objective space with shape of Pareto-optimal\n - front for the bi-criteria %s", berryFunctions::getName(fn))) + front for the bi-criteria %s", getName(fn))) return(pl) } diff --git a/man/autoplot.smoof_function.Rd b/man/autoplot.smoof_function.Rd index da53c9e5..3dd3c3e7 100644 --- a/man/autoplot.smoof_function.Rd +++ b/man/autoplot.smoof_function.Rd @@ -8,7 +8,7 @@ object, ..., show.optimum = FALSE, - main = berryFunctions::getName(x), + main = getName(x), render.levels = FALSE, render.contours = TRUE, log.scale = FALSE, diff --git a/man/makeAdjimanFunction.Rd b/man/makeAdjimanFunction.Rd index a0a0f7ad..f2ad5bff 100644 --- a/man/makeAdjimanFunction.Rd +++ b/man/makeAdjimanFunction.Rd @@ -6,17 +6,13 @@ \usage{ makeAdjimanFunction() } -\arguments{ -\item{A}{numeric vector of length 2 representing the input coordinates. -\code{x[1]} should be in the range [-1, 2], and \code{x[2]} should be in the range [2, 1].} -} \value{ An object of class \code{SingleObjectiveFunction}, representing the Adjiman Function. [\code{smoof_single_objective_function}] } \description{ -This two-dimensional multimodal test function follows the formula +This two-dimensional multi-modal test function follows the formula \deqn{f(\mathbf{x}) = \cos(\mathbf{x}_1)\sin(\mathbf{x}_2) - \frac{\mathbf{x}_1}{(\mathbf{x}_2^2 + 1)}} with \eqn{\mathbf{x}_1 \in [-1, 2], \mathbf{x}_2 \in [2, 1]}. } diff --git a/man/makeObjectiveFunction.Rd b/man/makeObjectiveFunction.Rd index 160869e0..c7555a62 100644 --- a/man/makeObjectiveFunction.Rd +++ b/man/makeObjectiveFunction.Rd @@ -23,6 +23,9 @@ makeObjectiveFunction( \item{name}{[\code{character(1)}]\cr Optional function name used e.g. in plots.} +\item{id}{[\code{character(1)}]\cr +Optional identifier for the function} + \item{description}{[\code{character(1)} | \code{NULL}]\cr Optional function description.} @@ -47,11 +50,11 @@ Is the function noisy? Defaults to \code{FALSE}.} \item{fn.mean}{[\code{function}]\cr Optional true mean function in case of a noisy objective function. This functions should - have the same mean as \code{fn}.} +have the same mean as \code{fn}.} \item{minimize}{[\code{logical}]\cr - Logical vector of length \code{n.objectives} indicating which objectives shall - be minimized/maximized. +Logical vector of length \code{n.objectives} indicating which objectives shall +be minimized/maximized. The default is \code{TRUE} \code{n.objectives} times.} \item{vectorized}{[\code{logical(1)}]\cr diff --git a/man/plot1DNumeric.Rd b/man/plot1DNumeric.Rd index bbab00cf..55b61b44 100644 --- a/man/plot1DNumeric.Rd +++ b/man/plot1DNumeric.Rd @@ -7,7 +7,7 @@ plot1DNumeric( x, show.optimum = FALSE, - main = berryFunctions::getName(x), + main = getName(x), n.samples = 500L, ... ) diff --git a/man/plot2DNumeric.Rd b/man/plot2DNumeric.Rd index 12eb3989..4b4acd07 100644 --- a/man/plot2DNumeric.Rd +++ b/man/plot2DNumeric.Rd @@ -7,7 +7,7 @@ plot2DNumeric( x, show.optimum = FALSE, - main = berryFunctions::getName(x), + main = getName(x), render.levels = FALSE, render.contours = TRUE, n.samples = 100L,