Drag to orbit. Click, then scroll to zoom.
Halgoworks: six optimization problems, solved step by step
Six classic optimization problems, solved in your browser by real algorithms written in C#. Pick one and watch every decision as it's made, with the reasoning spelled out.
Simulated annealing searching for the lowest valley. Uphill steps are accepted less often as it cools; red dots are rejected steps. The pin marks the deepest valley found so far.
Six problems, one question: what's the best choice?
Each asks for the best option among more possibilities than anyone could ever check. Four of them have no known fast exact method, so the labs show both exact algorithms and the shortcuts used in practice. The last two are the exceptions, and one is the other in disguise.
-
Open the lab
Vehicle routing
Plan routes for a fleet of trucks delivering to many customers, within truck capacity and delivery deadlines, at the lowest fuel cost.
-
Open the lab
Knapsack
Choose the most valuable combination of items without going over a weight or budget limit.
-
Open the lab
Job-shop scheduling
Order operations on shared machines so every job finishes as early as possible, respecting each job's sequence.
-
Open the lab
Bin packing
Fit items of different sizes into as few fixed-size containers as possible.
-
Open the lab
Maximum flow
Push as much as possible from a source to a sink through a network whose links have limited capacity.
-
Open the lab
Bipartite matching
Pair up as many members of two groups as possible, using only allowed pairs and nobody twice. Solved by turning it into a maximum flow.
Why checking everything is hopeless
Work needed to guarantee the best answer by brute force, as the problem grows: subsets for knapsack, groupings for bin packing, visiting orders for routing, machine orders for a 5-machine job shop. Max flow is plotted with Edmonds–Karp's polynomial bound instead, and it barely leaves the floor.
- Vehicle routing
- Knapsack
- Job shop, 5 machines
- Bin packing
- Max flow (Edmonds–Karp)
How to read a lab
Every lab works the same way, so once you've used one you can read them all.
-
Pick an example
Each lab opens on a hand-picked example. Switch to another one or generate a random instance.
-
Choose an algorithm
Exact methods, greedy rules and local search side by side, on the same instance.
-
Play or step through
Space plays and pauses, the arrow keys step one decision at a time. Drag the timeline to jump.
-
Follow the amber
Amber always marks what the algorithm is looking at right now: in the picture, in the narration and in the pseudo-code.