File indexing completed on 2026-09-16 09:17:48
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #ifndef _math_PSOParticlesPool_HeaderFile
0017 #define _math_PSOParticlesPool_HeaderFile
0018
0019 #include <NCollection_Array1.hxx>
0020
0021
0022
0023
0024 struct PSO_Particle
0025 {
0026 double* Position;
0027 double* Velocity;
0028 double* BestPosition;
0029 double Distance;
0030 double BestDistance;
0031
0032 PSO_Particle()
0033 {
0034 Distance = RealLast();
0035 BestDistance = RealLast();
0036 Position = nullptr;
0037 Velocity = nullptr;
0038 BestPosition = nullptr;
0039 }
0040
0041
0042 bool operator<(const PSO_Particle& thePnt) const { return Distance < thePnt.Distance; }
0043 };
0044
0045
0046
0047 class math_PSOParticlesPool
0048 {
0049 public:
0050 Standard_EXPORT math_PSOParticlesPool(const int theParticlesCount, const int theDimensionCount);
0051
0052 Standard_EXPORT PSO_Particle* GetParticle(const int theIdx);
0053
0054 Standard_EXPORT PSO_Particle* GetBestParticle();
0055
0056 Standard_EXPORT PSO_Particle* GetWorstParticle();
0057
0058 Standard_EXPORT ~math_PSOParticlesPool();
0059
0060 private:
0061 NCollection_Array1<PSO_Particle> myParticlesPool;
0062 NCollection_Array1<double> myMemory;
0063 int myParticlesCount;
0064 int myDimensionCount;
0065 };
0066
0067 #endif