EvolvingObjects
eoVectorParticle< FitT, PositionType, VelocityType > Class Template Reference

Main class for particle representation of particle swarm optimization. More...

#include <eoVectorParticle.h>

Inheritance diagram for eoVectorParticle< FitT, PositionType, VelocityType >:
PO< FitT > vector EO< FitT > eoObject eoPersistent eoPrintable

List of all members.

Public Types

typedef PositionType AtomType
typedef VelocityType ParticleVelocityType

Public Member Functions

 eoVectorParticle (unsigned _size=0, PositionType _position=PositionType(), VelocityType _velocity=VelocityType(), PositionType _bestPositions=PositionType())
 Default constructor.
void position (const std::vector< PositionType > &_v)
void resize (unsigned _size)
 Resize the tree vectors of the particle: positions, velocities and bestPositions.
void resizeBestPositions (unsigned _size)
 Resize the best positions.
void resizeVelocities (unsigned _size)
 Resize the velocities.
bool operator< (const eoVectorParticle< FitT, PositionType, VelocityType > &_eo) const
 to avoid conflicts between EA and PSO
virtual void printOn (std::ostream &os) const
 Print-on a vector-particle.

Public Attributes

std::vector< PositionType > bestPositions
std::vector< ParticleVelocityType > velocities

Detailed Description

template<class FitT, class PositionType, class VelocityType>
class eoVectorParticle< FitT, PositionType, VelocityType >

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

Definition at line 42 of file eoVectorParticle.h.


Constructor & Destructor Documentation

template<class FitT, class PositionType, class VelocityType>
eoVectorParticle< FitT, PositionType, VelocityType >::eoVectorParticle ( unsigned  _size = 0,
PositionType  _position = PositionType (),
VelocityType  _velocity = VelocityType (),
PositionType  _bestPositions = PositionType () 
) [inline]

Default constructor.

Parameters:
_sizeLength of the tree vectors (we expect the same size), default is 0
_position
_velocity
_bestPositions

Definition at line 73 of file eoVectorParticle.h.


Member Function Documentation

template<class FitT, class PositionType, class VelocityType>
void eoVectorParticle< FitT, PositionType, VelocityType >::resize ( unsigned  _size) [inline]

Resize the tree vectors of the particle: positions, velocities and bestPositions.

Parameters:
_sizeThe new size for positions, velocities and bestPositions

Definition at line 101 of file eoVectorParticle.h.

template<class FitT, class PositionType, class VelocityType>
void eoVectorParticle< FitT, PositionType, VelocityType >::resizeBestPositions ( unsigned  _size) [inline]

Resize the best positions.

Parameters:
_sizeThe new size for the best positions.

Definition at line 113 of file eoVectorParticle.h.

template<class FitT, class PositionType, class VelocityType>
void eoVectorParticle< FitT, PositionType, VelocityType >::resizeVelocities ( unsigned  _size) [inline]

Resize the velocities.

Parameters:
_sizeThe new size for the velocities.

Definition at line 123 of file eoVectorParticle.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Friends