indieyourself / gaft

A Genetic Algorithm Framework in Python

Home Page:https://pypi.python.org/pypi/gaft/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GAFT

A Genetic Algorithm Framework in pyThon

Build Status

image

Code Health

platform

versions

Introduction

gaft is a Python Framework for genetic algorithm computation. It provide built-in genetic operators for genetic algorithm optimization and plugin interfaces for users to define your own genetic operators and on-the-fly analysis for algorithm testing.

gaft is now accelerated using MPI parallelization interfaces. You can run it on your cluster in parallal with MPI environment.

Installation:

  1. Via pip:

    pip install gaft
  2. From source:

    python setup.py install

Example:

1. Importing

2. Define population

3. Create genetic operators

4. Create genetic algorithm engine to run optimization

5. Define and register fitness function

6. Define and register an on-the-fly analysis (optional)

7. Run

8. Evolution curve

image

9. Optimization animation

image

See example 01 for a one-dimension search for the global maximum of function f(x) = x + 10sin(5x) + 7cos(4x)

Global maximum search for binary function

image

See example 02 for a two-dimension search for the global maximum of function f(x) = y*sin(2*pi*x) + x*cos(2*pi*y)

Plugins

You can define your own genetic operators for GAFT and run your algorithm test.

The plugin interfaces are defined in /gaft/plugin_interfaces/, you can extend the interface class and define your own analysis class or genetic operator class. The built-in operators and built-in on-the-fly analysis can be treated as an official example for plugins development.

TODO

  1. ✅ Parallelization
  2. 🏃 Add more built-in genetic operators with different algorithms (-)
  3. 🏃 Add C++ backend (-)

About

A Genetic Algorithm Framework in Python

https://pypi.python.org/pypi/gaft/

License:MIT License


Languages

Language:Python 100.0%