2#include "FunctionMinEvalOp.h"
7 state->getRegistry()->registerEntry(
"function", (voidP) (
new uint(1)), ECF::UINT);
13 voidP sptr = state->getRegistry()->getEntry(
"function");
37 double realTemp = 0, value = 0;
41 for (uint i = 0; i < gen->
realValue.size(); i++){
42 realTemp = pow((gen->
realValue[i] - (i + 1)), 2.);
50 for(uint i = 0; i < gen->
realValue.size(); ++i) {
53 value = 0.5 - (pow(sin(sqrt(z)), 2) - 0.5) / pow(1 + 0.001 * z, 2);
54 value = -1 * value + 1;
59 double valueSum = 0, valueProduct = 1, realSum = 0, realProduct = 0;
60 for (uint i = 0; i < gen->
realValue.size(); i++){
61 realSum = pow(gen->
realValue[i], 2.)/4000;
63 realProduct = cos(gen->
realValue[i] / sqrt((
double)(i+1)));
64 valueProduct *= realProduct;
66 value = valueSum - valueProduct + 1;
71 double realSum = 0, valueSum = 0, realCos = 0, valueCos = 0, pi = 3.141592;
72 for (uint i = 0; i < gen->
realValue.size(); i++){
75 realCos = cos (2 * pi * gen->
realValue[i]);
78 value = -20 * exp(-0.2*sqrt(valueSum / gen->
realValue.size())) - exp(valueCos / gen->
realValue.size()) + 20 + exp(1.);
83 double realTemp = 0, pi = 3.141592;
84 for (uint i = 0; i < gen->
realValue.size(); i++) {
88 value = value + 10 * gen->
realValue.size();
94 for (uint i = 0; i < gen->
realValue.size() - 1; i++){
103 for(uint i = 0; i < gen->
realValue.size(); ++i) {
106 value = pow(z, 0.25) * (1.0 + pow( sin( 50 * pow(z, 0.1)), 2));
112 value = pow(x1, 4)/4 - x1*x1 + 2*x1 + (x2 - 1)*(x2 - 1);
125 for(uint i = 1; i <= 10; i++) {
128 net1 = 1. / (1 + exp(-(x10 + i * x11)));
131 net2 = 1. / (1 + exp(-(x20 + i * x21)));
133 net1 = x30 + net1 * x31 + net2 * x32;
136 error += pow(fabs(net1 - (i*i)), 2);
143 throw(
"FunctionMinEvalOp: invalid function index in configuration!");
146 fitness->setValue(value);
Fitness for minimization problems.
FloatingPoint class - implements genotype as a vector of floating point values.
FitnessP evaluate(IndividualP individual)
Evaluate a single individual. Method must create and return a Fitness object.
uint iFunction_
function index
void registerParameters(StateP)
Register evaluator parameters. Called before EvaluateOp::initialize method.
bool initialize(StateP)
Initialize the evaluator. Called before first evaluation occurs.
std::vector< double > realValue
vector of floating point values