+ eda algo: same algo than eda-sa without sa, + plotting scripts and problem functions moved to application/common
This commit is contained in:
parent
ba6770df43
commit
65191e2212
16 changed files with 595 additions and 14 deletions
42
application/common/Sphere.h
Normal file
42
application/common/Sphere.h
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
#ifndef _Sphere_h
|
||||
#define _Sphere_h
|
||||
|
||||
#include <eo>
|
||||
#include <es.h>
|
||||
#include <es/eoRealInitBounded.h>
|
||||
#include <es/eoRealOp.h>
|
||||
#include <es/eoEsChromInit.h>
|
||||
#include <es/eoRealOp.h>
|
||||
#include <es/make_real.h>
|
||||
#include <apply.h>
|
||||
#include <eoProportionalCombinedOp.h>
|
||||
|
||||
template < typename EOT >
|
||||
class Sphere : public eoEvalFunc< EOT >
|
||||
{
|
||||
public:
|
||||
typedef typename EOT::AtomType AtomType;
|
||||
|
||||
virtual void operator()( EOT& p )
|
||||
{
|
||||
if (!p.invalid())
|
||||
return;
|
||||
|
||||
p.fitness( _evaluate( p ) );
|
||||
}
|
||||
|
||||
private:
|
||||
AtomType _evaluate( EOT& p )
|
||||
{
|
||||
AtomType r = 0.0;
|
||||
|
||||
for (unsigned int i = 0; i < p.size() - 1; ++i)
|
||||
{
|
||||
r += p[i] * p[i];
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // !_Sphere_h
|
||||
Reference in a new issue