python-sat 1.8.dev29__cp313-cp313-win_amd64.whl → 1.8.dev30__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.

Potentially problematic release.


This version of python-sat might be problematic. Click here for more details.

Files changed (23) hide show
  1. pycard.cp313-win_amd64.pyd +0 -0
  2. pysat/__init__.py +1 -1
  3. pysat/integer.py +121 -0
  4. pysolvers.cp313-win_amd64.pyd +0 -0
  5. {python_sat-1.8.dev29.dist-info → python_sat-1.8.dev30.dist-info}/METADATA +1 -1
  6. {python_sat-1.8.dev29.dist-info → python_sat-1.8.dev30.dist-info}/RECORD +23 -23
  7. {python_sat-1.8.dev29.data → python_sat-1.8.dev30.data}/scripts/approxmc.py +0 -0
  8. {python_sat-1.8.dev29.data → python_sat-1.8.dev30.data}/scripts/bbscan.py +0 -0
  9. {python_sat-1.8.dev29.data → python_sat-1.8.dev30.data}/scripts/bica.py +0 -0
  10. {python_sat-1.8.dev29.data → python_sat-1.8.dev30.data}/scripts/fm.py +0 -0
  11. {python_sat-1.8.dev29.data → python_sat-1.8.dev30.data}/scripts/genhard.py +0 -0
  12. {python_sat-1.8.dev29.data → python_sat-1.8.dev30.data}/scripts/lbx.py +0 -0
  13. {python_sat-1.8.dev29.data → python_sat-1.8.dev30.data}/scripts/lsu.py +0 -0
  14. {python_sat-1.8.dev29.data → python_sat-1.8.dev30.data}/scripts/mcsls.py +0 -0
  15. {python_sat-1.8.dev29.data → python_sat-1.8.dev30.data}/scripts/models.py +0 -0
  16. {python_sat-1.8.dev29.data → python_sat-1.8.dev30.data}/scripts/musx.py +0 -0
  17. {python_sat-1.8.dev29.data → python_sat-1.8.dev30.data}/scripts/optux.py +0 -0
  18. {python_sat-1.8.dev29.data → python_sat-1.8.dev30.data}/scripts/primer.py +0 -0
  19. {python_sat-1.8.dev29.data → python_sat-1.8.dev30.data}/scripts/rc2.py +0 -0
  20. {python_sat-1.8.dev29.data → python_sat-1.8.dev30.data}/scripts/unigen.py +0 -0
  21. {python_sat-1.8.dev29.dist-info → python_sat-1.8.dev30.dist-info}/WHEEL +0 -0
  22. {python_sat-1.8.dev29.dist-info → python_sat-1.8.dev30.dist-info}/licenses/LICENSE.txt +0 -0
  23. {python_sat-1.8.dev29.dist-info → python_sat-1.8.dev30.dist-info}/top_level.txt +0 -0
Binary file
pysat/__init__.py CHANGED
@@ -10,7 +10,7 @@
10
10
 
11
11
  # current version
12
12
  #==============================================================================
13
- VERSION = (1, 8, 'dev', 29)
13
+ VERSION = (1, 8, 'dev', 30)
14
14
 
15
15
 
16
16
  # PEP440 Format
pysat/integer.py CHANGED
@@ -1752,6 +1752,127 @@ class IntegerEngine(BooleanEngine):
1752
1752
 
1753
1753
  return lits
1754
1754
 
