Skip to content
Snippets Groups Projects
Commit f6f5d1e9 authored by Caron Olivier's avatar Caron Olivier
Browse files

add comments for web documentation

parent c8de579d
No related branches found
No related tags found
No related merge requests found
Pipeline #4521 failed
......@@ -86,6 +86,7 @@ namespace opt::manySolutions::geneticAlgorithm {
this->setSelection(*select);
}
// tag::algoNSGA2[]
/**
* The operator that runs the nsga-ii genetic algorithm
* @param POPULATION population
......@@ -95,20 +96,20 @@ namespace opt::manySolutions::geneticAlgorithm {
for (auto &i: sol) {
eval(i);
}
auto fronts = NSGA2_Solution<SOL>::fastNonDominatedSort(sol);
for (auto &f: fronts) NSGA2_Solution<SOL>::crowdingDistanceAssignment(sol, f);
auto fronts = NSGA2_Solution<SOL>::fastNonDominatedSort(sol); // <1>
for (auto &f: fronts) NSGA2_Solution<SOL>::crowdingDistanceAssignment(sol, f); // <2>
while (this->criterion->operator()()) {
this->numberOfGenerations++;
this->selection->operator()(sol);
this->selection->operator()(sol); // <3>
this->crossover->operator()(this->selection->getSelectedPopulation());
this->mutation->operator()(this->crossover->getOffspring());
this->replacement->operator()(sol, this->mutation->getOffspring());
this->replacement->operator()(sol, this->mutation->getOffspring()); // <4>
this->criterion->update();
this->checkpoint->operator()(sol);
}
}
// end::algoNSGA2[]
protected:
core::Eval<NSGA2SOL> &eval;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment