The Lockkeeper's Ledger

New to canal locks? (30-second primer)

The canal climbs a hill as a staircase of flat pools. A lock is a small chamber between two pools with gates at each end. To lift a boat, the keeper lets it into the chamber at the low level, closes the gates and fills the chamber with water taken from the pool above; the boat floats up and leaves at the top. Going down, the chamber is emptied into the pool below.

So a chamber is always either low or high. If a boat arrives and the chamber is on the wrong side, the keeper must first turn it round with nobody inside (an empty turn). Every fill draws water from the pool above, and a pool may never drop below its minimum, so busy days can run the upper pools dry until water flows down from the summit feeder. There are only a few keepers, who walk the towpath between locks, and locks only work from 06:00 to 22:00.

The goal: get every boat through on time, weighting lateness by priority (a doctor's launch counts more than a holiday boat), using as little water as possible.

The canal

water narrowboat barge late / closed ● keeper

Timetable (Gantt)

Bars are lock operations (labelled with the boats aboard; hatched = empty turn). Grey = night, red = closure. Click to jump the animation there.

Why were boats late?

Every boat, every wait

Worked out from the simulation of the schedule minute by minute. Click a boat to follow it in the animation.

Disruption mode

Close a lock or hold a boat back, then re-plan. The page re-runs the scheduler (the same code as solve.js, shorter search) right here in your browser.

Close a lock
Lock day from for min
Delay a boat's release
by min
Disruptions
none yet
Search time

All data and code are inlined in this file; it works offline.