Module travelling_salesman::brute_force
source · [−]Expand description
Find an exact solution to the Travelling Salesman Problem using Brute Force
Note: This isn’t really a useful algorithm as Brute force is O(n!)
, and is only included
for completeness.
Examples
extern crate travelling_salesman;
fn main() {
let tour = travelling_salesman::brute_force::solve(
&[
(27.0, 78.0),
(18.0, 24.0),
(48.0, 62.0),
(83.0, 77.0),
(55.0, 56.0),
],
);
println!("Tour distance: {}, route: {:?}", tour.distance, tour.route);
}
Functions
Returns an exact solution to the Travelling Salesman Problem using Brute Force