PySDD 1.0.2__tar.gz → 1.0.5__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 (86) hide show
  1. {pysdd-1.0.2 → pysdd-1.0.5}/PKG-INFO +1 -1
  2. {pysdd-1.0.2 → pysdd-1.0.5}/PySDD.egg-info/PKG-INFO +1 -1
  3. {pysdd-1.0.2 → pysdd-1.0.5}/pyproject.toml +4 -3
  4. {pysdd-1.0.2 → pysdd-1.0.5}/pysdd/lib/libsdd-2.0/src/sdds/io.c +2 -2
  5. {pysdd-1.0.2 → pysdd-1.0.5}/pysdd/lib/libsdd-2.0/src/vtree_search/search.c +1 -1
  6. {pysdd-1.0.2 → pysdd-1.0.5}/pysdd/lib/libsdd-2.0/src/vtrees/compare.c +2 -2
  7. {pysdd-1.0.2 → pysdd-1.0.5}/pysdd/lib/libsdd-2.0/src/vtrees/io.c +7 -7
  8. {pysdd-1.0.2 → pysdd-1.0.5}/tests/test_nnf.py +13 -18
  9. {pysdd-1.0.2 → pysdd-1.0.5}/LICENSE +0 -0
  10. {pysdd-1.0.2 → pysdd-1.0.5}/PySDD.egg-info/SOURCES.txt +0 -0
  11. {pysdd-1.0.2 → pysdd-1.0.5}/PySDD.egg-info/dependency_links.txt +0 -0
  12. {pysdd-1.0.2 → pysdd-1.0.5}/PySDD.egg-info/entry_points.txt +0 -0
  13. {pysdd-1.0.2 → pysdd-1.0.5}/PySDD.egg-info/requires.txt +0 -0
  14. {pysdd-1.0.2 → pysdd-1.0.5}/PySDD.egg-info/top_level.txt +0 -0
  15. {pysdd-1.0.2 → pysdd-1.0.5}/README.rst +0 -0
  16. {pysdd-1.0.2 → pysdd-1.0.5}/pysdd/__init__.py +0 -0
  17. {pysdd-1.0.2 → pysdd-1.0.5}/pysdd/__main__.py +0 -0
  18. {pysdd-1.0.2 → pysdd-1.0.5}/pysdd/cli.py +0 -0
  19. {pysdd-1.0.2 → pysdd-1.0.5}/pysdd/iterator.py +0 -0
  20. {pysdd-1.0.2 → pysdd-1.0.5}/pysdd/lib/libsdd-2.0/src/basic/computed.c +0 -0
  21. {pysdd-1.0.2 → pysdd-1.0.5}/pysdd/lib/libsdd-2.0/src/basic/count_and_size.c +0 -0
  22. {pysdd-1.0.2 → pysdd-1.0.5}/pysdd/lib/libsdd-2.0/src/basic/gc.c +0 -0
  23. {pysdd-1.0.2 → pysdd-1.0.5}/pysdd/lib/libsdd-2.0/src/basic/hash.c +0 -0
  24. {pysdd-1.0.2 → pysdd-1.0.5}/pysdd/lib/libsdd-2.0/src/basic/memory.c +0 -0
  25. {pysdd-1.0.2 → pysdd-1.0.5}/pysdd/lib/libsdd-2.0/src/basic/multiply.c +0 -0
  26. {pysdd-1.0.2 → pysdd-1.0.5}/pysdd/lib/libsdd-2.0/src/basic/nodes.c +0 -0
  27. {pysdd-1.0.2 → pysdd-1.0.5}/pysdd/lib/libsdd-2.0/src/basic/partitions.c +0 -0
  28. {pysdd-1.0.2 → pysdd-1.0.5}/pysdd/lib/libsdd-2.0/src/basic/references.c +0 -0
  29. {pysdd-1.0.2 → pysdd-1.0.5}/pysdd/lib/libsdd-2.0/src/basic/replace.c +0 -0
  30. {pysdd-1.0.2 → pysdd-1.0.5}/pysdd/lib/libsdd-2.0/src/basic/shadows.c +0 -0
  31. {pysdd-1.0.2 → pysdd-1.0.5}/pysdd/lib/libsdd-2.0/src/basic/sort.c +0 -0
  32. {pysdd-1.0.2 → pysdd-1.0.5}/pysdd/lib/libsdd-2.0/src/manager/copy.c +0 -0
  33. {pysdd-1.0.2 → pysdd-1.0.5}/pysdd/lib/libsdd-2.0/src/manager/interface.c +0 -0
  34. {pysdd-1.0.2 → pysdd-1.0.5}/pysdd/lib/libsdd-2.0/src/manager/manager.c +0 -0
  35. {pysdd-1.0.2 → pysdd-1.0.5}/pysdd/lib/libsdd-2.0/src/manager/stats.c +0 -0
  36. {pysdd-1.0.2 → pysdd-1.0.5}/pysdd/lib/libsdd-2.0/src/manager/variables.c +0 -0
  37. {pysdd-1.0.2 → pysdd-1.0.5}/pysdd/lib/libsdd-2.0/src/sdds/apply.c +0 -0
  38. {pysdd-1.0.2 → pysdd-1.0.5}/pysdd/lib/libsdd-2.0/src/sdds/bits.c +0 -0
  39. {pysdd-1.0.2 → pysdd-1.0.5}/pysdd/lib/libsdd-2.0/src/sdds/cardinality.c +0 -0
  40. {pysdd-1.0.2 → pysdd-1.0.5}/pysdd/lib/libsdd-2.0/src/sdds/condition.c +0 -0
  41. {pysdd-1.0.2 → pysdd-1.0.5}/pysdd/lib/libsdd-2.0/src/sdds/copy.c +0 -0
  42. {pysdd-1.0.2 → pysdd-1.0.5}/pysdd/lib/libsdd-2.0/src/sdds/count.c +0 -0
  43. {pysdd-1.0.2 → pysdd-1.0.5}/pysdd/lib/libsdd-2.0/src/sdds/essential_vars.c +0 -0
  44. {pysdd-1.0.2 → pysdd-1.0.5}/pysdd/lib/libsdd-2.0/src/sdds/exists.c +0 -0
  45. {pysdd-1.0.2 → pysdd-1.0.5}/pysdd/lib/libsdd-2.0/src/sdds/exists_multiple.c +0 -0
  46. {pysdd-1.0.2 → pysdd-1.0.5}/pysdd/lib/libsdd-2.0/src/sdds/exists_multiple_static.c +0 -0
  47. {pysdd-1.0.2 → pysdd-1.0.5}/pysdd/lib/libsdd-2.0/src/sdds/forall.c +0 -0
  48. {pysdd-1.0.2 → pysdd-1.0.5}/pysdd/lib/libsdd-2.0/src/sdds/model_count.c +0 -0
  49. {pysdd-1.0.2 → pysdd-1.0.5}/pysdd/lib/libsdd-2.0/src/sdds/rename_vars.c +0 -0
  50. {pysdd-1.0.2 → pysdd-1.0.5}/pysdd/lib/libsdd-2.0/src/sdds/size.c +0 -0
  51. {pysdd-1.0.2 → pysdd-1.0.5}/pysdd/lib/libsdd-2.0/src/sdds/wmc.c +0 -0
  52. {pysdd-1.0.2 → pysdd-1.0.5}/pysdd/lib/libsdd-2.0/src/util.c +0 -0
  53. {pysdd-1.0.2 → pysdd-1.0.5}/pysdd/lib/libsdd-2.0/src/verify.c +0 -0
  54. {pysdd-1.0.2 → pysdd-1.0.5}/pysdd/lib/libsdd-2.0/src/version.c +0 -0
  55. {pysdd-1.0.2 → pysdd-1.0.5}/pysdd/lib/libsdd-2.0/src/vtree_fragments/construction.c +0 -0
  56. {pysdd-1.0.2 → pysdd-1.0.5}/pysdd/lib/libsdd-2.0/src/vtree_fragments/moves.c +0 -0
  57. {pysdd-1.0.2 → pysdd-1.0.5}/pysdd/lib/libsdd-2.0/src/vtree_fragments/operations.c +0 -0
  58. {pysdd-1.0.2 → pysdd-1.0.5}/pysdd/lib/libsdd-2.0/src/vtree_operations/cartesian_product.c +0 -0
  59. {pysdd-1.0.2 → pysdd-1.0.5}/pysdd/lib/libsdd-2.0/src/vtree_operations/dissect.c +0 -0
  60. {pysdd-1.0.2 → pysdd-1.0.5}/pysdd/lib/libsdd-2.0/src/vtree_operations/limits.c +0 -0
  61. {pysdd-1.0.2 → pysdd-1.0.5}/pysdd/lib/libsdd-2.0/src/vtree_operations/op_left_rotate.c +0 -0
  62. {pysdd-1.0.2 → pysdd-1.0.5}/pysdd/lib/libsdd-2.0/src/vtree_operations/op_right_rotate.c +0 -0
  63. {pysdd-1.0.2 → pysdd-1.0.5}/pysdd/lib/libsdd-2.0/src/vtree_operations/op_swap.c +0 -0
  64. {pysdd-1.0.2 → pysdd-1.0.5}/pysdd/lib/libsdd-2.0/src/vtree_operations/rollback.c +0 -0
  65. {pysdd-1.0.2 → pysdd-1.0.5}/pysdd/lib/libsdd-2.0/src/vtree_operations/split.c +0 -0
  66. {pysdd-1.0.2 → pysdd-1.0.5}/pysdd/lib/libsdd-2.0/src/vtree_search/auto.c +0 -0
  67. {pysdd-1.0.2 → pysdd-1.0.5}/pysdd/lib/libsdd-2.0/src/vtree_search/state.c +0 -0
  68. {pysdd-1.0.2 → pysdd-1.0.5}/pysdd/lib/libsdd-2.0/src/vtrees/edit.c +0 -0
  69. {pysdd-1.0.2 → pysdd-1.0.5}/pysdd/lib/libsdd-2.0/src/vtrees/maps.c +0 -0
  70. {pysdd-1.0.2 → pysdd-1.0.5}/pysdd/lib/libsdd-2.0/src/vtrees/moves.c +0 -0
  71. {pysdd-1.0.2 → pysdd-1.0.5}/pysdd/lib/libsdd-2.0/src/vtrees/static.c +0 -0
  72. {pysdd-1.0.2 → pysdd-1.0.5}/pysdd/lib/libsdd-2.0/src/vtrees/vtree.c +0 -0
  73. {pysdd-1.0.2 → pysdd-1.0.5}/pysdd/lib/sdd-2.0/src/fnf/compiler.c +0 -0
  74. {pysdd-1.0.2 → pysdd-1.0.5}/pysdd/lib/sdd-2.0/src/fnf/fnf.c +0 -0
  75. {pysdd-1.0.2 → pysdd-1.0.5}/pysdd/lib/sdd-2.0/src/fnf/io.c +0 -0
  76. {pysdd-1.0.2 → pysdd-1.0.5}/pysdd/lib/sdd-2.0/src/fnf/utils.c +0 -0
  77. {pysdd-1.0.2 → pysdd-1.0.5}/pysdd/sdd.pyx +0 -0
  78. {pysdd-1.0.2 → pysdd-1.0.5}/pysdd/util.py +0 -0
  79. {pysdd-1.0.2 → pysdd-1.0.5}/pysdd/wmcstochastic.py +0 -0
  80. {pysdd-1.0.2 → pysdd-1.0.5}/setup.cfg +0 -0
  81. {pysdd-1.0.2 → pysdd-1.0.5}/tests/test_iterator.py +0 -0
  82. {pysdd-1.0.2 → pysdd-1.0.5}/tests/test_minimize.py +0 -0
  83. {pysdd-1.0.2 → pysdd-1.0.5}/tests/test_psdd.py +0 -0
  84. {pysdd-1.0.2 → pysdd-1.0.5}/tests/test_util.py +0 -0
  85. {pysdd-1.0.2 → pysdd-1.0.5}/tests/test_vtree.py +0 -0
  86. {pysdd-1.0.2 → pysdd-1.0.5}/tests/test_wmcstochastic.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: PySDD
