t-eoPareto now plots the evolving population and t-eoRandom check is slightly more strict

This commit is contained in:
maartenkeijzer 2001-03-14 10:14:27 +00:00
commit fe89662e3c
3 changed files with 22 additions and 4 deletions

View file

@ -1,6 +1,9 @@
#include <eo>
//#include <utils/eoMOFitnessStat.h>
//#include <utils/eoFileSnapshot.h>
using namespace std;
typedef vector<double> fitness_type;
@ -43,7 +46,7 @@ class Init : public eoInit<eoDouble>
}
};
// Test pareto dominance and perf2worth
// Test pareto dominance and perf2worth, and while you're at it, test the eoGnuPlot monitor as well
void the_main()
{
@ -51,6 +54,7 @@ void the_main()
Eval eval;
Mutate mutate;
unsigned num_gen = 10;
unsigned pop_size = 50;
eoPop<eoDouble> pop(pop_size, init);
@ -80,9 +84,22 @@ void the_main()
eoCommaReplacement<eoDouble> replace;
unsigned long generation = 0;
eoGenContinue<eoDouble> gen(10, generation);
eoGenContinue<eoDouble> gen(num_gen, generation);
eoCheckPoint<eoDouble> cp(gen);
eoMOFitnessStat<eoDouble> fitness0(0, "FirstObjective");
eoMOFitnessStat<eoDouble> fitness1(1, "SecondObjective");
cp.add(fitness0);
cp.add(fitness1);
eoGnuplot1DSnapshot snapshot("pareto");
cp.add(snapshot);
snapshot.add(fitness0);
snapshot.add(fitness1);
// Three algos
eoEasyEA<eoDouble> ea1(cp, eval, breeder1, replace);
eoEasyEA<eoDouble> ea2(cp, eval, breeder2, replace);