The fitness function calculates fitness value of 100.0 / ( error + 1 )
where error equals to the sum of absolute differences between function values (computed using the function encoded by chromosome) and input values (function to be approximated).
Sample usage:
// constants double[] constants = new double[5] { 1, 2, 3, 5, 7 }; // function to be approximated double[,] data = new double[5, 2] { {1, 1}, {2, 3}, {3, 6}, {4, 10}, {5, 15} }; // create population Population population = new Population( 100, new GPTreeChromosome( new SimpleGeneFunction( 1 + constants.Length ) ), new SymbolicRegressionFitness( data, constants ), new EliteSelection( ) ); // run one epoch of the population population.RunEpoch( );