ExVrp.IteratedLocalSearch.Result (ExVrp v0.8.0)

Copy Markdown View Source

Result of running ILS.

This matches PyVRP's Result class interface:

  • cost/1 - Returns the cost of the best solution (infinity if infeasible)
  • feasible?/1 - Returns whether the best solution is feasible
  • best - The best Solution found
  • stats - Statistics from the search
  • num_iterations - Total iterations performed
  • runtime - Runtime in milliseconds

Summary

Functions

Returns the cost of the best solution.

Returns whether the best solution is feasible.

Returns a summary string of the result.

Types

t()

@type t() :: %ExVrp.IteratedLocalSearch.Result{
  best: ExVrp.Solution.t(),
  num_iterations: non_neg_integer(),
  runtime: non_neg_integer(),
  stats: map()
}

Functions

cost(result)

@spec cost(t()) :: non_neg_integer() | :infinity

Returns the cost of the best solution.

This is the objective the search minimises: unit_distance_cost times distance, plus unit_duration_cost times duration, plus the fixed cost of every vehicle used, plus the prizes of any clients left unvisited.

Returning best.distance instead makes callers rank solutions on one term of that sum, so a caller comparing independent starts picks on a metric no start optimised. That matters most when starts settle on different vehicle counts, or when the distance matrix carries penalties rather than metres.

Returns :infinity if the solution is infeasible, matching PyVRP's behavior.

feasible?(result)

@spec feasible?(t()) :: boolean()

Returns whether the best solution is feasible.

summary(result)

@spec summary(t()) :: String.t()

Returns a summary string of the result.