Created
April 14, 2023 22:31
-
-
Save machkouroke/8abb87a4ecaad91b508c5173d58de43c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function survival(n_survivors::Int64, population::Vector{Chromosome})::Vector{Chromosome} | |
evaluations::Vector{Float64} = [fitness(x) for x in population] | |
indices_tries = sortperm(vec(evaluations), rev=true) | |
return population[indices_tries[1:n_survivors]] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment