60% less demurrage
- Client: Iron ore producer, Brazil
- Scale: 6 million tonnes a year, 2 pits, 1 rail corridor, 35 vessels a year
- Team: 2 engineers, 10 weeks
- Stack: SWI-Prolog, Go, PostgreSQL
The client mines hematite and itabirite from two open pits, crushes and screens them into sinter feed and lump, and rails the product to a third-party port terminal, where it shares train slots and berths with larger producers. Each vessel arrives within a laycan, and each cargo must meet contract limits on Fe, SiO2, Al2O3 and P. Itabirite carries more silica than hematite, so the mix of the two largely sets a cargo’s silica, and that mix depends on which pit can feed which stockpile in time.
A slipped slot
The railway moves a train slot from Tuesday to Thursday. Before, the planner reworked one spreadsheet by hand: which pit could still feed which stockpile, whether the blend would still meet the vessel’s silica limit, and whether the vessel could still load inside its laycan. That took most of a day, often the night before loading. Too often the answer was to ship what was on the stockpile and take the penalty, or to let the vessel wait at anchor while demurrage accrued.
Now the slot confirmation reaches the scheduler, which replans in seconds, and the planner sees a proposal: which pit to draw from, which train carries which blend, and the expected grade of each cargo against its specification. The planner accepts it or edits it.
Nothing the client owned could do this. Mine planning software plans the pit over months and years, and the terminal’s system schedules berths without knowing anything about grade. The one scheduling package the client trialled could express train slots or blend constraints, but not both in the same plan.
What we built
- A constraint model in SWI-Prolog that proposes the weekly plan: which pit feeds which stockpile and which trains carry which blend, so that each cargo meets its specification within its laycan.
- Replanning in seconds when a train slot or a grade-control assay changes.
- A Go service that collects grade-control assays from the pits and slot confirmations from the railway, and alerts the planner when a cargo drifts toward a penalty.
Rules nobody had written down
The first plans the scheduler proposed were feasible on paper, and the planner rejected about half of them. They broke rules that existed only in people’s heads: one loader could not feed both stockpiles in the same shift, and the railway would not split a train between two blends even where the contract allowed it. Each rejection became a constraint. By the fourth week, the planner accepted most proposals with small edits.
Results
| Before | After | |
|---|---|---|
| Cargoes with a silica penalty | about 1 in 8 | 1 of 38 |
| The weekly plan | 2 days | 1 hour |
| A buyer’s change of specification | a day | minutes |
The 38 are all cargoes since go-live. Demurrage days fell 60% in the first two quarters after go-live, against the same two quarters a year earlier. The terminal’s line-up was about as long in both periods, so the drop in demurrage is not a quieter port.
The planner runs the scheduler every week. When a new rule turns up, such as a maintenance window on the railway, we add it as a constraint, usually the same day.