repycudd 3.1.0__tar.gz

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 (127) hide show
  1. repycudd-3.1.0/INSTALL +44 -0
  2. repycudd-3.1.0/LICENSE +27 -0
  3. repycudd-3.1.0/MANIFEST.in +4 -0
  4. repycudd-3.1.0/PKG-INFO +42 -0
  5. repycudd-3.1.0/README +94 -0
  6. repycudd-3.1.0/README.md +24 -0
  7. repycudd-3.1.0/brel.i +95 -0
  8. repycudd-3.1.0/cudd-3.0.0/LICENSE +31 -0
  9. repycudd-3.1.0/cudd-3.0.0/config.h +27 -0
  10. repycudd-3.1.0/cudd-3.0.0/cudd/cudd.h +983 -0
  11. repycudd-3.1.0/cudd-3.0.0/cudd/cuddAPI.c +4773 -0
  12. repycudd-3.1.0/cudd-3.0.0/cudd/cuddAddAbs.c +543 -0
  13. repycudd-3.1.0/cudd-3.0.0/cudd/cuddAddApply.c +891 -0
  14. repycudd-3.1.0/cudd-3.0.0/cudd/cuddAddFind.c +298 -0
  15. repycudd-3.1.0/cudd-3.0.0/cudd/cuddAddInv.c +190 -0
  16. repycudd-3.1.0/cudd-3.0.0/cudd/cuddAddIte.c +620 -0
  17. repycudd-3.1.0/cudd-3.0.0/cudd/cuddAddNeg.c +275 -0
  18. repycudd-3.1.0/cudd-3.0.0/cudd/cuddAddWalsh.c +375 -0
  19. repycudd-3.1.0/cudd-3.0.0/cudd/cuddAndAbs.c +364 -0
  20. repycudd-3.1.0/cudd-3.0.0/cudd/cuddAnneal.c +757 -0
  21. repycudd-3.1.0/cudd-3.0.0/cudd/cuddApa.c +1070 -0
  22. repycudd-3.1.0/cudd-3.0.0/cudd/cuddApprox.c +2177 -0
  23. repycudd-3.1.0/cudd-3.0.0/cudd/cuddBddAbs.c +739 -0
  24. repycudd-3.1.0/cudd-3.0.0/cudd/cuddBddCorr.c +470 -0
  25. repycudd-3.1.0/cudd-3.0.0/cudd/cuddBddIte.c +1406 -0
  26. repycudd-3.1.0/cudd-3.0.0/cudd/cuddBridge.c +986 -0
  27. repycudd-3.1.0/cudd-3.0.0/cudd/cuddCache.c +990 -0
  28. repycudd-3.1.0/cudd-3.0.0/cudd/cuddCheck.c +825 -0
  29. repycudd-3.1.0/cudd-3.0.0/cudd/cuddClip.c +538 -0
  30. repycudd-3.1.0/cudd-3.0.0/cudd/cuddCof.c +497 -0
  31. repycudd-3.1.0/cudd-3.0.0/cudd/cuddCompose.c +1703 -0
  32. repycudd-3.1.0/cudd-3.0.0/cudd/cuddDecomp.c +2131 -0
  33. repycudd-3.1.0/cudd-3.0.0/cudd/cuddEssent.c +1419 -0
  34. repycudd-3.1.0/cudd-3.0.0/cudd/cuddExact.c +940 -0
  35. repycudd-3.1.0/cudd-3.0.0/cudd/cuddExport.c +1483 -0
  36. repycudd-3.1.0/cudd-3.0.0/cudd/cuddGenCof.c +2326 -0
  37. repycudd-3.1.0/cudd-3.0.0/cudd/cuddGenetic.c +904 -0
  38. repycudd-3.1.0/cudd-3.0.0/cudd/cuddGroup.c +2096 -0
  39. repycudd-3.1.0/cudd-3.0.0/cudd/cuddHarwell.c +578 -0
  40. repycudd-3.1.0/cudd-3.0.0/cudd/cuddInit.c +281 -0
  41. repycudd-3.1.0/cudd-3.0.0/cudd/cuddInt.h +1249 -0
  42. repycudd-3.1.0/cudd-3.0.0/cudd/cuddInteract.c +395 -0
  43. repycudd-3.1.0/cudd-3.0.0/cudd/cuddLCache.c +1462 -0
  44. repycudd-3.1.0/cudd-3.0.0/cudd/cuddLevelQ.c +547 -0
  45. repycudd-3.1.0/cudd-3.0.0/cudd/cuddLinear.c +1297 -0
  46. repycudd-3.1.0/cudd-3.0.0/cudd/cuddLiteral.c +255 -0
  47. repycudd-3.1.0/cudd-3.0.0/cudd/cuddMatMult.c +694 -0
  48. repycudd-3.1.0/cudd-3.0.0/cudd/cuddPriority.c +1996 -0
  49. repycudd-3.1.0/cudd-3.0.0/cudd/cuddRead.c +537 -0
  50. repycudd-3.1.0/cudd-3.0.0/cudd/cuddRef.c +756 -0
  51. repycudd-3.1.0/cudd-3.0.0/cudd/cuddReorder.c +2066 -0
  52. repycudd-3.1.0/cudd-3.0.0/cudd/cuddSat.c +1730 -0
  53. repycudd-3.1.0/cudd-3.0.0/cudd/cuddSign.c +282 -0
  54. repycudd-3.1.0/cudd-3.0.0/cudd/cuddSolve.c +346 -0
  55. repycudd-3.1.0/cudd-3.0.0/cudd/cuddSplit.c +660 -0
  56. repycudd-3.1.0/cudd-3.0.0/cudd/cuddSubsetHB.c +1310 -0
  57. repycudd-3.1.0/cudd-3.0.0/cudd/cuddSubsetSP.c +1606 -0
  58. repycudd-3.1.0/cudd-3.0.0/cudd/cuddSymmetry.c +1670 -0
  59. repycudd-3.1.0/cudd-3.0.0/cudd/cuddTable.c +3214 -0
  60. repycudd-3.1.0/cudd-3.0.0/cudd/cuddUtil.c +4188 -0
  61. repycudd-3.1.0/cudd-3.0.0/cudd/cuddWindow.c +986 -0
  62. repycudd-3.1.0/cudd-3.0.0/cudd/cuddZddCount.c +308 -0
  63. repycudd-3.1.0/cudd-3.0.0/cudd/cuddZddFuncs.c +1549 -0
  64. repycudd-3.1.0/cudd-3.0.0/cudd/cuddZddGroup.c +1302 -0
  65. repycudd-3.1.0/cudd-3.0.0/cudd/cuddZddIsop.c +890 -0
  66. repycudd-3.1.0/cudd-3.0.0/cudd/cuddZddLin.c +925 -0
  67. repycudd-3.1.0/cudd-3.0.0/cudd/cuddZddMisc.c +233 -0
  68. repycudd-3.1.0/cudd-3.0.0/cudd/cuddZddPort.c +357 -0
  69. repycudd-3.1.0/cudd-3.0.0/cudd/cuddZddReord.c +1580 -0
  70. repycudd-3.1.0/cudd-3.0.0/cudd/cuddZddSetop.c +1080 -0
  71. repycudd-3.1.0/cudd-3.0.0/cudd/cuddZddSymm.c +1639 -0
  72. repycudd-3.1.0/cudd-3.0.0/cudd/cuddZddUtil.c +1127 -0
  73. repycudd-3.1.0/cudd-3.0.0/dddmp/dddmp.h +330 -0
  74. repycudd-3.1.0/cudd-3.0.0/dddmp/dddmpBinary.c +343 -0
  75. repycudd-3.1.0/cudd-3.0.0/dddmp/dddmpConvert.c +180 -0
  76. repycudd-3.1.0/cudd-3.0.0/dddmp/dddmpDbg.c +167 -0
  77. repycudd-3.1.0/cudd-3.0.0/dddmp/dddmpInt.h +216 -0
  78. repycudd-3.1.0/cudd-3.0.0/dddmp/dddmpLoad.c +1491 -0
  79. repycudd-3.1.0/cudd-3.0.0/dddmp/dddmpLoadCnf.c +1084 -0
  80. repycudd-3.1.0/cudd-3.0.0/dddmp/dddmpNodeAdd.c +451 -0
  81. repycudd-3.1.0/cudd-3.0.0/dddmp/dddmpNodeBdd.c +452 -0
  82. repycudd-3.1.0/cudd-3.0.0/dddmp/dddmpNodeCnf.c +931 -0
  83. repycudd-3.1.0/cudd-3.0.0/dddmp/dddmpStoreAdd.c +944 -0
  84. repycudd-3.1.0/cudd-3.0.0/dddmp/dddmpStoreBdd.c +1117 -0
  85. repycudd-3.1.0/cudd-3.0.0/dddmp/dddmpStoreCnf.c +1578 -0
  86. repycudd-3.1.0/cudd-3.0.0/dddmp/dddmpStoreMisc.c +1522 -0
  87. repycudd-3.1.0/cudd-3.0.0/dddmp/dddmpUtil.c +436 -0
  88. repycudd-3.1.0/cudd-3.0.0/epd/epd.c +1053 -0
  89. repycudd-3.1.0/cudd-3.0.0/epd/epd.h +112 -0
  90. repycudd-3.1.0/cudd-3.0.0/epd/epdInt.h +146 -0
  91. repycudd-3.1.0/cudd-3.0.0/mtr/mtr.h +134 -0
  92. repycudd-3.1.0/cudd-3.0.0/mtr/mtrBasic.c +398 -0
  93. repycudd-3.1.0/cudd-3.0.0/mtr/mtrGroup.c +842 -0
  94. repycudd-3.1.0/cudd-3.0.0/mtr/mtrInt.h +144 -0
  95. repycudd-3.1.0/cudd-3.0.0/st/st.c +1198 -0
  96. repycudd-3.1.0/cudd-3.0.0/st/st.h +269 -0
  97. repycudd-3.1.0/cudd-3.0.0/util/cpu_time.c +136 -0
  98. repycudd-3.1.0/cudd-3.0.0/util/cstringstream.c +195 -0
  99. repycudd-3.1.0/cudd-3.0.0/util/cstringstream.h +162 -0
  100. repycudd-3.1.0/cudd-3.0.0/util/datalimit.c +112 -0
  101. repycudd-3.1.0/cudd-3.0.0/util/prtime.c +80 -0
  102. repycudd-3.1.0/cudd-3.0.0/util/safe_mem.c +128 -0
  103. repycudd-3.1.0/cudd-3.0.0/util/ucbqsort.c +308 -0
  104. repycudd-3.1.0/cudd-3.0.0/util/util.h +230 -0
  105. repycudd-3.1.0/ddgen.i +32 -0
  106. repycudd-3.1.0/ddmanager.i +763 -0
  107. repycudd-3.1.0/ddnode.i +192 -0
  108. repycudd-3.1.0/docstring.h +2 -0
  109. repycudd-3.1.0/epd.i +98 -0
  110. repycudd-3.1.0/examples/example1.py +52 -0
  111. repycudd-3.1.0/examples/example2.py +93 -0
  112. repycudd-3.1.0/examples/example3.py +68 -0
  113. repycudd-3.1.0/externs.i +12 -0
  114. repycudd-3.1.0/pyiter.i +98 -0
  115. repycudd-3.1.0/pyproject.toml +39 -0
  116. repycudd-3.1.0/repycudd.cpp +591 -0
  117. repycudd-3.1.0/repycudd.egg-info/PKG-INFO +42 -0
  118. repycudd-3.1.0/repycudd.egg-info/SOURCES.txt +125 -0
  119. repycudd-3.1.0/repycudd.egg-info/dependency_links.txt +1 -0
  120. repycudd-3.1.0/repycudd.egg-info/top_level.txt +2 -0
  121. repycudd-3.1.0/repycudd.h +261 -0
  122. repycudd-3.1.0/repycudd.i +65 -0
  123. repycudd-3.1.0/setup.cfg +4 -0
  124. repycudd-3.1.0/setup.py +68 -0
  125. repycudd-3.1.0/test_smoke.py +71 -0
  126. repycudd-3.1.0/tlcinfo.i +60 -0
  127. repycudd-3.1.0/utils.i +166 -0
