This project implements a Genetic Algorithm (GA) in Python, designed for solving optimization problems. The GA is capable of minimizing multi-dimensional functions through evolutionary techniques inspired by biological processes.
This is a personal project developed for educational purposes. For more mature and robust implementations of GA, check out:
- Crossover: Combines pairs of individuals to produce offspring, ensuring diversity and exploration of the solution space.
- Mutation: Introduces random changes in the offspring, aiding in diversity and preventing premature convergence.
- Tournament Selection: Selects the best candidates as parents for the next generation, based on their fitness.
- GA Minimize Function: Orchestrates the GA process to minimize a given multi-dimensional function.
- Python 3.x
- NumPy
- (Optional) Matplotlib for any graphical representation of results
- Clone the repository:
git clone https://github.com/jhklarcher/genetic-algorithm.git
- Navigate to the cloned directory.
- Install the package:
pip install .
- Import the GA function:
from genetic_algorithm import ga_minimize
- Define your optimization problem as a function.
- Call
ga_minimize
with your function and other GA parameters.
See the examples directory for some usage examples.
Distributed under the MIT License. See LICENSE
for more information.