maky-hnou / Genetic_Algorithm

A genetic algorithm that guesses the right answer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Genetic Algorithm

Python version GitHub issues GitHub forks GitHub Stars License

About this repo:

An implementation of a genetic algorithm that guesses the right answer(string) using the mutation operator.
It has been developed on Ubuntu 18.04 using python 3.6.

Content:

  • example.py: The file containing the Genetic Algorithm example.

Try the example:

gene_set contains the set of chars (genes) that strings (generations) will be formed of.
The first iteration, a string (agent) will be randomly generated, its fitness value will be calculated using get_fitness(). Then the mutation operator will be applied every iteration and the fitness value will be calculated. This process will be repeated until we get a convergence to the target string.

N.B: The convergence may take long time since there is nothing preventing the same mutation to appear in the different generations.

About

A genetic algorithm that guesses the right answer

License:GNU General Public License v3.0


Languages

Language:Python 100.0%