or-tools-wasm lets you run Google OR-Tools directly in the browser. OR-Tools is a mathematical optimization library: it helps choose the best plan when there are many possible choices, rules, and tradeoffs.
You can use it for problems like planning delivery routes, assigning people to tasks, packing items under limits, scheduling work, or making the best use of limited resources. This WebAssembly package makes those solvers available from JavaScript and TypeScript, so demos and browser-based planning tools can run without a separate solver backend.
Source code is available on GitHub, and the package is on npm.
MathOpt (frontend)
Use MathOpt to route one model through selectable solver backends.
- Basic Model - switch between GLOP, GLPK, GSCIP, and CP-SAT
- Bakery Floor Planner - rolling MathOpt CP-SAT simulation with IncrementalSolver
- Sudoku Generator - MathOpt binary model with CP-SAT backend uniqueness checks
MPSolver (frontend)
Use MPSolver to route one linear model through selectable LP and integer backends.
- Basic Model - switch between GLOP, CLP, GLPK, SCIP, CBC, BOP, Knapsack, and SAT
- Network Design MIP - open shipping lanes and route demand
CP-SAT
Use CP-SAT for discrete optimization problems with integer, Boolean, scheduling, and logical constraints.
- Magic Square - fill a grid where every row, column, and diagonal has the same sum
- Model Playground - paste JSON CpModelProto text and solve it
- Schema Viewer - print embedded proto schemas
- Sports Scheduling - double round-robin minimization
- Steel Mill Slab - compare three solver variants
Routing
Use routing for vehicle routing, traveling salesperson, pickups and deliveries, capacities, and route constraints.
- Simple Routing - direct port of the basic OR-Tools example
- Vehicle Routing Problem - direct port of the VRP example
- Dispatch Map - multi-depot pallet delivery with animated routes
Network Flow
Use OR-Tools graph algorithms for max-flow, min-cost-flow, and linear sum assignment problems.
- Max Flow - direct port of simple_max_flow_program.py
- Min-Cost Flow - direct port of simple_min_cost_flow_program.py
- Linear Sum Assignment - direct port of assignment_linear_sum_assignment.py
GLOP
Use GLOP for continuous linear programs through the MPSolver API.
- Simple LP - direct port of simple_lp_program.py
- Stigler Diet - cost-minimizing diet LP with nutrient lower bounds
CLP
Use CLP for continuous linear programs through the MPSolver API.
GLPK
Use GLPK for continuous and mixed-integer linear programs through MPSolver, or as a MathOpt backend.
SCIP
Use SCIP for mixed-integer linear programs through MPSolver.
- Simple MIP - simple_mip_program.py model with SCIP
- Assignment With Task Sizes - binary MIP from the OR-Tools samples
CBC
Use CBC for mixed-integer linear programs through MPSolver.
BOP
Use BOP for Boolean and integer programming models through MPSolver.
Knapsack
Use the dedicated Knapsack API for 0-1 and multi-dimensional knapsack problems.
Set Cover
Use the dedicated Set Cover API for weighted set covering models and OR-Tools covering heuristics.
RCPSP
Use the CP-SAT-backed RCPSP API for resource-constrained project scheduling.
GSCIP
Use GSCIP for SCIP-backed mixed-integer optimization through MathOpt.
SAT
Use the SAT integer backend for MPSolver mixed-integer linear models.