python-sat 1.9.dev21__tar.gz → 1.9.dev23__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.
- {python_sat-1.9.dev21/python_sat.egg-info → python_sat-1.9.dev23}/PKG-INFO +1 -1
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/examples/hitman.py +16 -11
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/pysat/__init__.py +1 -1
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/pysat/engines.py +20 -10
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/pysat/solvers.py +262 -403
- {python_sat-1.9.dev21 → python_sat-1.9.dev23/python_sat.egg-info}/PKG-INFO +1 -1
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/python_sat.egg-info/SOURCES.txt +1 -0
- python_sat-1.9.dev23/solvers/ergo.tar.gz +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/solvers/patches/ergo.patch +14 -133
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/solvers/patches/glucose30.patch +23 -9
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/solvers/patches/glucose41.patch +28 -14
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/solvers/patches/glucose421.patch +37 -10
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/solvers/patches/gluecard30.patch +25 -11
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/solvers/patches/gluecard41.patch +31 -17
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/solvers/patches/minicard.patch +25 -11
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/solvers/patches/minisat22.patch +27 -12
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/solvers/patches/minisatep.patch +35 -8
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/solvers/patches/minisatgh.patch +26 -10
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/solvers/pysolvers.cc +625 -297
- python_sat-1.9.dev23/tests/test_activities.py +77 -0
- python_sat-1.9.dev23/tests/test_hitman.py +98 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/tests/test_propagate.py +2 -3
- python_sat-1.9.dev21/solvers/ergo.tar.gz +0 -0
- python_sat-1.9.dev21/tests/test_hitman.py +0 -31
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/LICENSE.txt +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/MANIFEST.in +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/README.rst +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/allies/__init__.py +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/allies/approxmc.py +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/allies/unigen.py +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/cardenc/bitwise.hh +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/cardenc/card.hh +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/cardenc/clset.hh +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/cardenc/common.hh +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/cardenc/iseq.hh +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/cardenc/itot.hh +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/cardenc/ladder.hh +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/cardenc/mto.hh +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/cardenc/pairwise.hh +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/cardenc/ptypes.hh +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/cardenc/pycard.cc +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/cardenc/seqcounter.hh +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/cardenc/sortcard.hh +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/cardenc/utils.hh +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/examples/__init__.py +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/examples/bbscan.py +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/examples/bica.py +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/examples/fm.py +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/examples/genhard.py +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/examples/lbx.py +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/examples/lsu.py +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/examples/mcsls.py +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/examples/models.py +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/examples/musx.py +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/examples/optux.py +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/examples/primer.py +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/examples/rc2.py +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/examples/usage.py +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/formula/pf_parse.cc +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/formula/pf_plus.cc +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/formula/pf_plus.hh +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/formula/pf_py.hh +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/formula/pf_scan.hh +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/formula/pf_weight.cc +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/formula/pf_weight.hh +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/formula/pyformula.cc +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/formula/pyformula.hh +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/pysat/_fileio.py +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/pysat/_utils.py +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/pysat/card.py +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/pysat/formula.py +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/pysat/integer.py +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/pysat/pb.py +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/pysat/process.py +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/python_sat.egg-info/dependency_links.txt +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/python_sat.egg-info/requires.txt +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/python_sat.egg-info/top_level.txt +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/requirements.txt +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/setup.cfg +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/setup.py +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/solvers/cadical103.tar.gz +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/solvers/cadical153.tar.gz +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/solvers/cadical195.tar.gz +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/solvers/cadical300.tar.gz +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/solvers/glucose30.tar.gz +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/solvers/glucose41.tar.gz +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/solvers/glucose421.tar.gz +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/solvers/lingeling.tar.gz +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/solvers/maplechrono.zip +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/solvers/maplecm.zip +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/solvers/maplesat.zip +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/solvers/mergesat3.tar.gz +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/solvers/minicard.tar.gz +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/solvers/minisat22.tar.gz +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/solvers/minisatgh.zip +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/solvers/patches/cadical103.patch +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/solvers/patches/cadical153.patch +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/solvers/patches/cadical195.patch +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/solvers/patches/cadical300.patch +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/solvers/patches/kissat404.patch +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/solvers/patches/lingeling.patch +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/solvers/patches/maplechrono.patch +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/solvers/patches/maplecm.patch +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/solvers/patches/maplesat.patch +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/solvers/patches/mergesat3.patch +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/solvers/prepare.py +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/tests/test_accum_stats.py +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/tests/test_atmost.py +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/tests/test_atmost1.py +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/tests/test_atmostk.py +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/tests/test_boolengine.py +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/tests/test_clausification.py +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/tests/test_cnf.py +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/tests/test_empty_clause.py +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/tests/test_empty_extclause.py +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/tests/test_encode_pb_conditional.py +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/tests/test_equals1.py +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/tests/test_flip_bits.py +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/tests/test_formula_parsing.py +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/tests/test_formula_unique.py +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/tests/test_idpool.py +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/tests/test_integer.py +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/tests/test_iseqcounter.py +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/tests/test_lsu.py +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/tests/test_oom.py +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/tests/test_pb.py +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/tests/test_process.py +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/tests/test_proof.py +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/tests/test_unique_model.py +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/tests/test_unique_mus.py +0 -0
- {python_sat-1.9.dev21 → python_sat-1.9.dev23}/tests/test_warmstart.py +0 -0
|
@@ -213,8 +213,8 @@ class Hitman(object):
|
|
|
213
213
|
enumerator. If ``htype`` is set to ``'mcsls'``, the :class:`.MCSls`
|
|
214
214
|
enumerator is used. Finally, value ``'sat'`` can be given, in which
|
|
215
215
|
case minimal hitting set enumeration will performed by means of a SAT
|
|
216
|
-
solver (can be either MiniSat-GH, or Lingeling, or CaDiCaL 153
|
|
217
|
-
polarity setting.
|
|
216
|
+
solver (can be either MiniSat-GH, or Lingeling, or CaDiCaL 153, 195,
|
|
217
|
+
or 300) with polarity setting.
|
|
218
218
|
|
|
219
219
|
In either case, unless pure SAT-based hitting set enumeration is
|
|
220
220
|
selected, an underlying problem solver can use a SAT oracle specified
|
|
@@ -394,21 +394,26 @@ class Hitman(object):
|
|
|
394
394
|
else: # 'sat'
|
|
395
395
|
assert self.solver in SolverNames.minisatgh + \
|
|
396
396
|
SolverNames.lingeling + SolverNames.cadical153 + \
|
|
397
|
-
SolverNames.cadical195
|
|
397
|
+
SolverNames.cadical195 + SolverNames.cadical300, \
|
|
398
|
+
'Hard polarity setting is unsupported by {0}'.format(self.solver)
|
|
398
399
|
|
|
399
400
|
# setting up a SAT solver, so that it supports the same interface
|
|
400
401
|
if formula.atms == []:
|
|
401
|
-
self.oracle = Solver(name=self.solver,
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
use_timer=True, native_card=True)
|
|
406
|
-
|
|
407
|
-
for atm in formula.atms:
|
|
408
|
-
self.oracle.add_atmost(*atm)
|
|
402
|
+
self.oracle = Solver(name=self.solver, use_timer=True)
|
|
403
|
+
elif self.solver in SolverNames.cadical195 + SolverNames.cadical300:
|
|
404
|
+
self.oracle = Solver(name=self.solver, use_timer=True,
|
|
405
|
+
native_card=True)
|
|
409
406
|
else:
|
|
410
407
|
assert 0, 'Native AtMostK constraints aren\'t supported by MinisatGH, Lingeling, or CaDiCaL 153'
|
|
411
408
|
|
|
409
|
+
# Elimination may create non-minimal hitting sets in Cadical 195 and 153
|
|
410
|
+
if self.solver in SolverNames.cadical153 + SolverNames.cadical195:
|
|
411
|
+
self.oracle.configure({'elim': 0})
|
|
412
|
+
|
|
413
|
+
self.oracle.append_formula(formula.hard)
|
|
414
|
+
for atm in formula.atms:
|
|
415
|
+
self.oracle.add_atmost(*atm)
|
|
416
|
+
|
|
412
417
|
# MinisatGH supports warm start mode
|
|
413
418
|
if self.solver in SolverNames.minisatgh:
|
|
414
419
|
self.oracle.start_mode(warm=True)
|
|
@@ -141,7 +141,7 @@ class LinearConstraint:
|
|
|
141
141
|
Constraint initialiser.
|
|
142
142
|
"""
|
|
143
143
|
|
|
144
|
-
if not weights or
|
|
144
|
+
if not weights or isinstance(weights, dict):
|
|
145
145
|
# the same literal may appear multiple times in the list
|
|
146
146
|
# so we need to calculate it's actual weight
|
|
147
147
|
cntr = Counter(lits)
|
|
@@ -378,7 +378,7 @@ class ParityConstraint:
|
|
|
378
378
|
for lit in lits:
|
|
379
379
|
if lit < 0:
|
|
380
380
|
lit = -lit
|
|
381
|
-
value ^=
|
|
381
|
+
value ^= 1
|
|
382
382
|
self.lits.append(lit)
|
|
383
383
|
|
|
384
384
|
# right-hand side, current value, and variable counter
|
|
@@ -1038,6 +1038,9 @@ class BooleanEngine(Propagator):
|
|
|
1038
1038
|
|
|
1039
1039
|
# forward simplification
|
|
1040
1040
|
for i, csi in enumerate(self.xors):
|
|
1041
|
+
if not csi.lits: # eliminated as redundant (0 = 0)
|
|
1042
|
+
continue
|
|
1043
|
+
|
|
1041
1044
|
v = csi.lits[0] # pivot variable
|
|
1042
1045
|
|
|
1043
1046
|
# going over all the other constraints and eliminating the pivot
|
|
@@ -1091,6 +1094,13 @@ class BooleanEngine(Propagator):
|
|
|
1091
1094
|
Update the propagator's state given a new assignment.
|
|
1092
1095
|
"""
|
|
1093
1096
|
|
|
1097
|
+
if fixed:
|
|
1098
|
+
self.fixed[abs(lit)] = True
|
|
1099
|
+
|
|
1100
|
+
# the solver may notify us again when an assigned literal gets fixed
|
|
1101
|
+
if self.level[abs(lit)] is not None:
|
|
1102
|
+
return
|
|
1103
|
+
|
|
1094
1104
|
self.level[abs(lit)] = self.decision_level
|
|
1095
1105
|
|
|
1096
1106
|
if self.qhead is None:
|
|
@@ -1100,9 +1110,6 @@ class BooleanEngine(Propagator):
|
|
|
1100
1110
|
|
|
1101
1111
|
self.trail.append(lit)
|
|
1102
1112
|
|
|
1103
|
-
if fixed:
|
|
1104
|
-
self.fixed[abs(lit)] = True
|
|
1105
|
-
|
|
1106
1113
|
def on_new_level(self):
|
|
1107
1114
|
"""
|
|
1108
1115
|
Keep track of decision level updates.
|
|
@@ -1116,6 +1123,8 @@ class BooleanEngine(Propagator):
|
|
|
1116
1123
|
Cancel all the decisions up to a certain level.
|
|
1117
1124
|
"""
|
|
1118
1125
|
|
|
1126
|
+
cursor = self.qhead
|
|
1127
|
+
|
|
1119
1128
|
# undoing the assignments
|
|
1120
1129
|
while len(self.trlim) > to:
|
|
1121
1130
|
while len(self.trail) > self.trlim[-1]:
|
|
@@ -1142,8 +1151,8 @@ class BooleanEngine(Propagator):
|
|
|
1142
1151
|
# updating decision level
|
|
1143
1152
|
self.decision_level = to
|
|
1144
1153
|
|
|
1145
|
-
# updating queue head
|
|
1146
|
-
self.qhead = None
|
|
1154
|
+
# updating queue head (some assignments have not been processed)
|
|
1155
|
+
self.qhead = min(cursor if cursor is not None else 0, len(self.trail))
|
|
1147
1156
|
|
|
1148
1157
|
def check_model(self, model):
|
|
1149
1158
|
"""
|
|
@@ -1204,8 +1213,9 @@ class BooleanEngine(Propagator):
|
|
|
1204
1213
|
lit = self.trail[self.qhead]
|
|
1205
1214
|
|
|
1206
1215
|
# if we have just propagated an opposite value,
|
|
1207
|
-
#
|
|
1216
|
+
# this is a conflict that needs proper treatment
|
|
1208
1217
|
if self.origin[-lit] is not None:
|
|
1218
|
+
result.append(-lit)
|
|
1209
1219
|
break
|
|
1210
1220
|
|
|
1211
1221
|
self.value[abs(lit)] = lit # actually setting the value
|
|
@@ -1277,7 +1287,7 @@ class BooleanEngine(Propagator):
|
|
|
1277
1287
|
|
|
1278
1288
|
if nid is not None:
|
|
1279
1289
|
# this one has a negative counterpart
|
|
1280
|
-
if pid < len(self.wlst[lit]):
|
|
1290
|
+
if pid < len(self.wlst[lit]) and isinstance(self.wlst[lit][pid], ParityConstraint):
|
|
1281
1291
|
# and it's affected
|
|
1282
1292
|
self.wlst[lit][pid].wopp[-lit] = pid
|
|
1283
1293
|
|
|
@@ -1288,7 +1298,7 @@ class BooleanEngine(Propagator):
|
|
|
1288
1298
|
self.wlst[-lit][nid] = self.wlst[-lit][-1]
|
|
1289
1299
|
self.wlst[-lit].pop()
|
|
1290
1300
|
|
|
1291
|
-
if nid < len(self.wlst[-lit]):
|
|
1301
|
+
if nid < len(self.wlst[-lit]) and isinstance(self.wlst[-lit][nid], ParityConstraint):
|
|
1292
1302
|
self.wlst[-lit][nid].wopp[lit] = nid
|
|
1293
1303
|
|
|
1294
1304
|
def provide_reason(self, lit):
|