-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathpso.h
37 lines (29 loc) · 886 Bytes
/
pso.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#ifndef PSO_H
#define PSO_H
#include "LibSimulation/lsim.h"
class PSO
{
private:
bool MinMax;
int varNum, PopSize, GenSize;
double phi1, phi2, omega;
Matrix V, X, P, G, GGen, GnTimes, Xfitness, Pfitness, Gfitness, GfitnessGen, GfitnessnTime, dataIn, dataOut;
Matrix Evaluation(Matrix Matrix2Evaluate);
void ParticleUpdate();
void ParticleEvaluation();
void VelocityUpdate();
void initAlgorithm();
void FitnessUpdate();
void FitnessUpdateMin();
void FitnessUpdateMax();
public:
PSO();
PSO(int varNum, int PopSize, int GenSize);
PSO(int varNum, int PopSize, int GenSize, double phi1, double phi2);
PSO(int varNum, int PopSize, int GenSize, double phi1, double phi2, double omega, bool MinMax);
~PSO();
void Run();
void Run(int nTimes);
void setData(Matrix dataIn, Matrix dataOut);
};
#endif // PSO_H