View source: R/setMBOControlTermination.R
| setMBOControlTermination | R Documentation |
Extends an MBO control object with infill criteria and infill optimizer options.
setMBOControlTermination(
control,
iters = NULL,
time.budget = NULL,
exec.time.budget = NULL,
target.fun.value = NULL,
max.evals = NULL,
more.termination.conds = list(),
use.for.adaptive.infill = NULL
)
control |
[ |
iters |
[ |
time.budget |
[ |
exec.time.budget |
[ |
target.fun.value |
[ |
max.evals |
[ |
more.termination.conds |
[
|
use.for.adaptive.infill |
[ |
[MBOControl].
Other MBOControl:
makeMBOControl(),
setMBOControlInfill(),
setMBOControlMultiObj(),
setMBOControlMultiPoint()
fn = smoof::makeSphereFunction(1L)
ctrl = makeMBOControl()
# custom termination condition (stop if target function value reached)
# We neglect the optimization direction (min/max) in this example.
yTargetValueTerminator = function(y.val) {
force(y.val)
function(opt.state) {
opt.path = opt.state$opt.path
current.best = getOptPathEl(opt.path, getOptPathBestIndex((opt.path)))$y
term = (current.best <= y.val)
message = if (!term) NA_character_ else sprintf("Target function value %f reached.", y.val)
return(list(term = term, message = message))
}
}
# assign custom termination condition
ctrl = setMBOControlTermination(ctrl, more.termination.conds = list(yTargetValueTerminator(0.05)))
res = mbo(fn, control = ctrl)
print(res)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.