* 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:
Adèle Harrissart 2014-08-04 13:40:28 +02:00
commit 490e837f7a
2359 changed files with 7688 additions and 16329 deletions

80
test/eo/t-eoTwoOptMutation.cpp Executable file
View file

@ -0,0 +1,80 @@
//-----------------------------------------------------------------------------
// t-eoTwoOptMutation.cpp
//-----------------------------------------------------------------------------
#include <set>
#include <paradiseo/eo.h>
#include <paradiseo/eo/eoInt.h>
#include <paradiseo/eo/eoTwoOptMutation.h>
//-----------------------------------------------------------------------------
typedef eoInt<double> Chrom;
//-----------------------------------------------------------------------------
double real_value(const Chrom & _chrom)
{
double sum = 0;
for (unsigned i = 0; i < _chrom.size(); i++)
sum += _chrom[i];
return sum/_chrom.size();
}
//-----------------------------------------------------------------------------
// Return true if the given chromosome corresponds to a permutation
bool check_permutation(const Chrom& _chrom){
unsigned size= _chrom.size();
std::set<unsigned> verif;
for(unsigned i=0; i< size; i++){
if(verif.insert(_chrom[i]).second==false){
std::cout << " Error: Wrong permutation !" << std::endl;
std::string s;
s.append( " Wrong permutation in t-eoShiftMutation");
throw std::runtime_error( s );
return false;
}
}
return true;
}
int main()
{
const unsigned POP_SIZE = 3, CHROM_SIZE = 8;
unsigned i;
// a chromosome randomizer
eoInitPermutation <Chrom> random(CHROM_SIZE);
// the population:
eoPop<Chrom> pop;
// Evaluation
eoEvalFuncPtr<Chrom> eval( real_value );
for (i = 0; i < POP_SIZE; ++i)
{
Chrom chrom(CHROM_SIZE);
random(chrom);
eval(chrom);
pop.push_back(chrom);
}
// a twoOpt mutation
eoTwoOptMutation <Chrom> twoOpt;
for (i = 0; i < POP_SIZE; ++i)
{
std::cout << " Initial chromosome n°" << i << " : " << pop[i] << "..." << std::endl;
twoOpt(pop[i]);
std::cout << " ... becomes : " << pop[i] << " after twoOpt mutation" << std::endl;
check_permutation(pop[i]);
}
return 0;
}
//-----------------------------------------------------------------------------