added test for printing population
This commit is contained in:
parent
b5bbc72957
commit
a1508b75a2
1 changed files with 4 additions and 2 deletions
|
|
@ -156,13 +156,15 @@ void main_function()
|
||||||
|
|
||||||
eoInitFixedLength<Chrom> init(16, gen);
|
eoInitFixedLength<Chrom> init(16, gen);
|
||||||
eoPop<Chrom> pop(100, init);
|
eoPop<Chrom> pop(100, init);
|
||||||
|
|
||||||
apply<Chrom>(eval, pop);
|
apply<Chrom>(eval, pop);
|
||||||
|
|
||||||
sga(pop);
|
sga(pop);
|
||||||
|
|
||||||
pop.sort();
|
pop.sort();
|
||||||
|
|
||||||
|
cout << "Population " << pop << endl;
|
||||||
|
|
||||||
cout << "\nBest: " << pop[0].fitness() << '\n';
|
cout << "\nBest: " << pop[0].fitness() << '\n';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
Reference in a new issue