← all repositories
guofei9987/scikit-opt

Python metaheuristic toolkit with hot-swappable genetic operators

scikit-opt bundles seven swarm-intelligence algorithms into a single Python package and lets you override their internal genetic operators without subclassing.

6.6k stars Python Other AI
scikit-opt
Not currently ranked — collecting fresh signals.
star history

What it does scikit-opt collects Genetic Algorithm, Particle Swarm Optimization, Simulated Annealing, Ant Colony, Immune Algorithm, Artificial Fish Swarm, and Differential Evolution behind a uniform Python API. You define an objective function, set bounds, and optionally add equality or inequality constraints; the library returns a best-fit solution. A dedicated GA_TSP subclass redefines crossover and mutation to solve Traveling Salesman problems on permutation chromosomes.

The interesting bit The library’s UDF (user-defined function) system lets you hot-swap genetic operators—selection, crossover, mutation, ranking—at runtime via a register() call instead of maintaining a fork. It also supports resumable optimization: you can run a few iterations, inspect the state, and call run() again to continue from where you left off.

Key highlights

  • Implements GA, PSO, DE, SA, Ant Colony, Immune, and Artificial Fish Swarm under one import namespace.
  • Supports both equality (constraint_eq) and inequality (constraint_ueq) constraints.
  • Provides vectorized, multithreaded, multiprocessing, and cached evaluation modes.
  • Ships with a built-in operator catalog for GA that can be mixed, matched, or overridden via UDF registration.
  • Includes GA_TSP, a permutation-aware genetic algorithm for route optimization.

Caveats

  • GPU support is explicitly experimental and targeted for stability in version 1.0.0.
  • The README demonstrates every algorithm with quick-start snippets but offers little guidance on which solver fits which problem shape.

Verdict Use this if you want to prototype metaheuristic pipelines or experiment with custom genetic operators without building a framework from scratch. Pass if you need industrial-grade, domain-specific optimizers with formal convergence guarantees.

Frequently asked

What is guofei9987/scikit-opt?
scikit-opt bundles seven swarm-intelligence algorithms into a single Python package and lets you override their internal genetic operators without subclassing.
Is scikit-opt open source?
Yes — guofei9987/scikit-opt is open source, released under the MIT license.
What language is scikit-opt written in?
guofei9987/scikit-opt is primarily written in Python.
How popular is scikit-opt?
guofei9987/scikit-opt has 6.6k stars on GitHub.
Where can I find scikit-opt?
guofei9987/scikit-opt is on GitHub at https://github.com/guofei9987/scikit-opt.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.