Back to Lesson 2 - Tutorial main page - Algorithm-Based - Component-Based page - Programming hints - EO documentation


#include <vector>
//-----------------------------------------------------------------------------
/** Just a simple function that takes an vector<double> and sets the fitnes 
     to the sphere function. Please use doubles not float!!!
     @param _ind A floatingpoint vector 
*/
double real_value(const std::vector<double>& _ind)
{
 double sum = 0;
 for (unsigned i = 0; i < _ind.size(); i++)
         sum += _ind[i] * _ind[i];
 return -sum;
}

Back to Lesson 2 - Tutorial main page - Algorithm-Based - Component-Based page - Programming hints - EO documentation
Marc Schoenauer

Last modified: Wed Nov 29 08:58:50 2000