The problem
Given n trucks and several simultaneously active haul
routes - each with its own shovels, cycle time, load time and payload -
how many trucks should run on each route to maximise total tonnes?
Because of queueing, this is not a proportional
split. Production on each route is concave in fleet size (each extra
truck queues more than the last), which has a very convenient
consequence: a greedy algorithm that always gives the next truck
to the route with the highest marginal tonnes is optimal for
concave separable objectives. deploy_fleet() implements
exactly that, with the marginal tonnes computed from the finite-source
queue model.
Route table format
routes <- haul_example("routes")
knitr::kable(routes)| route_id | material | n_shovels | cycle_min | load_min | payload_t | distance_km | min_trucks | max_trucks | priority_tph |
|---|---|---|---|---|---|---|---|---|---|
| PIT1-CRUSHER | ore | 2 | 18.5 | 3.0 | 90 | 3.2 | 2 | 10 | 900 |
| PIT1-WASTE-N | waste | 1 | 24.0 | 3.4 | 90 | 4.6 | 1 | 6 | NA |
| PIT2-CRUSHER | ore | 1 | 15.0 | 2.8 | 90 | 2.4 | 1 | 6 | 500 |
| PIT2-WASTE-S | waste | 2 | 28.5 | 3.6 | 140 | 5.8 | 2 | 10 | NA |
| STOCKPILE-REHANDLE | ore | 1 | 9.5 | 2.2 | 60 | 1.1 | 0 | 4 | NA |
Required columns: route_id, n_shovels,
cycle_min, load_min. Optional:
payload_t, min_trucks,
max_trucks, priority_tph.
Basic deployment
dep <- deploy_fleet(routes, n_trucks = 18)
dep
#> <haul_deployment>
#> Trucks assigned : 18
#> Total production: 4725.5 t/h
#>
#> route_id trucks prod_tph queue_min shovel_util bunching_eff
#> PIT1-CRUSHER 4 1000.6 0.09 0.278 0.996
#> PIT1-WASTE-N 1 197.1 0.00 0.124 1.000
#> PIT2-CRUSHER 3 861.9 0.99 0.447 0.947
#> PIT2-WASTE-S 7 1812.1 0.35 0.388 0.989
#> STOCKPILE-REHANDLE 3 853.8 0.95 0.522 0.925
#> match_factor
#> 0.28
#> 0.12
#> 0.47
#> 0.39
#> 0.56
plot_deployment(dep)
The assignment log shows every decision the optimiser made - invaluable for explaining the plan at a shift-change meeting:
head(dep$log, 10)
#> truck route_id marginal_tph route_tph reason
#> 1 1 PIT1-CRUSHER 251.1628 251.1628 min_trucks
#> 2 2 PIT1-CRUSHER 251.1628 502.3256 min_trucks
#> 3 3 PIT1-WASTE-N 197.0803 197.0803 min_trucks
#> 4 4 PIT2-CRUSHER 303.3708 303.3708 min_trucks
#> 5 5 PIT2-WASTE-S 261.6822 261.6822 min_trucks
#> 6 6 PIT2-WASTE-S 261.6822 523.3645 min_trucks
#> 7 7 PIT2-CRUSHER 288.7199 592.0907 priority_target
#> 8 8 PIT1-CRUSHER 250.1407 752.4662 priority_target
#> 9 9 PIT1-CRUSHER 248.1130 1000.5792 priority_target
#> 10 10 STOCKPILE-REHANDLE 307.6923 307.6923 marginal_tphReasons are one of min_trucks (constraint),
priority_target (route below its priority_tph)
or marginal_tph (pure greedy tonnes).
Constraints and targets
-
min_trucks- routes that must keep moving regardless of economics (e.g. contractual waste movement, tailings lifts). -
max_trucks- physical caps: pass-bay limits, dump capacity, loading face congestion. -
priority_tph- a production target: routes below target are topped up first (crusher feed security), and only then are surplus trucks allocated greedily.
routes2 <- routes
routes2$priority_tph[routes2$route_id == "PIT2-CRUSHER"] <- 700
dep2 <- deploy_fleet(routes2, n_trucks = 18)
dep2$allocation[, c("route_id", "trucks", "prod_tph")]
#> route_id trucks prod_tph
#> 1 PIT1-CRUSHER 4 1000.5792
#> 2 PIT1-WASTE-N 1 197.0803
#> 3 PIT2-CRUSHER 3 861.9382
#> 4 PIT2-WASTE-S 7 1812.1038
#> 5 STOCKPILE-REHANDLE 3 853.7985How many trucks are even worth owning?
Sweep the total and watch the marginal value of the fleet:
sweep <- do.call(rbind, lapply(6:26, function(n) {
d <- deploy_fleet(routes, n_trucks = n)
data.frame(n_trucks = n, total_tph = d$total_tph)
}))
sweep$marginal_tph <- c(NA, diff(sweep$total_tph))
knitr::kable(round(sweep, 1))| n_trucks | total_tph | marginal_tph |
|---|---|---|
| 6 | 1526.1 | NA |
| 7 | 1814.9 | 288.7 |
| 8 | 2065.0 | 250.1 |
| 9 | 2313.1 | 248.1 |
| 10 | 2620.8 | 307.7 |
| 11 | 2907.5 | 286.7 |
| 12 | 3177.3 | 269.8 |
| 13 | 3438.5 | 261.1 |
| 14 | 3698.5 | 260.0 |
| 15 | 3957.9 | 259.4 |
| 16 | 4216.3 | 258.4 |
| 17 | 4472.4 | 256.1 |
| 18 | 4725.5 | 253.1 |
| 19 | 4975.0 | 249.5 |
| 20 | 5220.9 | 246.0 |
| 21 | 5466.0 | 245.0 |
| 22 | 5710.9 | 244.9 |
| 23 | 5951.7 | 240.8 |
| 24 | 6191.1 | 239.4 |
| 25 | 6426.5 | 235.4 |
| 26 | 6654.9 | 228.4 |
When marginal_tph falls below the tonnes needed to cover
a truck’s operating-hour cost, stop adding trucks - that row is
your economic fleet size.
Notes on interpretation
- The optimiser treats routes as independent circuits; shared ramps or intersections that couple routes are outside the model - treat its output as the starting plan for the dispatcher.
- Heterogeneous fleets: run
deploy_fleet()per truck class with class-specificpayload_t, or use the class-weighted mean payload as an approximation. - The greedy log doubles as an ordered degradation plan: if trucks break down mid-shift, remove them in reverse assignment order.