Esempio n. 1
0
    def test_square_matrix(self):
        state = hun.HungarianAlg(
            np.asarray([[82, 83, 69, 92], [77, 37, 49, 92], [11, 69, 5, 86],
                        [8, 9, 98, 23]]))
        state.solve()

        self.assertEqual(state.minimum_cost, 140)
Esempio n. 2
0
    def test_unsolved(self):
        state = hun.HungarianAlg(
            np.asarray([[82, 83, 69, 92], [77, 37, 49, 92], [11, 69, 5, 86],
                        [8, 9, 98, 23]]))

        self.assertRaises(Exception)
Esempio n. 3
0
    def test_zero_cost_matrix(self):
        state = hun.HungarianAlg(np.asarray([[0, 0], [0, 0], [0, 0], [0, 0]]))
        state.solve()

        self.assertEqual(state.minimum_cost, 0)
Esempio n. 4
0
    def test_retangular_matrix_with_tie(self):
        state = hun.HungarianAlg(
            np.asarray([[5, 51], [5, 10], [551, 23], [415, 566]]))
        state.solve()

        self.assertEqual(state.minimum_cost, 15)