ParGA is a parallel genetic algorithm library written in Rust with Python bindings via PyO3. It delivers 5-50x speedups over pure Python GA libraries by auto-selecting the best execution strategy based on your fitness function’s cost.
Features
- Unified API: Single
GAclass that auto-selects the best execution strategy - Auto-Parallelization: Automatically parallelizes expensive fitness functions
- Island Model: Multiple migration topologies (ring, star, ladder, fully connected, random)
- Diverse Operators: Tournament, roulette, and rank selection; single-point, two-point, uniform, and blend crossover; Gaussian, uniform, and polynomial mutation
- Rust Backend: Fast execution for lightweight fitness functions
- Process Pools: Parallel pools for expensive fitness evaluations
Installation
# Python
pip install parga
# Rust
# Add to Cargo.toml:
# parga = "0.1"
Quick Start
from parga import GA
def fitness(x):
return sum(xi ** 2 for xi in x)
ga = GA(fitness_fn=fitness, dimensions=10)
result = ga.run()
The library measures your fitness function’s cost during initialization and picks the most efficient strategy automatically: Rust backend for fast functions, parallel process pools for expensive ones.