python-sat 1.9.dev22__cp313-cp313-win_amd64.whl → 1.9.dev24__cp313-cp313-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.cp313-win_amd64.pyd +0 -0
- pyformula.cp313-win_amd64.pyd +0 -0
- pysat/__init__.py +1 -1
- pysat/examples/hitman.py +16 -11
- pysat/examples/models.py +13 -6
- pysat/solvers.py +331 -767
- pysolvers.cp313-win_amd64.pyd +0 -0
- {python_sat-1.9.dev22.data → python_sat-1.9.dev24.data}/scripts/models.py +13 -6
- python_sat-1.9.dev24.dist-info/DELVEWHEEL +2 -0
- {python_sat-1.9.dev22.dist-info → python_sat-1.9.dev24.dist-info}/METADATA +1 -1
- {python_sat-1.9.dev22.dist-info → python_sat-1.9.dev24.dist-info}/RECORD +28 -28
- python_sat-1.9.dev22.dist-info/DELVEWHEEL +0 -2
- {python_sat-1.9.dev22.data → python_sat-1.9.dev24.data}/platlib/msvcp140-a4c2229bdc2a2a630acdc095b4d86008.dll +0 -0
- {python_sat-1.9.dev22.data → python_sat-1.9.dev24.data}/scripts/approxmc.py +0 -0
- {python_sat-1.9.dev22.data → python_sat-1.9.dev24.data}/scripts/bbscan.py +0 -0
- {python_sat-1.9.dev22.data → python_sat-1.9.dev24.data}/scripts/bica.py +0 -0
- {python_sat-1.9.dev22.data → python_sat-1.9.dev24.data}/scripts/fm.py +0 -0
- {python_sat-1.9.dev22.data → python_sat-1.9.dev24.data}/scripts/genhard.py +0 -0
- {python_sat-1.9.dev22.data → python_sat-1.9.dev24.data}/scripts/lbx.py +0 -0
- {python_sat-1.9.dev22.data → python_sat-1.9.dev24.data}/scripts/lsu.py +0 -0
- {python_sat-1.9.dev22.data → python_sat-1.9.dev24.data}/scripts/mcsls.py +0 -0
- {python_sat-1.9.dev22.data → python_sat-1.9.dev24.data}/scripts/musx.py +0 -0
- {python_sat-1.9.dev22.data → python_sat-1.9.dev24.data}/scripts/optux.py +0 -0
- {python_sat-1.9.dev22.data → python_sat-1.9.dev24.data}/scripts/primer.py +0 -0
- {python_sat-1.9.dev22.data → python_sat-1.9.dev24.data}/scripts/rc2.py +0 -0
- {python_sat-1.9.dev22.data → python_sat-1.9.dev24.data}/scripts/unigen.py +0 -0
- {python_sat-1.9.dev22.dist-info → python_sat-1.9.dev24.dist-info}/WHEEL +0 -0
- {python_sat-1.9.dev22.dist-info → python_sat-1.9.dev24.dist-info}/licenses/LICENSE.txt +0 -0
- {python_sat-1.9.dev22.dist-info → python_sat-1.9.dev24.dist-info}/top_level.txt +0 -0
pycard.cp313-win_amd64.pyd
CHANGED
|
Binary file
|
pyformula.cp313-win_amd64.pyd
CHANGED
|
Binary file
|
pysat/__init__.py
CHANGED
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/examples/models.py
CHANGED
|
@@ -66,7 +66,7 @@ import sys
|
|
|
66
66
|
|
|
67
67
|
#
|
|
68
68
|
#==============================================================================
|
|
69
|
-
def enumerate_models(formula, to_enum, solver, warm=False):
|
|
69
|
+
def enumerate_models(formula, to_enum, solver, warm=False, projection=[]):
|
|
70
70
|
"""
|
|
71
71
|
Enumeration procedure. It represents a loop iterating over satisfying
|
|
72
72
|
assignment for a given formula until either all or a given number of
|
|
@@ -76,11 +76,13 @@ def enumerate_models(formula, to_enum, solver, warm=False):
|
|
|
76
76
|
:param to_enum: number of models to compute
|
|
77
77
|
:param solver: name of SAT solver
|
|
78
78
|
:param warm: warm start flag
|
|
79
|
+
:param projection: optional variable IDs to enumerate
|
|
79
80
|
|
|
80
81
|
:type formula: :class:`.CNFPlus`
|
|
81
82
|
:type to_enum: int or 'all'
|
|
82
83
|
:type solver: str
|
|
83
84
|
:type warm: bool
|
|
85
|
+
:type projection: list(int)
|
|
84
86
|
"""
|
|
85
87
|
|
|
86
88
|
with Solver(name=solver, bootstrap_with=formula.clauses,
|
|
@@ -99,7 +101,7 @@ def enumerate_models(formula, to_enum, solver, warm=False):
|
|
|
99
101
|
|
|
100
102
|
# model enumeration and printing is done here
|
|
101
103
|
computed = 0
|
|
102
|
-
for i, model in enumerate(s.enum_models(), 1):
|
|
104
|
+
for i, model in enumerate(s.enum_models(projection=projection), 1):
|
|
103
105
|
print('v {0} 0'.format(' '.join(['{0}{1}'.format('+' if v > 0 else '', v) for v in model])))
|
|
104
106
|
|
|
105
107
|
computed = i
|
|
@@ -123,9 +125,10 @@ def parse_options():
|
|
|
123
125
|
|
|
124
126
|
try:
|
|
125
127
|
opts, args = getopt.getopt(sys.argv[1:],
|
|
126
|
-
'e:
|
|
128
|
+
'e:hp:s:w',
|
|
127
129
|
['enum=',
|
|
128
130
|
'help',
|
|
131
|
+
'project=',
|
|
129
132
|
'solver=',
|
|
130
133
|
'warm'])
|
|
131
134
|
except getopt.GetoptError as err:
|
|
@@ -136,6 +139,7 @@ def parse_options():
|
|
|
136
139
|
to_enum = 1
|
|
137
140
|
solver = 'g3'
|
|
138
141
|
warm = False
|
|
142
|
+
projection = []
|
|
139
143
|
|
|
140
144
|
for opt, arg in opts:
|
|
141
145
|
if opt in ('-e', '--enum'):
|
|
@@ -147,6 +151,8 @@ def parse_options():
|
|
|
147
151
|
elif opt in ('-h', '--help'):
|
|
148
152
|
usage()
|
|
149
153
|
sys.exit(0)
|
|
154
|
+
elif opt in ('-p', '--project'):
|
|
155
|
+
projection = [int(v) for v in arg.split(',')] if arg else []
|
|
150
156
|
elif opt in ('-s', '--solver'):
|
|
151
157
|
solver = str(arg)
|
|
152
158
|
elif opt in ('-w', '--warm'):
|
|
@@ -154,7 +160,7 @@ def parse_options():
|
|
|
154
160
|
else:
|
|
155
161
|
assert False, 'Unhandled option: {0} {1}'.format(opt, arg)
|
|
156
162
|
|
|
157
|
-
return to_enum, solver, warm, args
|
|
163
|
+
return to_enum, solver, warm, projection, args
|
|
158
164
|
|
|
159
165
|
|
|
160
166
|
#
|
|
@@ -169,6 +175,7 @@ def usage():
|
|
|
169
175
|
print(' -e, --enum=<int> Compute at most this number of models')
|
|
170
176
|
print(' Available values: [1 .. INT_MAX], all (default: 1)')
|
|
171
177
|
print(' -h, --help Show this message')
|
|
178
|
+
print(' -p, --project=<csv> Restrict models to these variables only (given as comma-separated integers)')
|
|
172
179
|
print(' -s, --solver=<string> SAT solver to use')
|
|
173
180
|
print(' Available values: cd, g3, g4, lgl, mcb, mcm, mpl, m22, mc, mgh (default = g3)')
|
|
174
181
|
print(' -w, --warm Use solver\'s warm start mode')
|
|
@@ -178,7 +185,7 @@ def usage():
|
|
|
178
185
|
#==============================================================================
|
|
179
186
|
if __name__ == '__main__':
|
|
180
187
|
# parsing command-line options
|
|
181
|
-
to_enum, solver, warm, files = parse_options()
|
|
188
|
+
to_enum, solver, warm, projection, files = parse_options()
|
|
182
189
|
|
|
183
190
|
# reading an input formula either from a file or from stdin
|
|
184
191
|
if files:
|
|
@@ -186,4 +193,4 @@ if __name__ == '__main__':
|
|
|
186
193
|
else:
|
|
187
194
|
formula = CNFPlus(from_fp=sys.stdin)
|
|
188
195
|
|
|
189
|
-
enumerate_models(formula, to_enum, solver, warm)
|
|
196
|
+
enumerate_models(formula, to_enum, solver, warm, projection)
|