| dict_recombinators_swap | R Documentation |
Values between two individuals are exchanged. This is relatively useless as an operator by itself, but is used
in combination with RecombinatorCmpMaybe to get a recombinator that is crossing over individuals
uniformly at random. Because this is such a frequently-used operation, the RecombinatorCrossoverUniform pseudo-class
exists as a shortcut.
None.
Supported Domain classes are: p_lgl ('ParamLgl'), p_int ('ParamInt'), p_dbl ('ParamDbl'), p_fct ('ParamFct')
This Recombinator can be created with the short access form rec()
(recs() to get a list), or through the the dictionary
dict_recombinators in the following way:
# preferred:
rec("swap")
recs("swap") # takes vector IDs, returns list of Recombinators
# long form:
dict_recombinators$get("swap")
miesmuschel::MiesOperator -> miesmuschel::Recombinator -> miesmuschel::RecombinatorPair -> RecombinatorSwap
new()Initialize the RecombinatorCrossoverSwap object.
RecombinatorSwap$new(keep_complement = TRUE)
keep_complement(logical(1))
Whether the operation should keep both resulting individuals (TRUE), or only the first and discard
the complement (FALSE). Default TRUE.
The $keep_complement field will reflect this value.
clone()The objects of this class are cloneable with this method.
RecombinatorSwap$clone(deep = FALSE)
deepWhether to make a deep clone.
Other recombinators:
OperatorCombination,
Recombinator,
RecombinatorPair,
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_xonary,
dict_recombinators_xounif
set.seed(1)
rs = rec("swap")
p = ps(x = p_int(-5, 5), y = p_dbl(-5, 5), z = p_dbl(-5, 5))
data = data.frame(x = 0:5, y = 0:5, z = 0:5)
rs$prime(p)
rs$operate(data)
rx = rec("cmpmaybe", rec("swap"), p = 0.5) # the same as 'rec("xounif")'
rx$prime(p)
rx$operate(data)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.