NUCS 2.2.0__tar.gz → 3.0.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 (122) hide show
  1. {nucs-2.2.0 → nucs-3.0.0/NUCS.egg-info}/PKG-INFO +16 -16
  2. {nucs-2.2.0 → nucs-3.0.0}/NUCS.egg-info/SOURCES.txt +0 -1
  3. {nucs-2.2.0/NUCS.egg-info → nucs-3.0.0}/PKG-INFO +16 -16
  4. {nucs-2.2.0 → nucs-3.0.0}/README.md +15 -15
  5. {nucs-2.2.0 → nucs-3.0.0}/docs/source/conf.py +2 -2
  6. {nucs-2.2.0 → nucs-3.0.0}/nucs/constants.py +36 -3
  7. {nucs-2.2.0 → nucs-3.0.0}/nucs/examples/alpha/__main__.py +2 -3
  8. {nucs-2.2.0 → nucs-3.0.0}/nucs/examples/bibd/__main__.py +2 -3
  9. {nucs-2.2.0 → nucs-3.0.0}/nucs/examples/donald/__main__.py +2 -3
  10. {nucs-2.2.0 → nucs-3.0.0}/nucs/examples/golomb/__main__.py +2 -3
  11. {nucs-2.2.0 → nucs-3.0.0}/nucs/examples/golomb/golomb_problem.py +11 -6
  12. {nucs-2.2.0 → nucs-3.0.0}/nucs/examples/knapsack/__main__.py +2 -3
  13. {nucs-2.2.0 → nucs-3.0.0}/nucs/examples/magic_sequence/__main__.py +2 -3
  14. {nucs-2.2.0 → nucs-3.0.0}/nucs/examples/magic_square/__main__.py +2 -3
  15. {nucs-2.2.0 → nucs-3.0.0}/nucs/examples/quasigroup/__main__.py +2 -3
  16. {nucs-2.2.0 → nucs-3.0.0}/nucs/examples/queens/__main__.py +23 -14
  17. {nucs-2.2.0 → nucs-3.0.0}/nucs/examples/schur_lemma/__main__.py +2 -3
  18. {nucs-2.2.0 → nucs-3.0.0}/nucs/examples/sports_tournament_scheduling/__main__.py +2 -3
  19. {nucs-2.2.0 → nucs-3.0.0}/nucs/propagators/propagators.py +4 -2
  20. {nucs-2.2.0 → nucs-3.0.0}/nucs/solvers/backtrack_solver.py +102 -64
  21. {nucs-2.2.0 → nucs-3.0.0}/nucs/solvers/bound_consistency_algorithm.py +20 -22
  22. nucs-3.0.0/nucs/solvers/choice_points.py +88 -0
  23. nucs-3.0.0/nucs/solvers/heuristics.py +193 -0
  24. nucs-3.0.0/nucs/solvers/multiprocessing_solver.py +129 -0
  25. {nucs-2.2.0 → nucs-3.0.0}/nucs/solvers/shaving_consistency_algorithm.py +73 -140
  26. {nucs-2.2.0 → nucs-3.0.0}/nucs/solvers/solver.py +53 -12
  27. {nucs-2.2.0 → nucs-3.0.0}/pyproject.toml +1 -1
  28. {nucs-2.2.0 → nucs-3.0.0}/tests/examples/test_alpha.py +1 -1
  29. {nucs-2.2.0 → nucs-3.0.0}/tests/examples/test_bibd.py +1 -1
  30. {nucs-2.2.0 → nucs-3.0.0}/tests/examples/test_donald.py +1 -1
  31. {nucs-2.2.0 → nucs-3.0.0}/tests/examples/test_latin_square.py +1 -1
  32. {nucs-2.2.0 → nucs-3.0.0}/tests/examples/test_magic_sequence.py +1 -1
  33. {nucs-2.2.0 → nucs-3.0.0}/tests/examples/test_magic_square.py +1 -1
  34. {nucs-2.2.0 → nucs-3.0.0}/tests/examples/test_quasigroup.py +1 -1
  35. {nucs-2.2.0 → nucs-3.0.0}/tests/examples/test_queens.py +1 -1
  36. {nucs-2.2.0 → nucs-3.0.0}/tests/examples/test_schur_lemma.py +1 -1
  37. {nucs-2.2.0 → nucs-3.0.0}/tests/examples/test_sudokus.py +1 -1
  38. {nucs-2.2.0 → nucs-3.0.0}/tests/propagators/test_lexicographic_leq.py +1 -2
  39. {nucs-2.2.0 → nucs-3.0.0}/tests/solvers/test_backtrack_solver.py +11 -12
  40. {nucs-2.2.0 → nucs-3.0.0}/tests/solvers/test_multiprocessing_solver.py +9 -5
  41. nucs-2.2.0/nucs/solvers/choice_points.py +0 -84
  42. nucs-2.2.0/nucs/solvers/heuristics.py +0 -165
  43. nucs-2.2.0/nucs/solvers/multiprocessing_solver.py +0 -77
  44. nucs-2.2.0/nucs/statistics.py +0 -104
  45. {nucs-2.2.0 → nucs-3.0.0}/LICENSE.md +0 -0
  46. {nucs-2.2.0 → nucs-3.0.0}/NUCS.egg-info/dependency_links.txt +0 -0
  47. {nucs-2.2.0 → nucs-3.0.0}/NUCS.egg-info/requires.txt +0 -0
  48. {nucs-2.2.0 → nucs-3.0.0}/NUCS.egg-info/top_level.txt +0 -0
  49. {nucs-2.2.0 → nucs-3.0.0}/nucs/__init__.py +0 -0
  50. {nucs-2.2.0 → nucs-3.0.0}/nucs/examples/__init__.py +0 -0
  51. {nucs-2.2.0 → nucs-3.0.0}/nucs/examples/alpha/__init__.py +0 -0
  52. {nucs-2.2.0 → nucs-3.0.0}/nucs/examples/alpha/alpha_problem.py +0 -0
  53. {nucs-2.2.0 → nucs-3.0.0}/nucs/examples/bibd/__init__.py +0 -0
  54. {nucs-2.2.0 → nucs-3.0.0}/nucs/examples/bibd/bibd_problem.py +0 -0
  55. {nucs-2.2.0 → nucs-3.0.0}/nucs/examples/donald/__init__.py +0 -0
  56. {nucs-2.2.0 → nucs-3.0.0}/nucs/examples/donald/donald_problem.py +0 -0
  57. {nucs-2.2.0 → nucs-3.0.0}/nucs/examples/golomb/__init__.py +0 -0
  58. {nucs-2.2.0 → nucs-3.0.0}/nucs/examples/knapsack/__init__.py +0 -0
  59. {nucs-2.2.0 → nucs-3.0.0}/nucs/examples/knapsack/knapsack_problem.py +0 -0
  60. {nucs-2.2.0 → nucs-3.0.0}/nucs/examples/magic_sequence/__init__.py +0 -0
  61. {nucs-2.2.0 → nucs-3.0.0}/nucs/examples/magic_sequence/magic_sequence_problem.py +0 -0
  62. {nucs-2.2.0 → nucs-3.0.0}/nucs/examples/magic_square/__init__.py +0 -0
  63. {nucs-2.2.0 → nucs-3.0.0}/nucs/examples/magic_square/magic_square_problem.py +0 -0
  64. {nucs-2.2.0 → nucs-3.0.0}/nucs/examples/quasigroup/__init__.py +0 -0
  65. {nucs-2.2.0 → nucs-3.0.0}/nucs/examples/quasigroup/quasigroup_problem.py +0 -0
  66. {nucs-2.2.0 → nucs-3.0.0}/nucs/examples/queens/__init__.py +0 -0
  67. {nucs-2.2.0 → nucs-3.0.0}/nucs/examples/queens/queens_problem.py +0 -0
  68. {nucs-2.2.0 → nucs-3.0.0}/nucs/examples/schur_lemma/__init__.py +0 -0
  69. {nucs-2.2.0 → nucs-3.0.0}/nucs/examples/schur_lemma/schur_lemma_problem.py +0 -0
  70. {nucs-2.2.0 → nucs-3.0.0}/nucs/examples/sports_tournament_scheduling/__init__.py +0 -0
  71. {nucs-2.2.0 → nucs-3.0.0}/nucs/examples/sports_tournament_scheduling/sports_tournament_scheduling_problem.py +0 -0
  72. {nucs-2.2.0 → nucs-3.0.0}/nucs/examples/sudoku/__init__.py +0 -0
  73. {nucs-2.2.0 → nucs-3.0.0}/nucs/examples/sudoku/sudoku_problem.py +0 -0
  74. {nucs-2.2.0 → nucs-3.0.0}/nucs/numba_helper.py +0 -0
  75. {nucs-2.2.0 → nucs-3.0.0}/nucs/numpy_helper.py +0 -0
  76. {nucs-2.2.0 → nucs-3.0.0}/nucs/problems/__init__.py +0 -0
  77. {nucs-2.2.0 → nucs-3.0.0}/nucs/problems/latin_square_problem.py +0 -0
  78. {nucs-2.2.0 → nucs-3.0.0}/nucs/problems/problem.py +0 -0
  79. {nucs-2.2.0 → nucs-3.0.0}/nucs/propagators/__init__.py +0 -0
  80. {nucs-2.2.0 → nucs-3.0.0}/nucs/propagators/affine_eq_propagator.py +0 -0
  81. {nucs-2.2.0 → nucs-3.0.0}/nucs/propagators/affine_geq_propagator.py +0 -0
  82. {nucs-2.2.0 → nucs-3.0.0}/nucs/propagators/affine_leq_propagator.py +0 -0
  83. {nucs-2.2.0 → nucs-3.0.0}/nucs/propagators/alldifferent_propagator.py +0 -0
  84. {nucs-2.2.0 → nucs-3.0.0}/nucs/propagators/and_propagator.py +0 -0
  85. {nucs-2.2.0 → nucs-3.0.0}/nucs/propagators/count_eq_propagator.py +0 -0
  86. {nucs-2.2.0 → nucs-3.0.0}/nucs/propagators/dummy_propagator.py +0 -0
  87. {nucs-2.2.0 → nucs-3.0.0}/nucs/propagators/element_lic_propagator.py +0 -0
  88. {nucs-2.2.0 → nucs-3.0.0}/nucs/propagators/element_liv_propagator.py +0 -0
  89. {nucs-2.2.0 → nucs-3.0.0}/nucs/propagators/exactly_eq_propagator.py +0 -0
  90. {nucs-2.2.0 → nucs-3.0.0}/nucs/propagators/exactly_true_propagator.py +0 -0
  91. {nucs-2.2.0 → nucs-3.0.0}/nucs/propagators/gcc_propagator.py +0 -0
  92. {nucs-2.2.0 → nucs-3.0.0}/nucs/propagators/lexicographic_leq_propagator.py +0 -0
  93. {nucs-2.2.0 → nucs-3.0.0}/nucs/propagators/max_eq_propagator.py +0 -0
  94. {nucs-2.2.0 → nucs-3.0.0}/nucs/propagators/max_leq_propagator.py +0 -0
  95. {nucs-2.2.0 → nucs-3.0.0}/nucs/propagators/min_eq_propagator.py +0 -0
  96. {nucs-2.2.0 → nucs-3.0.0}/nucs/propagators/min_geq_propagator.py +0 -0
  97. {nucs-2.2.0 → nucs-3.0.0}/nucs/propagators/relation_propagator.py +0 -0
  98. {nucs-2.2.0 → nucs-3.0.0}/nucs/solvers/__init__.py +0 -0
  99. {nucs-2.2.0 → nucs-3.0.0}/nucs/solvers/consistency_algorithms.py +0 -0
  100. {nucs-2.2.0 → nucs-3.0.0}/setup.cfg +0 -0
  101. {nucs-2.2.0 → nucs-3.0.0}/tests/__init__.py +0 -0
  102. {nucs-2.2.0 → nucs-3.0.0}/tests/examples/test_golomb.py +0 -0
  103. {nucs-2.2.0 → nucs-3.0.0}/tests/examples/test_knapsack.py +0 -0
  104. {nucs-2.2.0 → nucs-3.0.0}/tests/examples/test_sports_tournament_scheduling.py +0 -0
  105. {nucs-2.2.0 → nucs-3.0.0}/tests/problems/__init__.py +0 -0
  106. {nucs-2.2.0 → nucs-3.0.0}/tests/problems/test_problem.py +0 -0
  107. {nucs-2.2.0 → nucs-3.0.0}/tests/propagators/__init__.py +0 -0
  108. {nucs-2.2.0 → nucs-3.0.0}/tests/propagators/test_affine_eq.py +0 -0
  109. {nucs-2.2.0 → nucs-3.0.0}/tests/propagators/test_affine_geq.py +0 -0
  110. {nucs-2.2.0 → nucs-3.0.0}/tests/propagators/test_affine_leq.py +0 -0
  111. {nucs-2.2.0 → nucs-3.0.0}/tests/propagators/test_alldifferent.py +0 -0
  112. {nucs-2.2.0 → nucs-3.0.0}/tests/propagators/test_count_eq.py +0 -0
  113. {nucs-2.2.0 → nucs-3.0.0}/tests/propagators/test_element_lic.py +0 -0
  114. {nucs-2.2.0 → nucs-3.0.0}/tests/propagators/test_element_liv.py +0 -0
  115. {nucs-2.2.0 → nucs-3.0.0}/tests/propagators/test_exactly_eq.py +0 -0
  116. {nucs-2.2.0 → nucs-3.0.0}/tests/propagators/test_gcc.py +0 -0
  117. {nucs-2.2.0 → nucs-3.0.0}/tests/propagators/test_max_eq.py +0 -0
  118. {nucs-2.2.0 → nucs-3.0.0}/tests/propagators/test_max_leq.py +0 -0
  119. {nucs-2.2.0 → nucs-3.0.0}/tests/propagators/test_min_eq.py +0 -0
  120. {nucs-2.2.0 → nucs-3.0.0}/tests/propagators/test_min_geq.py +0 -0
  121. {nucs-2.2.0 → nucs-3.0.0}/tests/propagators/test_relation.py +0 -0
  122. {nucs-2.2.0 → nucs-3.0.0}/tests/solvers/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: NUCS
