Base class inheriting from Selector
for selection operations that make use of scalar values, generated by Scalor
.
SelectorScaling
is an abstract base class and should be inherited from. Inheriting classes should implement the private $.select_scalar()
function. During $operate()
, the $.select_scalar()
function is called, it should have three arguments, similar to Selector
's $.select()
function.
values
and n_select
are as given to $.select()
of the Selector
. The fitnesses
argument is first scaled by the associated Scalor
and then passed on as a numeric
vector.
Typically, $initialize()
should also be overloaded when inheriting.
Other base classes:
Filtor
,
FiltorSurrogate
,
MiesOperator
,
Mutator
,
MutatorDiscrete
,
MutatorNumeric
,
OperatorCombination
,
Recombinator
,
RecombinatorPair
,
Scalor
,
Selector
Other selectors:
Selector
,
dict_selectors_best
,
dict_selectors_maybe
,
dict_selectors_null
,
dict_selectors_proxy
,
dict_selectors_random
,
dict_selectors_sequential
,
dict_selectors_tournament
miesmuschel::MiesOperator
-> miesmuschel::Selector
-> SelectorScalar
new()
Initialize base class components of the SelectorScalar
.
SelectorScalar$new(
scalor = ScalorSingleObjective$new(),
is_deterministic = FALSE,
param_classes = c("ParamLgl", "ParamInt", "ParamDbl", "ParamFct"),
param_set = ps(),
supported = scalor$supported,
packages = character(0),
dict_entry = NULL
)
scalor
(Scalor
)Scalor
to use to generate scalar values from multiple objectives, if multi-objective optimization is performed.
Initialized to ScalorSingleObjective
: Doing single-objective optimization normally, throwing an error if used
in multi-objective setting: In that case, a Scalor
needs to be explicitly chosen.
is_deterministic
(logical(1)
)
Whether the Selector
is deterministic. Setting this to TRUE
adds a configuration parameter shuffle_selection
(initialized to TRUE
)
that causes the selection to be shuffled.
param_classes
(character
)
Classes of parameters that the operator can handle. May contain any of "ParamLgl"
, "ParamInt"
, "ParamDbl"
, "ParamFct"
.
Default is all of them.
The $param_classes
field will reflect this value.
param_set
(ParamSet
| list
of expression
)
Strategy parameters of the operator. This should be created by the subclass and given to super$initialize()
.
If this is a ParamSet
, it is used as the MiesOperator
's ParamSet
directly. Otherwise it must be a list
of expressions e.g. created by alist()
that evaluate to ParamSet
s,
possibly referencing self
and private
.
These ParamSet
are then combined using a ParamSetCollection
.
Default is the empty ParamSet
.
The $param_set
field will reflect this value.
supported
(character
)
Subset of "single-crit"
and "multi-crit"
, indicating wether single and / or multi-criterion optimization is supported.
Default to the supported set of scalor
.
The $supported
field will reflect this value.
packages
(character
)
Packages that need to be loaded for the operator to function. This should
be declared so these packages can be loaded when operators run on parallel
instances. Default is character(0)
.
The $packages
field will reflect this values.
dict_entry
(character(1)
| NULL
)
Key of the class inside the Dictionary
(usually one of
dict_mutators
, dict_recombinators
, dict_selectors
), where it can
be retrieved using a short access function. May be NULL
if the operator
is not entered in a dictionary.
The $dict_entry
field will reflect this value.
prime()
See MiesOperator
method. Primes both this operator, as well as the wrapped operator
given to scalor
during construction.
param_set
(ParamSet
)
Passed to MiesOperator
$prime()
.
invisible self
.