Skip to contents

The function described below applies this equation: $$f(x) = x^2 - 4x + 4$$ It assesses every individual \(x\) of a given population, to then provide an overview of how that population fits the equation.

Usage

evaluate_fitness(population)

Arguments

population

The list of individuals of the population.

Value

The output expected should be a list of \(f(x)\) values calculated from individuals in the population.

Author

Dany Mukesha

Examples

# example of usage
population <- c(1, 3, 0)
# Evaluate fitness
genetic.algo.optimizeR::evaluate_fitness(population)
#> [1] 1 1 4