Ejemplo n.º 1
0
    def test_no_solution(self):

        def callback(solutions, s):
            self.assertTrue(False)

        problem = array([[]])
        dlx = DLX.from_matrix(problem, callback)
        dlx.run(True)

        problem = array([[0]])
        dlx = DLX.from_matrix(problem, callback)
        dlx.run(True)

        problem = array([[0, 0],
                         [0, 0]])
        dlx = DLX.from_matrix(problem, callback)
        dlx.run(True)

        problem = array([[0, 1]])
        dlx = DLX.from_matrix(problem, callback)
        dlx.run(True)

        problem = array([[1, 0, 0],
                         [0, 0, 0],
                         [0, 0, 1]])
        dlx = DLX.from_matrix(problem, callback)
        dlx.run(True)
Ejemplo n.º 2
0
    def test_problem_1(self):
        def callback(solutions, s):
            self.validate([1], solutions, s)

        problem = array([[1]])

        dlx = DLX.from_matrix(problem, callback)
        dlx.run(True)
Ejemplo n.º 3
0
    def test_problem_1(self):

        def callback(solutions, s):
            self.validate([1], solutions, s)

        problem = array([[1]])

        dlx = DLX.from_matrix(problem, callback)
        dlx.run(True)
Ejemplo n.º 4
0
    def test_problem_3(self):
        def callback(solutions, s):
            self.validate([2, 4, 6], solutions, s)

        problem = array([[1, 0, 0, 1, 0, 0, 1], [1, 0, 0, 1, 0, 0, 0],
                         [0, 0, 0, 1, 0, 0, 1], [0, 0, 1, 0, 1, 1, 0],
                         [0, 1, 1, 0, 0, 1, 1], [0, 1, 0, 0, 0, 0, 1]])

        dlx = DLX.from_matrix(problem, callback)
        dlx.run(True)
Ejemplo n.º 5
0
    def test_no_solution(self):
        def callback(solutions, s):
            self.assertTrue(False)

        problem = array([[]])
        dlx = DLX.from_matrix(problem, callback)
        dlx.run(True)

        problem = array([[0]])
        dlx = DLX.from_matrix(problem, callback)
        dlx.run(True)

        problem = array([[0, 0], [0, 0]])
        dlx = DLX.from_matrix(problem, callback)
        dlx.run(True)

        problem = array([[0, 1]])
        dlx = DLX.from_matrix(problem, callback)
        dlx.run(True)

        problem = array([[1, 0, 0], [0, 0, 0], [0, 0, 1]])
        dlx = DLX.from_matrix(problem, callback)
        dlx.run(True)
Ejemplo n.º 6
0
    def test_problem_3(self):

        def callback(solutions, s):
            self.validate([2, 4, 6], solutions, s)

        problem = array([[1, 0, 0, 1, 0, 0, 1],
                         [1, 0, 0, 1, 0, 0, 0],
                         [0, 0, 0, 1, 0, 0, 1],
                         [0, 0, 1, 0, 1, 1, 0],
                         [0, 1, 1, 0, 0, 1, 1],
                         [0, 1, 0, 0, 0, 0, 1]])

        dlx = DLX.from_matrix(problem, callback)
        dlx.run(True)