00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef __freESPopulation_h
00023 #define __freESPopulation_h
00024
00025 #include "itkVectorContainer.h"
00026
00027 namespace FREE
00028 {
00029 namespace ES
00030 {
00034 template <class TIndividual>
00035 class ITK_EXPORT Population :
00036 public itk::VectorContainer<unsigned long, typename TIndividual::Pointer>
00037 {
00038 public:
00039
00040 typedef Population<TIndividual> Self;
00041 typedef itk::VectorContainer<unsigned long, typename TIndividual::Pointer> Superclass;
00042 typedef itk::SmartPointer<Self> Pointer;
00043 typedef itk::SmartPointer<const Self> ConstPointer;
00044
00045
00046 itkNewMacro(Self);
00047
00048
00049 itkTypeMacro(Population, VectorContainer);
00050
00051
00052 typedef TIndividual IndividualType;
00053 typedef typename IndividualType::Pointer IndividualPointer;
00054 typedef typename Superclass::ElementIdentifier ElementIdentifier;
00055 typedef unsigned long GenerationIDType;
00056 typedef unsigned long IndividualIDType;
00057
00058 typedef typename IndividualType::StrategicParametersType StrategicParametersType;
00059
00060 GenerationIDType GetGenerationID() const {return m_GenerationID;};
00061 void SetGenerationID(GenerationIDType id) {m_GenerationID = id;};
00062
00063
00064 IndividualIDType GenerateUniqueIndividualID() {return m_UniqueID++;} ;
00065
00066 IndividualIDType GetLastUniqueIndividualID() const {return m_UniqueID;} ;
00067
00068 IndividualType* GetIndividualByUniqueID(IndividualIDType iID);
00069
00073 itkSetObjectMacro(BestIndividualEver, IndividualType);
00076 itkGetConstObjectMacro(BestIndividualEver, IndividualType);
00077 itkGetObjectMacro(BestIndividualEver, IndividualType);
00078
00082 itkSetObjectMacro(BestIndividual, IndividualType);
00085 itkGetConstObjectMacro(BestIndividual, IndividualType);
00086 itkGetObjectMacro(BestIndividual, IndividualType);
00087
00088 const StrategicParametersType& StrategicParameters() const
00089 {
00090 return *(m_StrategicParameters.GetPointer());
00091 };
00092
00093 StrategicParametersType& StrategicParameters()
00094 {
00095 return *(m_StrategicParameters.GetPointer());
00096 };
00097
00098 virtual Pointer Clone() const;
00099
00100 protected:
00103 Population();
00104 virtual ~Population(){}
00105
00106 GenerationIDType m_GenerationID;
00107 IndividualIDType m_UniqueID;
00108
00110 typename StrategicParametersType::Pointer m_StrategicParameters;
00111
00114 IndividualPointer m_BestIndividualEver;
00115
00118 IndividualPointer m_BestIndividual;
00119
00120 virtual void PrintSelf(std::ostream& os, itk::Indent indent) const;
00121
00122 void operator=(Self const& population);
00123
00124 private:
00125 Population(Self const&);
00126 };
00127
00128 }
00129 }
00130
00131 #ifndef ITK_MANUAL_INSTANTIATION
00132 #include "freESPopulation.txx"
00133 #endif
00134
00135 #endif // __freESPopulations_h