paradiseo new mo added
git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1712 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
e2546ca8d5
commit
d7496cafff
116 changed files with 12034 additions and 0 deletions
38
trunk/paradiseo-mo/tutorial/oneMax/src/oneMaxBitNeighbor.h
Normal file
38
trunk/paradiseo-mo/tutorial/oneMax/src/oneMaxBitNeighbor.h
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
#ifndef _oneMaxBitNeighbor_h
|
||||
#define _oneMaxBitNeighbor_h
|
||||
|
||||
#include <neighborhood/moBitNeighbor.h>
|
||||
#include <ga.h>
|
||||
|
||||
/*
|
||||
contener of the neighbor information
|
||||
*/
|
||||
template< class Fitness >
|
||||
class OneMaxBitNeighbor : public moBitNeighbor<Fitness>
|
||||
{
|
||||
public:
|
||||
typedef eoBit<Fitness> EOType ;
|
||||
|
||||
using moBitNeighbor<Fitness>::bit ;
|
||||
|
||||
/*
|
||||
* incremental evaluation of the solution for the oneMax problem
|
||||
*/
|
||||
virtual void eval(EOType & solution) {
|
||||
if (solution[bit] == 0)
|
||||
fitness(solution.fitness() + 1);
|
||||
else
|
||||
fitness(solution.fitness() - 1);
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
// Local Variables:
|
||||
// coding: iso-8859-1
|
||||
// mode: C++
|
||||
// c-file-offsets: ((c . 0))
|
||||
// c-file-style: "Stroustrup"
|
||||
// fill-column: 80
|
||||
// End:
|
||||
Loading…
Add table
Add a link
Reference in a new issue