1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
#' Checks if a parameter or each parameter of a parameter set has ONLY finite lower and upper bounds.
#'
#' @template arg_par_or_set
#' @template arg_dict
#' @return `logical(1)`
#' @export
hasFiniteBoxConstraints = function(par, dict = NULL) {
UseMethod("hasFiniteBoxConstraints")
}
#' @export
hasFiniteBoxConstraints.Param = function(par, dict = NULL) {
bounds = c(getLower(par, dict = dict), getUpper(par, dict = dict))
if (length(bounds) == 0) {
return(TRUE)
}
return(all(is.finite(bounds)))
}
#' @export
hasFiniteBoxConstraints.ParamSet = function(par, dict = NULL) {
bounds = c(getLower(par, dict = dict), getUpper(par, dict = dict))
if (length(bounds) == 0) {
return(TRUE)
}
return(all(is.finite(bounds)))
}
|