python-sat 1.9.dev3__tar.gz → 1.9.dev4__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.dev3/python_sat.egg-info → python_sat-1.9.dev4}/PKG-INFO +1 -1
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/README.rst +1 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/examples/rc2.py +50 -23
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/pysat/__init__.py +1 -1
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/pysat/solvers.py +3 -3
- {python_sat-1.9.dev3 → python_sat-1.9.dev4/python_sat.egg-info}/PKG-INFO +1 -1
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/LICENSE.txt +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/MANIFEST.in +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/allies/__init__.py +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/allies/approxmc.py +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/allies/unigen.py +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/cardenc/bitwise.hh +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/cardenc/card.hh +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/cardenc/clset.hh +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/cardenc/common.hh +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/cardenc/itot.hh +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/cardenc/ladder.hh +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/cardenc/mto.hh +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/cardenc/pairwise.hh +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/cardenc/ptypes.hh +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/cardenc/pycard.cc +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/cardenc/seqcounter.hh +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/cardenc/sortcard.hh +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/cardenc/utils.hh +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/examples/__init__.py +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/examples/bbscan.py +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/examples/bica.py +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/examples/fm.py +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/examples/genhard.py +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/examples/hitman.py +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/examples/lbx.py +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/examples/lsu.py +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/examples/mcsls.py +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/examples/models.py +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/examples/musx.py +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/examples/optux.py +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/examples/primer.py +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/examples/usage.py +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/formula/pf_parse.cc +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/formula/pf_plus.cc +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/formula/pf_weight.cc +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/formula/pyformula.cc +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/pysat/_fileio.py +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/pysat/_utils.py +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/pysat/card.py +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/pysat/engines.py +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/pysat/formula.py +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/pysat/integer.py +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/pysat/pb.py +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/pysat/process.py +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/python_sat.egg-info/SOURCES.txt +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/python_sat.egg-info/dependency_links.txt +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/python_sat.egg-info/requires.txt +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/python_sat.egg-info/top_level.txt +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/requirements.txt +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/setup.cfg +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/setup.py +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/cadical103.tar.gz +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/cadical153.tar.gz +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/cadical195.tar.gz +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/cadical300.tar.gz +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/glucose30.tar.gz +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/glucose41.tar.gz +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/glucose421.tar.gz +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/lingeling.tar.gz +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/maplechrono.zip +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/maplecm.zip +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/maplesat.zip +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/mergesat3.tar.gz +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/minicard.tar.gz +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/minisat22.tar.gz +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/minisatgh.zip +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/patches/cadical103.patch +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/patches/cadical153.patch +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/patches/cadical195.patch +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/patches/cadical300.patch +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/patches/glucose30.patch +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/patches/glucose41.patch +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/patches/glucose421.patch +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/patches/gluecard30.patch +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/patches/gluecard41.patch +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/patches/kissat404.patch +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/patches/lingeling.patch +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/patches/maplechrono.patch +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/patches/maplecm.patch +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/patches/maplesat.patch +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/patches/mergesat3.patch +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/patches/minicard.patch +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/patches/minisat22.patch +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/patches/minisatep.patch +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/patches/minisatgh.patch +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/prepare.py +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/pysolvers.cc +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/tests/test_accum_stats.py +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/tests/test_atmost.py +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/tests/test_atmost1.py +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/tests/test_atmostk.py +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/tests/test_boolengine.py +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/tests/test_clausification.py +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/tests/test_cnf.py +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/tests/test_encode_pb_conditional.py +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/tests/test_equals1.py +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/tests/test_formula_parsing.py +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/tests/test_formula_unique.py +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/tests/test_idpool.py +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/tests/test_integer.py +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/tests/test_process.py +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/tests/test_propagate.py +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/tests/test_unique_model.py +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/tests/test_unique_mus.py +0 -0
- {python_sat-1.9.dev3 → python_sat-1.9.dev4}/tests/test_warmstart.py +0 -0
|
@@ -79,6 +79,7 @@ Minisat-based solvers only *core* versions are integrated):
|
|
|
79
79
|
- Minicard (`1.2 <https://github.com/liffiton/minicard>`__)
|
|
80
80
|
- Minisat (`2.2 release <http://minisat.se/MiniSat.html>`__)
|
|
81
81
|
- Minisat (`GitHub version <https://github.com/niklasso/minisat>`__)
|
|
82
|
+
- Minisat (`with IPASIR-UP support <https://github.com/hchenqide/minisat>`__)
|
|
82
83
|
|
|
83
84
|
In order to make SAT-based prototyping easier, PySAT integrates a variety of
|
|
84
85
|
cardinality encodings. All of them are implemented from scratch in C++. The
|
|
@@ -131,6 +131,7 @@
|
|
|
131
131
|
#
|
|
132
132
|
#==============================================================================
|
|
133
133
|
from __future__ import print_function
|
|
134
|
+
import bisect
|
|
134
135
|
import collections
|
|
135
136
|
import getopt
|
|
136
137
|
import itertools
|
|
@@ -810,8 +811,8 @@ class RC2(object):
|
|
|
810
811
|
handled by calling :func:`process_am1`.
|
|
811
812
|
"""
|
|
812
813
|
|
|
813
|
-
# literal connections
|
|
814
|
-
conns = collections.defaultdict(
|
|
814
|
+
# literal connections and selectors conflicting on their own
|
|
815
|
+
conns = collections.defaultdict(list)
|
|
815
816
|
confl = []
|
|
816
817
|
|
|
817
818
|
# prepare connections
|
|
@@ -819,26 +820,29 @@ class RC2(object):
|
|
|
819
820
|
st, props = self.oracle.propagate(assumptions=[l1], phase_saving=2)
|
|
820
821
|
if st:
|
|
821
822
|
for l2 in props:
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
conns[
|
|
823
|
+
l2 = -l2
|
|
824
|
+
if l2 in self.sels_set:
|
|
825
|
+
conns[l1].append(l2)
|
|
826
|
+
conns[l2].append(l1)
|
|
825
827
|
else:
|
|
826
828
|
# propagating this literal results in a conflict
|
|
827
829
|
confl.append(l1)
|
|
828
830
|
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
831
|
+
# sort (in-place) and deduplicate adjacency lists
|
|
832
|
+
for l in list(conns):
|
|
833
|
+
neigh = conns[l]
|
|
834
|
+
if neigh:
|
|
835
|
+
neigh.sort()
|
|
832
836
|
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
837
|
+
j = 1
|
|
838
|
+
for i in range(1, len(neigh)):
|
|
839
|
+
if neigh[i] != neigh[j - 1]:
|
|
840
|
+
neigh[j] = neigh[i]
|
|
841
|
+
j += 1
|
|
838
842
|
|
|
839
|
-
|
|
840
|
-
confl = list(confl)
|
|
843
|
+
del neigh[j:]
|
|
841
844
|
|
|
845
|
+
if confl:
|
|
842
846
|
# processing unit size cores
|
|
843
847
|
for l in confl:
|
|
844
848
|
self.core, self.minw = [l], self.wght[l]
|
|
@@ -849,24 +853,47 @@ class RC2(object):
|
|
|
849
853
|
print('c unit cores found: {0}; cost: {1}'.format(len(confl),
|
|
850
854
|
self.cost))
|
|
851
855
|
|
|
856
|
+
# the following graph manipulation requires
|
|
857
|
+
# fast membership checks for confl; making it a set
|
|
858
|
+
confl = set(confl)
|
|
859
|
+
|
|
860
|
+
# current degrees in the remaining graph;
|
|
861
|
+
# literals disconnected after removing conflicts are ignored
|
|
862
|
+
degree, lits = {}, set()
|
|
863
|
+
for l in conns:
|
|
864
|
+
if l not in confl:
|
|
865
|
+
d = sum(1 for l2 in conns[l] if l2 not in confl)
|
|
866
|
+
if d:
|
|
867
|
+
degree[l] = d
|
|
868
|
+
lits.add(l)
|
|
869
|
+
|
|
870
|
+
# detect AM1s on the original formula with conflicting selectors
|
|
871
|
+
# filtered out, similarly to the previous implementation
|
|
852
872
|
nof_am1 = 0
|
|
853
873
|
len_am1 = []
|
|
854
|
-
|
|
874
|
+
|
|
855
875
|
while lits:
|
|
856
|
-
am1 = [min(lits, key=lambda l:
|
|
876
|
+
am1 = [min(lits, key=lambda l: degree[l])]
|
|
857
877
|
|
|
858
|
-
for l in sorted(conns[am1[0]], key=lambda l:
|
|
878
|
+
for l in sorted(conns[am1[0]], key=lambda l: degree.get(l, 0)):
|
|
859
879
|
if l in lits:
|
|
860
880
|
for l_added in am1[1:]:
|
|
861
|
-
|
|
881
|
+
# adjacency lists are sorted, so we use
|
|
882
|
+
# binary search for clique membership tests
|
|
883
|
+
i = bisect.bisect_left(conns[l], l_added)
|
|
884
|
+
if i == len(conns[l]) or conns[l][i] != l_added:
|
|
862
885
|
break
|
|
863
886
|
else:
|
|
864
887
|
am1.append(l)
|
|
865
888
|
|
|
866
|
-
# updating remaining
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
889
|
+
# updating remaining literals and their degrees
|
|
890
|
+
am1_set = set(am1)
|
|
891
|
+
lits.difference_update(am1_set)
|
|
892
|
+
|
|
893
|
+
for l in am1:
|
|
894
|
+
for l2 in conns.get(l, []):
|
|
895
|
+
if l2 in lits:
|
|
896
|
+
degree[l2] -= 1
|
|
870
897
|
|
|
871
898
|
if len(am1) > 1:
|
|
872
899
|
# treat the new atmost1 relation
|
|
@@ -184,9 +184,9 @@
|
|
|
184
184
|
settings. For that reason, :class:`Cadical300`'s BVA is disabled by
|
|
185
185
|
default whenever it is created without a synchronized
|
|
186
186
|
:class:`.pysat.formula.IDPool`. Users who want BVA can either enable it
|
|
187
|
-
manually with :meth:`.configure` or attach a shared pool with
|
|
188
|
-
:meth:`.attach_vpool` and keep it synchronized explicitly with
|
|
189
|
-
:meth:`.sync_vpool`.
|
|
187
|
+
manually with :meth:`.Solver.configure` or attach a shared pool with
|
|
188
|
+
:meth:`.Solver.attach_vpool` and keep it synchronized explicitly with
|
|
189
|
+
:meth:`.Solver.sync_vpool`.
|
|
190
190
|
|
|
191
191
|
==============
|
|
192
192
|
Module details
|
|
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
|