added doc details to recognize particle swarm optimization
This commit is contained in:
parent
967b6b7741
commit
3adf8a19f4
20 changed files with 25 additions and 20 deletions
|
|
@ -30,7 +30,7 @@
|
||||||
#include <EO.h>
|
#include <EO.h>
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
/** PO inheriting from EO is specially designed for PSO particle.POs have got a fitness,
|
/** PO inheriting from EO is specially designed for particle swarm optimization particle.POs have got a fitness,
|
||||||
which at the same time needs to be only an object with the operation less than (<)
|
which at the same time needs to be only an object with the operation less than (<)
|
||||||
defined. A best fitness also belongs to the particle.Fitness says how
|
defined. A best fitness also belongs to the particle.Fitness says how
|
||||||
good is the particle for a current iteration whereas the best fitness can be saved for
|
good is the particle for a current iteration whereas the best fitness can be saved for
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** Abstract class for binary flight. Positions are updated but are expected to be binary.
|
/** Abstract class for binary flight of particle swarms. Positions are updated but are expected to be binary.
|
||||||
* A function must be used to decide, according to continuous velocities, of the
|
* A function must be used to decide, according to continuous velocities, of the
|
||||||
* new positions (0,1 ... ?)
|
* new positions (0,1 ... ?)
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@
|
||||||
#include <eoVectorParticle.h>
|
#include <eoVectorParticle.h>
|
||||||
|
|
||||||
|
|
||||||
/** eoBitParticle: Implementation of a bit-coded particle.
|
/** eoBitParticle: Implementation of a bit-coded particle (swarm optimization).
|
||||||
* Positions and best positions are 0 or 1 but the velocity is a vector of double.
|
* Positions and best positions are 0 or 1 but the velocity is a vector of double.
|
||||||
*/
|
*/
|
||||||
template < class FitT> class eoBitParticle: public eoVectorParticle<FitT,bool,double>
|
template < class FitT> class eoBitParticle: public eoVectorParticle<FitT,bool,double>
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** Inertia variable weighted based velocity performer + constriction. Derivated from abstract eoVelocity,
|
/** Inertia variable + constriction velocity for particle swarm optimization. Derivated from abstract eoVelocity,
|
||||||
* At step t: v(t+1)= K * ( w*v(t) + c1*r1* (xbest(t)-x(t)) + c2*r2* (gbest(t) - x(t)))
|
* At step t: v(t+1)= K * ( w*v(t) + c1*r1* (xbest(t)-x(t)) + c2*r2* (gbest(t) - x(t)))
|
||||||
* w is updated each time the velocity performer is called and K is fixed
|
* w is updated each time the velocity performer is called and K is fixed
|
||||||
* (ci given and Ri chosen at random in [0;1]).
|
* (ci given and Ri chosen at random in [0;1]).
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
/** Constricted velocity performer. Derivated from abstract eoVelocity,
|
/** Constricted velocity performer for particle swarm optimization. Derivated from abstract eoVelocity,
|
||||||
* At step t+1 : v(t+1)= C * [ v(t) + c1*r1 * (xbest(t)-x(t)) + c2*r2 * (gbest(t) - x(t)) ]
|
* At step t+1 : v(t+1)= C * [ v(t) + c1*r1 * (xbest(t)-x(t)) + c2*r2 * (gbest(t) - x(t)) ]
|
||||||
* C is fixed for all the particles and all the generations.
|
* C is fixed for all the particles and all the generations.
|
||||||
* Default C = 2 * k / abs(2 - P - sqrt (P*(P-4)))
|
* Default C = 2 * k / abs(2 - P - sqrt (P*(P-4)))
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@
|
||||||
#include <utils/eoRealVectorBounds.h>
|
#include <utils/eoRealVectorBounds.h>
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
/** Abstract class for PSO flight.
|
/** Abstract class for particle swarm optimization flight.
|
||||||
* All the flights must derivated from eoFlight.
|
* All the flights must derivated from eoFlight.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,8 @@
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update an inertia weight by assigning it a Gaussian randomized value.
|
* Update an inertia weight by assigning it a Gaussian randomized value
|
||||||
|
* (used for the velocity in particle swarm optimization).
|
||||||
*/
|
*/
|
||||||
class eoGaussRealWeightUp:public eoWeightUpdater<double>
|
class eoGaussRealWeightUp:public eoWeightUpdater<double>
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Linear (inertia) weight updater. Update a weight according to:
|
* Linear (inertia) weight updater for particle swarm optimization. Update a weight according to:
|
||||||
* w(t)=(w(0)-w(Nt))*(Nt -t)/Nt + w(Nt) where
|
* w(t)=(w(0)-w(Nt))*(Nt -t)/Nt + w(Nt) where
|
||||||
* t is the current generation/event
|
* t is the current generation/event
|
||||||
* Nt is the total number of generations/event
|
* Nt is the total number of generations/event
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* One of the local best strategies. Each particle has a fixed number of neighbours, ans
|
* One of the local best strategies for particle swarm optimization. Each particle has a fixed number of neighbours, ans
|
||||||
* the neighborhood is social.
|
* the neighborhood is social.
|
||||||
* The topology is never modified during the flight.
|
* The topology is never modified during the flight.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,9 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update an inertia weight by assigning it an (uniform) random value.
|
* Update an inertia weight by assigning it an (uniform) random value.
|
||||||
|
* The weight is a basic feature to evaluate the velocity of a particle in
|
||||||
|
* swarm optimization.
|
||||||
*/
|
*/
|
||||||
class eoRandomRealWeightUp:public eoWeightUpdater<double>
|
class eoRandomRealWeightUp:public eoWeightUpdater<double>
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,8 @@
|
||||||
#include <eoVectorParticle.h>
|
#include <eoVectorParticle.h>
|
||||||
|
|
||||||
|
|
||||||
/** eoRealParticle: Implementation of a real-coded particle. Positions, velocities and best positions are real-coded.
|
/** eoRealParticle: Implementation of a real-coded particle for
|
||||||
|
* particle swarm optimization. Positions, velocities and best positions are real-coded.
|
||||||
*/
|
*/
|
||||||
template < class FitT> class eoRealParticle: public eoVectorParticle<FitT,double,double>
|
template < class FitT> class eoRealParticle: public eoVectorParticle<FitT,double,double>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Binary flight based on the sigmoid function. Velocities are expected to be "double"
|
* Binary flight for particle swarm optimization based on the sigmoid function. Velocities are expected to be "double"
|
||||||
* Consider Pi to be the i-th position of a particle and Vi to be the i-th velocity of the same particle :
|
* Consider Pi to be the i-th position of a particle and Vi to be the i-th velocity of the same particle :
|
||||||
* if rand[0;1] < sig(Vi) (Vi <=> double)
|
* if rand[0;1] < sig(Vi) (Vi <=> double)
|
||||||
* Pi=1
|
* Pi=1
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** Standard PSO flight. Derivated from abstract eoFlight,
|
/** Standard flight for particle swarm optimization. Derivated from abstract eoFlight,
|
||||||
* just adds the velocities to the current position of the particle
|
* just adds the velocities to the current position of the particle
|
||||||
* and invalidates its fitness
|
* and invalidates its fitness
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
/** Standard PSO velocity performer. Derivated from abstract eoVelocity,
|
/** Standard velocity performer for particle swarm optimization. Derivated from abstract eoVelocity,
|
||||||
* At step t: v(t+1)= v(t) + c1*r1* ( xbest(t)-x(t) ) + c2*r2* ( gbest(t) - x(t) )
|
* At step t: v(t+1)= v(t) + c1*r1* ( xbest(t)-x(t) ) + c2*r2* ( gbest(t) - x(t) )
|
||||||
* (ci given and Ri chosen at random in [0;1]).
|
* (ci given and Ri chosen at random in [0;1]).
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Topology dedicated to "globest best" strategy.
|
* Topology dedicated to "globest best" strategy for particle swarm optimization.
|
||||||
* All the particles of the swarm belong to the same and only social neighborhood.
|
* All the particles of the swarm belong to the same and only social neighborhood.
|
||||||
* The global best is stored as a protected member and updated by using the "updateNeighborhood" method.
|
* The global best is stored as a protected member and updated by using the "updateNeighborhood" method.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** Inertia variable weighted based velocity performer. Derivated from abstract eoVelocity,
|
/** Inertia variable weight based velocity for particle swarm optimization. Derivated from abstract eoVelocity,
|
||||||
* At step t: v(t+1)= w*v(t) + c1*r1* ( xbest(t)-x(t) ) + c2*r2* ( gbest(t) - x(t) )
|
* At step t: v(t+1)= w*v(t) + c1*r1* ( xbest(t)-x(t) ) + c2*r2* ( gbest(t) - x(t) )
|
||||||
* w is updated each time the velocity performer is called.
|
* w is updated each time the velocity performer is called.
|
||||||
* (ci given and Ri chosen at random in [0;1]).
|
* (ci given and Ri chosen at random in [0;1]).
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@
|
||||||
#include <PO.h>
|
#include <PO.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Main class for particle representation. The positions, velocities and the best positions
|
* Main class for particle representation of particle swarm optimization. The positions, velocities and the best positions
|
||||||
* associated to the particle are stored as vectors. Inheriting from PO and std::vector,
|
* associated to the particle are stored as vectors. Inheriting from PO and std::vector,
|
||||||
* tree templates arguments are required: the fitness type (which is also the type of the
|
* tree templates arguments are required: the fitness type (which is also the type of the
|
||||||
* particle's best fitness), the position type and the velocity type.
|
* particle's best fitness), the position type and the velocity type.
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract class for PSO velocities calculation.
|
* Abstract class for velocities calculation (particle swarm optimization).
|
||||||
* All the velocities must derivated from eoVelocity.
|
* All the velocities must derivated from eoVelocity.
|
||||||
*/
|
*/
|
||||||
template < class POT > class eoVelocity:public eoBF < POT &,unsigned , void >
|
template < class POT > class eoVelocity:public eoBF < POT &,unsigned , void >
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@
|
||||||
#include <eoSTLFunctor.h>
|
#include <eoSTLFunctor.h>
|
||||||
#include <utils/eoRndGenerators.h>
|
#include <utils/eoRndGenerators.h>
|
||||||
|
|
||||||
/** Abstract class for PSO velocities initilization.*/
|
/** Abstract class for velocities initilization of particle swarm optimization.*/
|
||||||
template < class POT > class eoVelocityInit:public eoInit < POT >
|
template < class POT > class eoVelocityInit:public eoInit < POT >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,8 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract class for (inertia) weight updater. Used inside classes extending eoVelocity.
|
* Abstract class for (inertia) weight updater (particle swarm optimization).
|
||||||
|
* Used inside classes extending eoVelocity.
|
||||||
*/
|
*/
|
||||||
template < class WeightType > class eoWeightUpdater: public eoUF < WeightType &, void > {};
|
template < class WeightType > class eoWeightUpdater: public eoUF < WeightType &, void > {};
|
||||||
|
|
||||||
|
|
|
||||||
Reference in a new issue