Selector {miesmuschel} | R Documentation |
Selector Base Class
Description
Base class representing selection operations, inheriting from MiesOperator
.
A Selector
gets a table of individuals as input, along with information on the individuals' performance values and the
number of individuals to select, and returns a vector of integers indicating which individuals were selected.
Selection operations are performed in ES algorithms to facilitate concentration towards individuals that perform well with regard to the fitness measure.
Fitness values are always maximized, both in single- and multi-criterion optimization.
Unlike most other operator types inheriting from MiesOperator
, the $operate()
function has three arguments, which are passed on to $.select()
-
values
::data.frame
Individuals to operate on. Must pass the check of theDomain
given in the last$prime()
call and may not have any missing components. -
fitnesses
::numeric
|matrix
Fitnesses for each individual given invalues
. If this is anumeric
, then its length must be equal to the number of rows invalues
. If this is amatrix
, if number of rows must be equal to the number of rows invalues
, and it must have one column when doing single-crit optimization and one column each for each "criterion" when doing multi-crit optimization.
Thefitnesses
-value passed on to$.select()
is always amatrix
. -
n_select
::integer(1)
Number of individuals to select. SomeSelector
s select individuals with replacement, for which this value may be greater than the number of rows invalues
. -
group_size
::integer
Sampling group size hint, indicating that the caller would prefer there to not be any duplicates within this group size, e.g. because theSelector
is called to select individuals to be given to aRecombinator
with a certainn_indivs_in
, or because it is called as asurvival_selector
inmies_survival_comma()
ormies_survival_plus()
. TheSelector
may or may not ignore this value, however. This may possibly happen because of certain configuration parameters, or because the input size is too small.
Must either be a scalar value or sum up ton_select
. Must be non-negative. A scalar value of 0 is interpreted the same as 1.
If not given, this value defaults to 1.
The return value for an operation will be a numeric vector of integer values of length n_select
indexing the individuals that were selected. Some Selector
s
select individuals with replacement, for which the return value may contain indices more than once.
Inheriting
Selector
is an abstract base class and should be inherited from. Inheriting classes should implement the private $.select()
function. The user of the object calls $operate()
, and the arguments are passed on to private $.select()
after checking that
the operator is primed, that the values
argument conforms to the primed domain and that other values match. Typically, the $initialize()
function
should also be overloaded, and optionally the $prime()
function; they should call their super
equivalents.
Super class
miesmuschel::MiesOperator
-> Selector
Active bindings
supported
(
character
)
Optimization supported by thisSelector
, can be"single-crit"
,"multi-crit"
, or both.
Methods
Public methods
Inherited methods
Method new()
Initialize base class components of the Selector
.
Usage
Selector$new( is_deterministic = FALSE, param_classes = c("ParamLgl", "ParamInt", "ParamDbl", "ParamFct"), param_set = ps(), supported = c("single-crit", "multi-crit"), packages = character(0), dict_entry = NULL, own_param_set = quote(self$param_set) )
Arguments
is_deterministic
(
logical(1)
)
Whether theSelector
is deterministic. Setting this toTRUE
adds a configuration parametershuffle_selection
(initialized toTRUE
) 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
ofexpression
)
Strategy parameters of the operator. This should be created by the subclass and given tosuper$initialize()
. If this is aParamSet
, it is used as theMiesOperator
'sParamSet
directly. Otherwise it must be alist
of expressions e.g. created byalist()
that evaluate toParamSet
s, possibly referencingself
andprivate
. TheseParamSet
are then combined using aParamSetCollection
. Default is the emptyParamSet
.
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 ischaracter(0)
.
The$packages
field will reflect this values.dict_entry
(
character(1)
|NULL
)
Key of the class inside theDictionary
(usually one ofdict_mutators
,dict_recombinators
,dict_selectors
), where it can be retrieved using a short access function. May beNULL
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 aParamSet
indicating the configuration parameters that are entirely owned by this operator class (and not proxied from a construction argument object). This should bequote(self$param_set)
(the default) when theparam_set
argument is not a list of expressions.
Method clone()
The objects of this class are cloneable with this method.
Usage
Selector$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.
See Also
Other base classes:
Filtor
,
FiltorSurrogate
,
MiesOperator
,
Mutator
,
MutatorDiscrete
,
MutatorNumeric
,
OperatorCombination
,
Recombinator
,
RecombinatorPair
,
Scalor
,
SelectorScalar
Other selectors:
SelectorScalar
,
dict_selectors_best
,
dict_selectors_maybe
,
dict_selectors_null
,
dict_selectors_proxy
,
dict_selectors_random
,
dict_selectors_sequential
,
dict_selectors_tournament