#ifndef GENETIC_EXPLICIT_SIMULATION_H #define GENETIC_EXPLICIT_SIMULATION_H #include "genetic/population.h" #include "genetic/config.h" namespace Genetic { class Operator; class FitnessFunction; class ExplicitSimulation { public: ExplicitSimulation( Operator *pOper, FitnessFunction *pFunc, int iPopSize, float fKeep, float fRandom, bool bKeepBest=true ); virtual ~ExplicitSimulation(); void timestep(); Genetic::PhenotypeId selectWeighted(); double getMinFitness() const { return dMinFitness; } double getMaxFitness() const { return dMaxFitness; } protected: void updateFitness(); protected: Population xPop; Operator *pOper; FitnessFunction *pFunc; private: int iPopSize; float fKeep; float fRandom; bool bKeepBest; typedef Bu::Hash FitnessHash; FitnessHash hFitness; double dMinFitness; double dMaxFitness; double dTotalFitness; PhenotypeId uMaxFitness; }; }; #endif