Home
Solvor all your optimization needs.
solvOR is a pure Python optimization library designed for learning and experimentation. No numpy, no scipy, no compiled extensions. Each algorithm fits in one readable file you can study, modify, and extend.
Learn optimization by reading the code.
Why solvOR?¶
-
Readable Code
Every algorithm is implemented in clear, documented Python. No magic, no hidden complexity. Perfect for understanding how solvers actually work.
-
Educational First
Designed for students and learners. Each solver includes Wikipedia links, complexity analysis, and practical tips. Learn the theory by reading working code.
-
Easy to Customize
Want to add a custom heuristic? Modify the neighborhood function? Everything is accessible Python you can copy, tweak, and experiment with.
-
Practical Performance
While not as fast as OR-Tools on large instances, solvOR handles real problems effectively. Solves Sudoku instantly, TSP-100 in seconds, and scales to thousands of variables for many problem types.
Quick Start¶
What's in the Box?¶
| Category | Algorithms | Learn About |
|---|---|---|
| Linear Programming | solve_lp, solve_milp |
Simplex method, branch and bound |
| Constraint Programming | solve_sat, Model, solve_exact_cover |
SAT solving, Dancing Links |
| Metaheuristics | anneal, tabu_search, lns, evolve |
Local search, genetic algorithms |
| Continuous Optimization | adam, bfgs, nelder_mead, bayesian_opt |
Gradient descent, quasi-Newton methods |
| Graph Algorithms | dijkstra, astar, bellman_ford, floyd_warshall |
Shortest paths, A* search |
| Graph Analysis | topological_sort, scc, pagerank, louvain, kcore |
Dependency order, centrality, community detection |
| Network Flow | max_flow, min_cost_flow, kruskal, prim |
Ford-Fulkerson, MST algorithms |
| Combinatorial | solve_knapsack, solve_bin_pack, solve_job_shop |
Dynamic programming, scheduling |
| Assignment | solve_hungarian, network_simplex |
Hungarian algorithm |
Choosing an Algorithm¶
I need a provably optimal solution:
- Linear constraints, continuous variables →
solve_lp - Integer or binary variables →
solve_milp - Boolean satisfiability →
solve_sat - Complex constraints (all-different, etc.) →
Model
A good solution quickly is fine:
- Have a starting point →
tabu_searchoranneal - Continuous, no gradients →
nelder_mead - Expensive evaluations →
bayesian_opt
Graph or network problem:
- Shortest path →
dijkstra,astar,bellman_ford - Maximum flow →
max_flow - Spanning tree →
kruskal,prim - Dependencies →
topological_sort,strongly_connected_components - Node importance →
pagerank,kcore - Communities →
louvain
Popular Examples¶
-
Constraint programming with
all_different. Classic puzzle, elegant solution. -
Tabu search for TSP. See how local search escapes local optima.
-
A* pathfinding on a 2D grid. Understand heuristics in action.
-
Place N queens with no conflicts. A constraint satisfaction classic.
All cookbook examples · More examples
Philosophy¶
Design principles
- Working > perfect — Ship code that solves problems
- Readable > clever — Tomorrow-you needs to understand today-you's code
- Simple > general — Solve the problem at hand, not all possible problems
solvOR is not trying to compete with production solvers like OR-Tools, Gurobi, or CPLEX. It's designed to help you understand how these algorithms work, so you can make informed decisions about which tools to use and how to apply them.