tests/testthat/test-test_selection.R

test_that("selection selects correct number of individuals", {
    population <- c(1, 3, 0)
    fitness <- genetic.algo.optimizeR::evaluate_fitness(population)
    selected_parents <- genetic.algo.optimizeR::selection(population, fitness, num_parents = 2)
    expect_equal(length(selected_parents), 2)
})

Try the genetic.algo.optimizeR package in your browser

Any scripts or data that you put into this service are public.

genetic.algo.optimizeR documentation built on Oct. 10, 2024, 5:07 p.m.