Commit f4c6447a authored by Joseph Pallamidessi's avatar Joseph Pallamidessi

Update onemax example

parent 8a1fca6d
/*_________________________________________________________
Test functions
log normal adaptive mutation
Selection operator: Tournament
onemax.ez // Evolve individuals containing 111111111111111111...
__________________________________________________________*/
\User declarations :
#define SIZE 100
float pMutPerGene = 0.1;
#define SIZE 1000
float pMutPerGene=0.1;
\end
\User functions:
\end
\User CUDA:
\end
\User functions:
\Before everything else function:
\end
\After everything else function:
\end
\User classes :
\At the beginning of each generation function:
\end
GenomeClass {
int x[SIZE];
}
\At the end of each generation function:
\end
\At each generation before reduce function:
\end
\User classes :
GenomeClass {
int x[SIZE];
}
\end
\GenomeClass::display:
\end
\GenomeClass::initialiser : // "initializer" is also accepted
for(int i = 0; i < SIZE; i++ ) {
if( tossCoin() )
Genome.x[i] = 1;
else
Genome.x[i] = 0;
}
for(int i=0; i<SIZE; i++ )
Genome.x[i] = random(0,2);
\end
\GenomeClass::crossover :
int locus = random(1, SIZE);
for (int i = locus; i < SIZE; i++){
child.x[i] = parent2.x[i];
}
int nLocus=random(1,SIZE);
for (int i=nLocus;i<SIZE;i++)
child.x[i]=parent2.x[i];
\end
\GenomeClass::mutator : // Must return the number of mutations
int NbMut=0;
float pond = 1./sqrt((float)SIZE);
for (int i=0; i < SIZE; i++){
if (tossCoin(pMutPerGene)){
NbMut++;
Genome.x[i] = (Genome.x[i] + 1) % 2;
}
}
return NbMut;
\GenomeClass::mutator : // Must return a value (for historical reasons)
for (int i=0;i<SIZE;i++)
if (tossCoin(pMutPerGene)) Genome.x[i]=(Genome.x[i]+1)%2;
return 3;
\end
\GenomeClass::evaluator : // Returns the score
{
float score = 0.0;
for(int i = 0; i < SIZE; i++){
score += Genome.x[i];
}
return score;
}
float fScore=0;
for (int i=0;i<SIZE;i++) fScore+=Genome.x[i];
return fScore;
\end
\User Makefile options:
\end
\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
Population size : 2048 //POP_SIZE
Offspring size : 2048 // 40%
Population size : 100 //POP_SIZE
Offspring size : 100 // 40%
Mutation probability : 1 // MUT_PROB
Crossover probability : 1 // XOVER_PROB
Evaluator goal : minimise // Maximise
Selection operator: Tournament 2.0
Surviving parents: 100%//percentage or absolute
Evaluator goal : maximise // Maximise
Selection operator: Tournament 2
Surviving parents: 1//percentage or absolute
Surviving offspring: 100%
Reduce parents operator: Tournament 2
Reduce offspring operator: Tournament 2
......@@ -110,7 +92,7 @@ __________________________________________________________*/
Remote island model: false
IP file: ip.txt //File containing all the remote island's IP
Server port : 2929
Migration probability: 0.33
Migration probability: 0.3
Save population: 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