Adding code to Lesson4
This commit is contained in:
parent
7294d6acd5
commit
1eee26598b
6 changed files with 351 additions and 0 deletions
19
eo/tutorial/Lesson4/real_value.h
Normal file
19
eo/tutorial/Lesson4/real_value.h
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
#include <vector>
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
/** Just a simple function that takes an eoEsBase<double> and sets the fitnes
|
||||
to sphere
|
||||
@param _ind vector<double>
|
||||
*/
|
||||
|
||||
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 sqrt(sum);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in a new issue