selectElite: Select Elite Individuals Based on Evaluation Scores

View source: R/terga1.lib.R

selectEliteR Documentation

Select Elite Individuals Based on Evaluation Scores

Description

This function selects the top-performing individuals from a population based on their evaluation scores. It returns the indices of the highest-scoring individuals, making up a specified percentage of the total population.

Usage

selectElite(evaluation, percentage)

Arguments

evaluation

A numeric vector of evaluation scores for each individual in the population. Higher scores indicate better performance.

percentage

A numeric value representing the percentage of the top individuals to select, specified as a value between 0 and 100.

Details

The function calculates the number of individuals to select based on the given 'percentage' and the length of 'evaluation'. It then sorts 'evaluation' in descending order and returns the indices of the top-performing individuals.

This selection method is often used to maintain high-quality solutions (elites) in evolutionary algorithms, ensuring that the best individuals are retained across generations.

Value

A vector of indices representing the top-performing individuals in the population.

Examples

## Not run: 
evaluation <- c(0.8, 0.6, 0.9, 0.7, 0.5)
elite_indices <- selectElite(evaluation, percentage = 40)
print(elite_indices)  # Returns indices of the top 40% based on evaluation scores

## End(Not run)


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