corrected PSO dummy errors and completed documentation
This commit is contained in:
parent
b8da2db21f
commit
4b99bc8bc9
12 changed files with 581 additions and 281 deletions
|
|
@ -31,19 +31,22 @@
|
|||
#include <eoVelocityInit.h>
|
||||
#include <eoPop.h>
|
||||
#include <eoParticleBestInit.h>
|
||||
#include <eoTopology.h>
|
||||
|
||||
|
||||
/*
|
||||
* Abstract class for initialization of algorithm PSO
|
||||
*/
|
||||
template <class POT> class eoInitializerBase : public eoFunctorBase
|
||||
{
|
||||
public :
|
||||
{
|
||||
public :
|
||||
|
||||
virtual ~eoInitializerBase() {}
|
||||
virtual ~eoInitializerBase()
|
||||
{}
|
||||
|
||||
virtual void operator()(){};
|
||||
};
|
||||
virtual void operator()()
|
||||
{};
|
||||
};
|
||||
|
||||
/**
|
||||
Base (name) class for Initialization of algorithm PSO
|
||||
|
|
@ -51,8 +54,8 @@ public :
|
|||
@see eoInitializerBase eoUF apply
|
||||
*/
|
||||
template <class POT> class eoInitializer : public eoInitializerBase <POT>
|
||||
{
|
||||
public:
|
||||
{
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
//! @param _proc Evaluation function
|
||||
|
|
@ -60,25 +63,54 @@ public:
|
|||
//! @param _initBest Initialization of the best
|
||||
//! @param _pop Population
|
||||
eoInitializer(
|
||||
eoUF<POT&, void>& _proc,
|
||||
eoVelocityInit < POT > &_initVelo,
|
||||
eoParticleBestInit <POT> &_initBest,
|
||||
eoPop < POT > &_pop
|
||||
) : proc(_proc), initVelo(_initVelo), initBest(_initBest)
|
||||
eoUF<POT&, void>& _proc,
|
||||
eoVelocityInit < POT > &_initVelo,
|
||||
eoParticleBestInit <POT> &_initBest,
|
||||
eoTopology <POT> &_topology,
|
||||
eoPop < POT > &_pop
|
||||
) : proc(_proc), procPara(dummyEval), initVelo(_initVelo), initBest(_initBest), topology(_topology), pop(_pop)
|
||||
{
|
||||
apply(proc, _pop);
|
||||
apply < POT > (initVelo, _pop);
|
||||
apply < POT > (initBest, _pop);
|
||||
/* apply(proc, _pop);
|
||||
apply < POT > (initVelo, _pop);
|
||||
apply < POT > (initBest, _pop);
|
||||
topology.setup(_pop);*/
|
||||
}
|
||||
|
||||
//! Constructor for parallel evaluation
|
||||
//! @param _proc Evaluation function
|
||||
//! @param _initVelo Initialization of the velocity
|
||||
//! @param _initBest Initialization of the best
|
||||
//! @param _pop Population
|
||||
eoInitializer(
|
||||
eoPopEvalFunc <POT>& _proc,
|
||||
eoVelocityInit < POT > &_initVelo,
|
||||
eoParticleBestInit <POT> &_initBest,
|
||||
eoTopology <POT> &_topology,
|
||||
eoPop < POT > &_pop
|
||||
) : proc(dummy), procPara(_proc), initVelo(_initVelo), initBest(_initBest), topology(_topology), pop(_pop)
|
||||
{}
|
||||
|
||||
|
||||
//! Give the name of the class
|
||||
//! @return The name of the class
|
||||
virtual std::string className (void) const
|
||||
{
|
||||
{
|
||||
return "eoInitializer";
|
||||
}
|
||||
|
||||
|
||||
|
||||
virtual void operator () (/*eoPop < POT > &_pop*/)
|
||||
{
|
||||
eoPop<POT> empty_pop;
|
||||
apply(proc, pop);
|
||||
procPara(empty_pop, pop);
|
||||
apply < POT > (initVelo, pop);
|
||||
apply < POT > (initBest, pop);
|
||||
topology.setup(pop);
|
||||
}
|
||||
|
||||
private :
|
||||
private :
|
||||
|
||||
/*
|
||||
@param proc First evaluation
|
||||
|
|
@ -86,10 +118,28 @@ private :
|
|||
@param initBest Initialization of the best
|
||||
|
||||
*/
|
||||
eoPop < POT > & pop;
|
||||
eoUF<POT&, void>& proc;
|
||||
eoPopEvalFunc <POT>& procPara;
|
||||
eoVelocityInit < POT > & initVelo;
|
||||
eoParticleBestInit <POT> & initBest;
|
||||
};
|
||||
eoTopology <POT> & topology;
|
||||
class eoDummyEval : public eoPopEvalFunc<POT>
|
||||
{
|
||||
public:
|
||||
void operator()(eoPop<POT> &,eoPop<POT> &_pop)
|
||||
{}
|
||||
}
|
||||
dummyEval;
|
||||
class eoDummy : public eoUF<POT&, void>
|
||||
{
|
||||
public:
|
||||
void operator()(POT &)
|
||||
{}
|
||||
|
||||
}
|
||||
dummy;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
|||
Reference in a new issue