A Genetic Algorithm Framework in pyThon
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.
Via pip:
pip install gaft
From source:
python setup.py install
from gaft import GAEngine
from gaft.components import GAIndividual
from gaft.components import GAPopulation
from gaft.operators import RouletteWheelSelection
from gaft.operators import UniformCrossover
from gaft.operators import FlipBitMutation
# Analysis plugin base class.
from gaft.plugin_interfaces.analysis import OnTheFlyAnalysis
See example 01 for a one-dimension search for the global maximum of function f(x) = x + 10sin(5x) + 7cos(4x)
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)
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.
- ✅ Parallelization
- 🏃 Add more built-in genetic operators with different algorithms (-)
- 🏃 Add C++ backend (-)