Ejemplo n.º 1
0
    def test_explicit_upper_diag_row_tsplib_file(self):
        dimension = 1032
        distance_matrix = distances.tsplib_distance_matrix(
            self.explicit_upper_diag_row_file)

        assert distance_matrix.shape == (dimension, dimension)
        assert np.array_equal(distance_matrix.diagonal(), np.zeros(dimension))
Ejemplo n.º 2
0
    def test_explicit_full_matrix_tsplib_file(self):
        """Note that this test file is asymetric"""
        dimension = 17
        distance_matrix = distances.tsplib_distance_matrix(
            self.explicit_full_matrix_file)

        assert distance_matrix.shape == (dimension, dimension)
        assert np.array_equal(distance_matrix.diagonal(), np.zeros(dimension))
        assert not np.array_equal(distance_matrix, distance_matrix.T)
Ejemplo n.º 3
0
    def test_geo_tsplib_file(self):
        dimension = 22
        distance_matrix = distances.tsplib_distance_matrix(self.geo_file)

        assert distance_matrix.shape == (dimension, dimension)
        assert distance_matrix.dtype == int
Ejemplo n.º 4
0
    def test_ceil_2d_tsplib_file(self):
        dimension = 1000
        distance_matrix = distances.tsplib_distance_matrix(self.ceil_2d_file)

        assert distance_matrix.shape == (dimension, dimension)
        assert distance_matrix.dtype == int