R/mof.mmf15.R

Defines functions makeMMF15Function

Documented in makeMMF15Function

#' @title
#' MMF15 Function
#'
#' @description
#' 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
#'   Number of decision variables.
#' @param n.objectives [\code{integer(1)}]\cr
#'   Number of objectives.
#' @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 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) {
  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
  M = n.objectives
  force(M)

  # C implementation
  fn = function(x) {
    checkNumericInput(x, dimensions)
    mof_cec2019_mmf15(x = x, M = M, np = np)
  }

  makeMultiObjectiveFunction(
    name = "MMF15 function",
    id = sprintf("MMF15-%id-%io", dimensions, n.objectives),
    description = "MMF15 function",
    fn = fn,
    par.set =  ParamHelpers::makeNumericParamSet(
      len = dimensions,
      id = "x",
      lower = rep(0, dimensions),
      upper = rep(1, dimensions),
      vector = TRUE
    ),
    minimize = rep(TRUE, n.objectives),
    n.objectives = n.objectives
  )
}

class(makeMMF15Function) = c("function", "smoof_generator")
attr(makeMMF15Function, "name") = c("MMF15")
attr(makeMMF15Function, "type") = c("multi-objective")
attr(makeMMF15Function, "tags") = c("multi-objective")
jakobbossek/smoof documentation built on Feb. 17, 2024, 2:23 a.m.