Skip to content

Instantly share code, notes, and snippets.

@machkouroke
Created April 14, 2023 21:55
Show Gist options
  • Save machkouroke/9f376a1691bf2ca5692a0af54057c827 to your computer and use it in GitHub Desktop.
Save machkouroke/9f376a1691bf2ca5692a0af54057c827 to your computer and use it in GitHub Desktop.
function make_mates(population::Vector{Chromosome}, n_parents::Int64, n_mates::Int64; method::String="random")::Tuple
mates::Tuple = ()
for _ in 1:n_mates
indices::Vector{Int64} = select(size(population)[1], n_parents, population; method=method)
mates = (mates..., (population[indices[1]], population[indices[2]]))
end
return mates
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment