This commit is contained in:
kuepper 2005-10-05 22:08:29 +00:00
commit 3428a464c1
3 changed files with 34 additions and 30 deletions

View file

@ -260,11 +260,11 @@
<ul> <ul>
<li><a href="http://www.cs.bham.ac.uk/Mirrors/ftp.de.uu.net/EC/clife/www/">The <li><a href="http://www.cs.bham.ac.uk/Mirrors/ftp.de.uu.net/EC/clife/www/">The
Hitch-Hiker's Guide to Evolutionary Computation</a>, FAQ for Hitch-Hiker's Guide to Evolutionary Computation</a>, FAQ for
<a href="news:comp.ai.genetic">comp.ai.genetic</a></li>. <a href="news:comp.ai.genetic">comp.ai.genetic</a>.</li>
<li><a href="http://en.wikipedia.org/wiki/Evolutionary_algorithm">Wikipedia</a> <li><a href="http://en.wikipedia.org/wiki/Evolutionary_algorithm">Wikipedia</a>
on Evolutionary algorithms</li>. on Evolutionary algorithms.</li>
<li>Charles Darwin: <a href="http://www.bbc.co.uk/education/darwin/origin/index.htm">The <li>Charles Darwin: <a href="http://www.bbc.co.uk/education/darwin/origin/index.htm">The
Origin of Species</a></li>.x Origin of Species</a>.</li>
</ul> </ul>
</td> </td>
</tr> </tr>

View file

@ -33,20 +33,24 @@
#include <eoTransform.h> #include <eoTransform.h>
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
/** /** Breeding: combination of selecting and transforming a population
eoBreed: breeding is thought of a combination of selecting and transforming
a population. For efficiency reasons you might want to build your own
eoBreed derived class rather than relying on a seperate select and transform
function.
@see eoSelect, eoTransform, eoSelectTransform Breeding is thought of a combination of selecting and transforming a
population. For efficiency reasons you might want to build your own
eoBreed derived class rather than relying on a seperate select and
transform function.
@see eoSelect, eoTransform, eoSelectTransform
*/ */
template<class EOT> template<class EOT>
class eoBreed : public eoBF<const eoPop<EOT>&, eoPop<EOT>&, void> class eoBreed : public eoBF<const eoPop<EOT>&, eoPop<EOT>&, void>
{}; {};
/**
eoSelectTransform: special breeder that is just an application of an embedded select,
/** Embedded select, followed by an embedded transform
Special breeder that is just an application of an embedded select,
followed by an embedded transform followed by an embedded transform
*/ */
template <class EOT> template <class EOT>

View file

