rust_tsp: Solve Traveling Salesman Problem (TSP)

View source: R/extendr-wrappers.R

rust_tspR Documentation

Solve Traveling Salesman Problem (TSP)

Description

Solve a closed tour, open route, or fixed-end path over a square cost/distance matrix using nearest-neighbor construction with optional 2-opt and or-opt local search. Optional time windows and service times can be supplied for each stop.

Usage

rust_tsp(cost_matrix, start, end, method, earliest, latest, service_time)

Arguments

cost_matrix

Square cost/distance matrix (n x n)

start

Start index (0-based)

end

End index (0-based), or NULL for an open route

method

Algorithm: "nn" (nearest-neighbor only) or "2-opt" (with local search)

earliest

Optional earliest service times

latest

Optional latest service times

service_time

Optional service times at each stop

Value

List with tour (1-based), total_cost, nn_cost, improvement_pct, iterations, arrival_time, and departure_time


spopt documentation built on April 22, 2026, 9:07 a.m.