dict_selectors_best: Best Value Selector

dict_selectors_bestR Documentation

Best Value Selector

Description

Selector that selects the top n_select individuals based on the fitness value, breaking ties randomly. When n_select is larger than the number of individuals, the selection wraps around: All nrow(values) individuals are selected at least floor(nrow(values) / n_select) times, with the top nrow(values) %% n_select individuals being selected one more time.

Configuration Parameters

  • shuffle_selection :: logical(1)
    Whether to shuffle the selected output. When this is TRUE, selected individuals are returned in random order, so when this operator is e.g. used in mies_generate_offspring(), then subsequent recombination operators effectively operate on pairs (or larger groups) of random individuals. Otherwise they are returned in order, and recombination operates on the first batch of n_indivs_in returned individuals first, then the second batch etc. in order. Initialized to TRUE (recommended).

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("best")
sels("best")  # takes vector IDs, returns list of Selectors

# long form:
dict_selectors$get("best")

Super classes

miesmuschel::MiesOperator -> miesmuschel::Selector -> miesmuschel::SelectorScalar -> SelectorBest

Methods

Public methods

Inherited methods

Method new()

Initialize the SelectorBest object.

Usage
SelectorBest$new(scalor = ScalorSingleObjective$new())
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
SelectorBest$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

See Also

Other selectors: Selector, SelectorScalar, dict_selectors_maybe, dict_selectors_null, dict_selectors_proxy, dict_selectors_random, dict_selectors_sequential, dict_selectors_tournament

Examples

sb = sel("best")
p = ps(x = p_dbl(-5, 5))
# dummy data; note that SelectorBest does not depend on data content
data = data.frame(x = rep(0, 5))
fitnesses = c(1, 5, 2, 3, 0)

sb$prime(p)

sb$operate(data, fitnesses, 2)

sb$param_set$values$shuffle_selection = FALSE

sb$operate(data, fitnesses, 4)

miesmuschel documentation built on Sept. 11, 2024, 8:23 p.m.