python-sat 1.9.dev5__cp313-cp313-win_amd64.whl → 1.9.dev7__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.
Files changed (26) hide show
  1. pycard.cp313-win_amd64.pyd +0 -0
  2. pyformula.cp313-win_amd64.pyd +0 -0
  3. pysat/__init__.py +1 -1
  4. pysat/engines.py +35 -9
  5. pysat/examples/rc2.py +7 -0
  6. pysat/formula.py +2 -0
  7. pysolvers.cp313-win_amd64.pyd +0 -0
  8. {python_sat-1.9.dev5.data → python_sat-1.9.dev7.data}/scripts/rc2.py +7 -0
  9. {python_sat-1.9.dev5.dist-info → python_sat-1.9.dev7.dist-info}/METADATA +1 -1
  10. {python_sat-1.9.dev5.dist-info → python_sat-1.9.dev7.dist-info}/RECORD +26 -26
  11. {python_sat-1.9.dev5.dist-info → python_sat-1.9.dev7.dist-info}/WHEEL +1 -1
  12. {python_sat-1.9.dev5.data → python_sat-1.9.dev7.data}/scripts/approxmc.py +0 -0
  13. {python_sat-1.9.dev5.data → python_sat-1.9.dev7.data}/scripts/bbscan.py +0 -0
  14. {python_sat-1.9.dev5.data → python_sat-1.9.dev7.data}/scripts/bica.py +0 -0
  15. {python_sat-1.9.dev5.data → python_sat-1.9.dev7.data}/scripts/fm.py +0 -0
  16. {python_sat-1.9.dev5.data → python_sat-1.9.dev7.data}/scripts/genhard.py +0 -0
  17. {python_sat-1.9.dev5.data → python_sat-1.9.dev7.data}/scripts/lbx.py +0 -0
  18. {python_sat-1.9.dev5.data → python_sat-1.9.dev7.data}/scripts/lsu.py +0 -0
  19. {python_sat-1.9.dev5.data → python_sat-1.9.dev7.data}/scripts/mcsls.py +0 -0
  20. {python_sat-1.9.dev5.data → python_sat-1.9.dev7.data}/scripts/models.py +0 -0
  21. {python_sat-1.9.dev5.data → python_sat-1.9.dev7.data}/scripts/musx.py +0 -0
  22. {python_sat-1.9.dev5.data → python_sat-1.9.dev7.data}/scripts/optux.py +0 -0
  23. {python_sat-1.9.dev5.data → python_sat-1.9.dev7.data}/scripts/primer.py +0 -0
  24. {python_sat-1.9.dev5.data → python_sat-1.9.dev7.data}/scripts/unigen.py +0 -0
  25. {python_sat-1.9.dev5.dist-info → python_sat-1.9.dev7.dist-info}/licenses/LICENSE.txt +0 -0
  26. {python_sat-1.9.dev5.dist-info → python_sat-1.9.dev7.dist-info}/top_level.txt +0 -0
Binary file
Binary file
pysat/__init__.py CHANGED
@@ -10,7 +10,7 @@
10
10
 
11
11
  # current version
12
12
  #==============================================================================
13
- VERSION = (1, 9, 'dev', 5)
13
+ VERSION = (1, 9, 'dev', 7)
14
14
 
15
15
 
16
16
  # PEP440 Format
pysat/engines.py CHANGED
@@ -564,8 +564,11 @@ class Propagator(object):
564
564
  def provide_reason(self, lit: int) -> List[int]:
565
565
  pass # explain why a given literal was propagated
566
566
 
567
+ def has_clause(self) -> bool:
568
+ return False # optional: report whether an external clause exists
569
+
567
570
  def add_clause(self) -> List[int]:
568
- return [] # add an(y) external clause to the solver
571
+ return [] # if has_clause() is used, may also be the empty clause
569
572
  """
570
573
 
571
574
  def __init__(self):
@@ -687,10 +690,9 @@ class Propagator(object):
687
690
 
688
691
  def add_clause(self) -> List[int]:
689
692
  """
690
- The method is called by the solver to add an external clause if
691
- there is any. The clause can be arbitrary but if it is
692
- root-satisfied or tautological, the solver will ignore it without
693
- learning it.
693
+ The method is called by the solver to obtain an external clause.
694
+ The clause can be arbitrary but if it is root-satisfied or
695
+ tautological, the solver will ignore it without learning it.
694
696
 
