passage du code dans astyle

git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1713 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
jhumeau 2010-03-24 10:25:33 +00:00
commit dd66b5e4bd
105 changed files with 3950 additions and 3924 deletions

View file

@ -13,21 +13,21 @@ class BitMove : public moMove <EOT> {
public :
typedef EOT EOType;
unsigned bit;
typedef EOT EOType;
BitMove() {
bit = 0;
}
unsigned bit;
BitMove(unsigned _bit) : bit(_bit) { }
BitMove() {
bit = 0;
}
BitMove(unsigned _bit) : bit(_bit) { }
void operator () (EOT & chrom)
{
chrom[bit] = !chrom[bit];
};
void operator () (EOT & chrom)
{
chrom[bit] = !chrom[bit];
};
} ;

View file

@ -11,17 +11,17 @@
template <class EOT>
class OneMaxIncrEval : public moMoveIncrEval < BitMove<EOT> > {
public :
OneMaxIncrEval(){ };
public :
OneMaxIncrEval() { };
typename EOT::Fitness operator () (const BitMove<EOT> & move, const EOT & chrom) {
if(chrom[move.bit]==0){
return chrom.fitness()+1;
}
else{
return chrom.fitness()-1;
}
};
typename EOT::Fitness operator () (const BitMove<EOT> & move, const EOT & chrom) {
if (chrom[move.bit]==0) {
return chrom.fitness()+1;
}
else {
return chrom.fitness()-1;
}
};
};
#endif

View file

@ -9,13 +9,13 @@
template <class EOT>
class BitMove_init : public moMoveInit < BitMove<EOT> > {
public :
void operator () (BitMove<EOT> & __move, const EOT & genome) {
__move.bit = 0 ;
};
void operator () (BitMove<EOT> & __move, const EOT & genome) {
__move.bit = 0 ;
};
} ;
#endif

View file

@ -10,24 +10,24 @@
template <class EOT>
class BitMove_next : public moNextMove < BitMove<EOT> > {
public:
BitMove_next()
{
};
BitMove_next()
{
};
bool operator () (BitMove<EOT> & __move, const EOT & genome) {
if (__move.bit >= (genome.size() - 1)) {
return false ;
}
else {
__move.bit++;
return true ;
}
};
bool operator () (BitMove<EOT> & __move, const EOT & genome) {
if (__move.bit >= (genome.size() - 1)){
return false ;
}
else {
__move.bit++;
return true ;
}
};
} ;
#endif

View file

@ -12,22 +12,22 @@ template< class EOT >
class FuncOneMax : public eoEvalFunc<EOT>
{
private:
unsigned N;
unsigned N;
public:
FuncOneMax(unsigned n) : N(n) {};
FuncOneMax(unsigned n) : N(n) {};
~FuncOneMax(void) {} ;
void operator() (EOT & genome) {
unsigned sum = 0;
~FuncOneMax(void) {} ;
for (int i = 0; i < N; i++)
sum += genome[i];
void operator() (EOT & genome) {
unsigned sum = 0;
for (int i = 0; i < N; i++)
sum += genome[i];
genome.fitness(sum);
}
genome.fitness(sum);
}
};
#endif

View file

@ -8,33 +8,33 @@
template< class EOT >
class FuncRoyalRoad : public eoEvalFunc<EOT>
{
// number of blocks
unsigned n;
// number of blocks
unsigned n;
// size of a block
unsigned k;
// size of a block
unsigned k;
public:
FuncRoyalRoad(unsigned _n, unsigned _k) : n(_n), k(_k) {};
FuncRoyalRoad(unsigned _n, unsigned _k) : n(_n), k(_k) {};
~FuncRoyalRoad(void) {} ;
virtual void operator() (EOT & _solution)
{
unsigned sum = 0;
unsigned i, j;
~FuncRoyalRoad(void) {} ;
for (i = 0; i < n; i++) {
j = 0;
while (_solution[i * n + j] && j < k) j++;
virtual void operator() (EOT & _solution)
{
unsigned sum = 0;
unsigned i, j;
if (j == k)
sum++;
}
for (i = 0; i < n; i++) {
j = 0;
while (_solution[i * n + j] && j < k) j++;
if (j == k)
sum++;
}
_solution.fitness(sum);
};
_solution.fitness(sum);
};
};
#endif

View file

@ -19,10 +19,10 @@ public:
* 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);
if (solution[bit] == 0)
fitness(solution.fitness() + 1);
else
fitness(solution.fitness() - 1);
};
};