template<class OBSERVATION_TYPE>
class PSOParticle< OBSERVATION_TYPE >
Definition at line 29 of file PSOParticle.h.
template<class OBSERVATION_TYPE >
template<class OBSERVATION_TYPE >
This constructor attempts to initialize the particle, see the init function for more info.
- Parameters
-
K | the size of the particle state Vector, must be greater than zero |
xMin | the minimum range of the x state Vector (i.e. the space that should be searched) |
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
-
rhs | another instance of the PSOParticle which will be copied to this instance |
Definition at line 55 of file PSOParticle.h.
template<class OBSERVATION_TYPE >
template<class OBSERVATION_TYPE >
virtual Float 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 | 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 >
Float PSOParticle< OBSERVATION_TYPE >::gauss |
( |
Float |
x, |
|
|
Float |
mu, |
|
|
Float |
sigma |
|
) |
| |
|
inline |
Gets the standard Gaussian Distrubution for x, given mu and sigma
- Parameters
-
x | the x parameter for the Gaussian distrubution |
mu | the mu parameter for the Gaussian distrubution |
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 >
Initializes the PSOParticle. The size of xMin and xMax must match K.
- Parameters
-
K | the size of the particle state Vector, must be greater than zero |
xMin | the minimum range of the x state Vector (i.e. the space that should be searched) |
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 >
Float PSOParticle< OBSERVATION_TYPE >::normal |
( |
Float |
x, |
|
|
Float |
mu, |
|
|
Float |
sigma |
|
) |
| |
|
inline |
Gets the Normal Gaussian Distrubution for x, given mu and sigma
- Parameters
-
x | the x parameter for the Gaussian distrubution |
mu | the mu parameter for the Gaussian distrubution |
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
-
rhs | another instance of the PSOParticle which will be copied to this instance |
Definition at line 69 of file PSOParticle.h.
template<class OBSERVATION_TYPE >
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
-
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 >
virtual bool PSOParticle< OBSERVATION_TYPE >::reset |
( |
| ) |
|
|
inlinevirtual |
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 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 >
Update the particle, using the globalBest state Vector across all particles.
- Parameters
-
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: