示例#1
0
 def testWorstCaseSimpleCSP(self):
     '''incompatible problem last hyp'''
     for i in range(CSPTest.NVAL):
         self.__csp[CSPTest.NVAR - 2][i].value = -1
         self.__csp[CSPTest.NVAR - 1][i].value = -2
     solver = CSPExact(self.__csp, None)
     solFound = solver.solveCSP()
     logger.debug(solver)
     self.assertEqual(False, solFound)
示例#2
0
    def testInitialInvalidCSPElem(self):
        '''invalid root_hyp does not affect incompatibility'''
        for i in range(CSPTest.NVAL):
            self.__csp[CSPTest.NVAR - 2][i].value = -1
            self.__csp[CSPTest.NVAR - 1][i].value = 8
        solver = CSPExact(self.__csp, [CSPElem(-2, True)])

        solFound = solver.solveCSP()
        logger.debug(solver)
        self.assertEqual(True, solFound)
示例#3
0
    def testInitialCSPElem(self):
        ''' initial root_hyp makes csp incompatible'''
        for i in range(CSPTest.NVAL):
            self.__csp[CSPTest.NVAR - 2][i].value = -1
            self.__csp[CSPTest.NVAR - 1][i].value = 8
        solver = CSPExact(self.__csp, [CSPElem(-2, False)])

        solFound = solver.solveCSP()
        logger.debug(solver)
        self.assertEqual(False, solFound)