3
- Version: 2.2.0
3
+ Version: 3.0.0
4
4
  Summary: A Numpy and Numba based Python library for solving Constraint Satisfaction Problems over finite domains
5
5
  Author-email: Yan Georget <yan.georget@gmail.com>
6
6
  Project-URL: Homepage, https://github.com/yangeorget/nucs
@@ -60,11 +60,11 @@ NUMBA_CACHE_DIR=.numba/cache python -m nucs.examples.queens -n 12 --log_level=IN
60
60
  2024-11-12 17:24:49,061 - INFO - nucs.solvers.backtrack_solver - Choice points stack has a maximal height of 128
61
61
  2024-11-12 17:24:49,200 - INFO - nucs.solvers.multiprocessing_solver - MultiprocessingSolver has 1 processors
62
62
  {
63
- 'OPTIMIZER_SOLUTION_NB': 0,
64
- 'PROBLEM_FILTER_NB': 262011,
65
- 'PROBLEM_SHAVING_NB': 0,
66
- 'PROBLEM_SHAVING_CHANGE_NB': 0,
67
- 'PROBLEM_SHAVING_NO_CHANGE_NB': 0,
63
+ 'ALG_BC_NB': 262011,
64
+ 'ALG_BC_WITH_SHAVING_NB': 0,
65
+ 'ALG_SHAVING_NB': 0,
66
+ 'ALG_SHAVING_CHANGE_NB': 0,
67
+ 'ALG_SHAVING_NO_CHANGE_NB': 0,
68
68
  'PROPAGATOR_ENTAILMENT_NB': 0,
69
69
  'PROPAGATOR_FILTER_NB': 2269980,
70
70
  'PROPAGATOR_FILTER_NO_CHANGE_NB': 990450,
@@ -88,11 +88,11 @@ NUMBA_CACHE_DIR=.numba/cache python -m nucs.examples.bibd -v 8 -b 14 -r 7 -k 4 -
88
88
  2024-11-12 17:26:39,734 - INFO - nucs.solvers.backtrack_solver - BacktrackSolver uses consistency algorithm 0
89
89
  2024-11-12 17:26:39,734 - INFO - nucs.solvers.backtrack_solver - Choice points stack has a maximal height of 128
90
90
  {
91
- 'OPTIMIZER_SOLUTION_NB': 0,
92
- 'PROBLEM_FILTER_NB': 1425,
93
- 'PROBLEM_SHAVING_NB': 0,
94
- 'PROBLEM_SHAVING_CHANGE_NB': 0,
95
- 'PROBLEM_SHAVING_NO_CHANGE_NB': 0,
91
+ 'ALG_BC_NB': 1425,
92
+ 'ALG_BC_WITH_SHAVING_NB': 0,
93
+ 'ALG_SHAVING_NB': 0,
94
+ 'ALG_SHAVING_CHANGE_NB': 0,
95
+ 'ALG_SHAVING_NO_CHANGE_NB': 0,
96
96
  'PROPAGATOR_ENTAILMENT_NB': 4711,
97
97
  'PROPAGATOR_FILTER_NB': 104392,
98
98
  'PROPAGATOR_FILTER_NO_CHANGE_NB': 73792,
@@ -127,11 +127,11 @@ NUMBA_CACHE_DIR=.numba/cache python -m nucs.examples.golomb -n 10 --symmetry_bre
127
127
  2024-11-12 17:27:45,717 - INFO - nucs.solvers.backtrack_solver - Found a (new) solution: 60
128
128
  2024-11-12 17:27:45,977 - INFO - nucs.solvers.backtrack_solver - Found a (new) solution: 55
129
129
  {
130
- 'OPTIMIZER_SOLUTION_NB': 10,
131
- 'PROBLEM_FILTER_NB': 22652,
132
- 'PROBLEM_SHAVING_NB': 0,
133
- 'PROBLEM_SHAVING_CHANGE_NB': 0,
134
- 'PROBLEM_SHAVING_NO_CHANGE_NB': 0,
130
+ 'ALG_BC_NB': 22652,
131
+ 'ALG_BC_WITH_SHAVING_NB': 0,
132
+ 'ALG_SHAVING_NB': 0,
133
+ 'ALG_SHAVING_CHANGE_NB': 0,
134
+ 'ALG_SHAVING_NO_CHANGE_NB': 0,
135
135
  'PROPAGATOR_ENTAILMENT_NB': 107911,
136
136
  'PROPAGATOR_FILTER_NB': 2813035,
137
137
  'PROPAGATOR_FILTER_NO_CHANGE_NB': 1745836,
@@ -11,7 +11,6 @@ nucs/__init__.py
11
11
  nucs/constants.py
12
12
  nucs/numba_helper.py
13
13
  nucs/numpy_helper.py
14
- nucs/statistics.py
15
14
  nucs/examples/__init__.py
16
15
  nucs/examples/alpha/__init__.py
17
16
  nucs/examples/alpha/__main__.py
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: NUCS
3
- Version: 2.2.0
3
+ Version: 3.0.0
4
4
  Summary: A Numpy and Numba based Python library for solving Constraint Satisfaction Problems over finite domains
5
5
  Author-email: Yan Georget <yan.georget@gmail.com>
6
6
  Project-URL: Homepage, https://github.com/yangeorget/nucs
@@ -60,11 +60,11 @@ NUMBA_CACHE_DIR=.numba/cache python -m nucs.examples.queens -n 12 --log_level=IN
60
60
  2024-11-12 17:24:49,061 - INFO - nucs.solvers.backtrack_solver - Choice points stack has a maximal height of 128
61
61
  2024-11-12 17:24:49,200 - INFO - nucs.solvers.multiprocessing_solver - MultiprocessingSolver has 1 processors
62
62
  {
63
- 'OPTIMIZER_SOLUTION_NB': 0,
64
- 'PROBLEM_FILTER_NB': 262011,
65
- 'PROBLEM_SHAVING_NB': 0,
66
- 'PROBLEM_SHAVING_CHANGE_NB': 0,
67
- 'PROBLEM_SHAVING_NO_CHANGE_NB': 0,
63
+ 'ALG_BC_NB': 262011,
64
+ 'ALG_BC_WITH_SHAVING_NB': 0,
65
+ 'ALG_SHAVING_NB': 0,
66
+ 'ALG_SHAVING_CHANGE_NB': 0,
67
+ 'ALG_SHAVING_NO_CHANGE_NB': 0,
68
68
  'PROPAGATOR_ENTAILMENT_NB': 0,
69
69
  'PROPAGATOR_FILTER_NB': 2269980,
70
70
  'PROPAGATOR_FILTER_NO_CHANGE_NB': 990450,
@@ -88,11 +88,11 @@ NUMBA_CACHE_DIR=.numba/cache python -m nucs.examples.bibd -v 8 -b 14 -r 7 -k 4 -
88
88
  2024-11-12 17:26:39,734 - INFO - nucs.solvers.backtrack_solver - BacktrackSolver uses consistency algorithm 0
89
89
  2024-11-12 17:26:39,734 - INFO - nucs.solvers.backtrack_solver - Choice points stack has a maximal height of 128
90
90
  {
91
- 'OPTIMIZER_SOLUTION_NB': 0,
92
- 'PROBLEM_FILTER_NB': 1425,
93
- 'PROBLEM_SHAVING_NB': 0,
94
- 'PROBLEM_SHAVING_CHANGE_NB': 0,
95
- 'PROBLEM_SHAVING_NO_CHANGE_NB': 0,
91
+ 'ALG_BC_NB': 1425,
92
+ 'ALG_BC_WITH_SHAVING_NB': 0,
93
+ 'ALG_SHAVING_NB': 0,
94
+ 'ALG_SHAVING_CHANGE_NB': 0,
95
+ 'ALG_SHAVING_NO_CHANGE_NB': 0,
96
96
  'PROPAGATOR_ENTAILMENT_NB': 4711,
97
97
  'PROPAGATOR_FILTER_NB': 104392,
98
98
  'PROPAGATOR_FILTER_NO_CHANGE_NB': 73792,
@@ -127,11 +127,11 @@ NUMBA_CACHE_DIR=.numba/cache python -m nucs.examples.golomb -n 10 --symmetry_bre
127
127
  2024-11-12 17:27:45,717 - INFO - nucs.solvers.backtrack_solver - Found a (new) solution: 60
128
128
  2024-11-12 17:27:45,977 - INFO - nucs.solvers.backtrack_solver - Found a (new) solution: 55
129
129
  {
130
- 'OPTIMIZER_SOLUTION_NB': 10,
131
- 'PROBLEM_FILTER_NB': 22652,
132
- 'PROBLEM_SHAVING_NB': 0,
133
- 'PROBLEM_SHAVING_CHANGE_NB': 0,
134
- 'PROBLEM_SHAVING_NO_CHANGE_NB': 0,
130
+ 'ALG_BC_NB': 22652,
131
+ 'ALG_BC_WITH_SHAVING_NB': 0,
132
+ 'ALG_SHAVING_NB': 0,
133
+ 'ALG_SHAVING_CHANGE_NB': 0,
134
+ 'ALG_SHAVING_NO_CHANGE_NB': 0,
135
135
  'PROPAGATOR_ENTAILMENT_NB': 107911,
136
136
  'PROPAGATOR_FILTER_NB': 2813035,
137
137
  'PROPAGATOR_FILTER_NO_CHANGE_NB': 1745836,
@@ -38,11 +38,11 @@ NUMBA_CACHE_DIR=.numba/cache python -m nucs.examples.queens -n 12 --log_level=IN
38
38
  2024-11-12 17:24:49,061 - INFO - nucs.solvers.backtrack_solver - Choice points stack has a maximal height of 128
39
39
  2024-11-12 17:24:49,200 - INFO - nucs.solvers.multiprocessing_solver - MultiprocessingSolver has 1 processors
40
40
  {
41
- 'OPTIMIZER_SOLUTION_NB': 0,
42
- 'PROBLEM_FILTER_NB': 262011,
43
- 'PROBLEM_SHAVING_NB': 0,
44
- 'PROBLEM_SHAVING_CHANGE_NB': 0,
45
- 'PROBLEM_SHAVING_NO_CHANGE_NB': 0,
41
+ 'ALG_BC_NB': 262011,
42
+ 'ALG_BC_WITH_SHAVING_NB': 0,
43
+ 'ALG_SHAVING_NB': 0,
44
+ 'ALG_SHAVING_CHANGE_NB': 0,
45
+ 'ALG_SHAVING_NO_CHANGE_NB': 0,
46
46
  'PROPAGATOR_ENTAILMENT_NB': 0,
47
47
  'PROPAGATOR_FILTER_NB': 2269980,
48
48
  'PROPAGATOR_FILTER_NO_CHANGE_NB': 990450,
@@ -66,11 +66,11 @@ NUMBA_CACHE_DIR=.numba/cache python -m nucs.examples.bibd -v 8 -b 14 -r 7 -k 4 -
66
66
  2024-11-12 17:26:39,734 - INFO - nucs.solvers.backtrack_solver - BacktrackSolver uses consistency algorithm 0
67
67
  2024-11-12 17:26:39,734 - INFO - nucs.solvers.backtrack_solver - Choice points stack has a maximal height of 128
68
68
  {
69
- 'OPTIMIZER_SOLUTION_NB': 0,
70
- 'PROBLEM_FILTER_NB': 1425,
71
- 'PROBLEM_SHAVING_NB': 0,
72
- 'PROBLEM_SHAVING_CHANGE_NB': 0,
73
- 'PROBLEM_SHAVING_NO_CHANGE_NB': 0,
69
+ 'ALG_BC_NB': 1425,
70
+ 'ALG_BC_WITH_SHAVING_NB': 0,
71
+ 'ALG_SHAVING_NB': 0,
72
+ 'ALG_SHAVING_CHANGE_NB': 0,
73
+ 'ALG_SHAVING_NO_CHANGE_NB': 0,
74
74
  'PROPAGATOR_ENTAILMENT_NB': 4711,
75
75
  'PROPAGATOR_FILTER_NB': 104392,
76
76
  'PROPAGATOR_FILTER_NO_CHANGE_NB': 73792,
@@ -105,11 +105,11 @@ NUMBA_CACHE_DIR=.numba/cache python -m nucs.examples.golomb -n 10 --symmetry_bre
105
105
  2024-11-12 17:27:45,717 - INFO - nucs.solvers.backtrack_solver - Found a (new) solution: 60
106
106
  2024-11-12 17:27:45,977 - INFO - nucs.solvers.backtrack_solver - Found a (new) solution: 55
107
107
  {
108
- 'OPTIMIZER_SOLUTION_NB': 10,
109
- 'PROBLEM_FILTER_NB': 22652,
110
- 'PROBLEM_SHAVING_NB': 0,
111
- 'PROBLEM_SHAVING_CHANGE_NB': 0,
112
- 'PROBLEM_SHAVING_NO_CHANGE_NB': 0,
108
+ 'ALG_BC_NB': 22652,
109
+ 'ALG_BC_WITH_SHAVING_NB': 0,
110
+ 'ALG_SHAVING_NB': 0,
111
+ 'ALG_SHAVING_CHANGE_NB': 0,
112
+ 'ALG_SHAVING_NO_CHANGE_NB': 0,
113
113
  'PROPAGATOR_ENTAILMENT_NB': 107911,
114
114
  'PROPAGATOR_FILTER_NB': 2813035,
115
115
  'PROPAGATOR_FILTER_NO_CHANGE_NB': 1745836,
@@ -6,8 +6,8 @@ project = 'NUCS'
6
6
  copyright = '2024, Yan Georget'
7
7
  author = 'Yan Georget'
8
8
 
9
- release = '2.2.0'
10
- version = '2.2.0'
9
+ release = '3.0.0'
10
+ version = '3.0.0'
11
11
 
12
12
  # -- General configuration
13
13
 
@@ -29,8 +29,10 @@ PROBLEM_UNBOUND = 1 # returned when the filtering of a problem has been complet
29
29
  PROBLEM_BOUND = 2 # returned when a problem is solved
30
30
 
31
31
  SIGNATURE_COMPUTE_DOMAINS = int64(int32[:, :], int32[:]) # domains, parameters
32
- SIGNATURE_DOM_HEURISTIC = int64(int32[:], int32[:]) # shr_domain, shr_domain_copy
33
- SIGNATURE_VAR_HEURISTIC = int64(int32[:, :]) # shr_domains
32
+ SIGNATURE_DOM_HEURISTIC = int64(
33
+ int32[:, :, :], uint16[:, :], uint8[:], int64 # shr_domains_stack # dom_update_stack # stacks_top # dom_idx
34
+ )
35
+ SIGNATURE_VAR_HEURISTIC = int64(int32[:, :, :], uint8[:]) # shr_domains_stack, stacks_top
34
36
  SIGNATURE_CONSISTENCY_ALG = int64(
35
37
  int64[:], # statistics
36
38
  uint8[:], # algorithms
@@ -57,10 +59,41 @@ TYPE_CONSISTENCY_ALG = types.FunctionType(SIGNATURE_CONSISTENCY_ALG)
57
59
 
58
60
  NUMBA_DISABLE_JIT = os.getenv("NUMBA_DISABLE_JIT")
59
61
 
60
- LOG_FORMAT = "%(asctime)s - %(levelname)s - %(name)s - %(message)s"
62
+ LOG_FORMAT = "%(asctime)s - %(processName)s - %(levelname)s - %(name)s - %(funcName)s - %(message)s"
61
63
  LOG_LEVEL_DEBUG = "DEBUG"
62
64
  LOG_LEVEL_INFO = "INFO"
63
65
  LOG_LEVEL_WARNING = "WARNING"
64
66
  LOG_LEVEL_ERROR = "ERROR"
65
67
  LOG_LEVEL_CRITICAL = "CRITICAL"
66
68
  LOG_LEVELS = [LOG_LEVEL_DEBUG, LOG_LEVEL_INFO, LOG_LEVEL_WARNING, LOG_LEVEL_ERROR, LOG_LEVEL_CRITICAL]
69
+
70
+ STATS_MAX = 13
71
+ (
72
+ STATS_IDX_ALG_BC_NB,
73
+ STATS_IDX_ALG_BC_WITH_SHAVING_NB,
74
+ STATS_IDX_ALG_SHAVING_NB,
75
+ STATS_IDX_ALG_SHAVING_CHANGE_NB,
76
+ STATS_IDX_ALG_SHAVING_NO_CHANGE_NB,
77
+ STATS_IDX_PROPAGATOR_ENTAILMENT_NB,
78
+ STATS_IDX_PROPAGATOR_FILTER_NB,
79
+ STATS_IDX_PROPAGATOR_FILTER_NO_CHANGE_NB,
80
+ STATS_IDX_PROPAGATOR_INCONSISTENCY_NB,
81
+ STATS_IDX_SOLVER_BACKTRACK_NB,
82
+ STATS_IDX_SOLVER_CHOICE_NB,
83
+ STATS_IDX_SOLVER_CHOICE_DEPTH,
84
+ STATS_IDX_SOLVER_SOLUTION_NB,
85
+ ) = tuple(range(STATS_MAX))
86
+
87
+ STATS_LBL_ALG_BC_NB = "ALG_BC_NB"
88
+ STATS_LBL_ALG_BC_WITH_SHAVING_NB = "ALG_BC_WITH_SHAVING_NB"
89
+ STATS_LBL_ALG_SHAVING_NB = "ALG_SHAVING_NB"
90
+ STATS_LBL_ALG_SHAVING_CHANGE_NB = "ALG_SHAVING_CHANGE_NB"
91
+ STATS_LBL_ALG_SHAVING_NO_CHANGE_NB = "ALG_SHAVING_NO_CHANGE_NB"
92
+ STATS_LBL_PROPAGATOR_ENTAILMENT_NB = "PROPAGATOR_ENTAILMENT_NB"
93
+ STATS_LBL_PROPAGATOR_FILTER_NB = "PROPAGATOR_FILTER_NB"
94
+ STATS_LBL_PROPAGATOR_FILTER_NO_CHANGE_NB = "PROPAGATOR_FILTER_NO_CHANGE_NB"
95
+ STATS_LBL_PROPAGATOR_INCONSISTENCY_NB = "PROPAGATOR_INCONSISTENCY_NB"
96
+ STATS_LBL_SOLVER_BACKTRACK_NB = "SOLVER_BACKTRACK_NB"
97
+ STATS_LBL_SOLVER_CHOICE_NB = "SOLVER_CHOICE_NB"
98
+ STATS_LBL_SOLVER_CHOICE_DEPTH = "SOLVER_CHOICE_DEPTH"
99
+ STATS_LBL_SOLVER_SOLUTION_NB = "SOLVER_SOLUTION_NB"
@@ -18,10 +18,9 @@ from nucs.constants import LOG_LEVEL_INFO, LOG_LEVELS
18
18
  from nucs.examples.alpha.alpha_problem import AlphaProblem
19
19
  from nucs.solvers.backtrack_solver import BacktrackSolver
20
20
  from nucs.solvers.heuristics import DOM_HEURISTIC_MIN_VALUE, VAR_HEURISTIC_SMALLEST_DOMAIN
21
- from nucs.statistics import get_statistics
22
21
 
23
22
  # Run with the following command (the second run is much faster because the code has been compiled):
24
- # NUMBA_CACHE_DIR=.numba/cache PYTHONPATH=. python -m nucs.examples.alpha
23
+ # NUMBA_CACHE_DIR=.numba/cache python -m nucs.examples.alpha
25
24
  if __name__ == "__main__":
26
25
  parser = argparse.ArgumentParser()
27
26
  parser.add_argument("--log_level", choices=LOG_LEVELS, default=LOG_LEVEL_INFO)
@@ -34,5 +33,5 @@ if __name__ == "__main__":
34
33
  log_level=args.log_level,
35
34
  )
36
35
  solutions = solver.find_all()
37
- print(get_statistics(solver.statistics))
36
+ print(solver.get_statistics())
38
37
  print(problem.solution_as_dict(solutions[0]))
@@ -18,10 +18,9 @@ from nucs.constants import LOG_LEVEL_INFO, LOG_LEVELS
18
18
  from nucs.examples.bibd.bibd_problem import BIBDProblem
19
19
  from nucs.solvers.backtrack_solver import BacktrackSolver
20
20
  from nucs.solvers.heuristics import DOM_HEURISTIC_MAX_VALUE
21
- from nucs.statistics import get_statistics
22
21
 
23
22
  # Run with the following command (the second run is much faster because the code has been compiled):
24
- # NUMBA_CACHE_DIR=.numba/cache PYTHONPATH=. python -m nucs.examples.bibd -v 8 -b 14 -r 7 -k 4 -l 3 --symmetry_breaking
23
+ # NUMBA_CACHE_DIR=.numba/cache python -m nucs.examples.bibd -v 8 -b 14 -r 7 -k 4 -l 3 --symmetry_breaking
25
24
  if __name__ == "__main__":
26
25
  parser = argparse.ArgumentParser()
27
26
  parser.add_argument("-v", type=int)
@@ -35,4 +34,4 @@ if __name__ == "__main__":
35
34
  problem = BIBDProblem(args.v, args.b, args.r, args.k, args.l, args.symmetry_breaking)
36
35
  solver = BacktrackSolver(problem, dom_heuristic_idx=DOM_HEURISTIC_MAX_VALUE, log_level=args.log_level)
37
36
  solver.solve_all()
38
- print(get_statistics(solver.statistics))
37
+ print(solver.get_statistics())
@@ -18,10 +18,9 @@ from nucs.constants import LOG_LEVEL_INFO, LOG_LEVELS
18
18
  from nucs.examples.donald.donald_problem import DonaldProblem
19
19
  from nucs.solvers.backtrack_solver import BacktrackSolver
20
20
  from nucs.solvers.heuristics import DOM_HEURISTIC_MIN_VALUE, VAR_HEURISTIC_SMALLEST_DOMAIN
21
- from nucs.statistics import get_statistics
22
21
 
23
22
  # Run with the following command (the second run is much faster because the code has been compiled):
24
- # NUMBA_CACHE_DIR=.numba/cache PYTHONPATH=. python -m nucs.examples.donald
23
+ # NUMBA_CACHE_DIR=.numba/cache python -m nucs.examples.donald
25
24
  if __name__ == "__main__":
26
25
  parser = argparse.ArgumentParser()
27
26
  parser.add_argument("--log_level", choices=LOG_LEVELS, default=LOG_LEVEL_INFO)
@@ -33,6 +32,6 @@ if __name__ == "__main__":
33
32
  dom_heuristic_idx=DOM_HEURISTIC_MIN_VALUE,
34
33
  log_level=args.log_level,
35
34
  )
36
- print(get_statistics(solver.statistics))
35
+ print(solver.get_statistics())
37
36
  for solution in solver.solve():
38
37
  print(problem.solution_as_dict(solution))
@@ -18,10 +18,9 @@ from nucs.constants import LOG_LEVEL_INFO, LOG_LEVELS
18
18
  from nucs.examples.golomb.golomb_problem import GolombProblem, golomb_consistency_algorithm
19
19
  from nucs.solvers.backtrack_solver import BacktrackSolver
20
20
  from nucs.solvers.consistency_algorithms import register_consistency_algorithm
21
- from nucs.statistics import get_statistics
22
21
 
23
22
  # Run with the following command (the second run is much faster because the code has been compiled):
24
- # NUMBA_CACHE_DIR=.numba/cache PYTHONPATH=. python -m nucs.examples.golomb -n 10 --symmetry_breaking
23
+ # NUMBA_CACHE_DIR=.numba/cache python -m nucs.examples.golomb -n 10 --symmetry_breaking
25
24
  if __name__ == "__main__":
26
25
  parser = argparse.ArgumentParser()
27
26
  parser.add_argument("-n", type=int, default=10)
@@ -32,6 +31,6 @@ if __name__ == "__main__":
32
31
  consistency_alg_golomb = register_consistency_algorithm(golomb_consistency_algorithm)
33
32
  solver = BacktrackSolver(problem, consistency_alg_idx=consistency_alg_golomb, log_level=args.log_level)
34
33
  solution = solver.minimize(problem.length_idx)
35
- print(get_statistics(solver.statistics))
34
+ print(solver.get_statistics())
36
35
  if solution is not None:
37
36
  print(solution[: (args.n - 1)])
@@ -127,7 +127,7 @@ def golomb_consistency_algorithm(
127
127
  shr_domains_stack: NDArray,
128
128
  not_entailed_propagators_stack: NDArray,
129
129
  dom_update_stack: NDArray,
130
- stacks_height: NDArray,
130
+ stacks_top: NDArray,
131
131
  triggered_propagators: NDArray,
132
132
  compute_domains_addrs: NDArray,
133
133
  ) -> int:
@@ -139,7 +139,7 @@ def golomb_consistency_algorithm(
139
139
  """
140
140
  # first prune the search space
141
141
  mark_nb = (1 + int(math.sqrt(8 * len(dom_indices_arr) + 1))) // 2
142
- ni_var_idx = first_not_instantiated_var_heuristic(shr_domains_stack[0]) # no domains shared between vars
142
+ ni_var_idx = first_not_instantiated_var_heuristic(shr_domains_stack, stacks_top) # no domains shared between vars
143
143
  if 1 < ni_var_idx < mark_nb - 1: # otherwise useless
144
144
  used_distance = np.zeros(sum_first(mark_nb - 2) + 1, dtype=np.bool)
145
145
  # a reusable array for storing the minimal sum of different integers:
@@ -148,7 +148,7 @@ def golomb_consistency_algorithm(
148
148
  # the following will mark at most sum(n-3) numbers as used
149
149
  # hence there will be at least n-2 unused numbers greater than 0
150
150
  for var_idx in range(index(mark_nb, ni_var_idx - 2, ni_var_idx - 1) + 1):
151
- dist = shr_domains_stack[0, dom_indices_arr[var_idx], MIN] # no offset
151
+ dist = shr_domains_stack[stacks_top[0], dom_indices_arr[var_idx], MIN] # no offset
152
152
  if dist < len(used_distance):
153
153
  used_distance[dist] = True
154
154
  # let's compute the sum of non-used numbers
@@ -161,9 +161,14 @@ def golomb_consistency_algorithm(
161
161
  for i in range(ni_var_idx - 1, mark_nb - 1):
162
162
  for j in range(i + 1, mark_nb):
163
163
  dom_idx = dom_indices_arr[index(mark_nb, i, j)]
164
- shr_domains_stack[0, dom_idx, MIN] = minimal_sum[j - i] # no offset
164
+ shr_domains_stack[stacks_top[0], dom_idx, MIN] = minimal_sum[j - i] # no offset
165
165
  add_propagators(
166
- triggered_propagators, not_entailed_propagators_stack[0], shr_domains_propagators, dom_idx, MIN
166
+ triggered_propagators,
167
+ not_entailed_propagators_stack,
168
+ stacks_top,
169
+ shr_domains_propagators,
170
+ dom_idx,
171
+ MIN,
167
172
  )
168
173
  return bound_consistency_algorithm(
169
174
  statistics,
@@ -179,7 +184,7 @@ def golomb_consistency_algorithm(
179
184
  shr_domains_stack,
180
185
  not_entailed_propagators_stack,
181
186
  dom_update_stack,
182
- stacks_height,
187
+ stacks_top,
183
188
  triggered_propagators,
184
189
  compute_domains_addrs,
185
190
  )
@@ -18,10 +18,9 @@ from nucs.constants import LOG_LEVEL_INFO, LOG_LEVELS
18
18
  from nucs.examples.knapsack.knapsack_problem import KnapsackProblem
19
19
  from nucs.solvers.backtrack_solver import BacktrackSolver
20
20
  from nucs.solvers.heuristics import DOM_HEURISTIC_MAX_VALUE, VAR_HEURISTIC_FIRST_NOT_INSTANTIATED
21
- from nucs.statistics import get_statistics
22
21
 
23
22
  # Run with the following command (the second run is much faster because the code has been compiled):
24
- # NUMBA_CACHE_DIR=.numba/cache PYTHONPATH=. python -m nucs.examples.knapsack
23
+ # NUMBA_CACHE_DIR=.numba/cache python -m nucs.examples.knapsack
25
24
  if __name__ == "__main__":
26
25
  parser = argparse.ArgumentParser()
27
26
  parser.add_argument("--log_level", choices=LOG_LEVELS, default=LOG_LEVEL_INFO)
@@ -38,5 +37,5 @@ if __name__ == "__main__":
38
37
  log_level=args.log_level,
39
38
  )
40
39
  solution = solver.maximize(problem.weight)
41
- print(get_statistics(solver.statistics))
40
+ print(solver.get_statistics())
42
41
  print(solution)
@@ -18,10 +18,9 @@ from nucs.constants import LOG_LEVEL_INFO, LOG_LEVELS
18
18
  from nucs.examples.magic_sequence.magic_sequence_problem import MagicSequenceProblem
19
19
  from nucs.solvers.backtrack_solver import BacktrackSolver
20
20
  from nucs.solvers.heuristics import DOM_HEURISTIC_MIN_VALUE, VAR_HEURISTIC_LAST_NOT_INSTANTIATED
21
- from nucs.statistics import get_statistics
22
21
 
23
22
  # Run with the following command (the second run is much faster because the code has been compiled):
24
- # NUMBA_CACHE_DIR=.numba/cache PYTHONPATH=. python -m nucs.examples.magic_sequence -n 100
23
+ # NUMBA_CACHE_DIR=.numba/cache python -m nucs.examples.magic_sequence -n 100
25
24
  if __name__ == "__main__":
26
25
  parser = argparse.ArgumentParser()
27
26
  parser.add_argument("-n", type=int, default=100)
@@ -35,4 +34,4 @@ if __name__ == "__main__":
35
34
  log_level=args.log_level,
36
35
  )
37
36
  solver.solve_all()
38
- print(get_statistics(solver.statistics))
37
+ print(solver.get_statistics())
@@ -18,10 +18,9 @@ from nucs.constants import LOG_LEVEL_INFO, LOG_LEVELS
18
18
  from nucs.examples.magic_square.magic_square_problem import MagicSquareProblem
19
19
  from nucs.solvers.backtrack_solver import BacktrackSolver
20
20
  from nucs.solvers.heuristics import DOM_HEURISTIC_MAX_VALUE, VAR_HEURISTIC_SMALLEST_DOMAIN
21
- from nucs.statistics import get_statistics
22
21
 
23
22
  # Run with the following command (the second run is much faster because the code has been compiled):
24
- # NUMBA_CACHE_DIR=.numba/cache PYTHONPATH=. python -m nucs.examples.magic_square -n 4 --symmetry_breaking
23
+ # NUMBA_CACHE_DIR=.numba/cache python -m nucs.examples.magic_square -n 4 --symmetry_breaking
25
24
  if __name__ == "__main__":
26
25
  parser = argparse.ArgumentParser()
27
26
  parser.add_argument("-n", type=int)
@@ -36,4 +35,4 @@ if __name__ == "__main__":
36
35
  log_level=args.log_level,
37
36
  )
38
37
  solver.solve_all()
39
- print(get_statistics(solver.statistics))
38
+ print(solver.get_statistics())
@@ -18,10 +18,9 @@ from nucs.constants import LOG_LEVEL_INFO, LOG_LEVELS
18
18
  from nucs.examples.quasigroup.quasigroup_problem import Quasigroup5Problem
19
19
  from nucs.solvers.backtrack_solver import BacktrackSolver
20
20
  from nucs.solvers.heuristics import DOM_HEURISTIC_MIN_VALUE, VAR_HEURISTIC_SMALLEST_DOMAIN
21
- from nucs.statistics import get_statistics
22
21
 
23
22
  # Run with the following command (the second run is much faster because the code has been compiled):
24
- # NUMBA_CACHE_DIR=.numba/cache PYTHONPATH=. python -m nucs.examples.quasigroup -n 10 --symmetry_breaking
23
+ # NUMBA_CACHE_DIR=.numba/cache python -m nucs.examples.quasigroup -n 10 --symmetry_breaking
25
24
  if __name__ == "__main__":
26
25
  parser = argparse.ArgumentParser()
27
26
  parser.add_argument("-n", type=int, default=10)
@@ -36,4 +35,4 @@ if __name__ == "__main__":
36
35
  log_level=args.log_level,
37
36
  )
38
37
  solver.solve_all()
39
- print(get_statistics(solver.statistics))
38
+ print(solver.get_statistics())
@@ -20,10 +20,9 @@ from nucs.solvers.backtrack_solver import BacktrackSolver
20
20
  from nucs.solvers.consistency_algorithms import CONSISTENCY_ALG_BC, CONSISTENCY_ALG_SHAVING
21
21
  from nucs.solvers.heuristics import VAR_HEURISTIC_FIRST_NOT_INSTANTIATED, VAR_HEURISTIC_SMALLEST_DOMAIN
22
22
  from nucs.solvers.multiprocessing_solver import MultiprocessingSolver
23
- from nucs.statistics import get_statistics
24
23
 
25
24
  # Run with the following command (the second run is much faster because the code has been compiled):
26
- # NUMBA_CACHE_DIR=.numba/cache PYTHONPATH=. python -m nucs.examples.queens -n 10
25
+ # NUMBA_CACHE_DIR=.numba/cache python -m nucs.examples.queens -n 10
27
26
  if __name__ == "__main__":
28
27
  parser = argparse.ArgumentParser()
29
28
  parser.add_argument("-n", type=int, default=10)
@@ -33,17 +32,27 @@ if __name__ == "__main__":
33
32
  parser.add_argument("--ff", type=bool, action=argparse.BooleanOptionalAction, default=False)
34
33
  args = parser.parse_args()
35
34
  problem = QueensProblem(args.n)
36
- problems = problem.split(args.processors, 0)
37
- solver = MultiprocessingSolver(
38
- [
39
- BacktrackSolver(
40
- problem,
41
- consistency_alg_idx=CONSISTENCY_ALG_SHAVING if args.shaving else CONSISTENCY_ALG_BC,
42
- var_heuristic_idx=VAR_HEURISTIC_SMALLEST_DOMAIN if args.ff else VAR_HEURISTIC_FIRST_NOT_INSTANTIATED,
43
- log_level=args.log_level,
44
- )
45
- for problem in problems
46
- ]
35
+ solver = (
36
+ MultiprocessingSolver(
37
+ [
38
+ BacktrackSolver(
39
+ problem,
40
+ consistency_alg_idx=CONSISTENCY_ALG_SHAVING if args.shaving else CONSISTENCY_ALG_BC,
41
+ var_heuristic_idx=(
42
+ VAR_HEURISTIC_SMALLEST_DOMAIN if args.ff else VAR_HEURISTIC_FIRST_NOT_INSTANTIATED
43
+ ),
44
+ log_level=args.log_level,
45
+ )
46
+ for problem in problem.split(args.processors, 0)
47
+ ]
48
+ )
49
+ if args.processors > 1
50
+ else BacktrackSolver(
51
+ problem,
52
+ consistency_alg_idx=CONSISTENCY_ALG_SHAVING if args.shaving else CONSISTENCY_ALG_BC,
53
+ var_heuristic_idx=VAR_HEURISTIC_SMALLEST_DOMAIN if args.ff else VAR_HEURISTIC_FIRST_NOT_INSTANTIATED,
54
+ log_level=args.log_level,
55
+ )
47
56
  )
48
57
  solver.solve_all()
49
- print(get_statistics(solver.statistics))
58
+ print(solver.get_statistics())
@@ -17,10 +17,9 @@ from rich import print
17
17
  from nucs.constants import LOG_LEVEL_INFO, LOG_LEVELS
18
18
  from nucs.examples.schur_lemma.schur_lemma_problem import SchurLemmaProblem
19
19
  from nucs.solvers.backtrack_solver import BacktrackSolver
20
- from nucs.statistics import get_statistics
21
20
 
22
21
  # Run with the following command (the second run is much faster because the code has been compiled):
23
- # NUMBA_CACHE_DIR=.numba/cache PYTHONPATH=. python -m nucs.examples.schur_lemma -n 20 --symmetry_breaking
22
+ # NUMBA_CACHE_DIR=.numba/cache python -m nucs.examples.schur_lemma -n 20 --symmetry_breaking
24
23
  if __name__ == "__main__":
25
24
  parser = argparse.ArgumentParser()
26
25
  parser.add_argument("-n", type=int, default=20)
@@ -30,4 +29,4 @@ if __name__ == "__main__":
30
29
  problem = SchurLemmaProblem(args.n, args.symmetry_breaking)
31
30
  solver = BacktrackSolver(problem, log_level=args.log_level)
32
31
  solver.solve_all()
33
- print(get_statistics(solver.statistics))
32
+ print(solver.get_statistics())
@@ -20,10 +20,9 @@ from nucs.examples.sports_tournament_scheduling.sports_tournament_scheduling_pro
20
20
  )
21
21
  from nucs.solvers.backtrack_solver import BacktrackSolver
22
22
  from nucs.solvers.heuristics import DOM_HEURISTIC_MIN_VALUE, VAR_HEURISTIC_SMALLEST_DOMAIN
23
- from nucs.statistics import get_statistics
24
23
 
25
24
  # Run with the following command (the second run is much faster because the code has been compiled):
26
- # NUMBA_CACHE_DIR=.numba/cache PYTHONPATH=. python -m nucs.examples.sports_tournament_scheduling -n 8
25
+ # NUMBA_CACHE_DIR=.numba/cache python -m nucs.examples.sports_tournament_scheduling -n 8
27
26
  if __name__ == "__main__":
28
27
  parser = argparse.ArgumentParser()
29
28
  parser.add_argument("-n", type=int, default=8)
@@ -38,6 +37,6 @@ if __name__ == "__main__":
38
37
  log_level=args.log_level,
39
38
  )
40
39
  solution = next(solver.solve())
41
- print(get_statistics(solver.statistics))
40
+ print(solver.get_statistics())
42
41
  if solution is not None:
43
42
  print(problem.solution_as_matrix(solution))
@@ -141,13 +141,15 @@ def pop_propagator(triggered_propagators: NDArray, previous_prop_idx: int) -> in
141
141
  @njit(cache=True)
142
142
  def add_propagators(
143
143
  triggered_propagators: NDArray,
144
- not_entailed_propagators: NDArray,
144
+ not_entailed_propagators_stack: NDArray,
145
+ stacks_top: NDArray,
145
146
  shr_domains_propagators: NDArray,
146
147
  dom_idx: int,
147
148
  bound: int,
148
149
  ) -> None:
150
+ cp_top_idx = stacks_top[0]
149
151
  for prop_idx in range(len(triggered_propagators)):
150
- if shr_domains_propagators[dom_idx, bound, prop_idx] and not_entailed_propagators[prop_idx]:
152
+ if shr_domains_propagators[dom_idx, bound, prop_idx] and not_entailed_propagators_stack[cp_top_idx, prop_idx]:
151
153
  triggered_propagators[prop_idx] = True
152
154
  # np.logical_or(triggered_propagators, shr_domains_propagators[dom_idx, bound], triggered_propagators)
153
155
  # np.logical_and(triggered_propagators, not_entailed_propagators, triggered_propagators)