File indexing completed on 2025-01-18 10:04:15
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 Standard_Real* Position;
0027 Standard_Real* Velocity;
0028 Standard_Real* BestPosition;
0029 Standard_Real Distance;
0030 Standard_Real BestDistance;
0031
0032 PSO_Particle()
0033 {
0034 Distance = RealLast();
0035 BestDistance = RealLast();
0036 Position = 0;
0037 Velocity = 0;
0038 BestPosition = 0;
0039 }
0040
0041
0042 bool operator< (const PSO_Particle& thePnt) const
0043 {
0044 return Distance < thePnt.Distance;
0045 }
0046 };
0047
0048
0049
0050 class math_PSOParticlesPool
0051 {
0052 public:
0053
0054 Standard_EXPORT math_PSOParticlesPool(const Standard_Integer theParticlesCount,
0055 const Standard_Integer theDimensionCount);
0056
0057 Standard_EXPORT PSO_Particle* GetParticle(const Standard_Integer theIdx);
0058
0059 Standard_EXPORT PSO_Particle* GetBestParticle();
0060
0061 Standard_EXPORT PSO_Particle* GetWorstParticle();
0062
0063 Standard_EXPORT ~math_PSOParticlesPool();
0064
0065 private:
0066
0067 NCollection_Array1<PSO_Particle> myParticlesPool;
0068 NCollection_Array1<Standard_Real> myMemory;
0069 Standard_Integer myParticlesCount;
0070 Standard_Integer myDimensionCount;
0071 };
0072
0073 #endif