#include "genetic/population.h" #include "genetic/phenotypebinary.h" #include "genetic/operatorbasic.h" #include "genetic/explicitsimulation.h" #include "fitnessfunctioneq.h" #include #include #include using namespace Bu; int main( int argc, char *argv[] ) { Bu::Random::seed( time( NULL ) ); sio << "Global maxima equation test" << sio.nl << " - -1.8*x^4 + 0.86*x^3 + 4.0*x^2 == 3.53518 (approx)" << sio.nl << sio.nl; Genetic::ExplicitSimulation ex( new Genetic::OperatorBasic( new Genetic::PhenotypeBinary( 32 ), 0.05 ), new FitnessFunctionEq(), 1000, .1, .1 ); for( int j = 0; j < 100; j++ ) { ex.timestep(); sio << ex.getMinFitness() << " - " << ex.getMaxFitness() << sio.nl; } return 0; }