CSMOn
Convergence Stabilization Modeling operating in Online mode
Public Member Functions
PSO Class Reference

Particle Swarm Optimization. More...

#include <PSO.hpp>

Inheritance diagram for PSO:
Inheritance graph
[legend]
Collaboration diagram for PSO:
Collaboration graph
[legend]

Public Member Functions

 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...
 

Detailed Description

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.

Constructor & Destructor Documentation

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
fitnessFunctionThe callback reference to the fitness function.
s1The lower bound of the search space.
s2The upper bound of the search space.
pThe number of particles.
nThe number of dimensions of the problem.
wThe acceleration coefficient. For linear decreasing weight, provide it in negative values
c1The cognitive knowledge rate.
c2The social knowledge rate.

Definition at line 45 of file PSO.cpp.

Member Function Documentation

int PSO::getBestPos ( double *  _x)
virtual

Get the best result obtained up to the moment (global best).

Parameters
_xA 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.

int PSO::getNEvals ( )
virtual

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.

void PSO::next ( int  M)
virtual

Obtain the next improvement.

Parameters
MThe 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: