This is the supplementary material for "Self-adaptation of Genetic Operators Through Genetic Programming Techniques" presented at GECCO 2017 (Andrés Felipe Cruz Salinas, Jonatan Gómez Perdomo). This repository contains the source code to reproduce the experiments mentioned on the paper.
- Java 8
- A Genetic Algorithm with real encoding (GA)
- Hybrid Adaptive Evolutionary Algorithm (HAEA) Paper link
- Adaptive Operators Evolutionary Algorithm (AOEA) [This is the proposed approach of this work]
A number of benchmarking functions were implemented in the package benchmarking.real. Every experiment consists of run an algorithm by a certain number of iterations. Each experiment is repeated K times in order to analyze the average results of the algorithms. Since repeating the experiments can take a lot of time, we divide the computation on different threads. The number of experiments that are run sequentally on a single thread is defined by the user.
The experiments configuration is read from a file with the given format:
ALGORITHM_NAME
FUNCTION_NAME;DIMENSION;OUPUT_FILENAME;POPULATION_SIZE;ITERATIONS;OPERATORS_POPULATION_SIZE;NUMBER_OF_RUNS
...
...
- ALGORITHM_NAME : Either GA, HAEA or AOEA
- FUNCTION_NAME : The name of the function to optimize, the names of the implemented functions are: [plane, schwefel, rastrigin, shubert2d, h1, centraltwopeaktrap, himmelblau, griewangk, rosenbrocksaddle, twopeaktrap, bohachevsky2, bohachevsky1, cigar, schaffer, jong1, ackley, jong3, jong2]
- OUPUT_FILENAME : This is the prefix of the generated result files.
- POPULATION_SIZE : The size of the candidate solutions population.
- ITERATIONS : The number of iterations to run the algorithm.
- OPERATORS_POPULATION_SIZE : The size of the operators population. If ALGORITHM_NAME is not AOEA, this parameter is ignored. but a numerical value must be provided (it can be anything).
- NUMBER_OF_RUNS : The number of times an experiment is repeated.
Each experiment configuration is separated by a new line after ALGORITHM_NAME.
java MainRealExperiment CONFIG_FILE EXPERIMENTS_PER_THREAD
-
EXPERIMENTS_PER_THREAD : The number of experiments to be computed sequentially on each thread. if you want to run on a single thread, please set this setting accordingly.
-
CONFIG_FILE : The path of the configuration file described above.
There a three files generated by each experiment:
-
Log file: Its name is: the name of the function, its configuration, and the date. It informs every time an experiment is started, and the final value. It is useful to check how much experiments has been run.
-
Avg Results per generation file: This file contains the best, wost, median and stdev of the fitness value of each iteration. As a experiment configuration may be run more than once, the value per iteration is the average of all the runs (over all the NUMBER_OF_RUNS times).
-
Last Generation File per experiment run: This file contains exactly NUMBER_OF_RUNS lines, each line contains the best individual of each run.
-
Best operators (optional): If NUMBER_OF_RUNS == 1 and ALGORITHM_NAME == AOEA then a bestOperators file is generated. It contains the operators population per generation. Each operator of a generation is composed by 4 lines:
-
An unique id between 0 and OPERATORS_POPULATION_SIZE - 1
-
The rate of that operator in current generation
-
A pre-order of the operator tree separated by whitespaces
-
A in-order of the operator tree separated by whitespaces
Each label of a node is composed by: NODELABEL_HASHCODE, the hashcode is used to avoid ambiguities on the tree construction. To reconstruct the operators, apply an standard tree construction algorithm using the provided pre-order and the in-order.
Note: The hashcode should be removed in order to perform analysis of the tree structures, such as computing tree edit distances.
- We recommend to be careful on setting EXPERIMENTS_PER_THREAD to avoid an excessive CPU utilization.
- The algorithms were designed to maximize functions, so every function that is minimized on the testbed is multiplied by -1 (and will appear like that on the results files).
- Although this implementation was developed with efficiency in mind, is not fully optimized to be used at production. We provide this code to support the reproducibility of the proposed algorithm. Use it at your own risk.
- We provide the files "config_aoea", "config_ga" and "config_haea" to optimize the functions with the parameters mentioned on the paper.
Any comments are welcome at [email protected]