Skip to content

Instantly share code, notes, and snippets.

@machkouroke
Created April 14, 2023 21:41
Show Gist options
  • Save machkouroke/b676cbdc5906dcbda6beacbb8ab84441 to your computer and use it in GitHub Desktop.
Save machkouroke/b676cbdc5906dcbda6beacbb8ab84441 to your computer and use it in GitHub Desktop.
function generate_solution(n::Int)::Chromosome
return [Queen(i, j) for (i, j) in enumerate(randperm(n))] |> Chromosome
end
function randpop(popsize::Int64, n::Int64)::Vector{Chromosome}
return [generate_solution(n) for _ in 1:popsize]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment