* New tree configuration of the project:
.../
... + -- EO
| |
| |
+-- src ----- + -- EDO
| |
| |
+-- test + -- MO
| |
| |
+-- tutorial + -- MOEO
| |
| |
+-- doc + -- SMP
| |
| |
... + -- EOMPI
|
|
+ -- EOSERIAL
Question for current maintainers: ./README: new release?
Also:
* Moving out eompi & eoserial modules (issue #2).
* Correction of the errors when executing "make doc" command.
* Adding a solution for the conflicting headers problem (see the two CMake Cache
Values: PROJECT_TAG & PROJECT_HRS_INSTALL_SUBPATH) (issue #1)
* Header inclusions:
** src: changing absolute paths into relative paths ('#include <...>' -> '#include "..."')
** test, tutorial: changing relative paths into absolute paths ('#include "..."' -> '#include <...>')
* Moving out some scripts from EDO -> to the root
* Add a new script for compilation and installation (see build_gcc_linux_install)
* Compilation with uBLAS library or EDO module: now ok
* Minor modifications on README & INSTALL files
* Comment eompi failed tests with no end
*** TODO: CPack (debian (DEB) & RedHat (RPM) packages) (issues #6 & #7) ***
This commit is contained in:
parent
515bd5943d
commit
490e837f7a
2359 changed files with 7688 additions and 16329 deletions
|
|
@ -1,117 +0,0 @@
|
|||
#include <eo>
|
||||
|
||||
// tests a Steady State GA
|
||||
|
||||
// Needed to define this breeder, maybe make it a breeder
|
||||
template <class EOT>
|
||||
class eoBreedOne : public eoBreed<EOT>
|
||||
{
|
||||
public :
|
||||
eoBreedOne(eoSelectOne<EOT>& _select, eoGenOp<EOT>& _op) : select(_select), op(_op) {}
|
||||
|
||||
void operator()(const eoPop<EOT>& _src, eoPop<EOT>& _dest)
|
||||
{
|
||||
_dest.clear();
|
||||
eoSelectivePopulator<EOT> pop(_src, _dest, select);
|
||||
op(pop);
|
||||
}
|
||||
|
||||
private :
|
||||
eoSelectOne<EOT>& select;
|
||||
eoGenOp<EOT>& op;
|
||||
};
|
||||
|
||||
typedef eoMinimizingFitness FitnessType;
|
||||
typedef eoVector<FitnessType, unsigned> EoType;
|
||||
|
||||
template <class EOT>
|
||||
class eoMyEval : public eoEvalFunc<EOT>
|
||||
{
|
||||
public :
|
||||
|
||||
void operator()(EOT& _eo)
|
||||
{
|
||||
_eo.fitness(*std::max_element(_eo.begin(), _eo.end()));
|
||||
}
|
||||
};
|
||||
|
||||
template <class EOT>
|
||||
class Xover : public eoBinOp<EOT>
|
||||
{
|
||||
bool operator()(EOT& _eo, const EOT& _eo2)
|
||||
{
|
||||
unsigned point = rng.random(_eo.size());
|
||||
std::copy(_eo2.begin() + point, _eo2.end(), _eo.begin() + point);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template <class EOT>
|
||||
class Mutate : public eoMonOp<EOT>
|
||||
{
|
||||
bool operator()(EOT& _eo)
|
||||
{
|
||||
unsigned point = rng.random(_eo.size());
|
||||
_eo[point] = rng.random(1024);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
int pop_size = 10;
|
||||
|
||||
eoGenContinue<EoType> cnt(10);
|
||||
eoCheckPoint<EoType> cp(cnt);
|
||||
|
||||
|
||||
Xover<EoType> xover;
|
||||
Mutate<EoType> mutate;
|
||||
|
||||
eoProportionalOp<EoType> opsel;
|
||||
|
||||
opsel.add(xover, 0.8);
|
||||
opsel.add(mutate, 0.2);
|
||||
|
||||
|
||||
eoDetTournamentSelect<EoType> selector(3);
|
||||
eoBreedOne<EoType> breed(selector, opsel);
|
||||
|
||||
// Replace a single one
|
||||
eoSSGAWorseReplacement<EoType> replace;
|
||||
|
||||
|
||||
// eoRandomSelect<EoType> selector;
|
||||
// eoGeneralBreeder<EoType> breed(selector, opsel);
|
||||
// eoPlusReplacement<EoType> replace;
|
||||
|
||||
|
||||
eoMyEval<EoType> eval;
|
||||
|
||||
eoEasyEA<EoType> algo(cp, eval, breed, replace);
|
||||
|
||||
eoUniformGenerator<unsigned> unif(0,1024);
|
||||
eoInitFixedLength<EoType> init(20, unif);
|
||||
|
||||
eoPop<EoType> pop(pop_size, init);
|
||||
|
||||
// evaluate
|
||||
apply<EoType>(eval, pop);
|
||||
|
||||
eoBestFitnessStat<EoType> best("Best_Fitness");
|
||||
eoAverageStat<EoType> avg("Avg_Fitness");
|
||||
eoStdoutMonitor mon;
|
||||
|
||||
cp.add(best);
|
||||
cp.add(avg);
|
||||
|
||||
// cp.add(mon);
|
||||
|
||||
mon.add(best);
|
||||
mon.add(avg);
|
||||
|
||||
// and run
|
||||
algo(pop);
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue