python-sat 1.8.dev25__cp310-cp310-musllinux_1_2_x86_64.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.cpython-310-x86_64-linux-gnu.so +0 -0
- pysat/__init__.py +24 -0
- pysat/_fileio.py +209 -0
- pysat/_utils.py +58 -0
- pysat/allies/__init__.py +0 -0
- pysat/allies/approxmc.py +385 -0
- pysat/allies/unigen.py +435 -0
- pysat/card.py +802 -0
- pysat/engines.py +1302 -0
- pysat/examples/__init__.py +0 -0
- pysat/examples/bbscan.py +663 -0
- pysat/examples/bica.py +691 -0
- pysat/examples/fm.py +527 -0
- pysat/examples/genhard.py +516 -0
- pysat/examples/hitman.py +653 -0
- pysat/examples/lbx.py +638 -0
- pysat/examples/lsu.py +496 -0
- pysat/examples/mcsls.py +610 -0
- pysat/examples/models.py +189 -0
- pysat/examples/musx.py +344 -0
- pysat/examples/optux.py +710 -0
- pysat/examples/primer.py +620 -0
- pysat/examples/rc2.py +1858 -0
- pysat/examples/usage.py +63 -0
- pysat/formula.py +5619 -0
- pysat/pb.py +463 -0
- pysat/process.py +363 -0
- pysat/solvers.py +7591 -0
- pysolvers.cpython-310-x86_64-linux-gnu.so +0 -0
- python_sat-1.8.dev25.data/scripts/approxmc.py +385 -0
- python_sat-1.8.dev25.data/scripts/bbscan.py +663 -0
- python_sat-1.8.dev25.data/scripts/bica.py +691 -0
- python_sat-1.8.dev25.data/scripts/fm.py +527 -0
- python_sat-1.8.dev25.data/scripts/genhard.py +516 -0
- python_sat-1.8.dev25.data/scripts/lbx.py +638 -0
- python_sat-1.8.dev25.data/scripts/lsu.py +496 -0
- python_sat-1.8.dev25.data/scripts/mcsls.py +610 -0
- python_sat-1.8.dev25.data/scripts/models.py +189 -0
- python_sat-1.8.dev25.data/scripts/musx.py +344 -0
- python_sat-1.8.dev25.data/scripts/optux.py +710 -0
- python_sat-1.8.dev25.data/scripts/primer.py +620 -0
- python_sat-1.8.dev25.data/scripts/rc2.py +1858 -0
- python_sat-1.8.dev25.data/scripts/unigen.py +435 -0
- python_sat-1.8.dev25.dist-info/METADATA +45 -0
- python_sat-1.8.dev25.dist-info/RECORD +50 -0
- python_sat-1.8.dev25.dist-info/WHEEL +5 -0
- python_sat-1.8.dev25.dist-info/licenses/LICENSE.txt +21 -0
- python_sat-1.8.dev25.dist-info/top_level.txt +3 -0
- python_sat.libs/libgcc_s-0cd532bd.so.1 +0 -0
- python_sat.libs/libstdc++-5d72f927.so.6.0.33 +0 -0
pysat/examples/usage.py
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
#-*- coding:utf-8 -*-
|
|
3
|
+
##
|
|
4
|
+
## usage.py
|
|
5
|
+
##
|
|
6
|
+
## Created on: Nov 27, 2016
|
|
7
|
+
## Author: Alexey S. Ignatiev
|
|
8
|
+
## E-mail: aignatiev@ciencias.ulisboa.pt
|
|
9
|
+
##
|
|
10
|
+
|
|
11
|
+
#
|
|
12
|
+
#==============================================================================
|
|
13
|
+
from __future__ import print_function
|
|
14
|
+
from pysat.solvers import Solver # standard way to import the library
|
|
15
|
+
from pysat.solvers import Minisat22, Glucose3 # more direct way
|
|
16
|
+
|
|
17
|
+
#
|
|
18
|
+
#==============================================================================
|
|
19
|
+
if __name__ == '__main__':
|
|
20
|
+
print('simple infrastructure (add_clause, solve):')
|
|
21
|
+
s1 = Solver(name='g3')
|
|
22
|
+
s1.add_clause([-1, 2])
|
|
23
|
+
s1.add_clause([-2, 3])
|
|
24
|
+
s1.add_clause([-3, 4])
|
|
25
|
+
|
|
26
|
+
if s1.solve() == True:
|
|
27
|
+
print(s1.get_model())
|
|
28
|
+
|
|
29
|
+
print('blocking models:')
|
|
30
|
+
m = s1.get_model()
|
|
31
|
+
s1.add_clause([-l for l in m]) # actual blocking
|
|
32
|
+
|
|
33
|
+
if s1.solve() == True:
|
|
34
|
+
print(s1.get_model()) # should compute another model
|
|
35
|
+
s1.delete() # this is needed if used not within the 'with' context
|
|
36
|
+
|
|
37
|
+
print('model enumeration + bootstrapping the solver:')
|
|
38
|
+
s2 = Minisat22(bootstrap_with=[[-1, 2], [-2, 3], [-3, 4]]) # also working with MiniSat22 directly
|
|
39
|
+
for m in s2.enum_models(): # implemented as a generator
|
|
40
|
+
print(m)
|
|
41
|
+
s2.delete()
|
|
42
|
+
|
|
43
|
+
print('\'with\' constructor + assumptions:')
|
|
44
|
+
with Solver(name='mgh', bootstrap_with=[[-1, 2], [-2, 3], [-3, 4]]) as s3:
|
|
45
|
+
for m in s3.enum_models(assumptions=[5]):
|
|
46
|
+
print(m)
|
|
47
|
+
|
|
48
|
+
# no s3.delete() is needed -- it is called automatically if used in the 'with' environment
|
|
49
|
+
|
|
50
|
+
print('appending formula and extracting an unsat core:')
|
|
51
|
+
with Glucose3(bootstrap_with=[[-1, 2], [-2, 3]]) as s4:
|
|
52
|
+
s4.append_formula([[-3, 4], [-4, 5]])
|
|
53
|
+
|
|
54
|
+
if s4.solve(assumptions=[1, -5]) == False:
|
|
55
|
+
print(s4.get_core())
|
|
56
|
+
|
|
57
|
+
# no s4.delete() is needed -- it is called automatically if used in the 'with' environment
|
|
58
|
+
|
|
59
|
+
print('extracting a proof:') # supported by glucose and lingeling only
|
|
60
|
+
with Glucose3(bootstrap_with=[[-1, 2], [1, -2], [-1, -2], [1, 2]], with_proof=True) as s5:
|
|
61
|
+
|
|
62
|
+
if s5.solve() == False:
|
|
63
|
+
print(s5.get_proof())
|