paradiseo/eo/tutorial/Lesson2/real_value.h
evomarc 415b419671 The BIG change of general operator interface
I also changed
  - the eoQuadratic into eoQuad (as dicussed with Maarten)
  - the eoBin into eoBit, with more appropriate names for the "binary"
    operators (that can be unary!) as no one protested when I posted on
    eodev list
2001-02-09 05:09:26 +00:00

22 lines
560 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++)
{
if ( (_ind[i]<0) || (_ind[i]>1) )
cout << "Sorti des bornes: " << _ind[i] << " ";
sum += _ind[i] * _ind[i];
}
return -sum;
}