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 <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
|
||||
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
|
||||
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
|
||||
be minimized with a proper definition of the < operator. The fitness
|
||||
object must have, besides an void ctor, a copy ctor.
|
||||
be minimized with a proper definition of the < operator.
|
||||
|
||||
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
|
||||
{
|
||||
|
|
@ -150,6 +165,8 @@ private:
|
|||
bool invalidFitness; // true if the value of fitness is invalid
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
|
|
|
|||
|
|
@ -29,8 +29,9 @@
|
|||
|
||||
/**
|
||||
Combined INIT: a proportional recombination of eoInit objects
|
||||
*/
|
||||
|
||||
@ingroup Initializators
|
||||
*/
|
||||
template< class EOT>
|
||||
class eoCombinedInit: public eoInit<EOT> {
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -34,6 +34,14 @@
|
|||
#include <utils/eoRndGenerators.h>
|
||||
#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
|
||||
contructor. It is derived from eoMonOp, so it can be used
|
||||
|
|
@ -41,7 +49,6 @@
|
|||
|
||||
@see eoPop
|
||||
*/
|
||||
|
||||
template <class EOT>
|
||||
class eoInit : public eoUF<EOT&, void>
|
||||
{
|
||||
|
|
@ -202,3 +209,4 @@ class eoInitAdaptor : public eoMonOp<EOT>
|
|||
};
|
||||
|
||||
#endif
|
||||
/** @}*/
|
||||
|
|
|
|||
|
|
@ -33,8 +33,13 @@
|
|||
#include <eoParticleBestInit.h>
|
||||
#include <eoTopology.h>
|
||||
|
||||
/**
|
||||
@addtogroup Initializators
|
||||
@{
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
/**
|
||||
* Abstract class for initialization of algorithm PSO
|
||||
*/
|
||||
template <class POT> class eoInitializerBase : public eoFunctorBase
|
||||
|
|
@ -137,5 +142,5 @@ class eoDummy : public eoUF<POT&, void>
|
|||
};
|
||||
#endif
|
||||
|
||||
|
||||
/** @} */
|
||||
|
||||
|
|
|
|||
|
|
@ -33,16 +33,16 @@
|
|||
|
||||
#include <utils/compatibility.h>
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// eoObject
|
||||
//-----------------------------------------------------------------------------
|
||||
/**
|
||||
/*
|
||||
eoObject used to be the base class for the whole hierarchy, but this has
|
||||
changed. eoObject is used to define a name (#className#)
|
||||
that is used when loading or saving the state.
|
||||
|
||||
Previously, this object also defined a print and read
|
||||
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.
|
||||
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
|
||||
|
||||
@ingroup Core
|
||||
*/
|
||||
class eoObject
|
||||
{
|
||||
|
|
|
|||
|
|
@ -30,14 +30,13 @@
|
|||
#include <eoFunctor.h>
|
||||
#include <utils/eoRNG.h>
|
||||
/**
|
||||
\defgroup Operators
|
||||
Genetic Operators are used for various purposes
|
||||
*/
|
||||
@defgroup Operators Operators
|
||||
|
||||
/** @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?
|
||||
There is a genetic operator hierarchy, with eoOp as father and
|
||||
Typically, a mutation is an operator that modifies an individual, and an algorithm is an operator that modifies a population.
|
||||
|
||||
In EO, there is a genetic operator hierarchy, with eoOp as father and
|
||||
eoMonOp (monary or unary operator), eoBinOp and eoQuadOp (binary operators)
|
||||
and eoGenOp (any number of inputs and outputs, see eoGenOp.h)
|
||||
as subclasses.
|
||||
|
|
@ -53,9 +52,19 @@ how to build them from a description in a file.
|
|||
@version 0.9
|
||||
@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.
|
||||
Genetic operators act on chromosomes, changing them.
|
||||
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 >
|
||||
{
|
||||
public:
|
||||
|
|
@ -75,3 +79,5 @@ public:
|
|||
|
||||
#endif /*_EOPARTICLEBESTINIT_H */
|
||||
|
||||
/** @} */
|
||||
|
||||
|
|
|
|||
|
|
@ -33,6 +33,11 @@
|
|||
#include <eoParticleBestInit.h>
|
||||
#include <eoTopology.h>
|
||||
|
||||
/**
|
||||
@addtogroup Initializators
|
||||
@{
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Abstract class for initialization of algorithm PSO
|
||||
|
|
@ -145,5 +150,5 @@ template <class POT> class eoParticleInitializer : public eoInitializerBase <POT
|
|||
};
|
||||
#endif /*_eoParticleFullInitializer_H*/
|
||||
|
||||
|
||||
/** @} */
|
||||
|
||||
|
|
|
|||
|
|
@ -28,23 +28,17 @@
|
|||
#ifndef 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 <string> // para std::string
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
#include "eoPrintable.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// eoPersistent
|
||||
//-----------------------------------------------------------------------------
|
||||
/**
|
||||
@addtogroup Core
|
||||
@{
|
||||
*/
|
||||
|
||||
/**
|
||||
An persistent object that knows how to write (through functions inherited from
|
||||
#eoPrintable#) and read itself
|
||||
|
|
@ -64,9 +58,9 @@ class eoPersistent: public eoPrintable
|
|||
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
///Standard input for all objects in the EO hierarchy
|
||||
std::istream & operator >> ( std::istream& _is, eoPersistent& _o );
|
||||
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
|
|
|||
|
|
@ -30,15 +30,17 @@
|
|||
#include <iostream> // std::istream, std::ostream
|
||||
#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
|
||||
(#printOn#). Besides, this file defines the standard output for all the objects;
|
||||
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.
|
||||
if the objects define printOn there's no need to define #operator <<#.
|
||||
|
||||
@ingroup Core
|
||||
*/
|
||||
class eoPrintable
|
||||
{
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@
|
|||
|
||||
/**
|
||||
* Swap two components of a chromosome.
|
||||
*
|
||||
* @ingroup Variators
|
||||
*/
|
||||
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 <utils/eoLogger.h>
|
||||
|
||||
|
||||
/**
|
||||
@addtogroup Core
|
||||
@{
|
||||
*/
|
||||
|
||||
/** Base class for fixed length chromosomes
|
||||
|
||||
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
|
||||
std::vector<>), copy ctor,
|
||||
|
||||
*/
|
||||
template <class FitT, class 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
|
||||
|
||||
/** @} */
|
||||
|
||||
// Local Variables:
|
||||
// coding: iso-8859-1
|
||||
|
|
|
|||
|
|
@ -27,6 +27,12 @@
|
|||
|
||||
#include <PO.h>
|
||||
|
||||
|
||||
/**
|
||||
@addtogroup Core
|
||||
@{
|
||||
*/
|
||||
|
||||
/**
|
||||
* 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,
|
||||
|
|
@ -146,3 +152,4 @@ public:
|
|||
};
|
||||
|
||||
#endif /*_EOVECTORPARTICLE_H*/
|
||||
/** @} */
|
||||
|
|
|
|||
|
|
@ -32,6 +32,11 @@
|
|||
#include <eoSTLFunctor.h>
|
||||
#include <utils/eoRndGenerators.h>
|
||||
|
||||
/**
|
||||
@addtogroup Initializators
|
||||
@{
|
||||
*/
|
||||
|
||||
/** Abstract class for velocities initilization of particle swarm optimization.*/
|
||||
template < class POT > class eoVelocityInit:public eoInit < POT >
|
||||
{
|
||||
|
|
@ -137,3 +142,6 @@ private:
|
|||
};
|
||||
|
||||
#endif /*EOVELOCITYINIT_H */
|
||||
|
||||
/** @} */
|
||||
|
||||
|
|
|
|||
Reference in a new issue