milkr_cost function

Vehicle runs cost / distance

Vehicle runs cost / distance

Calculates the total distance associated to a clarke_wright() result. This is the measure that the corresponding Capacitated Vehicle Routing Problem minimizes.

milkr_cost(solution)

Arguments

  • solution: A "heumilkr_solution" object, typically obtained by clarke_wright().

Returns

The total traveled distance.

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)