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.

For more information, please see the Travelling Salesman Problem Wikipedia article.

Examples

extern crate time;
extern crate travelling_salesman;

fn main() {
  let tour = travelling_salesman::simulated_annealing::solve(
    &[
       (27.0, 78.0),
       (18.0, 24.0),
       (48.0, 62.0),
       (83.0, 77.0),
       (55.0, 56.0),
    ],
    time::Duration::seconds(1),
  );

  println!("Tour distance: {}, route: {:?}", tour.distance, tour.route);
}

Modules

brute_force

Find an exact solution to the Travelling Salesman Problem using Brute Force

hill_climbing

Find an approximate solution to the Travelling Salesman Problem using Hill Climbing

random_search

Find an approximate solution to the Travelling Salesman Problem using Random Search

simulated_annealing

Find an approximate solution to the Travelling Salesman Problem using Simulated Annealing

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