Scalor that uses a single given objective, throwing an error in case it is used in a multi-objective problem.

In contrast to ScalorOne, this Scalor throws an error when more than one objective is present. When this Scalor gets used as the default value, e.g. for a Selector, then it forces the user to make an explicit decision about what Scalor to use in a multi-objective setting.

Configuration Parameters

No configuration parameters.

Supported Operand Types

Supported Param classes are: ParamLgl, ParamInt, ParamDbl, ParamFct

Dictionary

This Scalor can be created with the short access form scl() (scls() to get a list), or through the the dictionary dict_scalors in the following way:

# preferred:
scl("single")
scls("single")  # takes vector IDs, returns list of Scalors

# long form:
dict_scalors$get("single")

Super classes

miesmuschel::MiesOperator -> miesmuschel::Scalor -> ScalorSingleObjective

Methods

Inherited methods


Method new()

Initialize the ScalorSingleObjective object.

Usage


Method clone()

The objects of this class are cloneable with this method.

Usage

ScalorSingleObjective$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

ss = scl("single")
p = ps(x = p_dbl(-5, 5))
# dummy data; note that ScalorOne does not depend on data content
data = data.frame(x = rep(0, 5))
fitnesses_so = c(1, 5, 2, 3, 0)
fitnesses_mo = matrix(c(1, 5, 2, 3, 0, 3, 1, 0, 10, 8), ncol = 2)

ss$prime(p)

ss$operate(data, fitnesses_so)
#> [1] 1 5 2 3 0

try(ss$operate(data, fitnesses_mo))
#> Error in .__Scalor__.operate(self = self, private = private, super = super,  : 
#>   Assertion on 'fitnesses' failed: Must have at most 1 cols, but has 2 cols.