EvolvingObjects
|
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 (<) defined. More...
#include <PO.h>
Public Types | |
typedef PO< F >::Fitness | Fitness |
Public Member Functions | |
PO () | |
Default constructor. | |
Fitness | fitness () const |
Return fitness value. | |
void | fitness (const Fitness &_fitness) |
Set fitness. | |
Fitness | best () const |
Return the best fitness. | |
void | best (const Fitness &_bestFitness) |
Set the best fitness. | |
bool | invalid () const |
Return true If fitness value is invalid, false otherwise. | |
void | invalidate () |
Invalidate the fitness. | |
bool | invalidBest () const |
Return true If the best fitness value is invalid, false otherwise. | |
void | invalidateBest () |
Invalidate the best fitness. | |
virtual std::string | className () const |
Return the class id. | |
bool | operator< (const PO &_po2) const |
Returns true if. | |
bool | operator> (const PO &_po2) const |
virtual void | printOn (std::ostream &_os) const |
Write object. | |
virtual void | readFrom (std::istream &_is) |
Read object. | |
Private Attributes | |
Fitness | repFitness |
bool | invalidFitness |
Fitness | bestFitness |
bool | invalidBestFitness |
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 (<) 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 many iterations.
Return true If fitness value is invalid, false otherwise.
Reimplemented from EO< F >.
Definition at line 101 of file PO.h.
Referenced by PO< FitT >::best(), and PO< FitT >::fitness().
void PO< F >::invalidate | ( | ) | [inline] |
bool PO< F >::invalidBest | ( | ) | const [inline] |
void PO< F >::invalidateBest | ( | ) | [inline] |
Return the class id.
Reimplemented from EO< F >.
Reimplemented in eoBitParticle< FitT >, and eoRealParticle< FitT >.
Write object.
Called printOn since it prints the object _on_ a stream.
_os | A std::ostream. |
Reimplemented from EO< F >.
Reimplemented in eoVectorParticle< FitT, PositionType, VelocityType >, eoVectorParticle< FitT, double, double >, and eoVectorParticle< FitT, bool, double >.
Read object.
\ Calls base class, just in case that one had something to do. The read and print methods should be compatible and have the same format. In principle, format is "plain": they just print a number
_is | a std::istream. |
runtime_std::exception | If a valid object can't be read. |
Reimplemented from EO< F >.