get_Parents: Retrieve Selected Individuals as Parents

View source: R/terga2.lib.R

get_ParentsR Documentation

Retrieve Selected Individuals as Parents

Description

This function identifies and returns the indices of individuals in the population who are marked as selected, which can be used as parents in evolutionary processes.

Usage

get_Parents(pop)

Arguments

pop

A list representing the population, where each individual has a 'selected' attribute indicating if they are selected.

Details

The function uses 'populationGet_X' to retrieve individuals with the 'selected' attribute set to 'TRUE'. It returns the indices of these individuals, allowing them to be used as parents in subsequent evolutionary steps.

Value

A vector of indices corresponding to individuals in the population who are marked as selected.

Examples

## Not run: 
pop <- list(
  list(fit_ = 0.9, selected = TRUE),
  list(fit_ = 0.8, selected = FALSE),
  list(fit_ = 0.7, selected = TRUE)
)
parents <- get_Parents(pop)
print(parents) # Should return indices of selected individuals

## End(Not run)


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