selector_v2 | R Documentation |
This function randomly selects a specified number of individuals from a population without considering their fitness scores. It is a simple selection strategy that introduces diversity by choosing individuals at random.
selector_v2(pop, number, clf = NULL)
pop |
A list representing the population from which individuals are selected. |
number |
An integer specifying the number of individuals to select randomly from the population. |
clf |
An optional classifier object that can contain additional parameters for selection (not directly used in this function). |
The function selects 'number' individuals randomly from the population 'pop', without replacement. This approach does not prioritize fitness and can be useful for introducing genetic diversity in evolutionary algorithms.
A list of randomly selected individuals from the population.
## Not run:
pop <- list(
list(fit_ = 0.9, indices_ = 1:5),
list(fit_ = 0.8, indices_ = 6:10),
list(fit_ = 0.7, indices_ = 11:15)
)
selected_individuals <- selector_v2(pop, number = 2)
print(selected_individuals)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.