Create more doxygen groups for base classes, clean some doc
This commit is contained in:
parent
2670bd857f
commit
044d1223bb
14 changed files with 114 additions and 41 deletions
29
eo/src/EO.h
29
eo/src/EO.h
|
|
@ -31,15 +31,30 @@
|
||||||
#include <eoObject.h> // eoObject
|
#include <eoObject.h> // eoObject
|
||||||
#include <eoPersistent.h> // eoPersistent
|
#include <eoPersistent.h> // eoPersistent
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
/**
|
||||||
/** EO is a base class for evolvable objects, that is, the subjects of
|
@defgroup Core Core components
|
||||||
|
|
||||||
|
This are the base classes from which useful objects inherits.
|
||||||
|
|
||||||
|
@{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** EO is the base class for objects with a fitness.
|
||||||
|
|
||||||
|
Those evolvable objects are the subjects of
|
||||||
evolution. EOs have only got a fitness, which at the same time needs to be
|
evolution. EOs have only got a fitness, which at the same time needs to be
|
||||||
only an object with the operation less than (<) defined. Fitness says how
|
only an object with the operation less than (<) defined. Fitness says how
|
||||||
good is the object; evolution or change of these objects is left to the
|
good is the object; evolution or change of these objects is left to the
|
||||||
genetic operators. A fitness less than another means a worse fitness, in
|
genetic operators.
|
||||||
|
|
||||||
|
A fitness less than another means a worse fitness, in
|
||||||
whatever the context; thus, fitness is always maximized; although it can
|
whatever the context; thus, fitness is always maximized; although it can
|
||||||
be minimized with a proper definition of the < operator. The fitness
|
be minimized with a proper definition of the < operator.
|
||||||
object must have, besides an void ctor, a copy ctor.
|
|
||||||
|
A fitness can be invalid if undefined, trying to read an invalid fitness will raise an error.
|
||||||
|
@ref Operators that effectively modify EO objects must invalidate them.
|
||||||
|
|
||||||
|
The fitness object must have, besides an void ctor, a copy ctor.
|
||||||
*/
|
*/
|
||||||
template<class F = double> class EO: public eoObject, public eoPersistent
|
template<class F = double> class EO: public eoObject, public eoPersistent
|
||||||
{
|
{
|
||||||
|
|
@ -150,6 +165,8 @@ private:
|
||||||
bool invalidFitness; // true if the value of fitness is invalid
|
bool invalidFitness; // true if the value of fitness is invalid
|
||||||
};
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/** @} */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,9 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Combined INIT: a proportional recombination of eoInit objects
|
Combined INIT: a proportional recombination of eoInit objects
|
||||||
*/
|
|
||||||
|
|
||||||
|
@ingroup Initializators
|
||||||
|
*/
|
||||||
template< class EOT>
|
template< class EOT>
|
||||||
class eoCombinedInit: public eoInit<EOT> {
|
class eoCombinedInit: public eoInit<EOT> {
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,14 @@
|
||||||
#include <utils/eoRndGenerators.h>
|
#include <utils/eoRndGenerators.h>
|
||||||
#include <utils/rnd_generators.h> // for shuffle method
|
#include <utils/rnd_generators.h> // for shuffle method
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@defgroup Initializators Initialization operators
|
||||||
|
@ingroup Operators
|
||||||
|
|
||||||
|
Initializators are operators that creates initial individuals and populations.
|
||||||
|
*/
|
||||||
|
/** @{*/
|
||||||
/**
|
/**
|
||||||
Base (name) class for Initialization of chromosomes, used in a population
|
Base (name) class for Initialization of chromosomes, used in a population
|
||||||
contructor. It is derived from eoMonOp, so it can be used
|
contructor. It is derived from eoMonOp, so it can be used
|
||||||
|
|
@ -41,7 +49,6 @@
|
||||||
|
|
||||||
@see eoPop
|
@see eoPop
|
||||||
*/
|
*/
|
||||||
|
|
||||||
template <class EOT>
|
template <class EOT>
|
||||||
class eoInit : public eoUF<EOT&, void>
|
class eoInit : public eoUF<EOT&, void>
|
||||||
{
|
{
|
||||||
|
|
@ -202,3 +209,4 @@ class eoInitAdaptor : public eoMonOp<EOT>
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
/** @}*/
|
||||||
|
|
|
||||||
|
|
@ -33,8 +33,13 @@
|
||||||
#include <eoParticleBestInit.h>
|
#include <eoParticleBestInit.h>
|
||||||
#include <eoTopology.h>
|
#include <eoTopology.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
@addtogroup Initializators
|
||||||
|
@{
|
||||||
|
*/
|
||||||
|
|
||||||
/*
|
|
||||||
|
/**
|
||||||
* Abstract class for initialization of algorithm PSO
|
* Abstract class for initialization of algorithm PSO
|
||||||
*/
|
*/
|
||||||
template <class POT> class eoInitializerBase : public eoFunctorBase
|
template <class POT> class eoInitializerBase : public eoFunctorBase
|
||||||
|
|
@ -137,5 +142,5 @@ class eoDummy : public eoUF<POT&, void>
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/** @} */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,16 +33,16 @@
|
||||||
|
|
||||||
#include <utils/compatibility.h>
|
#include <utils/compatibility.h>
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
/*
|
||||||
// eoObject
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
eoObject used to be the base class for the whole hierarchy, but this has
|
eoObject used to be the base class for the whole hierarchy, but this has
|
||||||
changed. eoObject is used to define a name (#className#)
|
changed. eoObject is used to define a name (#className#)
|
||||||
that is used when loading or saving the state.
|
that is used when loading or saving the state.
|
||||||
|
|
||||||
Previously, this object also defined a print and read
|
Previously, this object also defined a print and read
|
||||||
interface, but it´s been moved to eoPrintable and eoPersistent.
|
interface, but it´s been moved to eoPrintable and eoPersistent.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** Defines a name (#className#), used when loading or saving a state.
|
||||||
|
|
||||||
It is recommended that you only derive from eoObject in concrete classes.
|
It is recommended that you only derive from eoObject in concrete classes.
|
||||||
Some parts of EO do not implement this yet, but that will change in the future.
|
Some parts of EO do not implement this yet, but that will change in the future.
|
||||||
|
|
@ -51,6 +51,7 @@ framework that is only needed when the classes have state that changes at runtim
|
||||||
|
|
||||||
@see eoPersistent eoPrintable, eoState
|
@see eoPersistent eoPrintable, eoState
|
||||||
|
|
||||||
|
@ingroup Core
|
||||||
*/
|
*/
|
||||||
class eoObject
|
class eoObject
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -30,14 +30,13 @@
|
||||||
#include <eoFunctor.h>
|
#include <eoFunctor.h>
|
||||||
#include <utils/eoRNG.h>
|
#include <utils/eoRNG.h>
|
||||||
/**
|
/**
|
||||||
\defgroup Operators
|
@defgroup Operators Operators
|
||||||
Genetic Operators are used for various purposes
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @name Genetic operators
|
in EO, an operator is any functors that modifies objects and inherits from an eoOp.
|
||||||
|
|
||||||
What is a genetic algorithm without genetic operators?
|
Typically, a mutation is an operator that modifies an individual, and an algorithm is an operator that modifies a population.
|
||||||
There is a genetic operator hierarchy, with eoOp as father and
|
|
||||||
|
In EO, there is a genetic operator hierarchy, with eoOp as father and
|
||||||
eoMonOp (monary or unary operator), eoBinOp and eoQuadOp (binary operators)
|
eoMonOp (monary or unary operator), eoBinOp and eoQuadOp (binary operators)
|
||||||
and eoGenOp (any number of inputs and outputs, see eoGenOp.h)
|
and eoGenOp (any number of inputs and outputs, see eoGenOp.h)
|
||||||
as subclasses.
|
as subclasses.
|
||||||
|
|
@ -53,9 +52,19 @@ how to build them from a description in a file.
|
||||||
@version 0.9
|
@version 0.9
|
||||||
@see eoGenOp.h eoOpFactory
|
@see eoGenOp.h eoOpFactory
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//@{
|
//@{
|
||||||
|
|
||||||
|
/**
|
||||||
|
@defgroup Variators Variation operators
|
||||||
|
Variators are operators that modify individuals.
|
||||||
|
|
||||||
|
@defgroup Selectors Selection operators
|
||||||
|
Selectors are operators that select a subset of a population.
|
||||||
|
|
||||||
|
@defgroup Replacors Replacement operators
|
||||||
|
Replacors are operators that replace a subset of a population by another set of individuals.
|
||||||
|
*/
|
||||||
|
|
||||||
/** Abstract data types for EO operators.
|
/** Abstract data types for EO operators.
|
||||||
Genetic operators act on chromosomes, changing them.
|
Genetic operators act on chromosomes, changing them.
|
||||||
The type to use them on is problem specific. If your genotype
|
The type to use them on is problem specific. If your genotype
|
||||||
|
|
|
||||||
|
|
@ -30,9 +30,13 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract class for particle best position initialization.
|
@addtogroup Initializators
|
||||||
|
@{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abstract class for particle best position initialization.
|
||||||
|
*/
|
||||||
template < class POT > class eoParticleBestInit:public eoUF < POT &, void >
|
template < class POT > class eoParticleBestInit:public eoUF < POT &, void >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
@ -75,3 +79,5 @@ public:
|
||||||
|
|
||||||
#endif /*_EOPARTICLEBESTINIT_H */
|
#endif /*_EOPARTICLEBESTINIT_H */
|
||||||
|
|
||||||
|
/** @} */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,11 @@
|
||||||
#include <eoParticleBestInit.h>
|
#include <eoParticleBestInit.h>
|
||||||
#include <eoTopology.h>
|
#include <eoTopology.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
@addtogroup Initializators
|
||||||
|
@{
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Abstract class for initialization of algorithm PSO
|
* Abstract class for initialization of algorithm PSO
|
||||||
|
|
@ -145,5 +150,5 @@ template <class POT> class eoParticleInitializer : public eoInitializerBase <POT
|
||||||
};
|
};
|
||||||
#endif /*_eoParticleFullInitializer_H*/
|
#endif /*_eoParticleFullInitializer_H*/
|
||||||
|
|
||||||
|
/** @} */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,23 +28,17 @@
|
||||||
#ifndef EOPERSISTENT_H
|
#ifndef EOPERSISTENT_H
|
||||||
#define EOPERSISTENT_H
|
#define EOPERSISTENT_H
|
||||||
|
|
||||||
/// @name variables Some definitions of variables used throughout the program
|
|
||||||
//@{
|
|
||||||
/// max length to store stuff read
|
|
||||||
const unsigned MAXLINELENGTH=1024;
|
|
||||||
//@}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#include <iostream> // std::istream, std::ostream
|
#include <iostream> // std::istream, std::ostream
|
||||||
#include <string> // para std::string
|
#include <string> // para std::string
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
#include "eoPrintable.h"
|
#include "eoPrintable.h"
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
/**
|
||||||
// eoPersistent
|
@addtogroup Core
|
||||||
//-----------------------------------------------------------------------------
|
@{
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
An persistent object that knows how to write (through functions inherited from
|
An persistent object that knows how to write (through functions inherited from
|
||||||
#eoPrintable#) and read itself
|
#eoPrintable#) and read itself
|
||||||
|
|
@ -64,9 +58,9 @@ class eoPersistent: public eoPrintable
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
///Standard input for all objects in the EO hierarchy
|
///Standard input for all objects in the EO hierarchy
|
||||||
std::istream & operator >> ( std::istream& _is, eoPersistent& _o );
|
std::istream & operator >> ( std::istream& _is, eoPersistent& _o );
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/** @} */
|
||||||
|
|
|
||||||
|
|
@ -30,15 +30,17 @@
|
||||||
#include <iostream> // std::istream, std::ostream
|
#include <iostream> // std::istream, std::ostream
|
||||||
#include <string> // para std::string
|
#include <string> // para std::string
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
/*
|
||||||
// eoPrintable
|
This functionality was separated from eoObject, since it makes no sense to print
|
||||||
//-----------------------------------------------------------------------------
|
some objects (for instance, a #eoFactory# or a random number generator.
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Base class for objects that can print themselves
|
Base class for objects that can print themselves
|
||||||
(#printOn#). Besides, this file defines the standard output for all the objects;
|
(#printOn#). Besides, this file defines the standard output for all the objects;
|
||||||
if the objects define printOn there's no need to define #operator <<#.\\
|
if the objects define printOn there's no need to define #operator <<#.
|
||||||
This functionality was separated from eoObject, since it makes no sense to print
|
|
||||||
some objects (for instance, a #eoFactory# or a random number generator.
|
@ingroup Core
|
||||||
*/
|
*/
|
||||||
class eoPrintable
|
class eoPrintable
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,8 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Swap two components of a chromosome.
|
* Swap two components of a chromosome.
|
||||||
|
*
|
||||||
|
* @ingroup Variators
|
||||||
*/
|
*/
|
||||||
template<class Chrom> class eoSwapMutation: public eoMonOp<Chrom>
|
template<class Chrom> class eoSwapMutation: public eoMonOp<Chrom>
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,12 @@ Old contact: todos@geneura.ugr.es, http://geneura.ugr.es
|
||||||
#include <EO.h>
|
#include <EO.h>
|
||||||
#include <utils/eoLogger.h>
|
#include <utils/eoLogger.h>
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@addtogroup Core
|
||||||
|
@{
|
||||||
|
*/
|
||||||
|
|
||||||
/** Base class for fixed length chromosomes
|
/** Base class for fixed length chromosomes
|
||||||
|
|
||||||
It just derives from EO and std::vector and redirects the smaller than
|
It just derives from EO and std::vector and redirects the smaller than
|
||||||
|
|
@ -35,6 +41,7 @@ operator to EO (fitness based comparison).
|
||||||
|
|
||||||
GeneType must have the following methods: void ctor (needed for the
|
GeneType must have the following methods: void ctor (needed for the
|
||||||
std::vector<>), copy ctor,
|
std::vector<>), copy ctor,
|
||||||
|
|
||||||
*/
|
*/
|
||||||
template <class FitT, class GeneType>
|
template <class FitT, class GeneType>
|
||||||
class eoVector : public EO<FitT>, public std::vector<GeneType>
|
class eoVector : public EO<FitT>, public std::vector<GeneType>
|
||||||
|
|
@ -143,6 +150,7 @@ bool operator>(const eoVector<FitT, GeneType>& _eo1, const eoVector<FitT, GeneTy
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/** @} */
|
||||||
|
|
||||||
// Local Variables:
|
// Local Variables:
|
||||||
// coding: iso-8859-1
|
// coding: iso-8859-1
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,12 @@
|
||||||
|
|
||||||
#include <PO.h>
|
#include <PO.h>
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@addtogroup Core
|
||||||
|
@{
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Main class for particle representation of particle swarm optimization. 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,
|
||||||
|
|
@ -146,3 +152,4 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /*_EOVECTORPARTICLE_H*/
|
#endif /*_EOVECTORPARTICLE_H*/
|
||||||
|
/** @} */
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,11 @@
|
||||||
#include <eoSTLFunctor.h>
|
#include <eoSTLFunctor.h>
|
||||||
#include <utils/eoRndGenerators.h>
|
#include <utils/eoRndGenerators.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
@addtogroup Initializators
|
||||||
|
@{
|
||||||
|
*/
|
||||||
|
|
||||||
/** Abstract class for velocities initilization of particle swarm optimization.*/
|
/** 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 >
|
||||||
{
|
{
|
||||||
|
|
@ -137,3 +142,6 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /*EOVELOCITYINIT_H */
|
#endif /*EOVELOCITYINIT_H */
|
||||||
|
|
||||||
|
/** @} */
|
||||||
|
|
||||||
|
|
|
||||||
Reference in a new issue