[yul-phaser] Change the design of crossover operators so that they produce a single chromosome rather than a pair

This commit is contained in:
Kamil Śliwak
2020-03-09 13:21:48 +01:00
parent a3e97108c5
commit 763bdb1d51
6 changed files with 74 additions and 65 deletions
+2 -3
View File
@@ -108,12 +108,11 @@ Population Population::crossover(PairSelection const& _selection, function<Cross
vector<Individual> crossedIndividuals;
for (auto const& [i, j]: _selection.materialise(m_individuals.size()))
{
auto [childChromosome1, childChromosome2] = _crossover(
auto childChromosome = _crossover(
m_individuals[i].chromosome,
m_individuals[j].chromosome
);
crossedIndividuals.emplace_back(move(childChromosome1), *m_fitnessMetric);
crossedIndividuals.emplace_back(move(childChromosome2), *m_fitnessMetric);
crossedIndividuals.emplace_back(move(childChromosome), *m_fitnessMetric);
}
return Population(m_fitnessMetric, crossedIndividuals);