pub fn nearest_neighbor(instance: &SolomonInstance) -> SolutionExpand description
Builds an initial feasible CVRP solution using a greedy Nearest Neighbor heuristic.
Starting from the depot (node 0), the algorithm repeatedly selects the closest unvisited customer that fits within the current vehicle’s remaining capacity. When no feasible insertion exists, the current route is closed (return to depot) and a new vehicle route is started.
§Panics
Panics on an invalid instance, an individual demand exceeding capacity, or when the greedy construction exhausts the fleet. Fleet exhaustion does not prove that the instance is infeasible: another construction may succeed.