A practical application of Genetic Algorithms to optimize functions.
Schaffer's F6
Consider the following function:
In this case, each chromosome will have a 44-bit word, with k_i = 22 bits to each variable of the problem. The function to convert this representation to a real number is:
where:
With that, we define the parameters for the algorithm (F6 as the fitness function, a fixed mutation and crossover rates, a fixed population size), and follows these steps:
Where the termination criterion is a fixed number of generations.
$ git clone https://github.com/tonisidneimc/Genetic-Algorithm/
$ cd Genetic-Algorithm
$ make
It may vary due to randomness in the evolution process, but running the algorithm a few more times or with higher mutation rates or higher number of generations may converge better.