1755
+ def decode_assignment(self, lits, vars=None):
1756
+ """
1757
+ Given a list of assigned Boolean literals, return a mapping
1758
+ ``{Integer: integer_value}`` for those variables whose value is
1759
+ fixed by the assignment alone. Unlike :meth:`.decode_model`, this
1760
+ method does not require a full model and only looks at literals
1761
+ present in ``lits``. Also note that the method does not require
1762
+ the input literals to be in any particular order.
1763
+
1764
+ If multiple inconsistent *equality* literals are present for the
1765
+ same variable, the value is reported as a list of all observed
1766
+ values, which (if an issue) can be used to find the culprit in the
1767
+ encoding. For order-based literals, if the inferred bounds fix the
1768
+ value, the value is reported as an integer; otherwise, the value
1769
+ is reported as the list of all values within the inferred bounds.
1770
+ If order-based bounds are contradictory (lower bound exceeds upper
1771
+ bound), the value is reported as an empty list.
1772
+
1773
+ Example:
1774
+
1775
+ .. code-block:: python
1776
+
1777
+ >>> st, props = solver.propagate(assumptions=clues)
1778
+ >>> vals = eng.decode_assignment(props)
1779
+ >>> # vals[i] is an int if the value is fixed,
1780
+ >>> # a list if conflicting if multiple values are present,
1781
+ >>> # or [] if contradictory bounds were derived.
1782
+
1783
+ :param lits: literals in the assignment
1784
+ :param vars: subset of variables to decode (optional)
1785
+ :type lits: iterable(int)
1786
+ :type vars: list(:class:`Integer`) or None
1787
+
1788
+ :rtype: dict
1789
+ """
1790
+
1791
+ # don't anything about any variables!
1792
+ if self.vpool is None:
1793
+ return {}
1794
+
1795
+ # optional filtering by a subset of variables
1796
+ allowed = None if vars is None else set(vars)
1797
+
1798
+ # per-variable state tracked only when we see relevant literals
1799
+ eq_true, lbounds, ubounds = {}, {}, {}
1800
+
1801
+ seen = set()
1802
+ for lit in lits:
1803
+ if lit == 0:
1804
+ # literal '0' makes no sense
1805
+ raise ValueError('Literal 0 is not allowed')
1806
+
1807
+ if lit not in seen:
1808
+ seen.add(lit)
1809
+
1810
+ # getting the object given a literal
1811
+ obj = self.vpool.obj(abs(lit))
1812
+
1813
+ # we expect a tuple of (var, 'kind', value)
1814
+ if not obj or not isinstance(obj, tuple) or len(obj) != 3:
1815
+ # not a variable we know!
1816
+ continue
1817
+
1818
+ var, kind, value = obj
1819
+ if not isinstance(var, Integer) or kind not in ('eq', 'ge'):
1820
+ # still not our variable!
1821
+ continue
1822
+
1823
+ # checking if the variable is among those we are interested in
1824
+ if allowed is not None and var not in allowed:
1825
+ continue
1826
+
1827
+ if kind == 'eq':
1828
+ if lit > 0:
1829
+ eq_true.setdefault(var, set()).add(value)
1830
+ else: # kind == 'ge'
1831
+ if var not in lbounds:
1832
+ lbounds[var] = var.lb
1833
+ ubounds[var] = var.ub
1834
+
1835
+ # refining the bounds if we can
1836
+ if lit > 0:
1837
+ if value > lbounds[var]:
1838
+ lbounds[var] = value
1839
+ else:
1840
+ bound = value - 1
1841
+ if bound < ubounds[var]:
1842
+ ubounds[var] = bound
1843
+
1844
+ # now, we are going to collate the data and put it here
1845
+ res = {}
1846
+
1847
+ # direct/coupled encodings expose equality literals
1848
+ for var, values in eq_true.items():
1849
+ if len(values) == 1:
1850
+ # taking the concrete value we found
1851
+ res[var] = next(iter(values))
1852
+ else:
1853
+ # multiple values are found
1854
+ res[var] = sorted(values)
1855
+
1856
+ # order/coupled encodings may be fixed by bounds alone
1857
+ for var in lbounds:
1858
+ if var in res:
1859
+ # well, we already have a concrete value for this variable
1860
+ continue
1861
+
1862
+ if lbounds[var] == ubounds[var]:
1863
+ # concrete value defined from the bounds
1864
+ res[var] = lbounds[var]
1865
+
1866
+ elif lbounds[var] < ubounds[var]:
1867
+ # the bounds represent a valid range
1868
+ res[var] = list(range(lbounds[var], ubounds[var] + 1))
1869
+ else:
1870
+ # conflicting bounds detected; report as an empty list
1871
+ # to signal contradiction without raising
1872
+ res[var] = []
1873
+
1874
+ return res
1875
+
1755
1876
 
1756
1877
  # example usage
1757
1878
  #==============================================================================
Binary file
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-sat
3
- Version: 1.8.dev29
3
+ Version: 1.8.dev30
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
@@ -1,12 +1,12 @@
1
- pycard.cp313-win_amd64.pyd,sha256=hSjfF_RHBHGvqy5Jl7KTXhkj2Bc6HsbT1U1l4nKzTjk,69632
2
- pysolvers.cp313-win_amd64.pyd,sha256=q4ujCcSwb4BMOnoHXg6xRv0mli-BXydfTcP2-I4MXZk,2232320
3
- pysat/__init__.py,sha256=P6sqFWhc7u8FZ8TXN4DsARiPq7E40ViS3xUgEro1I60,681
1
+ pycard.cp313-win_amd64.pyd,sha256=Ium9bf2cnCb5T415FxCoSjfFEJja2fnFg4KZ7Gwtu0s,69632
2
+ pysolvers.cp313-win_amd64.pyd,sha256=74-wWkPjHk8mkVJ8TJPZ3hzMmMaN6yler43J2jJIegU,2232320
3
+ pysat/__init__.py,sha256=g5sNbIxu3NQHKEfmF83NBULSybCzIEuGGdoPrQyxMjs,681
4
4
  pysat/_fileio.py,sha256=cmrqvhPXxC87lpvLlFDG7EWpusQOaqCGPMDfWhqT6dg,6373
5
5
  pysat/_utils.py,sha256=4cv40p70FKvjCTKq8GqzS_jlxF74cp_lojTZSim_qJE,1340
6
6
  pysat/card.py,sha256=rav3_t_mCzbLw8SAdXcOh-PNbFtaATVSAJzpbygqiQ4,30066
7
7
  pysat/engines.py,sha256=PzcZJ4zFXDHfcSSHF7iPadtrwSVEt4t9B_cO5epwTZk,45182
8
8
  pysat/formula.py,sha256=eMa4LDzWG-8Tg4xNivjcHdcRW4Ku7RumIoB9Jr-sVSs,207193
9
- pysat/integer.py,sha256=-gjRCfPnVuHBTKy-PkdhUF5tf1O48m9rdcxssqcaJPk,63609
9
+ pysat/integer.py,sha256=aSWPlE7t-3fP1bSj-qSNoUr1RmQgkBtv1g3KqTRhi8o,68408
10
10
  pysat/pb.py,sha256=DMy8UfbbpfJo5cTZul9W1o_mlr-B0lCIEseZjrQYd8A,17816
11
11
  pysat/process.py,sha256=8lNbpEKipFZjbQ9DCJPfdL8eZHx-ltNuu7h4geWWdJY,12739
12
12
  pysat/solvers.py,sha256=00Y6yKNXvJOLA7l4aIDgueFbNM9lt3PkmT2OxB43aQ8,229975
@@ -28,22 +28,22 @@ pysat/examples/optux.py,sha256=8eYHO_uhL_4ugb-hRv2s6cnOwTurfqkpbdnK9T4iDtw,27697
28
28
  pysat/examples/primer.py,sha256=0OeV9R6mWyIr2BKIitkrfgY3q2XE-sV1ZLSiybGRFXw,23375
29
29
  pysat/examples/rc2.py,sha256=QjN-LbLWNnDwSyZKn10_INniPpIK8dv_0BGPZzbXxa8,75763
30
30
  pysat/examples/usage.py,sha256=x9luw6pyKAAndlxAeUWFhS4aLSVmD2t_j_5uA9YddHg,2183
31
- python_sat-1.8.dev29.data/scripts/approxmc.py,sha256=h6aMnSpIaYXkTMq-tCSzNWwKb0AG-vTH4vuLWGn5Q4s,13958
32
- python_sat-1.8.dev29.data/scripts/bbscan.py,sha256=xGxklG6Gc_UBaM8QvEJDOtQhEamxAncfsd65E-0JcAc,22696
33
- python_sat-1.8.dev29.data/scripts/bica.py,sha256=q6fQGsFp1EaaYRZGBsDFOIJPVScr5k42XFskBzW69mA,27776
34
- python_sat-1.8.dev29.data/scripts/fm.py,sha256=ek1QDsuxiq1zm1PBLbrSXXEE89RP9_DYwVNnyB3eO4s,18650
35
- python_sat-1.8.dev29.data/scripts/genhard.py,sha256=YswufT272W4xTJrSBlOC2ucJx4RK4ntfRv73rASrx30,19520
36
- python_sat-1.8.dev29.data/scripts/lbx.py,sha256=rCQ6zH_DXoVjBrzhZHSDJMfP92-hz2JVwh6e4m44AUc,23874
37
- python_sat-1.8.dev29.data/scripts/lsu.py,sha256=cAATg2x0Cu1LC8KszMctHqywjq7pygkb9vWNBrbUEZs,16681
38
- python_sat-1.8.dev29.data/scripts/mcsls.py,sha256=cTJQMIO-4iho412wG0JhvhqXWy81U0RQV8wwOgkri3Q,22690
39
- python_sat-1.8.dev29.data/scripts/models.py,sha256=UmMmklExzyXAIhh-0i038nQb7hTK6CbdV1M6m2GxxSI,5917
40
- python_sat-1.8.dev29.data/scripts/musx.py,sha256=LwK10YuQ8pIf1TJwp0HKp54O0hdk8zBy3TIfGsF1yW0,11277
41
- python_sat-1.8.dev29.data/scripts/optux.py,sha256=t20YBZH4_axTkRMapq-DL-fq-9tBybPWo0pkhIyGhDw,28394
42
- python_sat-1.8.dev29.data/scripts/primer.py,sha256=iE9Vy0XyeySIY-7-L_VMwRahsIVCEmm9k04OhLwDvuw,23982
43
- python_sat-1.8.dev29.data/scripts/rc2.py,sha256=yFieB6_5sYLLfIRo6Al9DXt3V5Y-qIUYH5E89xoaLN4,77749
44
- python_sat-1.8.dev29.data/scripts/unigen.py,sha256=e-HC2UxWA8MTN90VslkHX1ZlTPjdhI4etzkn6G8YAX4,17140
45
- python_sat-1.8.dev29.dist-info/licenses/LICENSE.txt,sha256=6QMvEzxqdPXEoiAZUBaZLeLF4hW2S81fjKz_THER0uQ,1109
46
- python_sat-1.8.dev29.dist-info/METADATA,sha256=nSxVtNTtB0kjeojErCIEy3U9r-TGkVg1PssbXNYFZZY,1784
47
- python_sat-1.8.dev29.dist-info/WHEEL,sha256=-WvvtQtdhM1F5HMi-4hSXLQ_1Tg6qJRWO1HnLNr4mCU,102
48
- python_sat-1.8.dev29.dist-info/top_level.txt,sha256=fgEEGhMLivlF1ExCX8Y3niWsr4pDPRb5HdaWjNtabFI,23
49
- python_sat-1.8.dev29.dist-info/RECORD,,
31
+ python_sat-1.8.dev30.data/scripts/approxmc.py,sha256=h6aMnSpIaYXkTMq-tCSzNWwKb0AG-vTH4vuLWGn5Q4s,13958
32
+ python_sat-1.8.dev30.data/scripts/bbscan.py,sha256=xGxklG6Gc_UBaM8QvEJDOtQhEamxAncfsd65E-0JcAc,22696
33
+ python_sat-1.8.dev30.data/scripts/bica.py,sha256=q6fQGsFp1EaaYRZGBsDFOIJPVScr5k42XFskBzW69mA,27776
34
+ python_sat-1.8.dev30.data/scripts/fm.py,sha256=ek1QDsuxiq1zm1PBLbrSXXEE89RP9_DYwVNnyB3eO4s,18650
35
+ python_sat-1.8.dev30.data/scripts/genhard.py,sha256=YswufT272W4xTJrSBlOC2ucJx4RK4ntfRv73rASrx30,19520
36
+ python_sat-1.8.dev30.data/scripts/lbx.py,sha256=rCQ6zH_DXoVjBrzhZHSDJMfP92-hz2JVwh6e4m44AUc,23874
37
+ python_sat-1.8.dev30.data/scripts/lsu.py,sha256=cAATg2x0Cu1LC8KszMctHqywjq7pygkb9vWNBrbUEZs,16681
38
+ python_sat-1.8.dev30.data/scripts/mcsls.py,sha256=cTJQMIO-4iho412wG0JhvhqXWy81U0RQV8wwOgkri3Q,22690
39
+ python_sat-1.8.dev30.data/scripts/models.py,sha256=UmMmklExzyXAIhh-0i038nQb7hTK6CbdV1M6m2GxxSI,5917
40
+ python_sat-1.8.dev30.data/scripts/musx.py,sha256=LwK10YuQ8pIf1TJwp0HKp54O0hdk8zBy3TIfGsF1yW0,11277
41
+ python_sat-1.8.dev30.data/scripts/optux.py,sha256=t20YBZH4_axTkRMapq-DL-fq-9tBybPWo0pkhIyGhDw,28394
42
+ python_sat-1.8.dev30.data/scripts/primer.py,sha256=iE9Vy0XyeySIY-7-L_VMwRahsIVCEmm9k04OhLwDvuw,23982
43
+ python_sat-1.8.dev30.data/scripts/rc2.py,sha256=yFieB6_5sYLLfIRo6Al9DXt3V5Y-qIUYH5E89xoaLN4,77749
44
+ python_sat-1.8.dev30.data/scripts/unigen.py,sha256=e-HC2UxWA8MTN90VslkHX1ZlTPjdhI4etzkn6G8YAX4,17140
45
+ python_sat-1.8.dev30.dist-info/licenses/LICENSE.txt,sha256=6QMvEzxqdPXEoiAZUBaZLeLF4hW2S81fjKz_THER0uQ,1109
46
+ python_sat-1.8.dev30.dist-info/METADATA,sha256=WtlTd1cYPghe2ZUjJbzjvDSNELDjRrLUApFNct_E1MQ,1784
47
+ python_sat-1.8.dev30.dist-info/WHEEL,sha256=-WvvtQtdhM1F5HMi-4hSXLQ_1Tg6qJRWO1HnLNr4mCU,102
48
+ python_sat-1.8.dev30.dist-info/top_level.txt,sha256=fgEEGhMLivlF1ExCX8Y3niWsr4pDPRb5HdaWjNtabFI,23
49
+ python_sat-1.8.dev30.dist-info/RECORD,,