Using statistics with Paradiseo-EO

Introduction

This tutorial allows to learn how gains statistics for your programs with Paradiseo-EO.

This tutorial is inspired of the one available on the following page: http://eodev.sourceforge.net/eo/tutorial/html/eoLesson3.html

Modification of your code

If you have designed an EA with Paradiseo-EO, you have used an eoContinue object. For example:

eoGenContinue<MY_SOLUTION_REPRESENTATION> genCont(maxGen);

The first thing to do to use statistics is to declare an eoCheckPoint and add your old eoContinue in it because an eoCheckPoint is also a eoContinue. In our example:

eoCheckPoint<MY_SOLUTION_REPRESENTATION>checkpoint(genCont);

The statistics available with Paradiseo-EO are eoStat objects (see in the documentation the objects that herit from the eoStat object).

You need to add the eoStat objects you want to use in the checkpoint object. In our example, we want to save the fitness of the best individual at each generation:

eoBestFitnessStat<MY_SOLUTION_REPRESENTATION> bestStat;
checkpoint.add(bestStat);

To look and save the values of each of the activated statistic, you need to declare an eoMonitor object, to add the wanted eoStat objects in it and finally to add the eoMonitor object in the checkpoint.

If you want to:

  • see the statistics on the screen, use an eoStdoutMonitor.
  • save the statistics in a file, use an eoFileMonitor.
  • draw the statistics thanks to gnuplot during the program execution, use an eoGnuplot1DMonitor.

Of course, you can combine several monitors. In our example, we use 2 eoMonitors:

eoStdoutMonitor monitor(false);
monitor.add(bestStat);

eoFileMonitor fileMonitor("stats.xg", " ");
fileMonitor.add(bestStat);

checkpoint.add(monitor);
checkpoint.add(fileMonitor);

Finally, you give the eoCheckPoint object to the constructor of your algorithm. In our example:

eoEasyEA<MY_SOLUTION_REPRESENTATION> myEA(checkpoint, ...

Epilogue

Thanks to this tutorial, you can now easily use all the statistics you want for your programs, all the statistics available in Paradiseo-EO but also your own designed statistics.

Good luck.