Source

PyCGA /

Filename Size Date modified Message
139 B
1.3 KB
8.7 KB
1.6 KB
1.6 KB
1.2 KB

PyCGA

PyCGA is a simple implementation of Compact Genetic Algorithm (cGA) written in Python for educational purposes. It implements a simple OneMax fitness function and a trap-5, as well as a (very simple and very biased) method of solving the said trap. PyCGA can also plot simple graphs showing how the fitness score and the state of each member inside the probability vector change as our algorithm "evolves" through generations.

Dependencies

  • Python version 2.7.3 or any later version in the Python 2.7 series
  • matplotlib (optional) for graph plotting

Usage

Just run PyCGA in your favorite terminal emulator, like the following examples:

python PyCGA.py

or (if the PyCGA.py script has execute permission)

./PyCGA.py

Which should be more than enough to start PyCGA with the default parameters.

For more information, such as how to enable graph plotting or change various parameters of PyCGA, please consult PyCGA's help, which can be invoke using the following commands:

python PyCGA.py --help

or

./PyCGA.py --help

References