tonisidneimc / Genetic-Algorithm

A practical application of Genetic Algorithms to optimize functions.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Genetic-Algorithm

A practical application of Genetic Algorithms to optimize functions.

Schaffer's F6

How-to

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.

Running

$ git clone https://github.com/tonisidneimc/Genetic-Algorithm/
$ cd Genetic-Algorithm
$ make

Output

output

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.

About

A practical application of Genetic Algorithms to optimize functions.

License:Apache License 2.0


Languages

Language:Python 99.1%Language:Makefile 0.9%