コード例 #1
0
ファイル: test_expand.py プロジェクト: StephanGocht/cnfgen
 def test_contradiction(self):
     dimacs = """\
     p cnf 3 1
     0
     """
     opb = """\
     * #variable= 3 #constraint= 1
     *
      >= 1;
     """
     F = CNF()
     F.add_greater_or_equal(["a", "b", "c"], 4)
     F = Expand(F)
     self.assertCnfEqualsDimacs(F, dimacs)
     self.assertCnfEqualsOPB(F, opb)
コード例 #2
0
ファイル: test_expand.py プロジェクト: marcvinyals/cnfgen
 def test_contradiction(self) :
     dimacs="""\
     p cnf 3 1
     0
     """
     opb="""\
     * #variable= 3 #constraint= 1
     *
      >= 1;
     """
     F=CNF()
     F.add_greater_or_equal(["a","b","c"],4)
     F = Expand(F)
     self.assertCnfEqualsDimacs(F,dimacs)
     self.assertCnfEqualsOPB(F,opb)
コード例 #3
0
ファイル: test_expand.py プロジェクト: StephanGocht/cnfgen
 def test_one_inequality(self):
     dimacs = """\
     p cnf 3 3
     1 2 0
     1 3 0
     2 3 0
     """
     opb = """\
     * #variable= 3 #constraint= 3
     *
     +1 x1 +1 x2 >= 1;
     +1 x1 +1 x3 >= 1;
     +1 x2 +1 x3 >= 1;
     """
     F = CNF()
     F.add_greater_or_equal(["a", "b", "c"], 2)
     F = Expand(F)
     self.assertCnfEqualsDimacs(F, dimacs)
     self.assertCnfEqualsOPB(F, opb)
コード例 #4
0
ファイル: test_expand.py プロジェクト: marcvinyals/cnfgen
 def test_one_inequality(self) :
     dimacs="""\
     p cnf 3 3
     1 2 0
     1 3 0
     2 3 0
     """
     opb="""\
     * #variable= 3 #constraint= 3
     *
     +1 x1 +1 x2 >= 1;
     +1 x1 +1 x3 >= 1;
     +1 x2 +1 x3 >= 1;
     """
     F=CNF()
     F.add_greater_or_equal(["a","b","c"],2)
     F = Expand(F)
     self.assertCnfEqualsDimacs(F,dimacs)
     self.assertCnfEqualsOPB(F,opb)