R/calculateGap.R

Defines functions calculateGap

# Calculates gap between best point and global optimum.
#
# Used in the exampleRun functions and printed in plots.
#
# @param design [\code{data.frame}]\cr
#   Initial design as data frame.
# @param global.opt [\code{numeric(1)]\cr
#   Value of the known global optimum.
# @param control [\code{\link{MBOControl}}]\cr
#   MBO control object.
# @return [\code{numeric(1)}]
calculateGap = function(design, global.opt, control) {
  best.y = if (control$minimize) min(design[, control$y.name]) else max(design[, control$y.name])
  abs(best.y - global.opt)
}

Try the mlrMBO package in your browser

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

mlrMBO documentation built on June 25, 2018, 9:04 a.m.