R/smoofFunctions.R

Defines functions checkSmoofFunScalibility getSmoofFunUpperBounds getSmoofFunLowerBounds getSmoofFunByName getAllSmoofFunctions

getAllSmoofFunctions <- function(){
    functionBlackList <- c("Shekel function","Hartmann")
    requireNamespace("smoof")
    smoofNames <- smoof::filterFunctionsByTags(tags = "single-objective")
    smoofNames <- smoofNames[-which(smoofNames %in% functionBlackList)]
    return(smoofNames)
}

getSmoofFunByName <- function(strName, input = NULL){
    #If input is not accessible return a 2-dimensional function
    if(is.null(input))
    {
        return(smoof::makeFunctionsByName(strName, dimensions = 2)[[1]])
    }else{
        smoof::makeFunctionsByName(strName, dimensions = getNDim(input))[[1]]
    }

}

getSmoofFunLowerBounds <- function(strName){
    fun <- getSmoofFunByName(strName)
    return(smoof::getLowerBoxConstraints(fun))
}

getSmoofFunUpperBounds <- function(strName){
    fun <- getSmoofFunByName(strName)
    return(smoof::getUpperBoxConstraints(fun))
}

checkSmoofFunScalibility <- function(strName,input){
    dims <- getNDim(input)
    fun <- smoof::makeFunctionsByName(strName, dimensions = dims)[[1]]
    return(dims == length(smoof::getLowerBoxConstraints(fun)))
}

Try the spotGUI package in your browser

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

spotGUI documentation built on March 31, 2021, 1:06 a.m.