Learn R Programming

bbotk (version 1.7.1)

oi: Syntactic Sugar for Optimization Instance Construction

Description

Function to construct a OptimInstanceBatchSingleCrit and OptimInstanceBatchMultiCrit.

Usage

oi(
  objective,
  search_space = NULL,
  terminator,
  callbacks = NULL,
  check_values = TRUE,
  keep_evals = "all"
)

Arguments

objective

(Objective)
Objective function.

search_space

(paradox::ParamSet)
Specifies the search space for the Optimizer. The paradox::ParamSet describes either a subset of the domain of the Objective or it describes a set of parameters together with a trafo function that transforms values from the search space to values of the domain. Depending on the context, this value defaults to the domain of the objective.

terminator

Terminator
Termination criterion.

callbacks

(list of mlr3misc::Callback)
List of callbacks.

check_values

(logical(1))
Should points before the evaluation and the results be checked for validity?

keep_evals

(character(1))
Keep all or only best evaluations in archive?

Examples

Run this code
# define the objective function
fun = function(xs) {
  list(y = - (xs[[1]] - 2)^2 - (xs[[2]] + 3)^2 + 10)
}

# set domain
domain = ps(
  x1 = p_dbl(-10, 10),
  x2 = p_dbl(-5, 5)
)

# set codomain
codomain = ps(
  y = p_dbl(tags = "maximize")
)

# create objective
objective = ObjectiveRFun$new(
  fun = fun,
  domain = domain,
  codomain = codomain,
  properties = "deterministic"
)

# initialize instance
instance = oi(
  objective = objective,
  terminator = trm("evals", n_evals = 20)
)

Run the code above in your browser using DataLab