Calculates the total distance associated to a clarke_wright()
result.
This is the measure that the corresponding Capacitated Vehicle Routing
Problem minimizes.
Arguments
- solution
A "
heumilkr_solution
" object, typically obtained byclarke_wright()
.
Examples
demand <- c(3, 2, 4, 2)
positions <-
data.frame(
pos_x = c(0, 1, -1, 2, 3),
pos_y = c(0, 1, 1, 2, 3)
)
solution <- clarke_wright(
demand,
dist(positions),
data.frame(n = NA_integer_, caps = 6)
)
milkr_cost(solution)
#> [1] 13.31371