# Mining Haul Dispatch

> Haul dispatch for open-pit mines: a linear program plans haul flows inside the coal-quality band, and each truck goes to the excavator furthest behind plan, with the reason logged.

Send each truck where the plan needs it, and say why.

- URL: https://weaveward.com/work/mining-haul-dispatch
- Year: 2026
- Industry: Mining
- Capabilities: Business systems, Data & dashboards, AI solutions
- Technologies: Python, SciPy, HiGHS, SimPy, NetworkX, NumPy, FastAPI, Pydantic, React, TypeScript, Vite, TanStack Query

## The challenge

Without coordinated dispatch, haul trucks bunch up: a queue forms at one excavator while another stands idle, opposing trucks meet on single-lane ramps and the fuel bay jams at shift change. In an open-pit coal or nickel mine, every truck cycles between excavators, haul roads, dumps or the ROM stockpile and the fuel bay, so a delay at one point spreads through the whole cycle.

Weighbridge records show under- and overloaded trucks, and the coal sent to the stockpile has to stay inside a calorific-value and ash band. Sites already collect truck GPS, CCTV, weighbridge and fuel data, but nothing turns those signals into dispatch and traffic decisions with a reason a supervisor can check.

## What we built

Mining Haul Dispatch pairs a two-stage dispatch engine with a shift simulator, a FastAPI service and a supervisor dashboard built around the pit map.

- **A haul plan inside the blend band.** A linear program sets the target flow on every excavator-to-dump route within dig rates, dump capacities, truck hours and the calorific-value and ash band at the ROM stockpile, and reports the binding limits and the value of one more truck
- **Truck assignments with reasons.** When a truck finishes dumping, it goes to the excavator furthest behind its planned flow, net of the time to get there. Every decision stores its reason, the candidates it weighed and the runner-up
- **Safe single-lane ramps.** Time-window bookings keep opposing trucks off the same single-lane segment, with priority for loaded trucks climbing, and an entry gate enforces the rule on the road
- **Refuelling spread across the shift.** Refuel trips are inserted when the predicted fuel-bay queue is short, instead of every truck refuelling in the shift-change rush
- **Payload compliance.** Every load is checked against the 10/10/20 payload policy, and weighed tonnes are reconciled with the plan
- **Sensor adapters.** Adapters turn 1 Hz truck GPS, CCTV queue counts, weighbridge tickets and fuel telemetry into typed readings. A queue counter is ready for a vision model, and congestion detection confirms slow GPS speeds with camera counts
- **Policy comparison by simulation.** A SimPy model of a 12-hour shift with breakdowns runs the same dispatch code to compare fixed assignment, dynamic dispatch, and dynamic dispatch with fuel scheduling and ramp control, with 95 percent confidence intervals

## How it works

### Model the haul roads

The pit is a directed graph of excavators, dumps, the ROM stockpile, intersections, the fuel bay and single-lane ramps with passing bays. Each road carries its length, a grade from elevations and loaded and empty travel times from a grade-speed table capped by posted limits.

### Plan the haul flows

An upper-stage linear program on SciPy's HiGHS solver maximises tonnes per hour, then a second stage keeps that output and minimises the trucks the plan needs. The plan is solved again whenever an excavator or a truck breaks down or returns to work.

### Dispatch at decision points

When a truck finishes dumping, the lower stage assigns it to an excavator and inserts a refuel trip when the bay is quiet. A loaded truck is routed to the planned dump route furthest behind its share, and under ramp control it books its climbs when loading starts, so empty trucks coming down wait at a passing bay.

### Stream the shift

A FastAPI service serves the plan, decisions, KPIs and payload reports, and a WebSocket streams the shift to the React dashboard: the pit map with moving trucks and queues, the decision log, the haul plan with a what-if control, payload compliance and the policy comparison.

## Engineering insights

The engine follows the two-stage scheme long used in mine dispatch: an upper stage plans the flows, and a lower stage assigns each truck against that plan and records why. The same dispatch code drives both the simulator and the dashboard.

- **Assign by minutes behind plan.** Each empty truck goes to the face furthest behind plan in minutes of planned digging, counting trucks already sent and accruing the gap across re-plans, net of travel and half the predicted queue. Trucks that decide at the same instant, as at shift start, are matched jointly with the Hungarian method, so the first cannot take the nearest needy face and strand the next on a long empty haul
- **Two layers keep single-lane ramps safe.** Bookings clear opposing windows by a margin and let a loaded climb displace waiting empty trucks, while an entry gate refuses any truck that would meet opposing traffic, whatever the bookings say. A property test over random booking sequences checks that invariant
- **The coal band stays linear.** A calorific-value or ash limit bounds a tonnage-weighted average, so each bound becomes one linear row: over the coal routes, flow times the quality's margin to the limit must sum to at least zero. When one seam alone cannot meet the band, the plan reports the stockpile shortfall instead of failing
- **Empty trucks may return to another face.** Loaded and empty flows are separate variables tied by conservation, so the plan can send an empty truck to the nearer face instead of back to its own. A second stage then minimises the trucks the plan needs, so spare trucks become visible
- **Policies compared on common random numbers.** Every random source draws from a stream keyed by seed, replication, source and entity, so all policies see the same breakdowns, load times and payloads. Results are paired differences with t-intervals, and an interval that spans zero is reported as inconclusive

## Design system

Pit daylight is a light operations interface for shift supervisors and mine planners in bright site offices. The pit map leads, numbers follow, and the reason for every decision is one click away.

- **Colour.** Warm sand surfaces sit under white panels and ink text. Haul orange marks trucks, primary actions and the selected item, flow teal marks planned flow and on-plan state, and amber and red are kept for things that need a response, such as queues, overloads and breakdowns
- **Typography.** IBM Plex Sans for interface text, headings and map labels, and IBM Plex Mono with tabular figures for every number, both bundled through @fontsource with no font CDN
- **Components.** In-house React components over CSS custom properties and CSS modules: a layered SVG pit map, KPI tiles with sparklines, status pills, a decision log with a candidate table, confidence-interval charts and a payload histogram with 110 and 120 percent reference lines
- **Accessibility.** Status is carried by shape and label as well as colour, so a waiting truck becomes an amber square and a broken-down one a red square. Text contrast meets WCAG AA and is tested in code, map trucks are keyboard operable and motion respects reduced-motion settings

## Where this fits

Open-pit mines and quarries that run haul fleets can start from the same engine: a plan that respects quality limits, assignments that explain themselves and single-lane rules enforced in code. Explore our [business systems](/services/business-systems), [analytics dashboards](/services/data-analytics-dashboards) and [AI solutions](/services/ai-solutions), or [talk about your haul operation](/contact).
