python-sat 1.9.dev21__cp315-cp315-win_amd64.whl → 1.9.dev23__cp315-cp315-win_amd64.whl
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.
- pycard.cp315-win_amd64.pyd +0 -0
- pyformula.cp315-win_amd64.pyd +0 -0
- pysat/__init__.py +1 -1
- pysat/engines.py +20 -10
- pysat/examples/hitman.py +16 -11
- pysat/solvers.py +262 -403
- pysolvers.cp315-win_amd64.pyd +0 -0
- python_sat-1.9.dev23.dist-info/DELVEWHEEL +2 -0
- {python_sat-1.9.dev21.dist-info → python_sat-1.9.dev23.dist-info}/METADATA +1 -1
- {python_sat-1.9.dev21.dist-info → python_sat-1.9.dev23.dist-info}/RECORD +28 -28
- python_sat-1.9.dev21.dist-info/DELVEWHEEL +0 -2
- {python_sat-1.9.dev21.data → python_sat-1.9.dev23.data}/platlib/msvcp140-a4c2229bdc2a2a630acdc095b4d86008.dll +0 -0
- {python_sat-1.9.dev21.data → python_sat-1.9.dev23.data}/scripts/approxmc.py +0 -0
- {python_sat-1.9.dev21.data → python_sat-1.9.dev23.data}/scripts/bbscan.py +0 -0
- {python_sat-1.9.dev21.data → python_sat-1.9.dev23.data}/scripts/bica.py +0 -0
- {python_sat-1.9.dev21.data → python_sat-1.9.dev23.data}/scripts/fm.py +0 -0
- {python_sat-1.9.dev21.data → python_sat-1.9.dev23.data}/scripts/genhard.py +0 -0
- {python_sat-1.9.dev21.data → python_sat-1.9.dev23.data}/scripts/lbx.py +0 -0
- {python_sat-1.9.dev21.data → python_sat-1.9.dev23.data}/scripts/lsu.py +0 -0
- {python_sat-1.9.dev21.data → python_sat-1.9.dev23.data}/scripts/mcsls.py +0 -0
- {python_sat-1.9.dev21.data → python_sat-1.9.dev23.data}/scripts/models.py +0 -0
- {python_sat-1.9.dev21.data → python_sat-1.9.dev23.data}/scripts/musx.py +0 -0
- {python_sat-1.9.dev21.data → python_sat-1.9.dev23.data}/scripts/optux.py +0 -0
- {python_sat-1.9.dev21.data → python_sat-1.9.dev23.data}/scripts/primer.py +0 -0
- {python_sat-1.9.dev21.data → python_sat-1.9.dev23.data}/scripts/rc2.py +0 -0
- {python_sat-1.9.dev21.data → python_sat-1.9.dev23.data}/scripts/unigen.py +0 -0
- {python_sat-1.9.dev21.dist-info → python_sat-1.9.dev23.dist-info}/WHEEL +0 -0
- {python_sat-1.9.dev21.dist-info → python_sat-1.9.dev23.dist-info}/licenses/LICENSE.txt +0 -0
- {python_sat-1.9.dev21.dist-info → python_sat-1.9.dev23.dist-info}/top_level.txt +0 -0
pycard.cp315-win_amd64.pyd
CHANGED
|
Binary file
|
pyformula.cp315-win_amd64.pyd
CHANGED
|
Binary file
|
pysat/__init__.py
CHANGED
pysat/engines.py
CHANGED
|
@@ -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):
|
pysat/examples/hitman.py
CHANGED
|
@@ -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)
|
pysat/solvers.py
CHANGED
|
@@ -457,8 +457,7 @@ class Solver(object):
|
|
|
457
457
|
name_ = name.lower()
|
|
458
458
|
extra = dict(kwargs)
|
|
459
459
|
|
|
460
|
-
if name_ not in SolverNames.cadical300
|
|
461
|
-
name_ not in SolverNames.ergo:
|
|
460
|
+
if name_ not in SolverNames.cadical300:
|
|
462
461
|
extra.pop('sync_with', None)
|
|
463
462
|
|
|
464
463
|
if name_ not in SolverNames.cadical195 and \
|
|
@@ -607,7 +606,7 @@ class Solver(object):
|
|
|
607
606
|
"""
|
|
608
607
|
|
|
609
608
|
if self.solver:
|
|
610
|
-
if type(self.solver)
|
|
609
|
+
if type(self.solver) is Cadical300:
|
|
611
610
|
self.solver.attach_vpool(vpool=vpool)
|
|
612
611
|
else:
|
|
613
612
|
raise NotImplementedError('Variable synchronization is supported only by CaDiCaL 3.0.0')
|
|
@@ -626,7 +625,7 @@ class Solver(object):
|
|
|
626
625
|
"""
|
|
627
626
|
|
|
628
627
|
if self.solver:
|
|
629
|
-
if type(self.solver)
|
|
628
|
+
if type(self.solver) is Cadical300:
|
|
630
629
|
self.solver.sync_vars()
|
|
631
630
|
else:
|
|
632
631
|
raise NotImplementedError('Variable synchronization is supported only by CaDiCaL 3.0.0')
|
|
@@ -645,198 +644,117 @@ class Solver(object):
|
|
|
645
644
|
"""
|
|
646
645
|
|
|
647
646
|
if self.solver:
|
|
648
|
-
if type(self.solver)
|
|
647
|
+
if type(self.solver) is Cadical300:
|
|
649
648
|
self.solver.sync_vpool()
|
|
650
649
|
else:
|
|
651
650
|
raise NotImplementedError('Variable synchronization is supported only by CaDiCaL 3.0.0')
|
|
652
651
|
|
|
653
652
|
def set_activities(self, activities={}):
|
|
654
653
|
"""
|
|
655
|
-
Replace the solver's variable ordering with a user-given
|
|
656
|
-
variable in ``activities`` takes the activity it maps to
|
|
657
|
-
other variable drops to ``0.0``.
|
|
658
|
-
|
|
659
|
-
|
|
654
|
+
Replace the solver's VSIDS variable ordering with a user-given
|
|
655
|
+
one: each variable in ``activities`` takes the activity it maps to
|
|
656
|
+
and every other variable's activity drops to ``0.0``. This
|
|
657
|
+
influences which decisions are made first. Note that
|
|
658
|
+
:meth:`set_phases` influences *how* they are made, so a user may
|
|
659
|
+
want to apply both methods together.
|
|
660
660
|
|
|
661
|
-
|
|
662
|
-
given values are on the same scale as what
|
|
661
|
+
Importantly, the call also resets the solver's activity bump
|
|
662
|
+
increment, so the given values are on the same scale as what CDCL
|
|
663
|
+
search adds next.
|
|
663
664
|
|
|
665
|
+
This is supported by :class:`Gluecard3`, :class:`Gluecard4`,
|
|
666
|
+
:class:`Glucose3`, :class:`Glucose4`, :class:`Glucose42`,
|
|
667
|
+
:class:`Minicard`, :class:`Minisat22`, :class:`MinisatGH`, and
|
|
668
|
+
:class:`MinisatEP`.
|
|
664
669
|
|
|
665
670
|
.. note::
|
|
666
671
|
|
|
667
|
-
The ordering
|
|
668
|
-
is reshaped by the solver's VSIDS
|
|
669
|
-
in.
|
|
672
|
+
The ordering defined by these activities is a starting point
|
|
673
|
+
rather than a constraint. It is reshaped by the solver's VSIDS
|
|
674
|
+
heuristic as conflicts come in.
|
|
670
675
|
|
|
671
676
|
.. note::
|
|
672
677
|
|
|
673
|
-
An activity of ``0.0`` deprioritises a variable
|
|
678
|
+
An activity of ``0.0`` deprioritises a variable. It does not
|
|
674
679
|
stop the solver branching on it.
|
|
675
680
|
|
|
676
681
|
:param activities: variables mapped to their activities
|
|
677
682
|
:type activities: dict(int, float)
|
|
678
|
-
"""
|
|
679
|
-
|
|
680
|
-
if self.solver:
|
|
681
|
-
if type(self.solver) in (Ergo,):
|
|
682
|
-
self.solver.set_activities(activities)
|
|
683
|
-
else:
|
|
684
|
-
raise NotImplementedError('Setting variable activities is unsupported by this solver')
|
|
685
|
-
|
|
686
|
-
def set_xscope(self, add=[], remove=[]):
|
|
687
|
-
"""
|
|
688
|
-
Adjust the scope of extension-variable mining: a pair of
|
|
689
|
-
literals is only ever mined if both their variables are in
|
|
690
|
-
scope. Variables in ``add`` join the scope, variables in
|
|
691
|
-
``remove`` leave it, and the two must not overlap. Calling the
|
|
692
|
-
method with neither puts every variable back in scope.
|
|
693
|
-
|
|
694
|
-
.. note::
|
|
695
|
-
|
|
696
|
-
A variable the solver introduces from two in-scope literals
|
|
697
|
-
joins the scope itself, so a scoped family can grow on its
|
|
698
|
-
own. The argument ``remove`` takes such a variable back out
|
|
699
|
-
once *both* of its defining literals have gone, recursively.
|
|
700
|
-
|
|
701
|
-
:param add: variables joining the mining scope
|
|
702
|
-
:param remove: variables leaving it
|
|
703
|
-
:type add: iterable(int)
|
|
704
|
-
:type remove: iterable(int)
|
|
705
|
-
"""
|
|
706
|
-
|
|
707
|
-
if self.solver:
|
|
708
|
-
if type(self.solver) in (Ergo,):
|
|
709
|
-
self.solver.set_xscope(add, remove)
|
|
710
|
-
else:
|
|
711
|
-
raise NotImplementedError('Extension-variable mining is unsupported by this solver')
|
|
712
|
-
|
|
713
|
-
def shift_xscope(self, old, new):
|
|
714
|
-
"""
|
|
715
|
-
Move the scope of extension-variable mining from the variables
|
|
716
|
-
of the literals in ``old`` to those of the literals in ``new``,
|
|
717
|
-
e.g. from one call's assumptions to the next one's. Only the
|
|
718
|
-
difference is passed on, so a scope that stays put costs nothing.
|
|
719
|
-
|
|
720
|
-
:param old: literals whose variables are in scope now
|
|
721
|
-
:param new: literals whose variables should be in scope instead
|
|
722
|
-
:type old: iterable(int)
|
|
723
|
-
:type new: iterable(int)
|
|
724
|
-
"""
|
|
725
|
-
|
|
726
|
-
if self.solver:
|
|
727
|
-
if type(self.solver) in (Ergo,):
|
|
728
|
-
self.solver.shift_xscope(old, new)
|
|
729
|
-
else:
|
|
730
|
-
raise NotImplementedError('Extension-variable mining is unsupported by this solver')
|
|
731
|
-
|
|
732
|
-
def xpairs(self, lits=None):
|
|
733
|
-
"""
|
|
734
|
-
Return the literal pairs the extension-variable miner is currently
|
|
735
|
-
tracking, as a list of ``(la, lb, z, count)`` tuples. A pair that
|
|
736
|
-
has already been "extended" carries the identifier of the
|
|
737
|
-
extension variable standing for ``la | lb`` in ``z``, and a
|
|
738
|
-
``count`` of ``0``; a pair still under consideration has ``z ==
|
|
739
|
-
0`` and a ``count`` saying how reliably it has recurred so far.
|
|
740
|
-
Promoted pairs come first.
|
|
741
|
-
|
|
742
|
-
If parameter ``lits`` is given, only the pairs over those literals
|
|
743
|
-
are reported, which is normally what a caller wants: the literals
|
|
744
|
-
it is about to encode. The literals must be distinct.
|
|
745
|
-
|
|
746
|
-
The result is valid until the next call to :meth:`solve`,
|
|
747
|
-
:meth:`solve_limited` or :meth:`propagate`, like a model or an
|
|
748
|
-
unsatisfiable core. Adopting a ``z`` beyond that point requires
|
|
749
|
-
:meth:`xpin`.
|
|
750
|
-
|
|
751
|
-
:param lits: literals to ask about, or ``None`` for every pair
|
|
752
|
-
:type lits: iterable(int)
|
|
753
|
-
|
|
754
|
-
:rtype: list(tuple(int, int, int, float))
|
|
755
|
-
"""
|
|
756
|
-
|
|
757
|
-
if self.solver:
|
|
758
|
-
if type(self.solver) in (Ergo,):
|
|
759
|
-
return self.solver.xpairs(lits)
|
|
760
|
-
else:
|
|
761
|
-
raise NotImplementedError('Extension-variable mining is unsupported by this solver')
|
|
762
|
-
|
|
763
|
-
def xname(self, pairs):
|
|
764
|
-
"""
|
|
765
|
-
Tell the solver about the names of the literal pairs given
|
|
766
|
-
externally. The solver adds the definition clauses, stops its
|
|
767
|
-
miner from introducing other names for the same pairs, and
|
|
768
|
-
rewrites its learnt clauses accordingly. Pair names adopted this
|
|
769
|
-
way are never retired.
|
|
770
683
|
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
A pair that already has a name, and a ``z`` that already
|
|
774
|
-
names another pair, are both ignored.
|
|
775
|
-
|
|
776
|
-
:param pairs: the pairs to name
|
|
777
|
-
:type pairs: iterable(tuple(int, int, int))
|
|
778
|
-
"""
|
|
779
|
-
|
|
780
|
-
if self.solver:
|
|
781
|
-
if type(self.solver) in (Ergo,):
|
|
782
|
-
self.solver.xname(pairs)
|
|
783
|
-
else:
|
|
784
|
-
raise NotImplementedError('Extension-variable mining is unsupported by this solver')
|
|
684
|
+
Usage example:
|
|
785
685
|
|
|
786
|
-
|
|
787
|
-
"""
|
|
788
|
-
Tell the solver that the given literal pairs are encoded
|
|
789
|
-
externally, so its miner must never consider them again. Unlike
|
|
790
|
-
:meth:`xname`, nothing is defined, recorded or rewritten: the
|
|
791
|
-
caller's own names for the pairs stay ordinary variables.
|
|
686
|
+
.. code-block:: python
|
|
792
687
|
|
|
793
|
-
|
|
794
|
-
|
|
688
|
+
>>> from pysat.solvers import Glucose3
|
|
689
|
+
>>>
|
|
690
|
+
>>> g = Glucose3(bootstrap_with=[[-1, 2], [-3, -2]])
|
|
691
|
+
>>> g.set_phases(literals=[1, 2, 3])
|
|
692
|
+
>>>
|
|
693
|
+
>>> # decide 1 first, then 3
|
|
694
|
+
>>> # note how 2 is missing -> it will get activity 0.0
|
|
695
|
+
>>> g.set_activities({1: 2.0, 3: 1.0})
|
|
696
|
+
>>> g.solve()
|
|
697
|
+
True
|
|
698
|
+
>>> g.get_model()
|
|
699
|
+
[1, 2, -3]
|
|
700
|
+
>>>
|
|
701
|
+
>>> # decide 3 first, then 1
|
|
702
|
+
>>> # (phase saving in the previous SAT call changed
|
|
703
|
+
>>> # the polarities, so we are setting them again)
|
|
704
|
+
>>> g.set_phases(literals=[1, 2, 3])
|
|
705
|
+
>>> g.set_activities({3: 2.0, 1: 1.0})
|
|
706
|
+
>>> g.solve()
|
|
707
|
+
True
|
|
708
|
+
>>> g.get_model()
|
|
709
|
+
[-1, -2, 3]
|
|
710
|
+
>>>
|
|
711
|
+
>>> g.delete()
|
|
795
712
|
"""
|
|
796
713
|
|
|
797
714
|
if self.solver:
|
|
798
|
-
if type(self.solver) in (Ergo,
|
|
799
|
-
|
|
715
|
+
if type(self.solver) in (Ergo, Gluecard3, Gluecard4, Glucose3,
|
|
716
|
+
Glucose4, Glucose42, Minicard, Minisat22,
|
|
717
|
+
MinisatGH, MinisatEP):
|
|
718
|
+
self.solver.set_activities(activities)
|
|
800
719
|
else:
|
|
801
|
-
raise NotImplementedError('
|
|
720
|
+
raise NotImplementedError('Setting variable activities is unsupported by this solver')
|
|
802
721
|
|
|
803
|
-
def
|
|
722
|
+
def get_activities(self, variables=[]):
|
|
804
723
|
"""
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
happening, indicating the variable is now used externally.
|
|
810
|
-
|
|
811
|
-
.. note::
|
|
724
|
+
Obtain the solver's current activities of ``variables`` as a
|
|
725
|
+
dictionary. Variables outside the parameter list are excluded.
|
|
726
|
+
Variables the solver does not know of report activity ``0.0``. The
|
|
727
|
+
returned values are the current variables' VSIDS activities.
|
|
812
728
|
|
|
813
|
-
|
|
729
|
+
This is supported by the same MiniSat-derived solvers, as
|
|
730
|
+
:meth:`set_activities`.
|
|
814
731
|
|
|
815
|
-
:param variables:
|
|
732
|
+
:param variables: variables to report
|
|
816
733
|
:type variables: iterable(int)
|
|
817
|
-
"""
|
|
818
734
|
|
|
819
|
-
|
|
820
|
-
if type(self.solver) in (Ergo,):
|
|
821
|
-
self.solver.xpin(variables)
|
|
822
|
-
else:
|
|
823
|
-
raise NotImplementedError('Extension-variable mining is unsupported by this solver')
|
|
735
|
+
:rtype: dict(int, float)
|
|
824
736
|
|
|
825
|
-
|
|
826
|
-
"""
|
|
827
|
-
Releases a pin taken by :meth:`xpin`, handing the variable
|
|
828
|
-
back to the solver's retirement: if nothing else references
|
|
829
|
-
it, it is retired at once and its identifier becomes reusable.
|
|
737
|
+
Usage example:
|
|
830
738
|
|
|
831
|
-
|
|
832
|
-
|
|
739
|
+
.. code-block:: python
|
|
740
|
+
|
|
741
|
+
>>> from pysat.solvers import Glucose3
|
|
742
|
+
>>>
|
|
743
|
+
>>> g = Glucose3(bootstrap_with=[[-1, 2], [-3, -2]])
|
|
744
|
+
>>> g.set_activities(activities={3: 2.0, 1: 1.0})
|
|
745
|
+
>>> g.get_activities(variables=[1, 2, 3])
|
|
746
|
+
{1: 1.0, 2: 0.0, 3: 2.0}
|
|
747
|
+
>>>
|
|
748
|
+
>>> g.delete()
|
|
833
749
|
"""
|
|
834
750
|
|
|
835
751
|
if self.solver:
|
|
836
|
-
if type(self.solver) in (Ergo,
|
|
837
|
-
|
|
752
|
+
if type(self.solver) in (Ergo, Gluecard3, Gluecard4, Glucose3,
|
|
753
|
+
Glucose4, Glucose42, Minicard, Minisat22,
|
|
754
|
+
MinisatGH, MinisatEP):
|
|
755
|
+
return self.solver.get_activities(variables)
|
|
838
756
|
else:
|
|
839
|
-
raise NotImplementedError('
|
|
757
|
+
raise NotImplementedError('Getting variable activities is unsupported by this solver')
|
|
840
758
|
|
|
841
759
|
def activate_atmost(self):
|
|
842
760
|
"""
|
|
@@ -3818,8 +3736,7 @@ class Ergo(object):
|
|
|
3818
3736
|
"""
|
|
3819
3737
|
|
|
3820
3738
|
def __init__(self, bootstrap_with=None, use_timer=False, incr=False,
|
|
3821
|
-
with_proof=False, warm_start=False, native_card=False
|
|
3822
|
-
sync_with=None):
|
|
3739
|
+
with_proof=False, warm_start=False, native_card=False):
|
|
3823
3740
|
"""
|
|
3824
3741
|
Basic constructor.
|
|
3825
3742
|
"""
|
|
@@ -3832,13 +3749,11 @@ class Ergo(object):
|
|
|
3832
3749
|
self.status = None
|
|
3833
3750
|
self.prfile = None
|
|
3834
3751
|
self.prfp = None
|
|
3835
|
-
self.sync_with = None
|
|
3836
3752
|
|
|
3837
3753
|
# checked here, so that __del__ finds the attributes above in place
|
|
3838
3754
|
assert ergo_present, 'Solver \'ergo\' is unavailable in this build of PySAT.'
|
|
3839
3755
|
|
|
3840
|
-
self.new(bootstrap_with, use_timer, with_proof, warm_start, native_card
|
|
3841
|
-
sync_with)
|
|
3756
|
+
self.new(bootstrap_with, use_timer, with_proof, warm_start, native_card)
|
|
3842
3757
|
|
|
3843
3758
|
def __del__(self):
|
|
3844
3759
|
"""
|
|
@@ -3862,7 +3777,7 @@ class Ergo(object):
|
|
|
3862
3777
|
self.delete()
|
|
3863
3778
|
|
|
3864
3779
|
def new(self, bootstrap_with=None, use_timer=False, with_proof=False,
|
|
3865
|
-
warm_start=False, native_card=False
|
|
3780
|
+
warm_start=False, native_card=False):
|
|
3866
3781
|
"""
|
|
3867
3782
|
Actual constructor of the solver.
|
|
3868
3783
|
"""
|
|
@@ -3902,53 +3817,10 @@ class Ergo(object):
|
|
|
3902
3817
|
if warm_start:
|
|
3903
3818
|
self.start_mode(warm=True)
|
|
3904
3819
|
|
|
3905
|
-
# if the user wants extension variables to coexist with their
|
|
3906
|
-
# own IDPool, the two have to be kept synchronized both ways
|
|
3907
|
-
self.attach_vpool(sync_with)
|
|
3908
|
-
|
|
3909
3820
|
self.use_timer = use_timer
|
|
3910
3821
|
self.call_time = 0.0 # time spent for the last call to oracle
|
|
3911
3822
|
self.accu_time = 0.0 # time accumulated for all calls to oracle
|
|
3912
3823
|
|
|
3913
|
-
def sync_vpool(self):
|
|
3914
|
-
"""
|
|
3915
|
-
Synchronize a user-provided IDPool with the variables already
|
|
3916
|
-
known to Ergo, i.e. occupy in the pool every identifier the
|
|
3917
|
-
solver minted on its own (as an extension variable). This is the
|
|
3918
|
-
solver to pool direction; see :meth:`.sync_vars` for the other
|
|
3919
|
-
one.
|
|
3920
|
-
"""
|
|
3921
|
-
|
|
3922
|
-
if self.ergo and self.sync_with is not None:
|
|
3923
|
-
top = pysolvers.ergo_nof_vars(self.ergo)
|
|
3924
|
-
|
|
3925
|
-
if top > self.sync_with.top:
|
|
3926
|
-
self.sync_with.occupy(self.sync_with.top + 1, top)
|
|
3927
|
-
self.sync_with.top = top
|
|
3928
|
-
|
|
3929
|
-
def sync_vars(self):
|
|
3930
|
-
"""
|
|
3931
|
-
Synchronize the variables of Ergo with a user-provided IDPool,
|
|
3932
|
-
i.e. declare in the solver every identifier the pool has already
|
|
3933
|
-
handed out. This is the pool to solver direction of
|
|
3934
|
-
:meth:`.sync_vpool`.
|
|
3935
|
-
"""
|
|
3936
|
-
|
|
3937
|
-
if self.ergo and self.sync_with is not None:
|
|
3938
|
-
pysolvers.ergo_dec_vars(self.ergo, self.sync_with.top)
|
|
3939
|
-
|
|
3940
|
-
def attach_vpool(self, vpool=None):
|
|
3941
|
-
"""
|
|
3942
|
-
Set a shared variable pool to keep synchronized with the solver.
|
|
3943
|
-
"""
|
|
3944
|
-
|
|
3945
|
-
if vpool is not None and not isinstance(vpool, IDPool):
|
|
3946
|
-
raise TypeError('This solver expects \'sync_with\' to be an IDPool object or None')
|
|
3947
|
-
|
|
3948
|
-
self.sync_with = vpool
|
|
3949
|
-
self.sync_vars()
|
|
3950
|
-
self.sync_vpool()
|
|
3951
|
-
|
|
3952
3824
|
def activate_atmost(self):
|
|
3953
3825
|
"""
|
|
3954
3826
|
This method enables native cardinality mode. Note that it is
|
|
@@ -4003,8 +3875,6 @@ class Ergo(object):
|
|
|
4003
3875
|
"""
|
|
4004
3876
|
|
|
4005
3877
|
if self.ergo:
|
|
4006
|
-
self.sync_vars()
|
|
4007
|
-
|
|
4008
3878
|
if self.use_timer:
|
|
4009
3879
|
start_time = process_time()
|
|
4010
3880
|
|
|
@@ -4015,8 +3885,6 @@ class Ergo(object):
|
|
|
4015
3885
|
self.call_time = process_time() - start_time
|
|
4016
3886
|
self.accu_time += self.call_time
|
|
4017
3887
|
|
|
4018
|
-
self.sync_vpool()
|
|
4019
|
-
|
|
4020
3888
|
return self.status
|
|
4021
3889
|
|
|
4022
3890
|
def solve_limited(self, assumptions=[], expect_interrupt=False):
|
|
@@ -4026,8 +3894,6 @@ class Ergo(object):
|
|
|
4026
3894
|
"""
|
|
4027
3895
|
|
|
4028
3896
|
if self.ergo:
|
|
4029
|
-
self.sync_vars()
|
|
4030
|
-
|
|
4031
3897
|
if self.use_timer:
|
|
4032
3898
|
start_time = process_time()
|
|
4033
3899
|
|
|
@@ -4038,8 +3904,6 @@ class Ergo(object):
|
|
|
4038
3904
|
self.call_time = process_time() - start_time
|
|
4039
3905
|
self.accu_time += self.call_time
|
|
4040
3906
|
|
|
4041
|
-
self.sync_vpool()
|
|
4042
|
-
|
|
4043
3907
|
return self.status
|
|
4044
3908
|
|
|
4045
3909
|
def conf_budget(self, budget):
|
|
@@ -4118,43 +3982,22 @@ class Ergo(object):
|
|
|
4118
3982
|
|
|
4119
3983
|
def set_activities(self, activities={}):
|
|
4120
3984
|
"""
|
|
4121
|
-
Replaces
|
|
4122
|
-
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
decisions the solver should make first, where :meth:`set_phases`
|
|
4126
|
-
says which way it should decide them.
|
|
4127
|
-
|
|
4128
|
-
.. note::
|
|
4129
|
-
|
|
4130
|
-
An activity of ``0.0`` deprioritises a variable; it does not
|
|
4131
|
-
stop the solver branching on it once the preferred ones are
|
|
4132
|
-
exhausted.
|
|
4133
|
-
|
|
4134
|
-
:param activities: variables mapped to their activities
|
|
4135
|
-
:type activities: dict(int, float)
|
|
4136
|
-
|
|
4137
|
-
Example:
|
|
3985
|
+
Replaces the solver's variable activities: each variable in
|
|
3986
|
+
``activities`` takes the activity it maps to, and every other
|
|
3987
|
+
variable's activity drops to ``0.0``.
|
|
3988
|
+
"""
|
|
4138
3989
|
|
|
4139
|
-
|
|
3990
|
+
if self.ergo:
|
|
3991
|
+
pysolvers.ergo_setacts(self.ergo, dict(activities))
|
|
4140
3992
|
|
|
4141
|
-
|
|
4142
|
-
|
|
4143
|
-
|
|
4144
|
-
>>> s.set_activities({1: 2.0, 3: 1.0})
|
|
4145
|
-
>>> s.solve()
|
|
4146
|
-
True
|
|
4147
|
-
>>> s.get_model()
|
|
4148
|
-
[1, 2, -3]
|
|
4149
|
-
>>> s.set_activities({3: 2.0, 1: 1.0})
|
|
4150
|
-
>>> s.solve()
|
|
4151
|
-
True
|
|
4152
|
-
>>> s.get_model()
|
|
4153
|
-
[-1, -2, 3]
|
|
3993
|
+
def get_activities(self, variables=[]):
|
|
3994
|
+
"""
|
|
3995
|
+
Return the current activities of ``variables``, as a dictionary.
|
|
4154
3996
|
"""
|
|
4155
3997
|
|
|
4156
3998
|
if self.ergo:
|
|
4157
|
-
|
|
3999
|
+
variables = list(variables)
|
|
4000
|
+
return dict(zip(variables, pysolvers.ergo_getacts(self.ergo, variables)))
|
|
4158
4001
|
|
|
4159
4002
|
def configure(self, parameters):
|
|
4160
4003
|
"""
|
|
@@ -4222,29 +4065,6 @@ class Ergo(object):
|
|
|
4222
4065
|
* ``adapt-at``: conflict count at which to (once) evaluate
|
|
4223
4066
|
switching solver strategies (int), or ``never``
|
|
4224
4067
|
|
|
4225
|
-
* ``ext``: enable automatic extension-variable mining (bool)
|
|
4226
|
-
|
|
4227
|
-
* ``ext-threshold``: co-occurrences a mined pair needs
|
|
4228
|
-
before it is turned into a new variable (float)
|
|
4229
|
-
|
|
4230
|
-
* ``ext-warmup``: conflicts to let pass, unmined, before
|
|
4231
|
-
``ext`` starts tracking candidate pairs (int)
|
|
4232
|
-
|
|
4233
|
-
* ``ext-escalate``: how quickly ``ext-threshold`` grows
|
|
4234
|
-
with the number of variables already introduced (float)
|
|
4235
|
-
|
|
4236
|
-
* ``ext-rewrite``: whether a promoted or named pair may
|
|
4237
|
-
be substituted into the clause database (default
|
|
4238
|
-
``True``); switching it off also stops mining from
|
|
4239
|
-
promoting, since a variable nothing references retires
|
|
4240
|
-
the moment it is created
|
|
4241
|
-
|
|
4242
|
-
* ``ext-equiv``: whether an extension variable gets the
|
|
4243
|
-
``la | lb -> z`` half of its definition (default
|
|
4244
|
-
``True``); without it ``z`` is only the upper bound a
|
|
4245
|
-
totalizer would have encoded itself, which a rewrite
|
|
4246
|
-
cannot use, so it forces ``ext-rewrite`` off
|
|
4247
|
-
|
|
4248
4068
|
:param parameters: parameter names mapped to their values
|
|
4249
4069
|
:type parameters: dict
|
|
4250
4070
|
"""
|
|
@@ -4262,138 +4082,6 @@ class Ergo(object):
|
|
|
4262
4082
|
if parameters.get('jw-mode', 'none') != 'none':
|
|
4263
4083
|
self.apply_jw()
|
|
4264
4084
|
|
|
4265
|
-
def set_xscope(self, add=[], remove=[]):
|
|
4266
|
-
"""
|
|
4267
|
-
Adjust the scope of extension-variable mining: a pair of
|
|
4268
|
-
literals is only ever mined if both their variables are in
|
|
4269
|
-
scope. Variables in ``add`` join the scope, variables in
|
|
4270
|
-
``remove`` leave it, and the two must not overlap. Calling the
|
|
4271
|
-
method with neither puts every variable back in scope.
|
|
4272
|
-
|
|
4273
|
-
.. note::
|
|
4274
|
-
|
|
4275
|
-
A variable the solver introduces from two in-scope literals
|
|
4276
|
-
joins the scope itself, so a scoped family can grow on its
|
|
4277
|
-
own. The argument ``remove`` takes such a variable back out
|
|
4278
|
-
once *both* of its defining literals have gone, recursively.
|
|
4279
|
-
|
|
4280
|
-
:param add: variables joining the mining scope
|
|
4281
|
-
:param remove: variables leaving it
|
|
4282
|
-
:type add: iterable(int)
|
|
4283
|
-
:type remove: iterable(int)
|
|
4284
|
-
"""
|
|
4285
|
-
|
|
4286
|
-
if self.ergo:
|
|
4287
|
-
pysolvers.ergo_setxscope(self.ergo, add, remove)
|
|
4288
|
-
|
|
4289
|
-
def shift_xscope(self, old, new):
|
|
4290
|
-
"""
|
|
4291
|
-
Move the mining scope from the variables of ``old`` to those of
|
|
4292
|
-
``new``; only the difference reaches Ergo.
|
|
4293
|
-
|
|
4294
|
-
:param old: literals whose variables are in scope now
|
|
4295
|
-
:param new: literals whose variables should be in scope instead
|
|
4296
|
-
:type old: iterable(int)
|
|
4297
|
-
:type new: iterable(int)
|
|
4298
|
-
"""
|
|
4299
|
-
|
|
4300
|
-
if self.ergo:
|
|
4301
|
-
pysolvers.ergo_shiftxscope(self.ergo, old, new)
|
|
4302
|
-
|
|
4303
|
-
def xpairs(self, lits=None):
|
|
4304
|
-
"""
|
|
4305
|
-
Return the literal pairs the extension-variable miner is currently
|
|
4306
|
-
tracking, as a list of ``(la, lb, z, count)`` tuples. A pair that
|
|
4307
|
-
has already been "extended" carries the identifier of the
|
|
4308
|
-
extension variable standing for ``la | lb`` in ``z``, and a
|
|
4309
|
-
``count`` of ``0``; a pair still under consideration has ``z ==
|
|
4310
|
-
0`` and a ``count`` saying how reliably it has recurred so far.
|
|
4311
|
-
Promoted pairs come first.
|
|
4312
|
-
|
|
4313
|
-
If ``lits`` is given, only the pairs over those literals are
|
|
4314
|
-
reported, which is normally what a caller wants: the literals it
|
|
4315
|
-
is about to encode. Asking narrowly is also much cheaper than
|
|
4316
|
-
taking the whole database home and sifting it there. The
|
|
4317
|
-
literals must be distinct.
|
|
4318
|
-
|
|
4319
|
-
The result is valid until the next call to :meth:`solve`,
|
|
4320
|
-
:meth:`solve_limited` or :meth:`propagate`, like a model or an
|
|
4321
|
-
unsatisfiable core. Adopting a ``z`` beyond that point requires
|
|
4322
|
-
:meth:`xpin`.
|
|
4323
|
-
|
|
4324
|
-
:param lits: literals to ask about, or ``None`` for every pair
|
|
4325
|
-
:type lits: iterable(int)
|
|
4326
|
-
|
|
4327
|
-
:rtype: list(tuple(int, int, int, float))
|
|
4328
|
-
"""
|
|
4329
|
-
|
|
4330
|
-
if self.ergo:
|
|
4331
|
-
return pysolvers.ergo_xpairs(self.ergo, lits)
|
|
4332
|
-
|
|
4333
|
-
def xname(self, pairs):
|
|
4334
|
-
"""
|
|
4335
|
-
Adopt variables of the caller's own as names for literal pairs,
|
|
4336
|
-
i.e. register ``z <-> la | lb`` for a pair the caller has encoded
|
|
4337
|
-
itself. Ergo adds ``z``'s definition clauses, records the pair so
|
|
4338
|
-
its miner never mints a second name for it, and rewrites its
|
|
4339
|
-
learnt clauses onto ``z``. An adopted name is pinned on arrival
|
|
4340
|
-
and never retires.
|
|
4341
|
-
|
|
4342
|
-
A pair that already has a name, and a ``z`` that already names
|
|
4343
|
-
another pair, are both ignored.
|
|
4344
|
-
|
|
4345
|
-
:param pairs: the pairs to name
|
|
4346
|
-
:type pairs: iterable(tuple(int, int, int))
|
|
4347
|
-
"""
|
|
4348
|
-
|
|
4349
|
-
if self.ergo:
|
|
4350
|
-
pysolvers.ergo_xname(self.ergo, [l for p in pairs for l in p])
|
|
4351
|
-
|
|
4352
|
-
def xblock(self, pairs):
|
|
4353
|
-
"""
|
|
4354
|
-
Keep the miner off literal pairs the caller encodes itself, for
|
|
4355
|
-
good. Nothing is defined, recorded or rewritten, and the
|
|
4356
|
-
caller's own variable for a pair is none of Ergo's business.
|
|
4357
|
-
|
|
4358
|
-
:param pairs: the pairs to keep the miner off
|
|
4359
|
-
:type pairs: iterable(tuple(int, int))
|
|
4360
|
-
"""
|
|
4361
|
-
|
|
4362
|
-
if self.ergo:
|
|
4363
|
-
pysolvers.ergo_xblock(self.ergo, [l for p in pairs for l in p[:2]])
|
|
4364
|
-
|
|
4365
|
-
def xpin(self, variables):
|
|
4366
|
-
"""
|
|
4367
|
-
Keeps the given extension variables alive. Ergo retires an
|
|
4368
|
-
extension variable once nothing references it any more and
|
|
4369
|
-
recycles its identifier for a later pair, which would
|
|
4370
|
-
silently change what an adopted ``z`` means; pinning holds a
|
|
4371
|
-
reference of its own so that never happens.
|
|
4372
|
-
|
|
4373
|
-
Identifiers that are not live extension variables are
|
|
4374
|
-
ignored. Each pin has to be matched by at most one
|
|
4375
|
-
:meth:`xunpin`.
|
|
4376
|
-
|
|
4377
|
-
:param variables: variables to pin, as reported by :meth:`xpairs`
|
|
4378
|
-
:type variables: iterable(int)
|
|
4379
|
-
"""
|
|
4380
|
-
|
|
4381
|
-
if self.ergo:
|
|
4382
|
-
pysolvers.ergo_xpin(self.ergo, variables)
|
|
4383
|
-
|
|
4384
|
-
def xunpin(self, variables):
|
|
4385
|
-
"""
|
|
4386
|
-
Releases a pin taken by :meth:`xpin`, handing the variable
|
|
4387
|
-
back to Ergo's own retirement: if nothing else references it,
|
|
4388
|
-
it is retired at once and its identifier becomes reusable.
|
|
4389
|
-
|
|
4390
|
-
:param variables: variables to unpin
|
|
4391
|
-
:type variables: iterable(int)
|
|
4392
|
-
"""
|
|
4393
|
-
|
|
4394
|
-
if self.ergo:
|
|
4395
|
-
pysolvers.ergo_xunpin(self.ergo, variables)
|
|
4396
|
-
|
|
4397
4085
|
def get_status(self):
|
|
4398
4086
|
"""
|
|
4399
4087
|
Returns solver's status.
|
|
@@ -4853,6 +4541,25 @@ class Gluecard3(object):
|
|
|
4853
4541
|
if self.gluecard:
|
|
4854
4542
|
pysolvers.gluecard3_setphases(self.gluecard, literals)
|
|
4855
4543
|
|
|
4544
|
+
def set_activities(self, activities={}):
|
|
4545
|
+
"""
|
|
4546
|
+
Replaces the solver's variable activities: each variable in
|
|
4547
|
+
``activities`` takes the activity it maps to, and every other
|
|
4548
|
+
variable's activity drops to ``0.0``.
|
|
4549
|
+
"""
|
|
4550
|
+
|
|
4551
|
+
if self.gluecard:
|
|
4552
|
+
pysolvers.gluecard3_setacts(self.gluecard, dict(activities))
|
|
4553
|
+
|
|
4554
|
+
def get_activities(self, variables=[]):
|
|
4555
|
+
"""
|
|
4556
|
+
Return the current activities of ``variables``, as a dictionary.
|
|
4557
|
+
"""
|
|
4558
|
+
|
|
4559
|
+
if self.gluecard:
|
|
4560
|
+
variables = list(variables)
|
|
4561
|
+
return dict(zip(variables, pysolvers.gluecard3_getacts(self.gluecard, variables)))
|
|
4562
|
+
|
|
4856
4563
|
def get_status(self):
|
|
4857
4564
|
"""
|
|
4858
4565
|
Returns solver's status.
|
|
@@ -5213,6 +4920,25 @@ class Gluecard4(object):
|
|
|
5213
4920
|
if self.gluecard:
|
|
5214
4921
|
pysolvers.gluecard41_setphases(self.gluecard, literals)
|
|
5215
4922
|
|
|
4923
|
+
def set_activities(self, activities={}):
|
|
4924
|
+
"""
|
|
4925
|
+
Replaces the solver's variable activities: each variable in
|
|
4926
|
+
``activities`` takes the activity it maps to, and every other
|
|
4927
|
+
variable's activity drops to ``0.0``.
|
|
4928
|
+
"""
|
|
4929
|
+
|
|
4930
|
+
if self.gluecard:
|
|
4931
|
+
pysolvers.gluecard41_setacts(self.gluecard, dict(activities))
|
|
4932
|
+
|
|
4933
|
+
def get_activities(self, variables=[]):
|
|
4934
|
+
"""
|
|
4935
|
+
Return the current activities of ``variables``, as a dictionary.
|
|
4936
|
+
"""
|
|
4937
|
+
|
|
4938
|
+
if self.gluecard:
|
|
4939
|
+
variables = list(variables)
|
|
4940
|
+
return dict(zip(variables, pysolvers.gluecard41_getacts(self.gluecard, variables)))
|
|
4941
|
+
|
|
5216
4942
|
def get_status(self):
|
|
5217
4943
|
"""
|
|
5218
4944
|
Returns solver's status.
|
|
@@ -5571,6 +5297,25 @@ class Glucose3(object):
|
|
|
5571
5297
|
if self.glucose:
|
|
5572
5298
|
pysolvers.glucose3_setphases(self.glucose, literals)
|
|
5573
5299
|
|
|
5300
|
+
def set_activities(self, activities={}):
|
|
5301
|
+
"""
|
|
5302
|
+
Replaces the solver's variable activities: each variable in
|
|
5303
|
+
``activities`` takes the activity it maps to, and every other
|
|
5304
|
+
variable's activity drops to ``0.0``.
|
|
5305
|
+
"""
|
|
5306
|
+
|
|
5307
|
+
if self.glucose:
|
|
5308
|
+
pysolvers.glucose3_setacts(self.glucose, dict(activities))
|
|
5309
|
+
|
|
5310
|
+
def get_activities(self, variables=[]):
|
|
5311
|
+
"""
|
|
5312
|
+
Return the current activities of ``variables``, as a dictionary.
|
|
5313
|
+
"""
|
|
5314
|
+
|
|
5315
|
+
if self.glucose:
|
|
5316
|
+
variables = list(variables)
|
|
5317
|
+
return dict(zip(variables, pysolvers.glucose3_getacts(self.glucose, variables)))
|
|
5318
|
+
|
|
5574
5319
|
def get_status(self):
|
|
5575
5320
|
"""
|
|
5576
5321
|
Returns solver's status.
|
|
@@ -5917,6 +5662,25 @@ class Glucose4(object):
|
|
|
5917
5662
|
if self.glucose:
|
|
5918
5663
|
pysolvers.glucose41_setphases(self.glucose, literals)
|
|
5919
5664
|
|
|
5665
|
+
def set_activities(self, activities={}):
|
|
5666
|
+
"""
|
|
5667
|
+
Replaces the solver's variable activities: each variable in
|
|
5668
|
+
``activities`` takes the activity it maps to, and every other
|
|
5669
|
+
variable's activity drops to ``0.0``.
|
|
5670
|
+
"""
|
|
5671
|
+
|
|
5672
|
+
if self.glucose:
|
|
5673
|
+
pysolvers.glucose41_setacts(self.glucose, dict(activities))
|
|
5674
|
+
|
|
5675
|
+
def get_activities(self, variables=[]):
|
|
5676
|
+
"""
|
|
5677
|
+
Return the current activities of ``variables``, as a dictionary.
|
|
5678
|
+
"""
|
|
5679
|
+
|
|
5680
|
+
if self.glucose:
|
|
5681
|
+
variables = list(variables)
|
|
5682
|
+
return dict(zip(variables, pysolvers.glucose41_getacts(self.glucose, variables)))
|
|
5683
|
+
|
|
5920
5684
|
def get_status(self):
|
|
5921
5685
|
"""
|
|
5922
5686
|
Returns solver's status.
|
|
@@ -6263,6 +6027,25 @@ class Glucose42(object):
|
|
|
6263
6027
|
if self.glucose:
|
|
6264
6028
|
pysolvers.glucose421_setphases(self.glucose, literals)
|
|
6265
6029
|
|
|
6030
|
+
def set_activities(self, activities={}):
|
|
6031
|
+
"""
|
|
6032
|
+
Replaces the solver's variable activities: each variable in
|
|
6033
|
+
``activities`` takes the activity it maps to, and every other
|
|
6034
|
+
variable's activity drops to ``0.0``.
|
|
6035
|
+
"""
|
|
6036
|
+
|
|
6037
|
+
if self.glucose:
|
|
6038
|
+
pysolvers.glucose421_setacts(self.glucose, dict(activities))
|
|
6039
|
+
|
|
6040
|
+
def get_activities(self, variables=[]):
|
|
6041
|
+
"""
|
|
6042
|
+
Return the current activities of ``variables``, as a dictionary.
|
|
6043
|
+
"""
|
|
6044
|
+
|
|
6045
|
+
if self.glucose:
|
|
6046
|
+
variables = list(variables)
|
|
6047
|
+
return dict(zip(variables, pysolvers.glucose421_getacts(self.glucose, variables)))
|
|
6048
|
+
|
|
6266
6049
|
def configure(self, parameters):
|
|
6267
6050
|
"""
|
|
6268
6051
|
Configure randomness-related parameters of the solver. Parameters
|
|
@@ -8347,6 +8130,25 @@ class Minicard(object):
|
|
|
8347
8130
|
if self.minicard:
|
|
8348
8131
|
pysolvers.minicard_setphases(self.minicard, literals)
|
|
8349
8132
|
|
|
8133
|
+
def set_activities(self, activities={}):
|
|
8134
|
+
"""
|
|
8135
|
+
Replaces the solver's variable activities: each variable in
|
|
8136
|
+
``activities`` takes the activity it maps to, and every other
|
|
8137
|
+
variable's activity drops to ``0.0``.
|
|
8138
|
+
"""
|
|
8139
|
+
|
|
8140
|
+
if self.minicard:
|
|
8141
|
+
pysolvers.minicard_setacts(self.minicard, dict(activities))
|
|
8142
|
+
|
|
8143
|
+
def get_activities(self, variables=[]):
|
|
8144
|
+
"""
|
|
8145
|
+
Return the current activities of ``variables``, as a dictionary.
|
|
8146
|
+
"""
|
|
8147
|
+
|
|
8148
|
+
if self.minicard:
|
|
8149
|
+
variables = list(variables)
|
|
8150
|
+
return dict(zip(variables, pysolvers.minicard_getacts(self.minicard, variables)))
|
|
8151
|
+
|
|
8350
8152
|
def get_status(self):
|
|
8351
8153
|
"""
|
|
8352
8154
|
Returns solver's status.
|
|
@@ -8693,6 +8495,25 @@ class Minisat22(object):
|
|
|
8693
8495
|
if self.minisat:
|
|
8694
8496
|
pysolvers.minisat22_setphases(self.minisat, literals)
|
|
8695
8497
|
|
|
8498
|
+
def set_activities(self, activities={}):
|
|
8499
|
+
"""
|
|
8500
|
+
Replaces the solver's variable activities: each variable in
|
|
8501
|
+
``activities`` takes the activity it maps to, and every other
|
|
8502
|
+
variable's activity drops to ``0.0``.
|
|
8503
|
+
"""
|
|
8504
|
+
|
|
8505
|
+
if self.minisat:
|
|
8506
|
+
pysolvers.minisat22_setacts(self.minisat, dict(activities))
|
|
8507
|
+
|
|
8508
|
+
def get_activities(self, variables=[]):
|
|
8509
|
+
"""
|
|
8510
|
+
Return the current activities of ``variables``, as a dictionary.
|
|
8511
|
+
"""
|
|
8512
|
+
|
|
8513
|
+
if self.minisat:
|
|
8514
|
+
variables = list(variables)
|
|
8515
|
+
return dict(zip(variables, pysolvers.minisat22_getacts(self.minisat, variables)))
|
|
8516
|
+
|
|
8696
8517
|
def get_status(self):
|
|
8697
8518
|
"""
|
|
8698
8519
|
Returns solver's status.
|
|
@@ -9027,6 +8848,25 @@ class MinisatGH(object):
|
|
|
9027
8848
|
if self.minisat:
|
|
9028
8849
|
pysolvers.minisatgh_setphases(self.minisat, literals)
|
|
9029
8850
|
|
|
8851
|
+
def set_activities(self, activities={}):
|
|
8852
|
+
"""
|
|
8853
|
+
Replaces the solver's variable activities: each variable in
|
|
8854
|
+
``activities`` takes the activity it maps to, and every other
|
|
8855
|
+
variable's activity drops to ``0.0``.
|
|
8856
|
+
"""
|
|
8857
|
+
|
|
8858
|
+
if self.minisat:
|
|
8859
|
+
pysolvers.minisatgh_setacts(self.minisat, dict(activities))
|
|
8860
|
+
|
|
8861
|
+
def get_activities(self, variables=[]):
|
|
8862
|
+
"""
|
|
8863
|
+
Return the current activities of ``variables``, as a dictionary.
|
|
8864
|
+
"""
|
|
8865
|
+
|
|
8866
|
+
if self.minisat:
|
|
8867
|
+
variables = list(variables)
|
|
8868
|
+
return dict(zip(variables, pysolvers.minisatgh_getacts(self.minisat, variables)))
|
|
8869
|
+
|
|
9030
8870
|
def get_status(self):
|
|
9031
8871
|
"""
|
|
9032
8872
|
Returns solver's status.
|
|
@@ -9406,6 +9246,25 @@ class MinisatEP(object):
|
|
|
9406
9246
|
if self.minisat:
|
|
9407
9247
|
pysolvers.minisatep_setphases(self.minisat, literals)
|
|
9408
9248
|
|
|
9249
|
+
def set_activities(self, activities={}):
|
|
9250
|
+
"""
|
|
9251
|
+
Replaces the solver's variable activities: each variable in
|
|
9252
|
+
``activities`` takes the activity it maps to, and every other
|
|
9253
|
+
variable's activity drops to ``0.0``.
|
|
9254
|
+
"""
|
|
9255
|
+
|
|
9256
|
+
if self.minisat:
|
|
9257
|
+
pysolvers.minisatep_setacts(self.minisat, dict(activities))
|
|
9258
|
+
|
|
9259
|
+
def get_activities(self, variables=[]):
|
|
9260
|
+
"""
|
|
9261
|
+
Return the current activities of ``variables``, as a dictionary.
|
|
9262
|
+
"""
|
|
9263
|
+
|
|
9264
|
+
if self.minisat:
|
|
9265
|
+
variables = list(variables)
|
|
9266
|
+
return dict(zip(variables, pysolvers.minisatep_getacts(self.minisat, variables)))
|
|
9267
|
+
|
|
9409
9268
|
def get_status(self):
|
|
9410
9269
|
"""
|
|
9411
9270
|
Returns solver's status.
|
pysolvers.cp315-win_amd64.pyd
CHANGED
|
Binary file
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
Version: 1.13.2
|
|
2
|
+
Arguments: ['C:\\Users\\runneradmin\\AppData\\Local\\Temp\\cibw-run-e_fhxnn2\\cp315-win_amd64\\build\\venv\\Scripts\\delvewheel', 'repair', '-w', 'C:\\Users\\runneradmin\\AppData\\Local\\Temp\\cibw-run-e_fhxnn2\\cp315-win_amd64\\repaired_wheel', '-v', 'C:\\Users\\runneradmin\\AppData\\Local\\Temp\\cibw-run-e_fhxnn2\\cp315-win_amd64\\built_wheel\\python_sat-1.9.dev23-cp315-cp315-win_amd64.whl']
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
pycard.cp315-win_amd64.pyd,sha256=
|
|
2
|
-
pyformula.cp315-win_amd64.pyd,sha256=
|
|
3
|
-
pysolvers.cp315-win_amd64.pyd,sha256=
|
|
1
|
+
pycard.cp315-win_amd64.pyd,sha256=7u_oKId_iSuq3c0UeZ3xCrlR9Ldv3uRCa6OctE4cKZ4,77312
|
|
2
|
+
pyformula.cp315-win_amd64.pyd,sha256=AWBL8CWHRQx3DfS4E7kexZvvvR0Bp0E8iVElJGnFfNE,33792
|
|
3
|
+
pysolvers.cp315-win_amd64.pyd,sha256=830ddF65bnlI4xkQ7Z14s7HokHCIZRBkz1kmhCR_3Tk,3689472
|
|
4
4
|
pysat/card.py,sha256=JufbOKVdVrxABb3oKci3869eQytso58gLTqISac4H58,39252
|
|
5
|
-
pysat/engines.py,sha256=
|
|
5
|
+
pysat/engines.py,sha256=G3hAOFuqc_GGf8ow5gKRLvNh48jiLInnQtIZSRwYuhs,48202
|
|
6
6
|
pysat/formula.py,sha256=GCTvBA9TI7Q2klIaa6R1Suz2IwilNK4-31o8ADLXJaE,221485
|
|
7
7
|
pysat/integer.py,sha256=McihZOmelBRKfw6Ng0A86_D_vLbXSvxla05tVWNyowk,99859
|
|
8
8
|
pysat/pb.py,sha256=DjsHXwu5TG1FSbHg11DOV7kyZvtXHxknwHIL-z7udxQ,17974
|
|
9
9
|
pysat/process.py,sha256=W0_Sm5rqas0SwZd5KgTuB35j2dA-WCg1Y4yqmIwLA9U,16255
|
|
10
|
-
pysat/solvers.py,sha256=
|
|
10
|
+
pysat/solvers.py,sha256=kdb2-ANxb-RTp6JcpYtctC2Xszwl1aiGBgrPRecLISA,325593
|
|
11
11
|
pysat/_fileio.py,sha256=FxmRrrmCDay-2Guhdy0YhDlmVDAsCNaqfHzz18n_O5I,6924
|
|
12
12
|
pysat/_utils.py,sha256=8mNX5XUKd9Bha99-jfvYgX2z2_CsE9z0DdEXCScSdCE,1398
|
|
13
|
-
pysat/__init__.py,sha256=
|
|
13
|
+
pysat/__init__.py,sha256=1Q2hEjX-RY_bSSJQ81ox-tuxIsg8xO73s14-ix7VFAA,1018
|
|
14
14
|
pysat/allies/approxmc.py,sha256=OV2nCeOKN69wXzGwHS9MH7exxYKW3wjMCwLD3GQ0Xqg,13971
|
|
15
15
|
pysat/allies/unigen.py,sha256=d3uMDKiJzA7RLwfuZL4aniYbHPo28SqQd-h3jpmoOxU,17153
|
|
16
16
|
pysat/allies/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -18,7 +18,7 @@ pysat/examples/bbscan.py,sha256=iWUv5uvGuo5et1FaJfgNnnQ3ursgYA6dhUba0GXCk1k,2270
|
|
|
18
18
|
pysat/examples/bica.py,sha256=yaV634q11Sox3ZJ5Un3JNVNbUzFYyisewZUjth8005k,28426
|
|
19
19
|
pysat/examples/fm.py,sha256=Sir6X5lyYZ75T6MLGeU82YYCkHv_VfrZX4oK11BRvUE,18663
|
|
20
20
|
pysat/examples/genhard.py,sha256=J6I3uVP5z0kipki6BWG7-LYpojcDTTXwXjeXBZ_m48A,19533
|
|
21
|
-
pysat/examples/hitman.py,sha256=
|
|
21
|
+
pysat/examples/hitman.py,sha256=yj1BBm8ghQvMQmcGope6xMs1L2fVfeMsgR2jozxZtDA,27021
|
|
22
22
|
pysat/examples/lbx.py,sha256=F8NW2KI9Enxjxmq_cz9wHYM1gbOqp00ULk2i24_ljDM,24096
|
|
23
23
|
pysat/examples/lsu.py,sha256=r1jKaon3QPTiPluBb3nzL9HW0HsoC5JfpMzfRUa_0GM,16700
|
|
24
24
|
pysat/examples/mcsls.py,sha256=oaDtP2Z1cNa6LfsA8Jq4pUpz9wzLsnwE2q-4yWb1s2Q,22912
|
|
@@ -29,24 +29,24 @@ pysat/examples/primer.py,sha256=zSC3mx1I-t2yeo-Yn1bAK42rXi4VtFIgSJT-oiozUiU,2399
|
|
|
29
29
|
pysat/examples/rc2.py,sha256=OkGxvQ8ufZME1GlDjmxB55hVHT5J526TWIncEBMWkn8,81083
|
|
30
30
|
pysat/examples/usage.py,sha256=9IBfW4lBHoZVBEFURW73jhc12zSeFg8_-to9o3gc5nM,2246
|
|
31
31
|
pysat/examples/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
32
|
-
python_sat-1.9.
|
|
33
|
-
python_sat-1.9.
|
|
34
|
-
python_sat-1.9.
|
|
35
|
-
python_sat-1.9.
|
|
36
|
-
python_sat-1.9.
|
|
37
|
-
python_sat-1.9.
|
|
38
|
-
python_sat-1.9.
|
|
39
|
-
python_sat-1.9.
|
|
40
|
-
python_sat-1.9.
|
|
41
|
-
python_sat-1.9.
|
|
42
|
-
python_sat-1.9.
|
|
43
|
-
python_sat-1.9.
|
|
44
|
-
python_sat-1.9.
|
|
45
|
-
python_sat-1.9.
|
|
46
|
-
python_sat-1.9.
|
|
47
|
-
python_sat-1.9.
|
|
48
|
-
python_sat-1.9.
|
|
49
|
-
python_sat-1.9.
|
|
50
|
-
python_sat-1.9.
|
|
51
|
-
python_sat-1.9.
|
|
52
|
-
python_sat-1.9.
|
|
32
|
+
python_sat-1.9.dev23.data/platlib/msvcp140-a4c2229bdc2a2a630acdc095b4d86008.dll,sha256=pMIim9wqKmMKzcCVtNhgCOXD47x3cxdDVPPaT1vrnN4,575056
|
|
33
|
+
python_sat-1.9.dev23.data/scripts/approxmc.py,sha256=h6aMnSpIaYXkTMq-tCSzNWwKb0AG-vTH4vuLWGn5Q4s,13958
|
|
34
|
+
python_sat-1.9.dev23.data/scripts/bbscan.py,sha256=xGxklG6Gc_UBaM8QvEJDOtQhEamxAncfsd65E-0JcAc,22696
|
|
35
|
+
python_sat-1.9.dev23.data/scripts/bica.py,sha256=659K6gdRBgYeNiLjQc_VnulXhbTHxnUljNYhXx-frwk,28413
|
|
36
|
+
python_sat-1.9.dev23.data/scripts/fm.py,sha256=ek1QDsuxiq1zm1PBLbrSXXEE89RP9_DYwVNnyB3eO4s,18650
|
|
37
|
+
python_sat-1.9.dev23.data/scripts/genhard.py,sha256=YswufT272W4xTJrSBlOC2ucJx4RK4ntfRv73rASrx30,19520
|
|
38
|
+
python_sat-1.9.dev23.data/scripts/lbx.py,sha256=1wAyfFjQQkhHte1OnSVhJviVmSEwWc0DaLro8fs6eik,24083
|
|
39
|
+
python_sat-1.9.dev23.data/scripts/lsu.py,sha256=EpXQCu8ZdYoNgi70Uc1b8drOwp1fo82mhGbpjonjIzw,16687
|
|
40
|
+
python_sat-1.9.dev23.data/scripts/mcsls.py,sha256=wetecyPhjfgu-jkjoZ4nrg3PiR2tCtLWLnQeiDCX5UU,22899
|
|
41
|
+
python_sat-1.9.dev23.data/scripts/models.py,sha256=UmMmklExzyXAIhh-0i038nQb7hTK6CbdV1M6m2GxxSI,5917
|
|
42
|
+
python_sat-1.9.dev23.data/scripts/musx.py,sha256=LwK10YuQ8pIf1TJwp0HKp54O0hdk8zBy3TIfGsF1yW0,11277
|
|
43
|
+
python_sat-1.9.dev23.data/scripts/optux.py,sha256=9-4ynzXVYq7y67vy-emMbMx_gSlOBMDBX4VWkjSyHgE,30508
|
|
44
|
+
python_sat-1.9.dev23.data/scripts/primer.py,sha256=iE9Vy0XyeySIY-7-L_VMwRahsIVCEmm9k04OhLwDvuw,23982
|
|
45
|
+
python_sat-1.9.dev23.data/scripts/rc2.py,sha256=vIzgJEHSleKl45B_eENP31avWORuhaP5ogbLbf_N1HY,81070
|
|
46
|
+
python_sat-1.9.dev23.data/scripts/unigen.py,sha256=e-HC2UxWA8MTN90VslkHX1ZlTPjdhI4etzkn6G8YAX4,17140
|
|
47
|
+
python_sat-1.9.dev23.dist-info/DELVEWHEEL,sha256=htVhEAWPljIpsTPEf_TISdetm8KTLMk3jYl-F4_SgKs,413
|
|
48
|
+
python_sat-1.9.dev23.dist-info/METADATA,sha256=e0DdF1jLIjr_3moMNH9O_48cVygjMisYOWAublpK_Zw,1854
|
|
49
|
+
python_sat-1.9.dev23.dist-info/RECORD,,
|
|
50
|
+
python_sat-1.9.dev23.dist-info/top_level.txt,sha256=0SLg3yVqNpeiqOwFcAo3OxXhqAnflCmb5Fjl6gsl-Do,33
|
|
51
|
+
python_sat-1.9.dev23.dist-info/WHEEL,sha256=0gLwYZa0C2fhgCxWR2c8HahwUiopqonVCV0wVwEg6fE,101
|
|
52
|
+
python_sat-1.9.dev23.dist-info/licenses/LICENSE.txt,sha256=q-8zFb06i-6m_ueuQhkc1J4Ew2QByvODVIgm6fZYdTY,1130
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
Version: 1.13.2
|
|
2
|
-
Arguments: ['C:\\Users\\runneradmin\\AppData\\Local\\Temp\\cibw-run-_8pjchug\\cp315-win_amd64\\build\\venv\\Scripts\\delvewheel', 'repair', '-w', 'C:\\Users\\runneradmin\\AppData\\Local\\Temp\\cibw-run-_8pjchug\\cp315-win_amd64\\repaired_wheel', '-v', 'C:\\Users\\runneradmin\\AppData\\Local\\Temp\\cibw-run-_8pjchug\\cp315-win_amd64\\built_wheel\\python_sat-1.9.dev21-cp315-cp315-win_amd64.whl']
|
|
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
|