Commit 345202d7 authored by Joseph Pallamidessi's avatar Joseph Pallamidessi

Add onemax example

parent 82a6c009
/*_________________________________________________________
Test functions
log normal adaptive mutation
Selection operator: Tournament
__________________________________________________________*/
\User declarations :
#define SIZE 100
float pMutPerGene = 0.1;
\end
\User functions:
\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;
}
\end
\GenomeClass::crossover :
int locus = random(1, SIZE);
for (int i = locus; 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;
\end
\GenomeClass::evaluator : // Returns the score
{
float score = 0.0;
for(int i = 0; i < SIZE; i++){
score += Genome.x[i];
}
return score;
}
\end
\User Makefile options:
\end
\Default run parameters : // Please let the parameters appear in this order
Number of generations : 35 // NB_GEN
Time limit: 0 // In seconds, 0 to deactivate
Population size : 2048 //POP_SIZE
Offspring size : 2048 // 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
Surviving offspring: 100%
Reduce parents operator: Tournament 2
Reduce offspring operator: Tournament 2
Final reduce operator: Tournament 2
Elitism: Strong //Weak or Strong
Elite: 1
Print stats: true //Default: 1
Generate csv stats file:false
Generate gnuplot script:false
Generate R script:false
Plot stats:true //Default: 0
Remote island model: false
IP file: ip.txt //File containing all the remote island's IP
Server port : 2929
Migration probability: 0.33
Save population: false
Start from file:false
\end
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