RecombinatorPair {miesmuschel} | R Documentation |
Pair Recombinator Base Class
Description
Base class for recombination that covers the common case of combining two individuals, where two (typically complementary) child individuals could be taken as the result, such as bitwise crossover or SBX crossover.
This is a relatively lightweight class, it adds the keep_complement
active binding and sets $n_indivs_in
and $n_indivs_out
appropriately.
Inheriting
RecombinatorPair
is an abstract base class and should be inherited from. Inheriting classes should implement the private
$.recombine_pair()
function. During $operate()
, the $.recombine_pair()
function is called with the same input as the $.recombine()
function
of the Recombinator
class. It should return a data.table
of two individuals.
Constructors of inheriting classes should have a keep_complement
argument.
Super classes
miesmuschel::MiesOperator
-> miesmuschel::Recombinator
-> RecombinatorPair
Active bindings
keep_complement
(
logical(1)
)
Whether the operation keeps both resulting individuals of the operation or discards the complement.
Methods
Public methods
Inherited methods
Method new()
Initialize base class components of the RecombinatorPair
.
Usage
RecombinatorPair$new( keep_complement = TRUE, param_classes = c("ParamLgl", "ParamInt", "ParamDbl", "ParamFct"), param_set = ps(), packages = character(0), dict_entry = NULL, own_param_set = quote(self$param_set) )
Arguments
keep_complement
(
logical(1)
)
Whether the operation should keep both resulting individuals (TRUE
), or only the first and discard the complement (FALSE
). DefaultTRUE
. The$keep_complement
field will reflect this value.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.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
RecombinatorPair$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.
See Also
Other base classes:
Filtor
,
FiltorSurrogate
,
MiesOperator
,
Mutator
,
MutatorDiscrete
,
MutatorNumeric
,
OperatorCombination
,
Recombinator
,
Scalor
,
Selector
,
SelectorScalar
Other recombinators:
OperatorCombination
,
Recombinator
,
dict_recombinators_cmpmaybe
,
dict_recombinators_convex
,
dict_recombinators_cvxpair
,
dict_recombinators_maybe
,
dict_recombinators_null
,
dict_recombinators_proxy
,
dict_recombinators_sbx
,
dict_recombinators_sequential
,
dict_recombinators_swap
,
dict_recombinators_xonary
,
dict_recombinators_xounif