R/OptPath_getter.R
getOptPathBestIndex.RdGet index of the best element from optimization path.
getOptPathBestIndex(
op,
y.name = op$y.names[1],
dob = op$env$dob,
eol = op$env$eol,
ties = "last"
)OptPath
Optimization path.
(character(1))
Name of target value to decide which element is best.
Default is y.names[1].
integer
Vector of date-of-birth values to further subset the result.
Only elements with a date-of-birth included in dob are selected.
Default is all.
integer
Vector of end-of-life values to further subset the result.
Only elements with an end-of-life included in eol are selected.
Default is all.
(character(1))
How should ties be broken when more than one optimal element is found?
“all”: return all indices,
“first”: return first optimal element in path,
“last”: return last optimal element in path,
“random”: return random optimal element in path.
Default is “last”.
Other optpath:
OptPath,
addOptPathEl(),
getOptPathCols(),
getOptPathCol(),
getOptPathDOB(),
getOptPathEOL(),
getOptPathEl(),
getOptPathErrorMessages(),
getOptPathExecTimes(),
getOptPathLength(),
getOptPathParetoFront(),
getOptPathX(),
getOptPathY(),
setOptPathElDOB(),
setOptPathElEOL()
ps = makeParamSet(makeNumericParam("x"))
op = makeOptPathDF(par.set = ps, y.names = "y", minimize = TRUE)
addOptPathEl(op, x = list(x = 1), y = 5)
addOptPathEl(op, x = list(x = 2), y = 3)
addOptPathEl(op, x = list(x = 3), y = 9)
addOptPathEl(op, x = list(x = 4), y = 3)
as.data.frame(op)
#> x y dob eol
#> 1 1 5 1 NA
#> 2 2 3 2 NA
#> 3 3 9 3 NA
#> 4 4 3 4 NA
getOptPathBestIndex(op)
#> [1] 4
getOptPathBestIndex(op, ties = "first")
#> [1] 2