19 #ifndef itkParticleSwarmOptimizerBase_h
20 #define itkParticleSwarmOptimizerBase_h
24 #include "ITKOptimizersExport.h"
70 using ParameterBoundsType = std::vector<std::pair<ParametersType::ValueType, ParametersType::ValueType>>;
94 itkSetMacro(InitializeNormalDistribution,
bool);
95 itkGetMacro(InitializeNormalDistribution,
bool);
96 itkBooleanMacro(InitializeNormalDistribution);
105 SetInitialSwarm(
const SwarmType & initialSwarm);
115 itkSetMacro(PrintSwarm,
bool);
116 itkGetMacro(PrintSwarm,
bool);
117 itkBooleanMacro(PrintSwarm);
122 StartOptimization()
override;
152 SetParameterBounds(std::pair<ParametersType::ValueType, ParametersType::ValueType> & bounds,
unsigned int n);
156 GetParameterBounds()
const;
172 itkSetMacro(FunctionConvergenceTolerance,
MeasureType);
173 itkGetMacro(FunctionConvergenceTolerance,
MeasureType);
178 SetParametersConvergenceTolerance(
ValueType convergenceTolerance,
unsigned int sz);
179 itkSetMacro(ParametersConvergenceTolerance, ParametersType);
180 itkGetMacro(ParametersConvergenceTolerance, ParametersType);
181 itkGetMacro(PercentageParticlesConverged,
double);
182 itkSetMacro(PercentageParticlesConverged,
double);
195 itkSetMacro(UseSeed,
bool);
196 itkGetMacro(UseSeed,
bool);
197 itkBooleanMacro(UseSeed);
208 GetStopConditionDescription()
const override;
215 PrintSwarm(std::ostream & os,
Indent indent)
const;
221 PrintSelf(std::ostream & os,
Indent indent)
const override;
223 PrintParamtersType(
const ParametersType & x, std::ostream & os)
const;
240 RandomInitialization();
242 FileInitialization();
245 std::ostringstream m_StopConditionDescription{};
246 bool m_InitializeNormalDistribution{};
251 ParametersType m_ParametersConvergenceTolerance{};
252 double m_PercentageParticlesConverged{};
254 std::vector<ParticleData> m_Particles{};
256 std::vector<MeasureType> m_FunctionBestValueMemory{};
257 ParametersType m_ParametersBestValue{};