BinaryTournamentSelect.h

Go to the documentation of this file.
00001 #ifndef CBINARYTOURNAMENTSELECT_H_
00002 #define CBINARYTOURNAMENTSELECT_H_
00003 
00004 #include "GeneralSelect.h"
00005 #include "GeneralRNG.h"
00006 /** \addtogroup gainv Genetic algorithm optimization */
00007 /* @{ */
00008 
00009 //! Implements binary tournament selection for genetic algorithms
00010 class BinaryTournamentSelect: public GeneralSelect
00011 {
00012 private:
00013         //! The number of members that have been selected because of the crowding distance, purely for monitoring
00014         size_t distancecount;
00015         //! Storage for shuffled indices of the population, set up during DoInit and used to get pairs of member in DoGetOne 
00016         std::vector<unsigned int> PopulationIndex;
00017         //! Local storage for the probabilities of the population
00018         tprobabilityv localprobabilities;
00019         //! Local storage for the crowding distance
00020         tcrowddistv localdistances;
00021         //! The random number generator to shuffle the population
00022         GeneralRNG  &Random;
00023         //! Pointer to a function that returns the probabilities of the population
00024         tProbabilityFunction ProbabilityFunction;
00025         //! Pointer to a function that returns the crowding distances of the population
00026         tDistanceFunction DistanceFunction;
00027         //! The current index within the population
00028         int ReturnIndex;
00029         //! Initialize PopulationIndex and the local storage fields
00030         virtual void DoInit();
00031         //! Return the index to a population member
00032         virtual size_t DoGetOne();
00033 public: 
00034         //! The constructor requires a random number generator and access functions for probabilities and crowding distances
00035         BinaryTournamentSelect(GeneralRNG &LocalRandom, tProbabilityFunction myPF,tDistanceFunction myDF);
00036         virtual ~BinaryTournamentSelect();
00037 };
00038 /* @} */
00039 #endif /*CBINARYTOURNAMENTSELECT_H_*/

Generated on Fri Jul 4 15:30:20 2008 for GPLIB++ by  doxygen 1.5.5