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 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 Operand Types

Supported Param classes are: ParamLgl, ParamInt, ParamDbl, 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")

Methods

Inherited methods


Method new()

Initialize the SelectorTournament object.

Usage

Arguments

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.


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.

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)
#> [1] 7 7

sb$operate(data, fitnesses, 4, group_size = 2)
#> [1] 7 6 2 7