Base class representing filter operations, inheriting from MiesOperator
.
A Filtor
gets a table of individuals that are to be filtered, as well as a table of individuals that were already evaluated,
along with information on the latter individuals' performance values. Furthermore, the
number of individuals to return is given. The Filtor
returns a vector of unique integers indicating which individuals were selected.
Filter operations are performed in ES algorithms to facilitate concentration towards individuals that likely perform well with regard to the fitness measure, without evaluating the fitness measure, for example through a surrogate model.
Fitness values are always maximized, both in single- and multi-criterion optimization.
Unlike most other operator types inheriting from MiesOperator
, the $operate()
function has four arguments, which are passed on to $.filter()
values
:: data.frame
Individuals to filter. Must pass the check of the Param
given in the last $prime()
call
and may not have any missing components.
known_values
:: data.frame
Individuals to use for filtering. Must pass the check of the Param
given in the last $prime()
call
and may not have any missing components. Note that known_values
may be empty.
fitnesses
:: numeric
| matrix
Fitnesses for each individual given in known_values
. If this is a numeric
, then its length must be equal to the number of rows in values
. If
this is a matrix
, if number of rows must be equal to the number of rows in values
, and it must have one column when doing single-crit optimization
and one column each for each "criterion" when doing multi-crit optimization.
n_filter
:: integer(1)
Number of individuals to select. Some Filtor
s select individuals with replacement, for which this value may be greater than the number of
rows in values
.
The return value for an operation will be a numeric vector of integer values of ength n_filter
indexing the individuals that were selected. Filtor
must always return unique integers, i.e. select every individual at most once.
Filtor
is an abstract base class and should be inherited from. Inheriting classes should implement the private $.filter()
function. The user of the object calls $operate()
, and the arguments are passed on to private $.filter()
after checking that
the operator is primed, that the values
and known_values
arguments conforms to the primed domain and that other values match.
The private$.needed_input()
function should also be overloaded, it is called by the public $needed_input()
function after initial checks;
see the documentation there.
Typically, the $initialize()
function should also be overloaded, and optionally the $prime()
function; they should call their super
equivalents.
Other base classes:
FiltorSurrogate
,
MiesOperator
,
Mutator
,
MutatorDiscrete
,
MutatorNumeric
,
OperatorCombination
,
Recombinator
,
RecombinatorPair
,
Scalor
,
Selector
,
SelectorScalar
Other filtors:
FiltorSurrogate
,
dict_filtors_maybe
,
dict_filtors_null
,
dict_filtors_proxy
,
dict_filtors_surprog
,
dict_filtors_surtour
miesmuschel::MiesOperator
-> Filtor
supported
(character
)
Optimization supported by this Filtor
, can be "single-crit"
, "multi-crit"
, or both.
new()
Initialize base class components of the Filtor
.
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 both of them.
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.
own_param_set
(language
)
An expression that evaluates to a ParamSet
indicating the configuration parameters that are entirely owned by
this operator class (and not proxied from a construction argument object). This should be quote(self$param_set)
(the default) when
the param_set
argument is not a list of expressions.
needed_input()
Calculate the number of values
that are required to
filter down to output_size
, given the current configuraiton parameter settings.