dict_selectors_tournament | R Documentation |
Selector
that repeatedly samples k
individuals and selects the best ouf of these.
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 than k
. The special value 0
sets this to the group_size
hint given to the $operate()
-call (but at most k
). This is equal to n_select
when used as survival-selector in mies_survival_plus()
/mies_survival_comma()
,
and equal to n_indivs_in
of a Recombinator
used in mies_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 when group_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; if group_size
(when sample_unique
is "groups"
) or n_select
(when sample_unique
is "global"
)
is greater than nrow(values)
, then the first nrow(values) * floor(group_size / nrow(values))
or nrow(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 Domain
classes are: p_lgl
('ParamLgl'), p_int
('ParamInt'), p_dbl
('ParamDbl'), p_fct
('ParamFct')
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")
miesmuschel::MiesOperator
-> miesmuschel::Selector
-> miesmuschel::SelectorScalar
-> SelectorTournament
new()
Initialize the SelectorTournament
object.
SelectorTournament$new(scalor = ScalorSingleObjective$new())
scalor
(Scalor
)
Scalor
to use to generate scalar values from multiple objectives, if multi-objective optimization is performed.
Initialized to ScalorSingleObjective
: Doing single-objective optimization normally, throwing an error if used
in multi-objective setting: In that case, a Scalor
needs to be explicitly chosen.
clone()
The objects of this class are cloneable with this method.
SelectorTournament$clone(deep = FALSE)
deep
Whether to make a deep clone.
Other selectors:
Selector
,
SelectorScalar
,
dict_selectors_best
,
dict_selectors_maybe
,
dict_selectors_null
,
dict_selectors_proxy
,
dict_selectors_random
,
dict_selectors_sequential
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.