MTK++ Latest version: 0.2.0

gaPopulation.h
Go to the documentation of this file.
00001 
00033 #ifndef GAPOPULATION_H
00034 #define GAPOPULATION_H
00035 
00036 #include <iostream>
00037 #include <string>
00038 #include <vector>
00039 #include <list>
00040 #include <algorithm>
00041 #include <sstream>
00042 
00043 #include "Utils/constants.h"
00044 
00045 namespace MTKpp
00046 {
00047 
00048 class gaRegion;
00049 class gaIndividual;
00050 
00051 // ============================================================
00052 // Class : gaPopulation()
00053 // ------------------------------------------------------------
00061 // ============================================================
00062 
00063 class gaPopulation
00064 {
00065 public:
00066 
00071     gaPopulation(gaRegion *parent = 0);
00072 
00074     virtual ~gaPopulation();
00075 
00080     gaIndividual* addIndividual();
00081 
00087     gaIndividual* addIndividual(gaIndividual* ind);
00088 
00094     void delIndividual(gaIndividual* ind);
00095 
00103     gaIndividual* getIndividual(int number, bool id, bool index);
00104 
00110     gaIndividual* getIndividual(std::string name);
00111 
00116     std::vector<gaIndividual*> getIndividuals();
00117 
00122     gaIndividual* getLastAdded();
00123 
00128     void setup(const int& maxInds);
00129 
00133     void initialize();
00134 
00138     void getAbsValues();
00139 
00143     void rank();
00144 
00145     //-------------//
00146     // - get/set - //
00147     //-------------//
00148 
00153     void setId(int id);
00154 
00159     int getId();
00160 
00165     void setName(std::string name);
00166 
00171     std::string getName();
00172 
00177     gaRegion* getParent();
00178 
00183     int getNumIndividuals();
00184 
00190     gaIndividual* getBestIndividual(int &i);
00191 
00192 protected:
00193 
00195     typedef std::vector<gaIndividual*>::iterator individualIterator;
00196 
00198     std::vector<gaIndividual*>    itsIndividualList;
00199 
00201     gaRegion*                     pParent;
00202 
00204     gaIndividual*                 pGaIndividual;
00205 
00207     gaIndividual*                 bestIndividual;
00208 
00210     int                           itsId;
00211 
00213     std::string                   itsName;
00214 
00215 };
00216 
00217 } // MTKpp namespace
00218 
00219 #endif // GAPOPULATION_H

Generated on Fri Dec 23 2011 09:28:50 for MTK++ by Doxygen 1.7.5.1