3
- Version: 1.0.2
3
+ Version: 1.0.5
4
4
  Summary: Sentential Decision Diagrams
5
5
  Author: Arthur Choi
6
6
  Author-email: Wannes Meert <wannes.meert@cs.kuleuven.be>, Robin Manhaeve <robin.manhaeve@kuleuven.be>
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: PySDD
3
- Version: 1.0.2
3
+ Version: 1.0.5
4
4
  Summary: Sentential Decision Diagrams
5
5
  Author: Arthur Choi
6
6
  Author-email: Wannes Meert <wannes.meert@cs.kuleuven.be>, Robin Manhaeve <robin.manhaeve@kuleuven.be>
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "PySDD"
7
- version = "1.0.2"
7
+ version = "1.0.5"
8
8
  description = "Sentential Decision Diagrams"
9
9
  authors = [
10
10
  { name = "Wannes Meert", email = "wannes.meert@cs.kuleuven.be" },
@@ -113,10 +113,11 @@ include-dirs = [
113
113
  ]
114
114
 
115
115
  [tool.cibuildwheel]
116
- environment = {CFLAGS="-std=c99 -O2 -finline-functions" }
116
+ environment = {CFLAGS="-O3 -DNDEBUG" }
117
117
  test-requires = "pytest"
118
118
  test-command = "pytest {project}/tests"
119
+ skip = "pp*"
119
120
 
120
121
  [tool.cibuildwheel.windows]
121
- environment = {CL = "/O2"}
122
+ environment = {CL = "/O2 /DNDEBUG"}
122
123
 
@@ -284,9 +284,9 @@ void print_sdd_node_file(FILE* file, SddNode* node) {
284
284
 
285
285
  if(node->type==TRUE) fprintf(file,"T %"PRIsS"\n",node->index);
286
286
  else if(node->type==FALSE) fprintf(file,"F %"PRIsS"\n",node->index);
287
- else if(node->type==LITERAL) fprintf(file,"L %"PRIsS" %"PRIsS" %"PRIlitS"\n",node->index,vtree->position,LITERAL_OF(node));
287
+ else if(node->type==LITERAL) fprintf(file,"L %"PRIsS" %"PRIlitS" %"PRIlitS"\n",node->index,vtree->position,LITERAL_OF(node));
288
288
  else {//decomposition
289
- fprintf(file,"D %"PRIsS" %"PRIsS" %"PRIsS"",node->index,vtree->position,node->size);
289
+ fprintf(file,"D %"PRIsS" %"PRIlitS" %"PRIsS"",node->index,vtree->position,node->size);
290
290
  FOR_each_prime_sub_of_node(prime,sub,node,fprintf(file," %"PRIsS" %"PRIsS"",prime->index,sub->index));
291
291
  fprintf(file,"\n");
292
292
  }
@@ -56,7 +56,7 @@ static inline
56
56
  SddSize balance(Vtree* vtree, SddManager* manager) {
57
57
  SddLiteral left_count = sdd_vtree_var_count(sdd_vtree_left(vtree));
58
58
  SddLiteral right_count = sdd_vtree_var_count(sdd_vtree_right(vtree));
59
- return labs(left_count - right_count);
59
+ return llabs(left_count - right_count);
60
60
  }
61
61
 
62
62
  /****************************************************************************************
@@ -52,9 +52,9 @@ Vtree* sdd_vtree_lca(Vtree* vtree1, Vtree* vtree2, Vtree* root) {
52
52
  Vtree* sdd_manager_lca_of_literals(int count, SddLiteral* literals, SddManager* manager) {
53
53
  assert(count>0);
54
54
  Vtree* root = manager->vtree;
55
- Vtree* vtree = sdd_manager_vtree_of_var(labs(literals[0]),manager);
55
+ Vtree* vtree = sdd_manager_vtree_of_var(llabs(literals[0]),manager);
56
56
  for(int i=1; i<count; i++) {
57
- Vtree* leaf = sdd_manager_vtree_of_var(labs(literals[i]),manager);
57
+ Vtree* leaf = sdd_manager_vtree_of_var(llabs(literals[i]),manager);
58
58
  vtree = sdd_vtree_lca(vtree,leaf,root);
59
59
  }
60
60
  return vtree;
@@ -38,12 +38,12 @@ Vtree* sdd_vtree_read(const char* filename) {
38
38
  //prints a vtree node
39
39
  void print_vtree_node(FILE* file, const Vtree* vnode) {
40
40
  if(LEAF(vnode)) {
41
- fprintf(file,"L %"PRIsS" %"PRIlitS"",vnode->position,vnode->var);
41
+ fprintf(file,"L %"PRIlitS" %"PRIlitS"",vnode->position,vnode->var);
42
42
  }
43
43
  else { // internal node
44
44
  print_vtree_node(file,vnode->left);
45
45
  print_vtree_node(file,vnode->right);
46
- fprintf(file,"I %"PRIsS" %"PRIsS" %"PRIsS"",vnode->position,vnode->left->position,vnode->right->position);
46
+ fprintf(file,"I %"PRIlitS" %"PRIlitS" %"PRIlitS"",vnode->position,vnode->left->position,vnode->right->position);
47
47
  }
48
48
  fprintf(file,"\n");
49
49
  }
@@ -66,7 +66,7 @@ void print_vtree_header(FILE* file) {
66
66
  void print_vtree(FILE* file, const Vtree* vtree) {
67
67
  SddLiteral count = 2*(vtree->var_count) -1;
68
68
  print_vtree_header(file);
69
- fprintf(file,"vtree %"PRIsS"\n",count);
69
+ fprintf(file,"vtree %"PRIlitS"\n",count);
70
70
  print_vtree_node(file,vtree);
71
71
  }
72
72
 
@@ -91,13 +91,13 @@ void print_vtree_nodes_as_dot(FILE* file, const Vtree* vtree) {
91
91
  if(LEAF(vtree)) {
92
92
  SddLiteral var = vtree->var;
93
93
  char* var_string = literal_to_label(var);
94
- fprintf(file,"\nn%"PRIsS" [label=\"%s\",fontname=\"Times-Italic\","
94
+ fprintf(file,"\nn%"PRIlitS" [label=\"%s\",fontname=\"Times-Italic\","
95
95
  "fontsize=14,shape=\"%s\",fixedsize=true,width=.25,height=.25"
96
96
  "]; ",position,var_string,shape);
97
97
  free(var_string);
98
98
  }
99
99
  else {
100
- fprintf(file,"\nn%"PRIsS" [label=\"%"PRIsS"\",fontname=\"Times\","
100
+ fprintf(file,"\nn%"PRIlitS" [label=\"%"PRIlitS"\",fontname=\"Times\","
101
101
  "shape=\"%s\",fontsize=12,fixedsize=true,width=.2,height=.18]; ",
102
102
  position,position,shape);
103
103
  print_vtree_nodes_as_dot(file,vtree->left);
@@ -110,14 +110,14 @@ void print_vtree_edges_as_dot(FILE* file, const Vtree* vtree, const Vtree* paren
110
110
  if(LEAF(vtree)) {
111
111
  if(parent != NULL) {
112
112
  SddLiteral parent_position = vtree->parent->position;
113
- fprintf(file,"\nn%"PRIsS"->n%"PRIsS" [headclip=true,arrowhead=none,headlabel=\"%"PRIsS"\","
113
+ fprintf(file,"\nn%"PRIlitS"->n%"PRIlitS" [headclip=true,arrowhead=none,headlabel=\"%"PRIlitS"\","
114
114
  "labelfontname=\"Times\",labelfontsize=10];",parent_position,position,position);
115
115
  }
116
116
  }
117
117
  else { //internal node
118
118
  if(parent != NULL) {
119
119
  SddLiteral parent_position = vtree->parent->position;
120
- fprintf(file,"\nn%"PRIsS"->n%"PRIsS" [arrowhead=none];",parent_position,position);
120
+ fprintf(file,"\nn%"PRIlitS"->n%"PRIlitS" [arrowhead=none];",parent_position,position);
121
121
  }
122
122
  print_vtree_edges_as_dot(file,vtree->left,vtree);
123
123
  print_vtree_edges_as_dot(file,vtree->right,vtree); // right first?
@@ -1,12 +1,10 @@
1
1
  from pysdd.util import nnf_file_wmc, sdd_file_wmc, psdd_file_wmc
2
- from pysdd.sdd import Fnf, Vtree, SddManager
3
2
  from pysdd import cli
4
3
  import sys
5
4
  import os
6
5
  import math
7
6
  import logging
8
7
  from pathlib import Path
9
- import filecmp
10
8
 
11
9
 
12
10
  logger = logging.getLogger("pysdd")
@@ -14,6 +12,13 @@ directory = None
14
12
  counter = 0
15
13
  here = Path(__file__).parent
16
14
 
15
+ def file_contents_equal(path1, path2):
16
+ with open(path1) as f1:
17
+ lines1 = [l.strip() for l in f1.readlines()]
18
+ with open(path2) as f2:
19
+ lines2 = [l.strip() for l in f2.readlines()]
20
+ return lines1 == lines2
21
+
17
22
 
18
23
  def test_nnf1():
19
24
  weights = {
@@ -33,16 +38,6 @@ def test_nnf2():
33
38
  assert wmc == 0.75
34
39
 
35
40
 
36
- # def test_dnf1():
37
- # dnf_filename = str(here / "rsrc" / "test.cnf.nnf")
38
- # fnf = Fnf.from_dnf_file(bytes(dnf_filename, encoding='utf8'))
39
- # # weights = read_weights(dnf_filename)
40
- # vtree = Vtree(var_count=fnf.var_count)
41
- # manager = SddManager.from_vtree(vtree)
42
- # node = manager.fnf_to_sdd(fnf)
43
- # print(node)
44
-
45
-
46
41
  def test_sdd1():
47
42
  weights = {
48
43
  +3: 0.5, +2: 0.5, +1: 1,
@@ -70,13 +65,12 @@ def test_psdd1():
70
65
 
71
66
 
72
67
  def test_dimacs1():
73
- """This test fails on Windows because of a mismatch between 64b and 32b data types."""
74
68
  fn_dimacs = here / "rsrc" / "dimacs1.txt"
75
69
  fn_vtree = here / "rsrc" / "dimacs1.vtree"
76
70
  fn_vtree_sol = here / "rsrc" / "dimacs1_solution.vtree"
77
71
  fn_sdd = here / "rsrc" / "dimacs1.sdd"
78
72
  cli.main(["-c", str(fn_dimacs), "-W", str(fn_vtree), "-R", str(fn_sdd)])
79
- assert filecmp.cmp(fn_vtree, fn_vtree_sol)
73
+ assert file_contents_equal(fn_vtree, fn_vtree_sol)
80
74
  with fn_vtree.open("r") as fp:
81
75
  print(fp.read())
82
76
 
@@ -87,8 +81,9 @@ if __name__ == "__main__":
87
81
  logger.addHandler(sh)
88
82
  directory = Path(os.environ.get('TESTDIR', Path(__file__).parent))
89
83
  print(f"Saving files to {directory}")
90
- # test_nnf1()
91
- # test_sdd2()
92
- # test_psdd1()
93
- # test_dnf1()
84
+ test_nnf1()
85
+ test_nnf2()
86
+ test_sdd1()
87
+ test_sdd2()
88
+ test_psdd1()
94
89
  test_dimacs1()
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes