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.

Files changed (111) hide show
  1. {python_sat-1.9.dev3/python_sat.egg-info → python_sat-1.9.dev4}/PKG-INFO +1 -1
  2. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/README.rst +1 -0
  3. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/examples/rc2.py +50 -23
  4. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/pysat/__init__.py +1 -1
  5. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/pysat/solvers.py +3 -3
  6. {python_sat-1.9.dev3 → python_sat-1.9.dev4/python_sat.egg-info}/PKG-INFO +1 -1
  7. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/LICENSE.txt +0 -0
  8. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/MANIFEST.in +0 -0
  9. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/allies/__init__.py +0 -0
  10. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/allies/approxmc.py +0 -0
  11. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/allies/unigen.py +0 -0
  12. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/cardenc/bitwise.hh +0 -0
  13. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/cardenc/card.hh +0 -0
  14. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/cardenc/clset.hh +0 -0
  15. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/cardenc/common.hh +0 -0
  16. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/cardenc/itot.hh +0 -0
  17. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/cardenc/ladder.hh +0 -0
  18. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/cardenc/mto.hh +0 -0
  19. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/cardenc/pairwise.hh +0 -0
  20. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/cardenc/ptypes.hh +0 -0
  21. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/cardenc/pycard.cc +0 -0
  22. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/cardenc/seqcounter.hh +0 -0
  23. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/cardenc/sortcard.hh +0 -0
  24. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/cardenc/utils.hh +0 -0
  25. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/examples/__init__.py +0 -0
  26. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/examples/bbscan.py +0 -0
  27. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/examples/bica.py +0 -0
  28. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/examples/fm.py +0 -0
  29. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/examples/genhard.py +0 -0
  30. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/examples/hitman.py +0 -0
  31. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/examples/lbx.py +0 -0
  32. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/examples/lsu.py +0 -0
  33. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/examples/mcsls.py +0 -0
  34. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/examples/models.py +0 -0
  35. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/examples/musx.py +0 -0
  36. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/examples/optux.py +0 -0
  37. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/examples/primer.py +0 -0
  38. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/examples/usage.py +0 -0
  39. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/formula/pf_parse.cc +0 -0
  40. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/formula/pf_plus.cc +0 -0
  41. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/formula/pf_weight.cc +0 -0
  42. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/formula/pyformula.cc +0 -0
  43. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/pysat/_fileio.py +0 -0
  44. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/pysat/_utils.py +0 -0
  45. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/pysat/card.py +0 -0
  46. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/pysat/engines.py +0 -0
  47. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/pysat/formula.py +0 -0
  48. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/pysat/integer.py +0 -0
  49. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/pysat/pb.py +0 -0
  50. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/pysat/process.py +0 -0
  51. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/python_sat.egg-info/SOURCES.txt +0 -0
  52. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/python_sat.egg-info/dependency_links.txt +0 -0
  53. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/python_sat.egg-info/requires.txt +0 -0
  54. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/python_sat.egg-info/top_level.txt +0 -0
  55. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/requirements.txt +0 -0
  56. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/setup.cfg +0 -0
  57. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/setup.py +0 -0
  58. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/cadical103.tar.gz +0 -0
  59. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/cadical153.tar.gz +0 -0
  60. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/cadical195.tar.gz +0 -0
  61. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/cadical300.tar.gz +0 -0
  62. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/glucose30.tar.gz +0 -0
  63. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/glucose41.tar.gz +0 -0
  64. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/glucose421.tar.gz +0 -0
  65. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/lingeling.tar.gz +0 -0
  66. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/maplechrono.zip +0 -0
  67. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/maplecm.zip +0 -0
  68. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/maplesat.zip +0 -0
  69. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/mergesat3.tar.gz +0 -0
  70. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/minicard.tar.gz +0 -0
  71. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/minisat22.tar.gz +0 -0
  72. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/minisatgh.zip +0 -0
  73. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/patches/cadical103.patch +0 -0
  74. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/patches/cadical153.patch +0 -0
  75. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/patches/cadical195.patch +0 -0
  76. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/patches/cadical300.patch +0 -0
  77. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/patches/glucose30.patch +0 -0
  78. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/patches/glucose41.patch +0 -0
  79. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/patches/glucose421.patch +0 -0
  80. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/patches/gluecard30.patch +0 -0
  81. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/patches/gluecard41.patch +0 -0
  82. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/patches/kissat404.patch +0 -0
  83. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/patches/lingeling.patch +0 -0
  84. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/patches/maplechrono.patch +0 -0
  85. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/patches/maplecm.patch +0 -0
  86. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/patches/maplesat.patch +0 -0
  87. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/patches/mergesat3.patch +0 -0
  88. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/patches/minicard.patch +0 -0
  89. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/patches/minisat22.patch +0 -0
  90. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/patches/minisatep.patch +0 -0
  91. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/patches/minisatgh.patch +0 -0
  92. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/prepare.py +0 -0
  93. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/solvers/pysolvers.cc +0 -0
  94. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/tests/test_accum_stats.py +0 -0
  95. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/tests/test_atmost.py +0 -0
  96. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/tests/test_atmost1.py +0 -0
  97. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/tests/test_atmostk.py +0 -0
  98. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/tests/test_boolengine.py +0 -0
  99. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/tests/test_clausification.py +0 -0
  100. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/tests/test_cnf.py +0 -0
  101. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/tests/test_encode_pb_conditional.py +0 -0
  102. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/tests/test_equals1.py +0 -0
  103. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/tests/test_formula_parsing.py +0 -0
  104. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/tests/test_formula_unique.py +0 -0
  105. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/tests/test_idpool.py +0 -0
  106. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/tests/test_integer.py +0 -0
  107. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/tests/test_process.py +0 -0
  108. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/tests/test_propagate.py +0 -0
  109. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/tests/test_unique_model.py +0 -0
  110. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/tests/test_unique_mus.py +0 -0
  111. {python_sat-1.9.dev3 → python_sat-1.9.dev4}/tests/test_warmstart.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-sat
3
- Version: 1.9.dev3
3
+ Version: 1.9.dev4
4
4
  Summary: A Python library for prototyping with SAT oracles
5
5
  Home-page: https://github.com/pysathq/pysat
6
6
  Author: Alexey Ignatiev, Joao Marques-Silva, Antonio Morgado
@@ -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(lambda: set([]))
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
- if -l2 in self.sels_set:
823
- conns[l1].add(-l2)
824
- conns[-l2].add(l1)
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
- if confl: # filtering out unnecessary connections
830
- ccopy = {}
831
- confl = set(confl)
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
- for l in conns:
834
- if l not in confl:
835
- cc = conns[l].difference(confl)
836
- if cc:
837
- ccopy[l] = cc
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
- conns = ccopy
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
- lits = set(conns.keys())
874
+
855
875
  while lits:
856
- am1 = [min(lits, key=lambda l: len(conns[l]))]
876
+ am1 = [min(lits, key=lambda l: degree[l])]
857
877
 
858
- for l in sorted(conns[am1[0]], key=lambda l: len(conns[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
- if l_added not in conns[l]:
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 lits and connections
867
- lits.difference_update(set(am1))
868
- for l in conns:
869
- conns[l] = conns[l].difference(set(am1))
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
@@ -10,7 +10,7 @@
10
10
 
11
11
  # current version
12
12
  #==============================================================================
13
- VERSION = (1, 9, 'dev', 3)
13
+ VERSION = (1, 9, 'dev', 4)
14
14
 
15
15
 
16
16
  # PEP440 Format
@@ -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
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-sat
3
- Version: 1.9.dev3
3
+ Version: 1.9.dev4
4
4
  Summary: A Python library for prototyping with SAT oracles
5
5
  Home-page: https://github.com/pysathq/pysat
6
6
  Author: Alexey Ignatiev, Joao Marques-Silva, Antonio Morgado
File without changes
File without changes
File without changes
File without changes
File without changes