#ifndef _Sphere_h #define _Sphere_h #include #include #include #include #include #include #include #include #include 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