Commit f4c6447a authored by Joseph Pallamidessi's avatar Joseph Pallamidessi
Browse files

Update onemax example

parent 8a1fca6d
/*_________________________________________________________ /*_________________________________________________________
Test functions onemax.ez // Evolve individuals containing 111111111111111111...
log normal adaptive mutation
Selection operator: Tournament
__________________________________________________________*/ __________________________________________________________*/
\User declarations : \User declarations :
#define SIZE 100 #define SIZE 1000
float pMutPerGene = 0.1; float pMutPerGene=0.1;
\end
\User functions:
\end \end
\User CUDA:
\end
\User functions: \Before everything else function:
\end \end
\After everything else function:
\end
\User classes : \At the beginning of each generation function:
\end
GenomeClass { \At the end of each generation function:
int x[SIZE]; \end
}
\At each generation before reduce function:
\end \end
\User classes :
GenomeClass {
int x[SIZE];
}
\end
\GenomeClass::display: \GenomeClass::display:
\end \end
\GenomeClass::initialiser : // "initializer" is also accepted \GenomeClass::initialiser : // "initializer" is also accepted
for(int i=0; i<SIZE; i++ )
for(int i = 0; i < SIZE; i++ ) { Genome.x[i] = random(0,2);
if( tossCoin() )
Genome.x[i] = 1;
else
Genome.x[i] = 0;
}
\end \end
\GenomeClass::crossover : \GenomeClass::crossover :
int locus = random(1, SIZE); int nLocus=random(1,SIZE);
for (int i = locus; i < SIZE; i++){
child.x[i] = parent2.x[i];
}
for (int i=nLocus;i<SIZE;i++)
child.x[i]=parent2.x[i];
\end \end
\GenomeClass::mutator : // Must return a value (for historical reasons)
\GenomeClass::mutator : // Must return the number of mutations for (int i=0;i<SIZE;i++)
int NbMut=0; if (tossCoin(pMutPerGene)) Genome.x[i]=(Genome.x[i]+1)%2;
float pond = 1./sqrt((float)SIZE); return 3;
for (int i=0; i < SIZE; i++){
if (tossCoin(pMutPerGene)){
NbMut++;
Genome.x[i] = (Genome.x[i] + 1) % 2;
}
}
return NbMut;
\end \end
\GenomeClass::evaluator : // Returns the score \GenomeClass::evaluator : // Returns the score
{ float fScore=0;
float score = 0.0; for (int i=0;i<SIZE;i++) fScore+=Genome.x[i];
return fScore;
for(int i = 0; i < SIZE; i++){
score += Genome.x[i];
}
return score;
}
\end \end
\User Makefile options: \User Makefile options:
\end \end
\Default run parameters : // Please let the parameters appear in this order \Default run parameters : // Please let the parameters appear in this order
Number of generations : 35 // NB_GEN Number of generations : 100 // NB_GEN
Time limit: 0 // In seconds, 0 to deactivate Time limit: 0 // In seconds, 0 to deactivate
Population size : 2048 //POP_SIZE Population size : 100 //POP_SIZE
Offspring size : 2048 // 40% Offspring size : 100 // 40%
Mutation probability : 1 // MUT_PROB Mutation probability : 1 // MUT_PROB
Crossover probability : 1 // XOVER_PROB Crossover probability : 1 // XOVER_PROB
Evaluator goal : minimise // Maximise Evaluator goal : maximise // Maximise
Selection operator: Tournament 2.0 Selection operator: Tournament 2
Surviving parents: 100%//percentage or absolute Surviving parents: 1//percentage or absolute
Surviving offspring: 100% Surviving offspring: 100%
Reduce parents operator: Tournament 2 Reduce parents operator: Tournament 2
Reduce offspring operator: Tournament 2 Reduce offspring operator: Tournament 2
...@@ -110,7 +92,7 @@ __________________________________________________________*/ ...@@ -110,7 +92,7 @@ __________________________________________________________*/
Remote island model: false Remote island model: false
IP file: ip.txt //File containing all the remote island's IP IP file: ip.txt //File containing all the remote island's IP
Server port : 2929 Server port : 2929
Migration probability: 0.33 Migration probability: 0.3
Save population: false Save population: false
Start from file:false Start from file:false
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment