tsp-solver 0.0.1

Genetic travelling salesman problem solver
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use ndarray::ArrayView1;

pub trait TspDistance
where
    Self: Sized,
{
    fn distance(&self, other: &Self) -> f64;
    fn total(objects: ArrayView1<Self>, paths: ArrayView1<usize>) -> f64 {
        let mut distance = 0.0;
        for i in 0..paths.len() - 1 {
            distance += objects[i].distance(&objects[i + 1]);
        }
        distance
    }
}