Crate travelling_salesman [−] [src]
Travelling Salesman Problem Solvers.
The aim of this crate is to host various Travelling Salesman Problem solvers. Patches implementing useful algorithms most welcome.
Examples
extern crate travelling_salesman; use travelling_salesman::brute_force; fn main() { let cities = vec![ (27.0, 78.0), (18.0, 24.0), (48.0, 62.0), (83.0, 17.0), ]; let tour = brute_force::solve(&cities); println!("tour distance: {}, tour route: {:?}", tour.distance, tour.route); }
Modules
brute_force |
Brute Force Travelling Salesman Problem Solver |
Structs
Tour |
Represents a tour of the travelling salesman |
Functions
get_distance_matrix |
Utility function to convert city coordinates to a distance matrix |
get_route_distance |
Utility function to calculate the distance travelled following the specified route |