milkr_cost: Vehicle runs cost / distance

View source: R/heumilkr_solution.R

milkr_costR Documentation

Vehicle runs cost / distance

Description

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

Usage

milkr_cost(solution)

Arguments

solution

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

Value

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)


heumilkr documentation built on June 8, 2025, 10:52 a.m.