def fitness_function(chromosome) do
chromosome
|> Enum.map(fn {roi, risk} -> 2 * roi - risk end)
|> Enum.sum()
end
should be:
def fitness_function(chromosome) do
chromosome.genes
|> Enum.map(fn {roi, risk} -> 2 * roi - risk end)
|> Enum.sum()
end