-
Notifications
You must be signed in to change notification settings - Fork 11
Getting started
Here is the detailed explanation of the differents section of an .ez file.
##Essential section
###Genome description This is the section where the user will be able to declare:
- The genome of the individuals trough the GenomeClass class
- Different classes that will be needed.
The GenomeClass field has to be present and ideally not empty. All the variables defined in this field (the genome) will be accessible in several other fields using the 'Genome' variable. Other "hidden" variables can be accessed such as:
- The fitness (variable: fitness. Ex: Genome.fitness) WARNING ! Thoses not C++ class, rather C structs so don't define variable and methods in them.
\User classes :
foo {
time_t timestamp;
}
GenomeClass {
float x[SIZE];
int serial;
foo bar;
}
\end
###Initialisation Uses the Genome EASEA variable to access the individual's genome.
\GenomeClass::initialiser : // "initializer" is also accepted
Genome.serial = rand() % 100;
Genome.bar.timestamp = time();
\end
###Crossover
Binary crossover that results in the production of a single child. The child is initialized by cloning the first parent. Uses parent1 and parent2 EASEA variables to access the parents genome. Uses the child EASEA variable to access the child's genome.
\GenomeClass::crossover :
child.bar.timestamp = time();
if(parent1.serial > parent2.serial)
child.serial = parent1.serial;
else
child.serial = parent2.serial;
\end
###Evaluation
The evaluation function is expected to be autonomous and independent from the rest of the code, for correct parallelization.
Must return the fitness, as a float, of the individual. Uses the Genome defined variable to access the individual's genome.
/* Returns the score as a real value
* uses Genome to evaluate the quality of the individual
*/
\GenomeClass::evaluator :
float score = (float) Genome.serial;
return scrore;
\end
###Mutation Must return the number, as an int, of mutations. Uses the Genome variable to access the individual's genome.
\GenomeClass::mutator : // Must return the number of mutations
// must mutate "Genome"
return 0;
\end
###Display and output Uses the Genome variable to access the individual's genome.
\GenomeClass::display:
cout << Genome.serial << endl;
\end
##Misc
This is the section where the user can declare some global variables and some global function.
\User declarations : // This section is copied on top of the output file
#include time.h
\end
This is the section where the user can declare the different functions he will need.
\User functions:
\end
###Trigger
This function will be called at the start of the algorithm before the parent initialization.
\Before everything else function:
cout<<"Before everything else function called "<<endl;
\end
This function will be called once the last generation has finished. The population can be accessed.
\After everything else function:
cout << "After everything else function called" << endl;
\end
This function will be called every generation before the reproduction phase. The population can be accessed.
\At the beginning of each generation function:
cout << "At the beginning of each generation function called" << endl;
\end
This function will be called at every generation after the printing of generation statistics. The population can be accessed.
\At the end of each generation function:
cout << "At the end of each generation function called" << endl;
\end
Those functions will be called at every generation before/after performing the different population reductions. The parent population AND the offspring population can be accessed (merged into a single population).
\At each generation before reduce function:
cout << "At each generation before replacement function called" << endl;
\end
This section allows the user to add some flags to the compiler typically to include some custom libraries. Two flags of the Makefile are accessible to the user in this section:
- CPPFLAGS
- LDFLAGS
\User Makefile options:
CPPLAGS += -llibrary
LDFLAGS += -I/path/to/include
\end
\Default run parameters : // Please let the parameters appear in this order
Number of generations : 100 // NB_GEN
Time limit: 0 // In seconds, 0 to deactivate
Population size : 1024 //POP_SIZE
Offspring size : 1024 // or a xx%
Mutation probability : 1 // MUT_PROB
Crossover probability : 1 // XOVER_PROB
Evaluator goal : maximize // maximise
Selection operator: Tournament 2.0
Surviving parents: 100% // Percentage or absolute
Surviving offspring: 100% // Percentage or absolute
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 // List of IP:PORT of islands to send individuals to
Migration probability: 0.33 // Probability of sending an individual per generation
Server port : 2929
Save population: false
Start from file:false
\end
\User CUDA:
//Transfert some variables to GPU here (cudaMalloc, MemCpy)
\end