update and new stuffs
git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@203 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
ad029622a0
commit
8f5ccd0d12
9 changed files with 158 additions and 239 deletions
|
|
@ -13,6 +13,9 @@
|
|||
#ifndef MOEODETTOURNAMENTSELECT_H_
|
||||
#define MOEODETTOURNAMENTSELECT_H_
|
||||
|
||||
#include <moeoComparator.h>
|
||||
#include <moeoDiversityAssignment.h>
|
||||
#include <moeoFitnessAssignment.h>
|
||||
#include <moeoSelectOne.h>
|
||||
#include <moeoSelectors.h>
|
||||
|
||||
|
|
@ -20,7 +23,7 @@
|
|||
* Selection strategy that selects ONE individual by deterministic tournament.
|
||||
*/
|
||||
template < class MOEOT >
|
||||
class moeoDetTournamentSelect:public moeoSelectOne <MOEOT>
|
||||
class moeoDetTournamentSelect : public moeoSelectOne <MOEOT>
|
||||
{
|
||||
public:
|
||||
|
||||
|
|
@ -31,7 +34,7 @@ public:
|
|||
* @param _comparator the comparator (used to compare 2 individuals)
|
||||
* @param _tSize the number of individuals in the tournament (default: 2)
|
||||
*/
|
||||
moeoDetTournamentSelect (moeoFitnessAssignment < MOEOT > & _evalFitness, moeoDiversityAssignment < MOEOT > & _evalDiversity, moeoComparator < MOEOT > & _comparator, unsigned _tSize = 2) :
|
||||
moeoDetTournamentSelect(moeoFitnessAssignment < MOEOT > & _evalFitness, moeoDiversityAssignment < MOEOT > & _evalDiversity, moeoComparator < MOEOT > & _comparator, unsigned _tSize = 2) :
|
||||
evalFitness (_evalFitness), evalDiversity (_evalDiversity), comparator (_comparator), tSize (_tSize)
|
||||
{
|
||||
// consistency check
|
||||
|
|
@ -41,7 +44,7 @@ public:
|
|||
tSize = 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Ctor without comparator. A moeoFitnessThenDiversityComparator is used as default.
|
||||
|
|
@ -49,7 +52,7 @@ public:
|
|||
* @param _evalDiversity the diversity assignment strategy
|
||||
* @param _tSize the number of individuals in the tournament (default: 2)
|
||||
*/
|
||||
moeoDetTournamentSelect (moeoFitnessAssignment < MOEOT > &_evalFitness, moeoDiversityAssignment < MOEOT > &_evalDiversity, unsigned _tSize = 2) :
|
||||
moeoDetTournamentSelect (moeoFitnessAssignment < MOEOT > & _evalFitness, moeoDiversityAssignment < MOEOT > & _evalDiversity, unsigned _tSize = 2) :
|
||||
evalFitness (_evalFitness),evalDiversity(_evalDiversity),tSize(_tSize)
|
||||
{
|
||||
// a moeoFitThenDivComparator is used as default
|
||||
|
|
@ -113,12 +116,13 @@ public:
|
|||
* Evaluate the fitness and the diversity of each individual of the population _pop.
|
||||
* @param _pop the population
|
||||
*/
|
||||
void setup (eoPop<MOEOT>& _pop)
|
||||
//void setup (eoPop<MOEOT>& _pop)
|
||||
virtual void setup(const eoPop<MOEOT>& _pop)
|
||||
{
|
||||
// eval fitness
|
||||
evalFitness(_pop);
|
||||
//evalFitness(_pop);
|
||||
// eval diversity
|
||||
evalDiversity(_pop);
|
||||
//evalDiversity(_pop);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -126,7 +130,7 @@ public:
|
|||
* Apply the tournament to the given population
|
||||
* @param _pop the population
|
||||
*/
|
||||
const MOEOT & operator () (const eoPop < MOEOT > &_pop)
|
||||
const MOEOT & operator () (const eoPop < MOEOT > &_pop)
|
||||
{
|
||||
// use the selector
|
||||
return mo_deterministic_tournament(_pop,tSize,comparator);
|
||||
|
|
|
|||
Loading…
Reference in a new issue