24 #include "core/geneticalgo.h"
25 #include "core/genotype.h"
26 #include "core/genome.h"
52 void setNumThreads(
int numThreads );
63 virtual QVector<Evaluation*> evaluationPool();
70 virtual void initialize();
72 virtual void gaStep();
74 virtual void finalize();
80 virtual void skipEvaluation();
98 static void describe( QString type );
106 typedef enum { initEvaluation, evaluating, nextGeneration_pass1, nextGeneration_pass2, endEvolution } GAPhases;
124 nsgaGenotype(
Genotype* g=NULL,
int rank=0,
double distance=0 ) {
127 this->distance = distance;
136 int dominationCounter;
138 bool operator<(
const nsgaGenotype& g )
const {
139 return this->distance < g.distance;
142 bool operator==(
const nsgaGenotype& g )
const {
143 return this->genotype == g.genotype;
146 typedef QVector<nsgaGenotype*> nsgaGenome;
150 void crowdingDistanceAssignment( nsgaGenome& genome );
152 QVector<nsgaGenome> fastNonDominatedSort( nsgaGenome& pareto );
154 static bool crowdingDistanceGreaterThan(
const nsgaGenotype* g1,
const nsgaGenotype* g2 ) {
155 return g1->distance > g2->distance;
158 class nObjectiveGreaterThan {
160 bool operator()(
const nsgaGenotype* g1,
const nsgaGenotype* g2 ) {
161 return g1->genotype->objective( currentObjective ) > g2->genotype->objective( currentObjective );
163 int currentObjective;
170 class evaluationThread {
173 evaluationThread( NSGA2* p, Evaluation* eProto );
187 QVector<int> sequence;
193 QList<evaluationThread*> evalThreads;
197 static void runStepWrapper( NSGA2::evaluationThread* e );