@ -3,7 +3,7 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// eoEasyEA.h // eoEasyEA.h
// (c) GeNeura Team, 1998 // (c) GeNeura Team, 1998
/* /*
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
@ -47,9 +47,9 @@ template <class EOT> class eoDistEvalEasyEA ;
/** An easy-to-use evolutionary algorithm; you can use any chromosome, /** An easy-to-use evolutionary algorithm; you can use any chromosome,
and any selection transformation, merging and evaluation and any selection transformation, merging and evaluation
algorithms; you can even change in runtime parameters of those algorithms; you can even change in runtime parameters of those
sub-algorithms sub-algorithms
Change (MS, July 3. 2001): Change (MS, July 3. 2001):
Replaced the eoEvalFunc by an eoPopEvalFunc: this immediately Replaced the eoEvalFunc by an eoPopEvalFunc: this immediately
allows many useful constructs, such as co-evolution (e.g. game players), allows many useful constructs, such as co-evolution (e.g. game players),
parisian approach (the solution to the problem is the whole population) parisian approach (the solution to the problem is the whole population)
@ -68,8 +68,8 @@ public:
eoContinue<EOT>& _continuator, eoContinue<EOT>& _continuator,
eoEvalFunc<EOT>& _eval, eoEvalFunc<EOT>& _eval,
eoBreed<EOT>& _breed, eoBreed<EOT>& _breed,
eoReplacement<EOT>& _replace eoReplacement<EOT>& _replace
) : continuator(_continuator), ) : continuator(_continuator),
eval (_eval), eval (_eval),
loopEval(_eval), loopEval(_eval),
popEval(loopEval), popEval(loopEval),
@ -83,9 +83,9 @@ public:
eoEasyEA(eoContinue <EOT> & _continuator, eoEasyEA(eoContinue <EOT> & _continuator,
eoPopEvalFunc <EOT> & _pop_eval, eoPopEvalFunc <EOT> & _pop_eval,
eoBreed <EOT> & _breed, eoBreed <EOT> & _breed,
eoReplacement <EOT> & _replace eoReplacement <EOT> & _replace
) : ) :
continuator (_continuator), continuator (_continuator),
eval (dummyEval), eval (dummyEval),
loopEval(dummyEval), loopEval(dummyEval),
popEval (_pop_eval), popEval (_pop_eval),
@ -93,7 +93,7 @@ public:
breed (_breed), breed (_breed),
mergeReduce (dummyMerge, dummyReduce), mergeReduce (dummyMerge, dummyReduce),
replace (_replace) { replace (_replace) {
} }
*/ */
@ -102,9 +102,9 @@ public:
eoContinue<EOT>& _continuator, eoContinue<EOT>& _continuator,
eoPopEvalFunc<EOT>& _eval, eoPopEvalFunc<EOT>& _eval,
eoBreed<EOT>& _breed, eoBreed<EOT>& _breed,
eoReplacement<EOT>& _replace eoReplacement<EOT>& _replace
) : continuator(_continuator), ) : continuator(_continuator),
eval (dummyEval), eval (dummyEval),
loopEval(dummyEval), loopEval(dummyEval),
popEval(_eval), popEval(_eval),
selectTransform(dummySelect, dummyTransform), selectTransform(dummySelect, dummyTransform),
@ -136,7 +136,7 @@ public:
eoEvalFunc<EOT>& _eval, eoEvalFunc<EOT>& _eval,
eoSelect<EOT>& _select, eoSelect<EOT>& _select,
eoTransform<EOT>& _transform, eoTransform<EOT>& _transform,
eoReplacement<EOT>& _replace eoReplacement<EOT>& _replace
) : continuator(_continuator), ) : continuator(_continuator),
eval (_eval), eval (_eval),
loopEval(_eval), loopEval(_eval),
@ -171,13 +171,13 @@ public:
/// Apply a few generation of evolution to the population. /// Apply a few generation of evolution to the population.
virtual void operator()(eoPop<EOT>& _pop) virtual void operator()(eoPop<EOT>& _pop)
{ {
eoPop<EOT> offspring, empty_pop; eoPop<EOT> offspring, empty_pop;
popEval(empty_pop, _pop); // A first eval of pop. popEval(empty_pop, _pop); // A first eval of pop.
do do
{ {
try try
{ {
unsigned pSize = _pop.size(); unsigned pSize = _pop.size();
offspring.clear(); // new offspring offspring.clear(); // new offspring
breed(_pop, offspring); breed(_pop, offspring);
@ -202,7 +202,7 @@ public:
} }
protected : protected :
// If selectTransform needs not be used, dummySelect and dummyTransform are used // If selectTransform needs not be used, dummySelect and dummyTransform are used
// to instantiate it. // to instantiate it.
class eoDummySelect : public eoSelect<EOT> class eoDummySelect : public eoSelect<EOT>
@ -215,15 +215,15 @@ protected :
{public: void operator()(EOT &) {} } dummyEval; {public: void operator()(EOT &) {} } dummyEval;
eoContinue<EOT>& continuator; eoContinue<EOT>& continuator;
eoEvalFunc <EOT> & eval ; eoEvalFunc <EOT> & eval ;
eoPopLoopEval<EOT> loopEval; eoPopLoopEval<EOT> loopEval;
eoPopEvalFunc<EOT>& popEval; eoPopEvalFunc<EOT>& popEval;
eoSelectTransform<EOT> selectTransform; eoSelectTransform<EOT> selectTransform;
eoBreed<EOT>& breed; eoBreed<EOT>& breed;
// If mergeReduce needs not be used, dummyMerge and dummyReduce are used // If mergeReduce needs not be used, dummyMerge and dummyReduce are used
// to instantiate it. // to instantiate it.
eoNoElitism<EOT> dummyMerge; eoNoElitism<EOT> dummyMerge;
@ -231,7 +231,7 @@ protected :
eoMergeReduce<EOT> mergeReduce; eoMergeReduce<EOT> mergeReduce;
eoReplacement<EOT>& replace; eoReplacement<EOT>& replace;
// Friend classes // Friend classes
friend class eoIslandsEasyEA <EOT> ; friend class eoIslandsEasyEA <EOT> ;
friend class eoDistEvalEasyEA <EOT> ; friend class eoDistEvalEasyEA <EOT> ;