selector_v2: Randomly Select Individuals from a Population

View source: R/terga2.lib.R

selector_v2R Documentation

Randomly Select Individuals from a Population

Description

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.

Usage

selector_v2(pop, number, clf = NULL)

Arguments

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).

Details

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.

Value

A list of randomly selected individuals from the population.

Examples

## 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)


predomics/predomicspkg documentation built on Dec. 11, 2024, 11:06 a.m.