You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
here ga.run() run the iterations inside until the termination. But I want to take the iteration out of ga.run(). That means ga.run() only feedback the populations, fitnesses, and best for a generation. For instance, I would like the code like
for (int generation = 0; generation < maxGenerations; generation++)
{
ga.run(); //feedback the populations, fitnesses, and best for a generation
}
How can I do this?
Thanks!
The text was updated successfully, but these errors were encountered:
It's inside the run function:
// starting population evolution
for (nogen = 1; nogen <= nbgen; ++nogen) {
// evolving population
pop.evolution();
// getting best current result
bestResult = pop(0)->getTotal();
// outputting results
if (output) print();
// checking convergence
if (tolerance != 0.0) {
if (fabs(bestResult - prevBestResult) < fabs(tolerance)) {
break;
}
prevBestResult = bestResult;
}
}
hi,
// running genetic algorithm ga.run();
here
ga.run()
run the iterations inside until the termination. But I want to take the iteration out ofga.run()
. That meansga.run()
only feedback the populations, fitnesses, and best for a generation. For instance, I would like the code likeHow can I do this?
Thanks!
The text was updated successfully, but these errors were encountered: