paradiseo/deprecated/eo/tutorial/Lesson5/eoOneMaxInit.h
Adèle Harrissart 490e837f7a * 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) ***
2014-09-06 13:04:35 +02:00

62 lines
1.8 KiB
C++
Executable file

/** -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
The above line is usefulin Emacs-like editors
*/
/*
Template for EO objects initialization in EO
============================================
*/
#ifndef _eoOneMaxInit_h
#define _eoOneMaxInit_h
// include the base definition of eoInit
#include <eoInit.h>
/**
* Always write a comment in this format before class definition
* if you want the class to be documented by Doxygen
*
* There is NO ASSUMPTION on the class GenoypeT.
* In particular, it does not need to derive from EO (e.g. to initialize
* atoms of an eoVector you will need an eoInit<AtomType>)
*/
template <class GenotypeT>
class eoOneMaxInit: public eoInit<GenotypeT> {
public:
/// Ctor - no requirement
// START eventually add or modify the anyVariable argument
// eoOneMaxInit()
eoOneMaxInit( unsigned _vecSize) : vecSize(_vecSize)
// END eventually add or modify the anyVariable argument
{
// START Code of Ctor of an eoOneMaxInit object
// END Code of Ctor of an eoOneMaxInit object
}
/** initialize a genotype
*
* @param _genotype generally a genotype that has been default-constructed
* whatever it contains will be lost
*/
void operator()(GenotypeT & _genotype)
{
// START Code of random initialization of an eoOneMax object
vector<bool> b(vecSize);
for (unsigned i=0; i<vecSize; i++)
b[i]=rng.flip();
_genotype.setB(b);
// END Code of random initialization of an eoOneMax object
_genotype.invalidate(); // IMPORTANT in case the _genotype is old
}
private:
// START Private data of an eoOneMaxInit object
unsigned vecSize; // size of all bitstrings that this eoInit randomize
// varType anyVariable; // for example ...
// END Private data of an eoOneMaxInit object
};
#endif