paradiseo/eo/tutorial/Lesson2/real_value.h
evomarc 72b6692f9b Modified all init sequences in Lesson2 and Lesson3 - and all corresponding
files in html dir - after the return of eoRndGenerators and subsequent
modifications of eoInit
2001-02-27 05:09:10 +00:00

20 lines
468 B
C++

#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
*/
// INIT
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;
}