repycudd-3.1.0/INSTALL ADDED
@@ -0,0 +1,44 @@
1
+ INSTALLING REPYCUDD
2
+ -------------------
3
+
4
+ PyPI has wheels for Linux, macOS and 64-bit Windows, so usually
5
+
6
+ python -m pip install repycudd
7
+
8
+ is all you need. The rest of this file is about building from source.
9
+
10
+ repycudd builds with pip on Linux, macOS and 64-bit Windows (CI covers all
11
+ three). CUDD 3.0.0 is vendored in cudd-3.0.0/ and linked statically into the
12
+ extension, so there is nothing else to install.
13
+
14
+ Requirements:
15
+ - Python 3.9 or later, with pip.
16
+ - A C/C++ compiler: gcc or clang on Linux and macOS, Microsoft Visual C++
17
+ 14.0 or later on Windows ("Build Tools for Visual Studio", C++ workload).
18
+ - SWIG >= 4.2. pip fetches it from PyPI automatically.
19
+
20
+ Install into the current environment:
21
+
22
+ python -m pip install .
23
+
24
+ Or into a plain directory:
25
+
26
+ python -m pip install --no-deps --target <dir> .
27
+
28
+ and then put <dir> on PYTHONPATH.
29
+
30
+ On CPython (except the free-threaded builds) the extension uses the stable
31
+ ABI, so the same build works on every CPython from 3.9 on.
32
+
33
+ The CUDD sources carry local patches so that pointers are never stored in a
34
+ `long`, which is 32 bits on 64-bit Windows.
35
+
36
+ BREL support (brel.i) is not built.
37
+
38
+ CREDITS
39
+
40
+ Current maintainer : Merritt Miller
41
+ merrittmiller@umail.ucsb.edu
42
+ Former maintainer : Aravind Vijayakumar
43
+ Original PyCUDD by : Steve Haynal
44
+ Thanks to Hao Xin for pointing out a change in SWIG convention.
repycudd-3.1.0/LICENSE ADDED
@@ -0,0 +1,27 @@
1
+ Copyright (c) 2014, The Regents of the University of California
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without
5
+ modification, are permitted provided that the following conditions are met:
6
+
7
+ 1. Redistributions of source code must retain the above copyright notice, this
8
+ list of conditions and the following disclaimer.
9
+
10
+ 2. Redistributions in binary form must reproduce the above copyright notice,
11
+ this list of conditions and the following disclaimer in the documentation
12
+ and/or other materials provided with the distribution.
13
+
14
+ 3. Neither the name of the copyright holder nor the names of its contributors
15
+ may be used to endorse or promote products derived from this software
16
+ without specific prior written permission.
17
+
18
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND
19
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,4 @@
1
+ # setup.py lists only the compiled sources, but SWIG and the compiler also need these
2
+ include *.i *.h INSTALL README test_smoke.py
3
+ recursive-include examples *.py
4
+ recursive-include cudd-3.0.0 *.h
@@ -0,0 +1,42 @@
1
+ Metadata-Version: 2.4
2
+ Name: repycudd
3
+ Version: 3.1.0
4
+ Summary: Python bindings for the CUDD 3.0.0 decision diagram package
5
+ License-Expression: BSD-3-Clause
6
+ Project-URL: Homepage, https://github.com/pysmt/repycudd
7
+ Project-URL: Issues, https://github.com/pysmt/repycudd/issues
8
+ Classifier: Programming Language :: C
9
+ Classifier: Programming Language :: C++
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: Implementation :: CPython
12
+ Classifier: Topic :: Scientific/Engineering :: Mathematics
13
+ Requires-Python: >=3.9
14
+ Description-Content-Type: text/markdown
15
+ License-File: LICENSE
16
+ License-File: cudd-3.0.0/LICENSE
17
+ Dynamic: license-file
18
+
19
+ # repycudd
20
+ Reentrant version of pycudd: a python wrapper for the CUDD BDD library.
21
+
22
+ This is a fork of PyCUDD (http://bears.ece.ucsb.edu/pycudd.html) providing a re-entrant version of the wrapper.
23
+
24
+ The main purpose of this fork is to provide pySMT (www.pysmt.org) a re-entrant wrapper for CUDD, hence some features (especially ADD and ZDD) not currently used by PySMT could be broken in repycudd.
25
+
26
+ Take a look at examples/ to see how to use the wrapper. For a higher level interface for using BDDs, consider using pySMT.
27
+
28
+ ## Installation
29
+
30
+ pip install repycudd
31
+
32
+ PyPI has wheels for Linux (x86_64 and aarch64), macOS (x86_64 and arm64) and Windows (x86_64), for CPython 3.9 and later. CUDD 3.0.0 is linked statically into the extension, so there is nothing else to install.
33
+
34
+ ## Building from source
35
+
36
+ python -m pip install .
37
+
38
+ This needs a C/C++ compiler; see INSTALL for the details. SWIG comes from PyPI as a build dependency.
39
+
40
+ ## Releasing
41
+
42
+ Set the new version in `pyproject.toml` and in `docstring.h` (`test_smoke.py` checks that they match), merge to master, then push a `vX.Y.Z` tag. The `wheels` workflow builds and tests the sdist and the wheels, uploads them to PyPI and creates the GitHub release.
repycudd-3.1.0/README ADDED
@@ -0,0 +1,94 @@
1
+ GETTING STARTED:
2
+
3
+ The script 'example1.py' shows how to create a BDD manager, various BDD variables
4
+ and how to find the truth set of a small function. Look at the comments and code in
5
+ this script to see how it is done. This script is executable from the command line.
6
+ Alternativley, Python may be started and individual commands may be entered at the
7
+ Python prompt.
8
+
9
+ Refer to the excellent documentation in the doc directory of the CUDD distribution for
10
+ details on CUDD functions. The various .i files show what CUDD functions are available
11
+ in PyCUDD. For example, from ddmanager.i:
12
+
13
+ DdNode * zddIthVar( int i) { DdNode* result = Cudd_zddIthVar(self, i); Cudd_Ref(result); return result; }
14
+
15
+ indicates that the CUDD function 'Cudd_zddIthVar' is available as the DdManager method
16
+ 'zddIthVar' in Python. It would be called as:
17
+
18
+ x = mgr.zddIthVar(i)
19
+
20
+ from Python. x is a returned Python DdNode object, mgr is an existing Python DdManager object, i is an integer.
21
+
22
+
23
+ As a general rule, drop the 'Cudd' or 'Cudd_bdd' from the prefix of the CUDD function to
24
+ arrive at the Python method. If a CUDD function requires a DdNode argument, it will
25
+ typically be a method of the Python DdNode class. The first DdNode in the argument list is
26
+ the 'self' or 'this' pointer. For example,
27
+
28
+ DdNode* Cudd_bddAndAbstract(DdManager *manager, DdNode *f, DdNode *g, DdNode *cube)
29
+
30
+ is callable from python as
31
+
32
+ x = f.AndAbstract(g,cube)
33
+
34
+ ZBDDs and ADDs are available in PyCUDD as well. The CUDD package treats a BDD,
35
+ ZBDD or ADD as a DdNode. For ease of implementation, this version of PyCUDD also
36
+ has only one DdNode object. This means that many methods are unprotected. If you
37
+ call a method that expects BDDs but you pass ZBDDs, then pycudd will probably
38
+ crash. This also means that operator overloading applies only to BDDs.
39
+ (See pycudd.i for operator overloading details.) For example, if you want the union
40
+ of two ZBDDs, you must use
41
+
42
+ x = y.zddUnion(z)
43
+
44
+ where y and z are Python DdNode objects and x is a returned Python DdNode object.
45
+ In this case, all DdNode objects are ZBDDs. Calling
46
+
47
+ x = y + z
48
+
49
+ where y and z are ZBDD Python DdNode objects will crash as the + operator is
50
+ overloaded only for DdNode objects which are BDDs. Future versions of PyCUDD will
51
+ deal with this situation in a better way.
52
+
53
+ CUDD sometimes requires arguments or returns values that are DdNode, int or double
54
+ arrays. Use the helper objects DdArray, IntArray or DoubleArray when this is required.
55
+ For example, the CUDD function
56
+
57
+ int Cudd_SetVarMap(DdManager *manager, DdNode **x, DdNode **y, int n)
58
+
59
+ is called from Python as
60
+
61
+ mgr.SetVarMap(x,y,n)
62
+
63
+ where x and y are existing DdArray objects and n is an integer. Refer
64
+ to the .i files and pycudd.cpp to see how helper objects are created.
65
+
66
+ The CUDD package has been extended in pycudd. Extended features are indicated in
67
+ the .i files by the comments 'Added to DdManager' and 'Added to DdNode'. The helper
68
+ class DdArray also has some extended features. For example, given a DdArray object ddarray,
69
+
70
+ f = ddarray.Constraint(low, high)
71
+
72
+ will return a DdNode object f where terms of f are all possible combinations of
73
+ subterms in the DdArray. All terms in f will contain no less than low and no more than
74
+ high subterms from the DdArray.
75
+
76
+ USING BREL (beta)
77
+
78
+ The BREL interface is still in testing -- it currently has just the basic functionality.
79
+ Refer to example3.py for usage.
80
+
81
+ PyCUDD is distributed with the BSD V.3 license below. CUDD is distributed and maintained by the University of Colorado, under its own license, no claims or guarantees are made for the use of CUDD.
82
+
83
+ Copyright (c) 2014, The Regents of the University of California
84
+ All rights reserved.
85
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
86
+ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
87
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
88
+ 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
89
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
90
+
91
+
92
+
93
+
94
+
@@ -0,0 +1,24 @@
1
+ # repycudd
2
+ Reentrant version of pycudd: a python wrapper for the CUDD BDD library.
3
+
4
+ This is a fork of PyCUDD (http://bears.ece.ucsb.edu/pycudd.html) providing a re-entrant version of the wrapper.
5
+
6
+ The main purpose of this fork is to provide pySMT (www.pysmt.org) a re-entrant wrapper for CUDD, hence some features (especially ADD and ZDD) not currently used by PySMT could be broken in repycudd.
7
+
8
+ Take a look at examples/ to see how to use the wrapper. For a higher level interface for using BDDs, consider using pySMT.
9
+
10
+ ## Installation
11
+
12
+ pip install repycudd
13
+
14
+ PyPI has wheels for Linux (x86_64 and aarch64), macOS (x86_64 and arm64) and Windows (x86_64), for CPython 3.9 and later. CUDD 3.0.0 is linked statically into the extension, so there is nothing else to install.
15
+
16
+ ## Building from source
17
+
18
+ python -m pip install .
19
+
20
+ This needs a C/C++ compiler; see INSTALL for the details. SWIG comes from PyPI as a build dependency.
21
+
22
+ ## Releasing
23
+
24
+ Set the new version in `pyproject.toml` and in `docstring.h` (`test_smoke.py` checks that they match), merge to master, then push a `vX.Y.Z` tag. The `wheels` workflow builds and tests the sdist and the wheels, uploads them to PyPI and creates the GitHub release.
repycudd-3.1.0/brel.i ADDED
@@ -0,0 +1,95 @@
1
+ %{
2
+ #ifndef FROM_PYCUDDI
3
+ #error Use only from pycudd.i. Make sure to define FROM_PYCUDDI
4
+ #endif
5
+ %}
6
+
7
+ typedef struct BrelContext { } BrelContext_t;
8
+
9
+ %extend BrelContext_t {
10
+ BrelContext_t() {
11
+ BrelContext_t *context;
12
+ BrelParams_t *params;
13
+
14
+ context=ALLOC(BrelContext_t,1);
15
+ params=ALLOC(BrelParams_t,1);
16
+ BrelDefaultParams(params);
17
+
18
+ context->args=NULL;
19
+ context->Minimize=(Brel_Minimize)Brel_ISOP;
20
+ context->Cost=(Brel_CalculateCost)Brel_SharedBddSize;
21
+ context->FreeCost=(Brel_FreeCost)Brel_FreeDouble;
22
+ context->CmpCost=(Brel_CmpCost)Brel_CmpDouble;
23
+
24
+ context->HCost=(Brel_CalculateCost)Brel_SharedBddSize;
25
+
26
+ context->HFreeCost=(Brel_FreeCost)Brel_FreeDouble;
27
+ context->HCmpCost=(Brel_CmpCost)Brel_CmpDouble;
28
+ context->params=params;
29
+
30
+ return context;
31
+ }
32
+ }
33
+
34
+ typedef struct BrelRelation { } BrelRelation_t;
35
+
36
+ %extend BrelRelation_t {
37
+ BrelRelation_t(DdManager* ddman, DdNode *relation, DdArray *inps, DdArray *ops) {
38
+
39
+ BrelRelation_t *sbrrel;
40
+ int i;
41
+ DdNode **tmp;
42
+
43
+ sbrrel=ALLOC(BrelRelation_t,1);
44
+ sbrrel->numin = inps->sz;
45
+ sbrrel->numout = ops->sz;
46
+ sbrrel->bestcost = BRELMAXSOL;
47
+ sbrrel->numsol = 0;
48
+ sbrrel->bddsol = NULL;
49
+ // We want the I/O vars to be a copy of the DdArray arguments -- not a pointer to a mutable array!
50
+ sbrrel->inrel = ALLOC(DdNode *,sbrrel->numin);
51
+ sbrrel->outrel = ALLOC(DdNode *,sbrrel->numout);
52
+ // Need to increase the ref counts of the I/O DdNodes ...
53
+ for (i=0; i < inps->sz; i++) { sbrrel->inrel[i] = inps->vec[i]; Cudd_Ref(inps->vec[i]); }
54
+ for (i=0; i < ops->sz; i++) { sbrrel->outrel[i] = ops->vec[i]; Cudd_Ref(ops->vec[i]); }
55
+ sbrrel->relation = relation;
56
+ // And of the relation -- we want the extra reference
57
+ Cudd_Ref(relation);
58
+ sbrrel->ddman=ddman;
59
+ return sbrrel;
60
+ }
61
+
62
+ ~BrelRelation_t() {
63
+ if (self->inrel != NULL) { for (DdNode **tmp=self->inrel; tmp < self->inrel+self->numin; tmp++) Cudd_RecursiveDeref(self->ddman, *tmp); }
64
+ BRELFREE(self->inrel);
65
+ if (self->outrel != NULL and self->ddman) { for (DdNode **tmp=self->outrel; tmp < self->outrel+self->numout; tmp++) Cudd_RecursiveDeref(self->ddman, *tmp); }
66
+ BRELFREE(self->outrel);
67
+ if (self->ddman) Cudd_RecursiveDeref(self->ddman, self->relation);
68
+ if (self->bddsol != NULL and self->ddman) { for (DdNode **tmp=self->bddsol; tmp < self->bddsol+self->numout; tmp++) Cudd_RecursiveDeref(self->ddman, *tmp); }
69
+ BRELFREE(self->bddsol);
70
+ if (self->ddman) Cudd_RecursiveDeref(self->ddman,self->relation);
71
+ }
72
+
73
+ DdArray* SolveRelation(BrelContext_t *ctxt = NULL) {
74
+ DdNode **soln;
75
+ DdArray *result;
76
+ DdNode *opcube;
77
+ DdNode *tmp;
78
+ int i;
79
+ // Create a cube of the output variables from the DdNode ** that we have
80
+ opcube = self->outrel[0];
81
+ Cudd_Ref(opcube);
82
+ for (i=1; i<self->numout; i++) {
83
+ tmp = Cudd_bddAnd(self->ddman,self->outrel[i],opcube);
84
+ Cudd_Ref(tmp);
85
+ Cudd_RecursiveDeref(self->ddman,opcube);
86
+ opcube = tmp;
87
+ }
88
+ self->bddsol = Brel_Solve(self->ddman,self->relation,opcube,(Brel_Context_t *) ctxt);
89
+ // Done with opcube
90
+ Cudd_RecursiveDeref(self->ddman, opcube);
91
+ result = new DdArray(self->ddman,self->numout);
92
+ result->Assign(self->bddsol,self->numout);
93
+ return result;
94
+ }
95
+ }
@@ -0,0 +1,31 @@
1
+ Copyright (c) 1995-2004, Regents of the University of Colorado
2
+
3
+ All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions
7
+ are met:
8
+
9
+ Redistributions of source code must retain the above copyright
10
+ notice, this list of conditions and the following disclaimer.
11
+
12
+ Redistributions in binary form must reproduce the above copyright
13
+ notice, this list of conditions and the following disclaimer in the
14
+ documentation and/or other materials provided with the distribution.
15
+
16
+ Neither the name of the University of Colorado nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23
+ FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24
+ COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25
+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26
+ BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29
+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
30
+ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31
+ POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,27 @@
1
+ /* Hand-written stand-in for the autotools config.h; repycudd builds CUDD
2
+ from setup.py without running configure. SIZEOF_VOID_P and SIZEOF_INT
3
+ come from setup.py because they depend on the target ABI. */
4
+ #ifndef CUDD_CONFIG_H_
5
+ #define CUDD_CONFIG_H_
6
+
7
+ #define PACKAGE_VERSION "3.0.0"
8
+ #define HAVE_IEEE_754 1
9
+ #define HAVE_ASSERT_H 1
10
+ #define HAVE_INTTYPES_H 1
11
+ #define HAVE_STDDEF_H 1
12
+ #define HAVE_STDINT_H 1
13
+ #define HAVE_STDLIB_H 1
14
+ #define HAVE_STRING_H 1
15
+ #define HAVE_POWL 1
16
+
17
+ #ifndef _WIN32
18
+ #define HAVE_UNISTD_H 1
19
+ #define HAVE_SYSCONF 1
20
+ #define HAVE_SYS_RESOURCE_H 1
21
+ #define HAVE_SYS_TIME_H 1
22
+ #define HAVE_SYS_TIMES_H 1
23
+ #define HAVE_GETRLIMIT 1
24
+ #define HAVE_GETRUSAGE 1
25
+ #endif
26
+
27
+ #endif