695
697
  Root-falsified literals are eagerly removed from the clause.
696
698
  Falsified clauses trigger conflict analysis, propagating clauses
@@ -700,6 +702,19 @@ class Propagator(object):
700
702
  An empty clause (or root falsified clause, see above) makes the
701
703
  formula unsatisfiable and stops the search immediately.
702
704
 
705
+ .. note::
706
+
707
+ The exact meaning of returning ``[]`` depends on whether the
708
+ propagator defines method ``has_clause()``.
709
+
710
+ - If ``has_clause()`` is defined, the solver first queries it.
711
+ Whenever it returns ``True``, the follow-up call of
712
+ :meth:`add_clause` is expected to return the clause itself,
713
+ and ``[]`` denotes the actual empty clause.
714
+ - Otherwise, if ``has_clause()`` is undefined, returning
715
+ ``[]`` from :meth:`add_clause` is interpreted as saying that
716
+ there is no clause to add.
717
+
703
718
  :rtype: iterable(int)
704
719
  """
705
720
 
@@ -1283,14 +1298,25 @@ class BooleanEngine(Propagator):
1283
1298
 
1284
1299
  return [lit] + self.origin[lit].justify(lit)
1285
1300
 
1301
+ def has_clause(self):
1302
+ """
1303
+ Check whether the engine currently has an external clause to add.
1304
+ When queried separately by the solver, this lets
1305
+ :meth:`add_clause` return ``[]`` as an actual empty clause.
1306
+ """
1307
+
1308
+ return self.falsified is not None
1309
+
1286
1310
  def add_clause(self):
1287
1311
  """
1288
- Extract a new clause to add to the solver if one exists; return an
1289
- empty clause ``[]`` otherwise.
1312
+ Extract the external clause previously announced by
1313
+ :meth:`has_clause`.
1290
1314
  """
1291
1315
 
1292
- if self.falsified is None:
1293
- return []
1316
+ # # old behaviour checking if we have a clause to add;
1317
+ # # commenting this out because we have has_clause() now
1318
+ # if self.falsified is None:
1319
+ # return []
1294
1320
 
1295
1321
  to_add = self.falsified.explain_failure()
1296
1322
 
pysat/examples/rc2.py CHANGED
@@ -409,6 +409,9 @@ class RC2(object):
409
409
  :type clause: iterable(int)
410
410
  :type weight: int
411
411
 
412
+ :return: selector literal for a soft clause and ``None`` for a hard one
413
+ :rtype: int or None
414
+
412
415
  .. code-block:: python
413
416
 
414
417
  >>> from pysat.examples.rc2 import RC2
@@ -449,6 +452,8 @@ class RC2(object):
449
452
  '{0} does not support native cardinality constraints. Make sure you use the right type of formula.'.format(self.solver)
450
453
 
451
454
  self.oracle.add_atmost(cl, clause[1], weights=clause[2] if len(clause) == 3 else [])
455
+
456
+ return None
452
457
  else:
453
458
  # soft clauses should be augmented with a selector
454
459
  selv = cl[0] # for a unit clause, no selector is needed
@@ -472,6 +477,8 @@ class RC2(object):
472
477
  self.sall.append(selv)
473
478
  self.sels_set.add(selv)
474
479
 
480
+ return selv
481
+
475
482
  def delete(self):
476
483
  """
477
484
  Explicit destructor of the internal SAT oracle and all the
pysat/formula.py CHANGED
@@ -4129,6 +4129,7 @@ class WCNF(object):
4129
4129
  # normalize it, i.e. transform into a set of clauses
4130
4130
  # with a positive weight
4131
4131
  if negs:
4132
+ self.nv = max(self.nv, max(map(lambda cl: max(map(abs, cl[0])), negs)))
4132
4133
  self.normalize_negatives(negs)
4133
4134
 
4134
4135
  # if topw was unspecified and assigned to +infinity,
@@ -5380,6 +5381,7 @@ class WCNFPlus(WCNF, object):
5380
5381
  # normalize it, i.e. transform into a set of clauses
5381
5382
  # with a positive weight
5382
5383
  if negs:
5384
+ self.nv = max(self.nv, max(map(lambda cl: max(map(abs, cl[0])), negs)))
5383
5385
  self.normalize_negatives(negs)
5384
5386
 
5385
5387
  # if topw was unspecified and assigned to +infinity,
Binary file
@@ -409,6 +409,9 @@ class RC2(object):
409
409
  :type clause: iterable(int)
410
410
  :type weight: int
411
411
 
412
+ :return: selector literal for a soft clause and ``None`` for a hard one
413
+ :rtype: int or None
414
+
412
415
  .. code-block:: python
413
416
 
414
417
  >>> from pysat.examples.rc2 import RC2
@@ -449,6 +452,8 @@ class RC2(object):
449
452
  '{0} does not support native cardinality constraints. Make sure you use the right type of formula.'.format(self.solver)
450
453
 
451
454
  self.oracle.add_atmost(cl, clause[1], weights=clause[2] if len(clause) == 3 else [])
455
+
456
+ return None
452
457
  else:
453
458
  # soft clauses should be augmented with a selector
454
459
  selv = cl[0] # for a unit clause, no selector is needed
@@ -472,6 +477,8 @@ class RC2(object):
472
477
  self.sall.append(selv)
473
478
  self.sels_set.add(selv)
474
479
 
480
+ return selv
481
+
475
482
  def delete(self):
476
483
  """
477
484
  Explicit destructor of the internal SAT oracle and all the
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-sat
3
- Version: 1.9.dev5
3
+ Version: 1.9.dev7
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=oEHFR99AKhuXAUSiAvxNANb8IpiMg2YjOLDneg88z-M,71680
2
- pyformula.cp313-win_amd64.pyd,sha256=Uh0M7YXgOgGT0nQ9JUMyCWcFsFFeDUD71JE7SmPG_Ko,30208
3
- pysolvers.cp313-win_amd64.pyd,sha256=kHnoNbflXZmK-ZFWP2e8vwViScRFdWUG5-DObFPoCxU,3332608
4
- pysat/__init__.py,sha256=OwxlXwJeeh9Y0cxfqZ_0gm9r6oIZDBs0m3XQUCMDGc0,680
1
+ pycard.cp313-win_amd64.pyd,sha256=7mLtentpGvV6ABZrYrgLQu3LdLh4tQKZE3EVwIlI2fM,71680
2
+ pyformula.cp313-win_amd64.pyd,sha256=mYBsZFS_fkmpzy4maUvyjyiF3s7qE88-4BgFCvzUOh0,31232
3
+ pysolvers.cp313-win_amd64.pyd,sha256=EBm6zbuUAMxU-omqOSlP7-HGPVpn_as19HM2RSnsct0,3340288
4
+ pysat/__init__.py,sha256=4zSEPAX1iKQpFV3wsG_VVidiuVQN4i9k2Q7X-2hFQWw,680
5
5
  pysat/_fileio.py,sha256=pXRGGAaP7U8r3bpn5ShseCSHROXqi7ygaYe6T6QORto,6700
6
6
  pysat/_utils.py,sha256=4cv40p70FKvjCTKq8GqzS_jlxF74cp_lojTZSim_qJE,1340
7
7
  pysat/card.py,sha256=rav3_t_mCzbLw8SAdXcOh-PNbFtaATVSAJzpbygqiQ4,30066
8
- pysat/engines.py,sha256=PzcZJ4zFXDHfcSSHF7iPadtrwSVEt4t9B_cO5epwTZk,45182
9
- pysat/formula.py,sha256=3VdJYS6jZDRWSwn_KfofTmwD_x401O-3rQyfzgORL6o,210084
8
+ pysat/engines.py,sha256=yAYA_PzIGr_uRF85M7kL2bipjpLbY7jdfFKTdY-yW8I,46364
9
+ pysat/formula.py,sha256=tHltOuKQ5L7nefYlKDzPU0fWXol6-YUU1lexihNBRV4,210252
10
10
  pysat/integer.py,sha256=um6FXUzmBHUFlWXNKs0xLh9Jss3jiEin2Er_U41KtkA,90203
11
11
  pysat/pb.py,sha256=DMy8UfbbpfJo5cTZul9W1o_mlr-B0lCIEseZjrQYd8A,17816
12
12
  pysat/process.py,sha256=8lNbpEKipFZjbQ9DCJPfdL8eZHx-ltNuu7h4geWWdJY,12739
@@ -27,24 +27,24 @@ pysat/examples/models.py,sha256=cdIR8iOrYu2ibqfcb_kEKXQMCfmFiz7cvZ3y1dur3Qw,5741
27
27
  pysat/examples/musx.py,sha256=hswVGkjm95lhOyrtl1e4ouDyNSy-hWvQ05084Xnck9I,10946
28
28
  pysat/examples/optux.py,sha256=8eYHO_uhL_4ugb-hRv2s6cnOwTurfqkpbdnK9T4iDtw,27697
29
29
  pysat/examples/primer.py,sha256=0OeV9R6mWyIr2BKIitkrfgY3q2XE-sV1ZLSiybGRFXw,23375
30
- pysat/examples/rc2.py,sha256=y8UWP8qQcrWW8wGTDDPMdbuQVFAN1Gafb0x0gshkVZ4,76817
30
+ pysat/examples/rc2.py,sha256=i1sH8ukXng56Vx-KnA2GiOvC_aCa_vFRVGoTMJoZjW4,76984
31
31
  pysat/examples/usage.py,sha256=x9luw6pyKAAndlxAeUWFhS4aLSVmD2t_j_5uA9YddHg,2183
32
- python_sat-1.9.dev5.data/scripts/approxmc.py,sha256=h6aMnSpIaYXkTMq-tCSzNWwKb0AG-vTH4vuLWGn5Q4s,13958
33
- python_sat-1.9.dev5.data/scripts/bbscan.py,sha256=xGxklG6Gc_UBaM8QvEJDOtQhEamxAncfsd65E-0JcAc,22696
34
- python_sat-1.9.dev5.data/scripts/bica.py,sha256=q6fQGsFp1EaaYRZGBsDFOIJPVScr5k42XFskBzW69mA,27776
35
- python_sat-1.9.dev5.data/scripts/fm.py,sha256=ek1QDsuxiq1zm1PBLbrSXXEE89RP9_DYwVNnyB3eO4s,18650
36
- python_sat-1.9.dev5.data/scripts/genhard.py,sha256=YswufT272W4xTJrSBlOC2ucJx4RK4ntfRv73rASrx30,19520
37
- python_sat-1.9.dev5.data/scripts/lbx.py,sha256=rCQ6zH_DXoVjBrzhZHSDJMfP92-hz2JVwh6e4m44AUc,23874
38
- python_sat-1.9.dev5.data/scripts/lsu.py,sha256=cAATg2x0Cu1LC8KszMctHqywjq7pygkb9vWNBrbUEZs,16681
39
- python_sat-1.9.dev5.data/scripts/mcsls.py,sha256=cTJQMIO-4iho412wG0JhvhqXWy81U0RQV8wwOgkri3Q,22690
40
- python_sat-1.9.dev5.data/scripts/models.py,sha256=UmMmklExzyXAIhh-0i038nQb7hTK6CbdV1M6m2GxxSI,5917
41
- python_sat-1.9.dev5.data/scripts/musx.py,sha256=LwK10YuQ8pIf1TJwp0HKp54O0hdk8zBy3TIfGsF1yW0,11277
42
- python_sat-1.9.dev5.data/scripts/optux.py,sha256=t20YBZH4_axTkRMapq-DL-fq-9tBybPWo0pkhIyGhDw,28394
43
- python_sat-1.9.dev5.data/scripts/primer.py,sha256=iE9Vy0XyeySIY-7-L_VMwRahsIVCEmm9k04OhLwDvuw,23982
44
- python_sat-1.9.dev5.data/scripts/rc2.py,sha256=EgOSxypvgKz1rWeg7RBbwkLx4pOeldPEUK_l-2flySM,78830
45
- python_sat-1.9.dev5.data/scripts/unigen.py,sha256=e-HC2UxWA8MTN90VslkHX1ZlTPjdhI4etzkn6G8YAX4,17140
46
- python_sat-1.9.dev5.dist-info/licenses/LICENSE.txt,sha256=6QMvEzxqdPXEoiAZUBaZLeLF4hW2S81fjKz_THER0uQ,1109
47
- python_sat-1.9.dev5.dist-info/METADATA,sha256=pI1rE18WzkZbwyJgeFGwERd_2wvfqvC7wap4Sb1hfFU,1783
48
- python_sat-1.9.dev5.dist-info/WHEEL,sha256=x5Wpw_tLx5PQKiWdxpqvs0e7Sg-SO0mTWdEADYDGPGA,101
49
- python_sat-1.9.dev5.dist-info/top_level.txt,sha256=0SLg3yVqNpeiqOwFcAo3OxXhqAnflCmb5Fjl6gsl-Do,33
50
- python_sat-1.9.dev5.dist-info/RECORD,,
32
+ python_sat-1.9.dev7.data/scripts/approxmc.py,sha256=h6aMnSpIaYXkTMq-tCSzNWwKb0AG-vTH4vuLWGn5Q4s,13958
33
+ python_sat-1.9.dev7.data/scripts/bbscan.py,sha256=xGxklG6Gc_UBaM8QvEJDOtQhEamxAncfsd65E-0JcAc,22696
34
+ python_sat-1.9.dev7.data/scripts/bica.py,sha256=q6fQGsFp1EaaYRZGBsDFOIJPVScr5k42XFskBzW69mA,27776
35
+ python_sat-1.9.dev7.data/scripts/fm.py,sha256=ek1QDsuxiq1zm1PBLbrSXXEE89RP9_DYwVNnyB3eO4s,18650
36
+ python_sat-1.9.dev7.data/scripts/genhard.py,sha256=YswufT272W4xTJrSBlOC2ucJx4RK4ntfRv73rASrx30,19520
37
+ python_sat-1.9.dev7.data/scripts/lbx.py,sha256=rCQ6zH_DXoVjBrzhZHSDJMfP92-hz2JVwh6e4m44AUc,23874
38
+ python_sat-1.9.dev7.data/scripts/lsu.py,sha256=cAATg2x0Cu1LC8KszMctHqywjq7pygkb9vWNBrbUEZs,16681
39
+ python_sat-1.9.dev7.data/scripts/mcsls.py,sha256=cTJQMIO-4iho412wG0JhvhqXWy81U0RQV8wwOgkri3Q,22690
40
+ python_sat-1.9.dev7.data/scripts/models.py,sha256=UmMmklExzyXAIhh-0i038nQb7hTK6CbdV1M6m2GxxSI,5917
41
+ python_sat-1.9.dev7.data/scripts/musx.py,sha256=LwK10YuQ8pIf1TJwp0HKp54O0hdk8zBy3TIfGsF1yW0,11277
42
+ python_sat-1.9.dev7.data/scripts/optux.py,sha256=t20YBZH4_axTkRMapq-DL-fq-9tBybPWo0pkhIyGhDw,28394
43
+ python_sat-1.9.dev7.data/scripts/primer.py,sha256=iE9Vy0XyeySIY-7-L_VMwRahsIVCEmm9k04OhLwDvuw,23982
44
+ python_sat-1.9.dev7.data/scripts/rc2.py,sha256=yJL34GQclQakHH_Ksgt431Xwi7lmTZtiRI0VClHlirU,79004
45
+ python_sat-1.9.dev7.data/scripts/unigen.py,sha256=e-HC2UxWA8MTN90VslkHX1ZlTPjdhI4etzkn6G8YAX4,17140
46
+ python_sat-1.9.dev7.dist-info/licenses/LICENSE.txt,sha256=6QMvEzxqdPXEoiAZUBaZLeLF4hW2S81fjKz_THER0uQ,1109
47
+ python_sat-1.9.dev7.dist-info/METADATA,sha256=TqwyTig9BSaYLrlVOU5AO7FduVX6kp4G9WuGfjbqOEs,1783
48
+ python_sat-1.9.dev7.dist-info/WHEEL,sha256=AP_wkikJcUkDPUGvTNydv7g0R7BhW1u_fVHNKW7TJyI,101
49
+ python_sat-1.9.dev7.dist-info/top_level.txt,sha256=0SLg3yVqNpeiqOwFcAo3OxXhqAnflCmb5Fjl6gsl-Do,33
50
+ python_sat-1.9.dev7.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (82.0.1)
2
+ Generator: setuptools (83.0.0)
3
3
  Root-Is-Purelib: false
4
4
  Tag: cp313-cp313-win_amd64
5
5