In June 1947 the US Air Force set up a small team to mechanise its planning. Its chief mathematician, George Dantzig, wrote down the linear programming model that July. By the end of the summer he had the simplex method to solve it.
"Programming" meant planning. There was hardly a computer to program. Five years later, Charnes, Cooper and Mellon showed in Econometrica how an oil company could use the same maths to blend aviation fuel.
Blending, scheduling, routing, allocating scarce capacity: supply chain was one of the first customers of optimisation. Seventy-nine years on, the solvers are free, they run on a laptop, and an AI assistant will write the model for you in a minute.
What has not changed is the choice. There are now dozens of Python libraries for optimisation and simulation, with overlapping names and very different strengths. This post is a map: what exists, what each one is for, and which to reach for first.
What these libraries are
Two families do two different jobs.
Optimisation answers "what is the best plan, given my rules?" You describe decisions (how many to make, which truck goes where), constraints (capacity, due dates) and a goal (lowest cost). A solver searches for the best answer and proves how good it is.
Simulation answers "what happens to this plan when real life hits it?" You describe a process (a line, a dock, a returns desk) with its variability, and the library plays it out thousands of times. It does not find the best plan. It tells you how a given plan behaves.
Inside optimisation there is a second split that confuses most newcomers: the modelling layer versus the solver. The modelling layer is the language you write the problem in. The solver is the engine that crunches it. PuLP and Pyomo are languages. CBC, HiGHS and Gurobi are engines. You can usually swap the engine without rewriting the model.
Modelling layers
| Library | Owner and licence | Good at | Notes |
|---|---|---|---|
| PuLP | COIN-OR, MIT | Linear and mixed-integer models, readable code | Version 4.0 (September 2026) changed the syntax and no longer bundles the CBC solver. Older tutorials, and AI trained on them, may write code that breaks. |
| Pyomo | Pyomo project, BSD | Large, structured or nonlinear models | More to learn than PuLP, but scales to serious models with many solver options. |
| CVXPY | Open source, Apache 2.0 | Convex problems: fitting, smoothing, portfolio-style trade-offs | Checks that your problem is convex before it solves it. |
| linopy | PyPSA, MIT | Very large models built from tables and arrays | Born in energy-system planning, fits network and capacity models. |
| python-mip | COIN-OR, EPL 2.0 | Mixed-integer models with fine control | Works with CBC and Gurobi. |
Solvers
| Solver | Licence | Notes |
|---|---|---|
| HiGHS | MIT | Fast open-source solver for linear and mixed-integer problems. SciPy's `milp` and `linprog` run on it, so if you have SciPy, you already have it. |
| CBC | Open source (COIN-OR) | The old default behind PuLP. Still fine for small and medium models. |
| Gurobi | Commercial | Among the fastest for hard mixed-integer models. The pip version is capped at 2,000 variables and 2,000 constraints, for evaluation only. Free for academics. |
| Hexaly | Commercial | Formerly LocalSolver. Strong on routing, scheduling and nonlinear problems. |
| NVIDIA cuOpt | Apache 2.0 since 2025 | Runs on a GPU. Linear programs and vehicle routing at large scale. PuLP can call it. |
Specialists for scheduling and routing
| Library | Licence | Good at |
|---|---|---|
| Google OR-Tools | Apache 2.0 | CP-SAT for scheduling with sequencing, shifts and "if this, then not that" rules. A routing library for vehicle routing. Version 10 is in release candidate since 23 November 2026. |
| PyVRP | MIT | Vehicle routing with time windows, multiple depots, mixed fleets and pickups. |
| Timefold | Apache 2.0 | Strong for rostering, but its Python version was discontinued in 2025. Java and Kotlin only now. |
Simulation
| Library | Licence | Good at |
|---|---|---|
| SimPy | MIT | Discrete-event simulation of processes: lines, docks, forklifts, queues. The default choice. |
| salabim | MIT | The same kind of simulation, with built-in 2D and 3D animation to show stakeholders. |
| Ciw | MIT | Queueing networks: customer classes, priorities, people giving up and leaving the queue. |
| Mesa | Apache 2.0 | Agent-based models, where many suppliers, customers or drivers each follow their own rules. |
| AnyLogic and anyLogistix | Commercial | Visual tools with a graphical editor, for network design and digital twins. AnyLogic models can be driven from Python. |
And for people who live in spreadsheets: Excel's own Solver handles up to 200 decision cells. OpenSolver removes that limit, but its last release dates from 2020.
What it means for supply chain
The single most useful question is not "which library is best?" It is "what am I asking?"
| If your question is... | Reach for | Example |
|---|---|---|
| What should I make, buy or ship, at lowest cost? | PuLP with HiGHS | Weekly production plan, purchase allocation across suppliers |
| In which order, on which machine, in which shift? | OR-Tools CP-SAT | Line sequencing with changeovers, maintenance windows |
| Which truck visits which stops, and when? | OR-Tools routing or PyVRP | Daily delivery tours with time windows |
| The model works but takes hours, or will run every night | Pyomo or linopy, with Gurobi or Hexaly | Network design, multi-echelon capacity plans |
| Will this plan survive delays and breakdowns? | SimPy | Dock door count, line buffer size |
| How long will people wait, and how many give up? | Ciw | Customer service desk, returns counter |
| What happens when hundreds of actors react to each other? | Mesa | Bullwhip effect, supplier allocation in a shortage |
| I need to show it to a board, not to a developer | salabim, or AnyLogic | Animated warehouse layout |
A few patterns I see again and again:
- Start with PuLP and HiGHS. It covers most planning problems a single team has, it is readable, and it costs nothing. Move up only when a model gets too big or too slow.
- Scheduling is a different animal. Sequencing and shift rules are painful in a linear model and natural in CP-SAT. If your model has lots of "either this or that" binaries, try it there.
- Do not build your own routing. Routing is a solved problem with excellent free libraries. Your time is better spent on clean addresses and real drive times.
- Simulate before you commit. An optimiser assumes everything goes to plan. A simulation shows what happens when it doesn't. The two together are worth more than either alone.
- Keep the Excel model as a check. For small problems, Solver in a spreadsheet is a fine way to show a manager that the Python answer makes sense.
That fourth point is the one most teams skip. So here is a way to see it for yourself.
Try this: optimise a plan, then try to break it
This prompt needs an AI assistant that can write and run Python (Claude with code execution, ChatGPT with data analysis, or your own setup). It builds a week's plan for one assembly line at a fictional bicycle maker, then stress-tests it. All numbers are illustrative.
You are an operations research analyst helping a production planner.
Task, part 1 (optimise): Build a weekly production plan for one assembly line, Monday to Friday, using PuLP with the HiGHS or CBC solver (if PuLP will not run, use scipy.optimize.milp). Show the code.
Rules:
- The line has 15 hours per day.
- Each model that runs on a day costs a changeover of 1 hour and 250 EUR.
- Hours per bike: Road 0.20, Gravel 0.25, E-road 0.40, E-gravel 0.45.
- Bikes left in stock overnight cost 3 EUR per bike per night.
- Demand must be met by the end of its day. No backorders. Early production is allowed.
- Minimise changeover plus holding cost.
Demand (bikes due by end of day):
model,Mon,Tue,Wed,Thu,Fri
Road,10,10,10,30,10
Gravel,0,20,20,0,24
E-road,8,8,8,8,8
E-gravel,0,0,10,10,0
Task, part 2 (simulate): Using SimPy, run the plan for 1,000 simulated weeks. Each changeover takes 75% to 125% of planned time, each bike 85% to 115% (uniform). Each day has a 10% chance of a stoppage of 1 to 3 hours. Overtime is any time beyond 15 hours on a day.
Task, part 3: Re-optimise with the planned load capped at 13.5 hours per day, simulate again, and compare.
Output: a table per plan (bikes per model per day, planned hours per day, cost), then a comparison table: cost, share of weeks with any overtime, average overtime hours per week. End with three sentences of advice to the planner, and list your assumptions.What you should see
Run as written, the first plan costs 2,282 EUR and loads Monday, Wednesday and Thursday to exactly 15.0 hours. That is what optimisers do: they use every minute you give them. The exact split of bikes over the days can differ between runs, but the cost should not.
The simulation then shows the price of that precision. The 15-hour plan needed overtime in about 9 out of 10 weeks, on more than one and a half days per week on average. The capped plan cost 2,939 EUR, so 657 EUR more, and needed overtime in roughly 1 week in 4. Your simulated figures will move by a few points with the random draws.
Why this shows the point
Neither number is the answer on its own. The optimiser says the cheap plan is best. The simulation says it is best only if nothing ever goes wrong. Whether 657 EUR a week is worth fewer overtime calls is a business decision, and now it is one you can make with numbers instead of gut feel.
A good answer questions its own result. If the assistant calls the first plan "optimal" and stops, push it to part 2.
What it can't do, and the traps
- Garbage in, optimal garbage out. A solver trusts your run rates and costs completely. One wrong changeover time gives you a confidently wrong plan.
- AI writes old code. PuLP 4.0 changed its syntax in September 2026, and Timefold dropped Python in 2025. Ask the assistant to check the installed version and to run the code, not just write it.
- "Optimal" means optimal for the model. Anything you left out (a skill constraint, a supplier's minimum order) the solver will happily violate. Show the plan to the person who runs the line before you trust it.
- Simulation is only as good as its variability. Uniform 85% to 115% is a guess. Use real cycle times and stoppage logs where you have them.
- Free licences have edges. Gurobi's pip licence stops at 2,000 variables, and production use needs a paid licence. Check before a pilot becomes a process.
Simulate the plan you already have
You do not need to start with optimisation. Take this week's real plan for one line, dock or desk, and ask an AI assistant to simulate it in SimPy with the stoppages you remember from last month. If it breaks in the simulation, it was going to break on Thursday.
Dantzig's team built linear programming to plan an air force. You can now run the same ideas on a laptop before your morning coffee. The maths is no longer the bottleneck; knowing which question to ask is.
Which planning decision in your team would you most like to see optimised, or stress-tested?
Sources
- PuLP on PyPI, including the 4.0 migration note
- Pyomo documentation
- Google OR-Tools and OR-Tools releases
- HiGHS and SciPy milp, a wrapper of HiGHS
- CVXPY, linopy and python-mip
- Gurobi: size-limited pip licence and academic licences
- Hexaly
- NVIDIA: cuOpt open source under Apache 2.0
- PyVRP
- Timefold Solver 1.25 release notes (Python support dropped)
- SimPy, salabim, Ciw and Mesa
- anyLogistix
- Microsoft: Excel Solver and OpenSolver
- Charnes, Cooper and Mellon, Blending Aviation Gasolines (Econometrica, 1952)
- National Academies memorial tribute to George Dantzig




