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.
Value
The output expected should be a list of \(f(x)\) values calculated from individuals in the population.
Examples
# example of usage
population <- c(1, 3, 0)
# Evaluate fitness
genetic.algo.optimizeR::evaluate_fitness(population)
#> [1] 1 1 4