Particle Swarm Optimization.
More...
#include <PSO.hpp>
|
| PSO (callback_t fitnessFunction, double s1, double s2, int p, int n, double w, double c1, double c2) |
| A standard implementation of PSO. More...
|
|
void | startup () |
| Startup the PSO.
|
|
void | next (int M) |
| Obtain the next improvement. More...
|
|
int | getBestPos (double *_x) |
| Get the best result obtained up to the moment (global best). More...
|
|
int | getNEvals () |
| Get the number of fitness function evaluations performed up to the moment. More...
|
|
double | getFitness () |
| Get the best fitness value found up to the moment. More...
|
|
unsigned int | getRandomSeed () |
| Get a random number to be used as seed for the random number generator. More...
|
|
Particle Swarm Optimization.
- Date
- 04/Mar/2017
- Author
- Peter Frank Perroni (pfper.nosp@m.roni.nosp@m.@gmai.nosp@m.l.co.nosp@m.m)
Definition at line 53 of file PSO.hpp.
PSO::PSO |
( |
callback_t |
fitnessFunction, |
|
|
double |
s1, |
|
|
double |
s2, |
|
|
int |
p, |
|
|
int |
n, |
|
|
double |
w, |
|
|
double |
c1, |
|
|
double |
c2 |
|
) |
| |
A standard implementation of PSO.
- Parameters
-
fitnessFunction | The callback reference to the fitness function. |
s1 | The lower bound of the search space. |
s2 | The upper bound of the search space. |
p | The number of particles. |
n | The number of dimensions of the problem. |
w | The acceleration coefficient. For linear decreasing weight, provide it in negative values |
c1 | The cognitive knowledge rate. |
c2 | The social knowledge rate. |
Definition at line 45 of file PSO.cpp.
int PSO::getBestPos |
( |
double * |
_x | ) |
|
|
virtual |
Get the best result obtained up to the moment (global best).
- Parameters
-
_x | A pointer to store the positions of the global best. |
- Returns
- The index of the particle that found the global best position.
Implements ISearch.
Definition at line 160 of file PSO.cpp.
double PSO::getFitness |
( |
| ) |
|
|
virtual |
Get the best fitness value found up to the moment.
- Returns
- The best fitness value found.
Implements ISearch.
Definition at line 180 of file PSO.cpp.
Get the number of fitness function evaluations performed up to the moment.
- Returns
- The number of evaluations performed.
Implements ISearch.
Definition at line 170 of file PSO.cpp.
unsigned int PSO::getRandomSeed |
( |
| ) |
|
Get a random number to be used as seed for the random number generator.
This implementation can be adapted/changed as necessary.
- Returns
- A random seed.
Definition at line 191 of file PSO.cpp.
Obtain the next improvement.
- Parameters
-
M | The maximum number of evaluations allowed. |
Implements ISearch.
Definition at line 120 of file PSO.cpp.
The documentation for this class was generated from the following files: