nojhan / paradiseo

An evolutionary computation framework to (automatically) build fast parallel stochastic optimization solvers
https://nojhan.github.io/paradiseo/
Other
92 stars 33 forks source link

[Feature] eoSGAVerbose class to print better EOT in each generation #41

Closed ropinho closed 5 years ago

ropinho commented 5 years ago

Added derived class: eoSGAVerbose

template <class EOT>
class eoSGAVerbose : protected eoSGA<EOT> { ... }

class derived from eoSGA class.

OBS: Attributtes access of the eoSGA class was been modified from private to protected.

The objective of the eoSGAVerbose class is provides an automatic visualization about fitter individuals in each generation of the genectic algorithm implemented in eoSGA.

An utility of these feature is the convergence verification.

Usage

It works exactly like the eoSGA, but increased of prints on console. Then: Suppose all objects was been instantiated. (select, crossover, ...)

typedef eoBit<float> Indi;
...
eoSGAVerbose<Indi> GA(select, crossover, CRATE, mutation, MRATE, eval, cont);
GA(population);
...

Output example for Individuals size = 16 and Number of generations = 40:

G1 --> 10  16 0100011110101111
G2 --> 11  16 0100011111101111
G3 --> 12  16 0110011110111111
G4 --> 12  16 0110001111111111
G5 --> 13  16 0110011111111111
G6 --> 13  16 0110011111111111
G7 --> 13  16 0110011111111111
G8 --> 13  16 0110011111111111
G9 --> 13  16 0110011111111111
G10 --> 14  16 0111011111111111
G11 --> 14  16 0111011111111111
G12 --> 14  16 0111011111111111
G13 --> 15  16 0111111111111111
G14 --> 15  16 0111111111111111
G15 --> 15  16 0111111111111111
G16 --> 15  16 0111111111111111
G17 --> 15  16 0111111111111111
G18 --> 16  16 1111111111111111
G19 --> 16  16 1111111111111111
G20 --> 16  16 1111111111111111
G21 --> 16  16 1111111111111111
G22 --> 16  16 1111111111111111
G23 --> 16  16 1111111111111111
G24 --> 16  16 1111111111111111
G25 --> 16  16 1111111111111111
G26 --> 16  16 1111111111111111
G27 --> 16  16 1111111111111111
G28 --> 16  16 1111111111111111
G29 --> 16  16 1111111111111111
G30 --> 16  16 1111111111111111

This feature aims to automatize the visualization of informations about generations.

nojhan commented 5 years ago

Thanks for this PR! Unfortunately, there is already a more powerful mechanism to achieve that is Paradiseo! Indeed, each algorithm use an eoContinue operator, called at each iteration as a stopping predicate. Using this interface, you can embbed an eoCheckPoint within an eoContinue, which will "do stuff" at every call. There i several implementations that can compute all kind of statistics on the population, print them on various stream (stdout, file, etc.) and that can be called at various time (each iteration, every n iterations, every m seconds, at system signal reception, etc.).

A good entry point in the documentation is the "Monitoring" group: http://paradiseo.gforge.inria.fr/addon/eo/doc/group___monitors.html

You can also have a look at examples by looking at "do/make" scripts https://github.com/nojhan/paradiseo/blob/master/eo/src/do/make_checkpoint.h that automagically add various monitors to an existing algorithm.

ropinho commented 5 years ago

Oh, thanks! :)

While I was using eoSGA I came across this question that brought me to this modification.

I've been thinking about a consensus between simplicity and freedom of implementation. eoSGA provides simplicity but doesn't allow us to implement GA internally (for this there are other features with a higher learning curve).

I've thinking a feature which i explain with details on Issue #42 .