dict_selectors_tournament {miesmuschel} | R Documentation |
Tournament Selector
Description
Selector
that repeatedly samples k
individuals and selects the best ouf of these.
Configuration Parameters
-
k
::integer(1)
Tournament size. Must be set by the user. -
choose_per_tournament
:: Number of individuals to choose in each tournament. Must be smaller thank
. The special value0
sets this to thegroup_size
hint given to the$operate()
-call (but at mostk
). This is equal ton_select
when used as survival-selector inmies_survival_plus()
/mies_survival_comma()
, and equal ton_indivs_in
of aRecombinator
used inmies_generate_offspring()
.
Initialized to 1. -
sample_unique
::character(1)
Whether to sample individuals globally unique ("global"
, selected individuals are removed from the population after each tournament), unique within groups ("groups"
, individuals are replaced whengroup_size
individuals were sampled), unique per tournament ("tournament"
, individuals are replaced after each tournament), or not unique at all ("no"
, individuals are sampled with replacement within tournaments). This is done with best effort; ifgroup_size
(whensample_unique
is"groups"
) orn_select
(whensample_unique
is"global"
) is greater thannrow(values)
, then the firstnrow(values) * floor(group_size / nrow(values))
ornrow(values) * floor(n_select / nrow(values))
individuals are chosen deterministically by selecting every individual with the same frequency, followed by tournament selection for the remaining required individuals. Initialized to"groups"
.
Supported Operand Types
Supported Domain
classes are: p_lgl
('ParamLgl'), p_int
('ParamInt'), p_dbl
('ParamDbl'), p_fct
('ParamFct')
Dictionary
This Selector
can be created with the short access form sel()
(sels()
to get a list), or through the the dictionary
dict_selectors
in the following way:
# preferred: sel("tournament") sels("tournament") # takes vector IDs, returns list of Selectors # long form: dict_selectors$get("tournament")
Super classes
miesmuschel::MiesOperator
-> miesmuschel::Selector
-> miesmuschel::SelectorScalar
-> SelectorTournament
Methods
Public methods
Inherited methods
Method new()
Initialize the SelectorTournament
object.
Usage
SelectorTournament$new(scalor = ScalorSingleObjective$new())
Arguments
scalor
(
Scalor
)
Scalor
to use to generate scalar values from multiple objectives, if multi-objective optimization is performed. Initialized toScalorSingleObjective
: Doing single-objective optimization normally, throwing an error if used in multi-objective setting: In that case, aScalor
needs to be explicitly chosen.
Method clone()
The objects of this class are cloneable with this method.
Usage
SelectorTournament$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.
See Also
Other selectors:
Selector
,
SelectorScalar
,
dict_selectors_best
,
dict_selectors_maybe
,
dict_selectors_null
,
dict_selectors_proxy
,
dict_selectors_random
,
dict_selectors_sequential
Examples
sb = sel("tournament", k = 4)
p = ps(x = p_dbl(-5, 5))
# dummy data; note that SelectorBest does not depend on data content
data = data.frame(x = rep(0, 7))
fitnesses = c(1, 5, 2, 3, 0, 4, 6)
sb$prime(p)
sb$operate(data, fitnesses, 2)
sb$operate(data, fitnesses, 4, group_size = 2)