I had forgotten the real_value.h - SecondRealEA did not compile!
This commit is contained in:
parent
2e87ffd00f
commit
43f0d7ea79
1 changed files with 20 additions and 0 deletions
20
eo/tutorial/Lesson3/real_value.h
Normal file
20
eo/tutorial/Lesson3/real_value.h
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
#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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Reference in a new issue