python-sat 1.9.dev11__tar.gz → 1.9.dev13__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of python-sat might be problematic. Click here for more details.
- {python_sat-1.9.dev11/python_sat.egg-info → python_sat-1.9.dev13}/PKG-INFO +1 -1
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/pysat/__init__.py +1 -1
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/pysat/formula.py +13 -11
- {python_sat-1.9.dev11 → python_sat-1.9.dev13/python_sat.egg-info}/PKG-INFO +1 -1
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/tests/test_clausification.py +20 -3
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/tests/test_formula_unique.py +27 -3
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/LICENSE.txt +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/MANIFEST.in +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/README.rst +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/allies/__init__.py +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/allies/approxmc.py +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/allies/unigen.py +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/cardenc/bitwise.hh +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/cardenc/card.hh +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/cardenc/clset.hh +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/cardenc/common.hh +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/cardenc/itot.hh +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/cardenc/ladder.hh +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/cardenc/mto.hh +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/cardenc/pairwise.hh +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/cardenc/ptypes.hh +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/cardenc/pycard.cc +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/cardenc/seqcounter.hh +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/cardenc/sortcard.hh +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/cardenc/utils.hh +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/examples/__init__.py +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/examples/bbscan.py +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/examples/bica.py +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/examples/fm.py +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/examples/genhard.py +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/examples/hitman.py +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/examples/lbx.py +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/examples/lsu.py +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/examples/mcsls.py +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/examples/models.py +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/examples/musx.py +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/examples/optux.py +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/examples/primer.py +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/examples/rc2.py +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/examples/usage.py +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/formula/pf_parse.cc +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/formula/pf_plus.cc +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/formula/pf_plus.hh +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/formula/pf_py.hh +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/formula/pf_scan.hh +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/formula/pf_weight.cc +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/formula/pf_weight.hh +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/formula/pyformula.cc +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/formula/pyformula.hh +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/pysat/_fileio.py +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/pysat/_utils.py +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/pysat/card.py +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/pysat/engines.py +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/pysat/integer.py +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/pysat/pb.py +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/pysat/process.py +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/pysat/solvers.py +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/python_sat.egg-info/SOURCES.txt +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/python_sat.egg-info/dependency_links.txt +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/python_sat.egg-info/requires.txt +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/python_sat.egg-info/top_level.txt +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/requirements.txt +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/setup.cfg +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/setup.py +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/solvers/cadical103.tar.gz +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/solvers/cadical153.tar.gz +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/solvers/cadical195.tar.gz +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/solvers/cadical300.tar.gz +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/solvers/glucose30.tar.gz +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/solvers/glucose41.tar.gz +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/solvers/glucose421.tar.gz +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/solvers/lingeling.tar.gz +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/solvers/maplechrono.zip +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/solvers/maplecm.zip +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/solvers/maplesat.zip +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/solvers/mergesat3.tar.gz +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/solvers/minicard.tar.gz +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/solvers/minisat22.tar.gz +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/solvers/minisatgh.zip +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/solvers/patches/cadical103.patch +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/solvers/patches/cadical153.patch +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/solvers/patches/cadical195.patch +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/solvers/patches/cadical300.patch +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/solvers/patches/glucose30.patch +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/solvers/patches/glucose41.patch +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/solvers/patches/glucose421.patch +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/solvers/patches/gluecard30.patch +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/solvers/patches/gluecard41.patch +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/solvers/patches/kissat404.patch +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/solvers/patches/lingeling.patch +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/solvers/patches/maplechrono.patch +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/solvers/patches/maplecm.patch +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/solvers/patches/maplesat.patch +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/solvers/patches/mergesat3.patch +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/solvers/patches/minicard.patch +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/solvers/patches/minisat22.patch +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/solvers/patches/minisatep.patch +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/solvers/patches/minisatgh.patch +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/solvers/prepare.py +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/solvers/pysolvers.cc +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/tests/test_accum_stats.py +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/tests/test_atmost.py +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/tests/test_atmost1.py +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/tests/test_atmostk.py +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/tests/test_boolengine.py +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/tests/test_cnf.py +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/tests/test_empty_extclause.py +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/tests/test_encode_pb_conditional.py +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/tests/test_equals1.py +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/tests/test_formula_parsing.py +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/tests/test_idpool.py +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/tests/test_integer.py +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/tests/test_oom.py +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/tests/test_process.py +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/tests/test_propagate.py +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/tests/test_unique_model.py +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/tests/test_unique_mus.py +0 -0
- {python_sat-1.9.dev11 → python_sat-1.9.dev13}/tests/test_warmstart.py +0 -0
|
@@ -1798,10 +1798,10 @@ class And(Formula):
|
|
|
1798
1798
|
the subformulas expanding self's list of clauses and also
|
|
1799
1799
|
populates self's clauses with unit clauses, each containing the
|
|
1800
1800
|
auxiliary "name" of the corresponding subformula, thus
|
|
1801
|
-
representing their conjunction. However,
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1801
|
+
representing their conjunction. However, :class:`CNF` formulas
|
|
1802
|
+
are expanded without introducing an intermediate Boolean name -
|
|
1803
|
+
instead, they contribute their clausal representations to the
|
|
1804
|
+
list of self's clauses unchanged.
|
|
1805
1805
|
|
|
1806
1806
|
If ``name_required`` is set to ``True``, the method introduces one
|
|
1807
1807
|
name for the complete conjunction and encodes the equivalence
|
|
@@ -1814,13 +1814,13 @@ class And(Formula):
|
|
|
1814
1814
|
save_clauses = bool(self.clauses)
|
|
1815
1815
|
|
|
1816
1816
|
if not self.clauses:
|
|
1817
|
-
# recursively collect a clausal representation;
|
|
1818
|
-
#
|
|
1819
|
-
#
|
|
1817
|
+
# recursively collect a clausal representation; CNF objects are
|
|
1818
|
+
# already clausal, so they do not need a Boolean name at this
|
|
1819
|
+
# level
|
|
1820
1820
|
for sub in self.subformulas:
|
|
1821
|
-
if type(sub)
|
|
1821
|
+
if type(sub) is CNF:
|
|
1822
1822
|
sub._clausify(name_required=False)
|
|
1823
|
-
self.clauses.extend(
|
|
1823
|
+
self.clauses.extend(cl.copy() for cl in sub.clauses)
|
|
1824
1824
|
else:
|
|
1825
1825
|
sub._clausify(name_required=True)
|
|
1826
1826
|
self.clauses.append([sub.name])
|
|
@@ -2994,8 +2994,10 @@ class XOr(Formula):
|
|
|
2994
2994
|
f2 = Formula._vpool[Formula._context].obj(n2)
|
|
2995
2995
|
final = XOr(f1, f2)
|
|
2996
2996
|
|
|
2997
|
-
|
|
2998
|
-
|
|
2997
|
+
# the new name will be shared between the n-ary XOr and the
|
|
2998
|
+
# final binary XOr
|
|
2999
|
+
self.name = Formula._vpool[Formula._context].id(self)
|
|
3000
|
+
final.name = self.name
|
|
2999
3001
|
else:
|
|
3000
3002
|
self.name = Formula._vpool[Formula._context].id(self)
|
|
3001
3003
|
final = None
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from pysat.formula import Atom, Formula, And, Or, Neg, XOr
|
|
1
|
+
from pysat.formula import Atom, Formula, And, CNF, Or, Neg, XOr
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
def compare(a, b):
|
|
@@ -37,6 +37,23 @@ def test_clausification():
|
|
|
37
37
|
f = And(Atom('1'), Atom('2'))
|
|
38
38
|
compare(list(f), [[1], [2]])
|
|
39
39
|
|
|
40
|
-
# nested conjunctions
|
|
40
|
+
# nested conjunctions retain their own auxiliary name
|
|
41
41
|
g = And(f, Atom('3'))
|
|
42
|
-
compare(list(g), [[1], [2], [3]])
|
|
42
|
+
compare(list(g), [[1, -3], [2, -3], [3, -1, -2], [3], [4]])
|
|
43
|
+
|
|
44
|
+
# CNF operands are inherited directly by the outer conjunction
|
|
45
|
+
Formula.cleanup()
|
|
46
|
+
h = And(CNF(from_clauses=[[1, 2], [-1, 3]]), Atom('4'))
|
|
47
|
+
compare(list(h), [[1, 2], [-1, 3], [4]])
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def test_nary_xor_name_is_registered():
|
|
51
|
+
Formula.cleanup()
|
|
52
|
+
x, y, z = Atom('x'), Atom('y'), Atom('z')
|
|
53
|
+
xor = XOr(x, y, z)
|
|
54
|
+
formula = And(xor, Atom('w'))
|
|
55
|
+
formula.clausify()
|
|
56
|
+
|
|
57
|
+
vpool = Formula.export_vpool()
|
|
58
|
+
assert vpool.id(xor) == xor.name
|
|
59
|
+
assert vpool.obj(xor.name) is xor
|
|
@@ -62,10 +62,34 @@ def test_ite_uniqueness():
|
|
|
62
62
|
def test_cnf_as_and_subformula():
|
|
63
63
|
Formula.cleanup()
|
|
64
64
|
cnf = CNF(from_clauses=[[-1, 2], [3]])
|
|
65
|
-
|
|
65
|
+
subf = And(cnf, Atom(4))
|
|
66
|
+
form = And(subf, Atom(5))
|
|
67
|
+
|
|
68
|
+
# the CNF is flattened into its immediate And operand, while the
|
|
69
|
+
# unmerged nested And retains its own auxiliary name
|
|
70
|
+
assert list(form) == [[1, 6], [-2, 6], [-1, 2, -6],
|
|
71
|
+
[6, -7], [3, -7], [4, -7],
|
|
72
|
+
[7, -6, -3, -4], [7], [5]]
|
|
73
|
+
assert form.name is None
|
|
74
|
+
assert subf.name == 7
|
|
75
|
+
assert cnf.name is None
|
|
76
|
+
assert cnf.encoded == []
|
|
77
|
+
|
|
66
78
|
|
|
67
|
-
|
|
68
|
-
|
|
79
|
+
def test_merged_and_with_cnf_subformula():
|
|
80
|
+
Formula.cleanup()
|
|
81
|
+
cnf = CNF(from_clauses=[[-1, 2], [3]])
|
|
82
|
+
subf = And(cnf, Atom(4))
|
|
83
|
+
form = And(subf, Atom(5), merge=True)
|
|
84
|
+
|
|
85
|
+
# Merging removes the nested And boundary. When the merged formula is
|
|
86
|
+
# used as a subformula, it therefore gets exactly one gate name.
|
|
87
|
+
assert list(Or(form, Atom(6))) == [[1, 7], [-2, 7], [-1, 2, -7],
|
|
88
|
+
[7, -8], [3, -8], [4, -8],
|
|
89
|
+
[5, -8], [8, -7, -3, -4, -5],
|
|
90
|
+
[8, 6]]
|
|
91
|
+
assert form.name == 8
|
|
92
|
+
assert subf.name is None
|
|
69
93
|
assert cnf.name is None
|
|
70
94
|
assert cnf.encoded == []
|
|
71
95
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|