R/isMultiobjective.R

Defines functions isMultiobjective.smoof_wrapped_function isMultiobjective.smoof_function isMultiobjective

Documented in isMultiobjective

#' Checks whether the given function is multi-objective.
#'
#' @template arg_smoof_function
#' @return [\code{logical(1)}] \code{TRUE} if function is multi-objective.
#' @export
isMultiobjective = function(fn) {
  UseMethod("isMultiobjective")
}

#' @export
isMultiobjective.smoof_function = function(fn) {
  return(attr(fn, "n.objectives") >= 2L)
}

#' @export
isMultiobjective.smoof_wrapped_function = function(fn) {
  return(isMultiobjective(getWrappedFunction(fn)))
}

Try the smoof package in your browser

Any scripts or data that you put into this service are public.

smoof documentation built on March 31, 2023, 11:48 p.m.