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.
No configuration parameters.
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:
miesmuschel::MiesOperator
-> miesmuschel::Scalor
-> ScalorSingleObjective
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.