|
bool | initialized |
|
unsigned int | K |
|
double | w |
|
double | c1 |
|
double | c2 |
|
double | localBestCost |
|
vector< double > | x |
|
vector< double > | v |
|
vector< double > | localBestX |
|
vector< double > | xMin |
|
vector< double > | xMax |
|
Random | random |
|
template<class OBSERVATION_TYPE>
class GRT::PSOParticle< OBSERVATION_TYPE >
Definition at line 29 of file PSOParticle.h.
template<class OBSERVATION_TYPE >
template<class OBSERVATION_TYPE >
GRT::PSOParticle< OBSERVATION_TYPE >::PSOParticle |
( |
const unsigned int |
K, |
|
|
const vector< double > & |
xMin, |
|
|
const vector< double > & |
xMax |
|
) |
| |
|
inline |
This constructor attempts to initialize the particle, see the init function for more info.
- Parameters
-
const | unsigned int K: the size of the particle state vector, must be greater than zero |
const | vector< double > &xMin: the minimum range of the x state vector (i.e. the space that should be searched) |
const | vector< double > &xMax: the maximum range of the x state vector (i.e. the space that should be searched) |
Definition at line 46 of file PSOParticle.h.
template<class OBSERVATION_TYPE >
Defines the copy constructor.
- Parameters
-
Definition at line 55 of file PSOParticle.h.
template<class OBSERVATION_TYPE >
template<class OBSERVATION_TYPE >
virtual double GRT::PSOParticle< OBSERVATION_TYPE >::evaluate |
( |
OBSERVATION_TYPE & |
observation | ) |
|
|
inlinevirtual |
This function is used to evaluate the fitness of each particle. This function uses the squared distance between the estimated state vector and the observation, the observation must therefore have a length of K.
For most cases, you will need to override this function and replace the evaluation code with your own.
- Parameters
-
OBSERVATION_TYPE | &observation: a reference to the latest observation |
- Returns
- returns the particles evaluation, -1 will be returned if the evaluation fails
Definition at line 191 of file PSOParticle.h.
template<class OBSERVATION_TYPE >
double GRT::PSOParticle< OBSERVATION_TYPE >::gauss |
( |
double |
x, |
|
|
double |
mu, |
|
|
double |
sigma |
|
) |
| |
|
inline |
Gets the standard Gaussian Distrubution for x, given mu and sigma
- Parameters
-
double | x: the x parameter for the Gaussian distrubution |
double | mu: the mu parameter for the Gaussian distrubution |
double | sigma: the sigma parameter for the Gaussian distrubution |
- Returns
- returns the likelihood of x, given mu and sigma
Definition at line 264 of file PSOParticle.h.
template<class OBSERVATION_TYPE >
virtual bool GRT::PSOParticle< OBSERVATION_TYPE >::init |
( |
const unsigned int |
K, |
|
|
const vector< double > & |
xMin, |
|
|
const vector< double > & |
xMax |
|
) |
| |
|
inlinevirtual |
Initializes the PSOParticle. The size of xMin and xMax must match K.
- Parameters
-
const | unsigned int K: the size of the particle state vector, must be greater than zero |
const | vector< double > &xMin: the minimum range of the x state vector (i.e. the space that should be searched) |
const | vector< double > &xMax: the maximum range of the x state vector (i.e. the space that should be searched) |
- Returns
- returns true if the particle was initialized, false otherwise
Definition at line 97 of file PSOParticle.h.
template<class OBSERVATION_TYPE >
double GRT::PSOParticle< OBSERVATION_TYPE >::normal |
( |
double |
x, |
|
|
double |
mu, |
|
|
double |
sigma |
|
) |
| |
|
inline |
Gets the Normal Gaussian Distrubution for x, given mu and sigma
- Parameters
-
double | x: the x parameter for the Gaussian distrubution |
double | mu: the mu parameter for the Gaussian distrubution |
double | sigma: the sigma parameter for the Gaussian distrubution |
- Returns
- returns the likelihood of x, given mu and sigma
Definition at line 252 of file PSOParticle.h.
template<class OBSERVATION_TYPE >
Defines the equals operator, copies the data from the right hand instance to this instance.
- Parameters
-
Definition at line 69 of file PSOParticle.h.
template<class OBSERVATION_TYPE >
virtual bool GRT::PSOParticle< OBSERVATION_TYPE >::propagate |
( |
const vector< double > & |
model | ) |
|
|
inlinevirtual |
Propogates the particle, using the model. The default model used here is Gaussian Noise, in that case the propagation model will be a K dimensional vector, with each of the k values represen representing sigma for each dimension (it is assumed mu = 0).
If you override this function then you can define your own model.
- Parameters
-
const | vector< double > &model: the propagation model, this should be a K*2 dimensional vector |
- Returns
- returns true if the particle was propagated, false otherwise
Definition at line 129 of file PSOParticle.h.
template<class OBSERVATION_TYPE >
Resets the particles state vector with random uniform noise.
- Returns
- returns true if the particle was reset, false otherwise
Definition at line 217 of file PSOParticle.h.
template<class OBSERVATION_TYPE >
bool GRT::PSOParticle< OBSERVATION_TYPE >::setRandomSeed |
( |
unsigned long long |
seed | ) |
|
|
inline |
Sets the particles random seed.
- Parameters
-
unsigned | long long seed: the new seed value |
- Returns
- returns true if the seed was set, false otherwise
Definition at line 239 of file PSOParticle.h.
template<class OBSERVATION_TYPE >
Gets the square of x.
- Parameters
-
double | x: the value you want to square |
- Returns
- returns the square of x
Definition at line 274 of file PSOParticle.h.
template<class OBSERVATION_TYPE >
virtual bool GRT::PSOParticle< OBSERVATION_TYPE >::update |
( |
const vector< double > & |
globalBestX | ) |
|
|
inlinevirtual |
Update the particle, using the globalBest state vector across all particles.
- Parameters
-
const | vector< double > &globalBestX: the globe best state vector across all particles |
- Returns
- returns true if the particle was updated, false otherwise
Definition at line 152 of file PSOParticle.h.
The documentation for this class was generated from the following file:
- /Users/ngillian/Documents/dev/libs/grt/GRT/CoreAlgorithms/ParticleSwarmOptimization/PSOParticle.h