NuCS 4.4.4__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 (152) hide show
  1. nucs-4.4.4/LICENSE.md +21 -0
  2. nucs-4.4.4/NuCS.egg-info/PKG-INFO +152 -0
  3. nucs-4.4.4/NuCS.egg-info/SOURCES.txt +150 -0
  4. nucs-4.4.4/NuCS.egg-info/dependency_links.txt +1 -0
  5. nucs-4.4.4/NuCS.egg-info/requires.txt +3 -0
  6. nucs-4.4.4/NuCS.egg-info/top_level.txt +6 -0
  7. nucs-4.4.4/PKG-INFO +152 -0
  8. nucs-4.4.4/README.md +125 -0
  9. nucs-4.4.4/docs/source/conf.py +54 -0
  10. nucs-4.4.4/nucs/__init__.py +0 -0
  11. nucs-4.4.4/nucs/constants.py +127 -0
  12. nucs-4.4.4/nucs/examples/__init__.py +0 -0
  13. nucs-4.4.4/nucs/examples/alpha/__init__.py +0 -0
  14. nucs-4.4.4/nucs/examples/alpha/__main__.py +37 -0
  15. nucs-4.4.4/nucs/examples/alpha/alpha_problem.py +104 -0
  16. nucs-4.4.4/nucs/examples/bibd/__init__.py +0 -0
  17. nucs-4.4.4/nucs/examples/bibd/__main__.py +39 -0
  18. nucs-4.4.4/nucs/examples/bibd/bibd_problem.py +75 -0
  19. nucs-4.4.4/nucs/examples/donald/__init__.py +0 -0
  20. nucs-4.4.4/nucs/examples/donald/__main__.py +37 -0
  21. nucs-4.4.4/nucs/examples/donald/donald_problem.py +61 -0
  22. nucs-4.4.4/nucs/examples/golomb/__init__.py +0 -0
  23. nucs-4.4.4/nucs/examples/golomb/__main__.py +52 -0
  24. nucs-4.4.4/nucs/examples/golomb/golomb_problem.py +189 -0
  25. nucs-4.4.4/nucs/examples/knapsack/__init__.py +0 -0
  26. nucs-4.4.4/nucs/examples/knapsack/__main__.py +42 -0
  27. nucs-4.4.4/nucs/examples/knapsack/knapsack_problem.py +35 -0
  28. nucs-4.4.4/nucs/examples/magic_sequence/__init__.py +0 -0
  29. nucs-4.4.4/nucs/examples/magic_sequence/__main__.py +39 -0
  30. nucs-4.4.4/nucs/examples/magic_sequence/magic_sequence_problem.py +34 -0
  31. nucs-4.4.4/nucs/examples/magic_square/__init__.py +0 -0
  32. nucs-4.4.4/nucs/examples/magic_square/__main__.py +38 -0
  33. nucs-4.4.4/nucs/examples/magic_square/magic_square_problem.py +61 -0
  34. nucs-4.4.4/nucs/examples/quasigroup/__init__.py +0 -0
  35. nucs-4.4.4/nucs/examples/quasigroup/__main__.py +44 -0
  36. nucs-4.4.4/nucs/examples/quasigroup/quasigroup_problem.py +116 -0
  37. nucs-4.4.4/nucs/examples/queens/__init__.py +0 -0
  38. nucs-4.4.4/nucs/examples/queens/__main__.py +58 -0
  39. nucs-4.4.4/nucs/examples/queens/queens_problem.py +43 -0
  40. nucs-4.4.4/nucs/examples/schur_lemma/__init__.py +0 -0
  41. nucs-4.4.4/nucs/examples/schur_lemma/__main__.py +32 -0
  42. nucs-4.4.4/nucs/examples/schur_lemma/schur_lemma_problem.py +44 -0
  43. nucs-4.4.4/nucs/examples/sports_tournament_scheduling/__init__.py +0 -0
  44. nucs-4.4.4/nucs/examples/sports_tournament_scheduling/__main__.py +42 -0
  45. nucs-4.4.4/nucs/examples/sports_tournament_scheduling/sports_tournament_scheduling_problem.py +117 -0
  46. nucs-4.4.4/nucs/examples/sudoku/__init__.py +0 -0
  47. nucs-4.4.4/nucs/examples/sudoku/sudoku_problem.py +35 -0
  48. nucs-4.4.4/nucs/examples/tsp/__init__.py +0 -0
  49. nucs-4.4.4/nucs/examples/tsp/__main__.py +71 -0
  50. nucs-4.4.4/nucs/examples/tsp/total_cost_propagator.py +90 -0
  51. nucs-4.4.4/nucs/examples/tsp/tsp_instances.py +72 -0
  52. nucs-4.4.4/nucs/examples/tsp/tsp_problem.py +47 -0
  53. nucs-4.4.4/nucs/examples/tsp/tsp_var_heuristic.py +52 -0
  54. nucs-4.4.4/nucs/heuristics/__init__.py +0 -0
  55. nucs-4.4.4/nucs/heuristics/first_not_instantiated_var_heuristic.py +35 -0
  56. nucs-4.4.4/nucs/heuristics/greatest_domain_var_heuristic.py +40 -0
  57. nucs-4.4.4/nucs/heuristics/heuristics.py +60 -0
  58. nucs-4.4.4/nucs/heuristics/max_regret_var_heuristic.py +57 -0
  59. nucs-4.4.4/nucs/heuristics/max_value_dom_heuristic.py +58 -0
  60. nucs-4.4.4/nucs/heuristics/mid_value_dom_heuristic.py +47 -0
  61. nucs-4.4.4/nucs/heuristics/min_cost_dom_heuristic.py +52 -0
  62. nucs-4.4.4/nucs/heuristics/min_value_dom_heuristic.py +58 -0
  63. nucs-4.4.4/nucs/heuristics/smallest_domain_var_heuristic.py +42 -0
  64. nucs-4.4.4/nucs/heuristics/split_high_dom_heuristic.py +58 -0
  65. nucs-4.4.4/nucs/heuristics/split_low_dom_heuristic.py +58 -0
  66. nucs-4.4.4/nucs/heuristics/value_dom_heuristic.py +78 -0
  67. nucs-4.4.4/nucs/numba_helper.py +38 -0
  68. nucs-4.4.4/nucs/numpy_helper.py +32 -0
  69. nucs-4.4.4/nucs/problems/__init__.py +0 -0
  70. nucs-4.4.4/nucs/problems/circuit_problem.py +36 -0
  71. nucs-4.4.4/nucs/problems/latin_square_problem.py +103 -0
  72. nucs-4.4.4/nucs/problems/permutation_problem.py +34 -0
  73. nucs-4.4.4/nucs/problems/problem.py +196 -0
  74. nucs-4.4.4/nucs/propagators/__init__.py +0 -0
  75. nucs-4.4.4/nucs/propagators/affine_eq_propagator.py +69 -0
  76. nucs-4.4.4/nucs/propagators/affine_geq_propagator.py +83 -0
  77. nucs-4.4.4/nucs/propagators/affine_leq_propagator.py +83 -0
  78. nucs-4.4.4/nucs/propagators/alldifferent_propagator.py +219 -0
  79. nucs-4.4.4/nucs/propagators/and_propagator.py +67 -0
  80. nucs-4.4.4/nucs/propagators/count_eq_propagator.py +74 -0
  81. nucs-4.4.4/nucs/propagators/dummy_propagator.py +46 -0
  82. nucs-4.4.4/nucs/propagators/element_iv_propagator.py +81 -0
  83. nucs-4.4.4/nucs/propagators/element_lic_propagator.py +70 -0
  84. nucs-4.4.4/nucs/propagators/element_liv_propagator.py +84 -0
  85. nucs-4.4.4/nucs/propagators/exactly_eq_propagator.py +73 -0
  86. nucs-4.4.4/nucs/propagators/exactly_true_propagator.py +70 -0
  87. nucs-4.4.4/nucs/propagators/gcc_propagator.py +456 -0
  88. nucs-4.4.4/nucs/propagators/lexicographic_leq_propagator.py +159 -0
  89. nucs-4.4.4/nucs/propagators/max_eq_propagator.py +63 -0
  90. nucs-4.4.4/nucs/propagators/max_leq_propagator.py +69 -0
  91. nucs-4.4.4/nucs/propagators/min_eq_propagator.py +63 -0
  92. nucs-4.4.4/nucs/propagators/min_geq_propagator.py +69 -0
  93. nucs-4.4.4/nucs/propagators/no_sub_cycle_propagator.py +81 -0
  94. nucs-4.4.4/nucs/propagators/permutation_aux_propagator.py +65 -0
  95. nucs-4.4.4/nucs/propagators/propagators.py +175 -0
  96. nucs-4.4.4/nucs/propagators/relation_propagator.py +63 -0
  97. nucs-4.4.4/nucs/propagators/scc_propagator.py +75 -0
  98. nucs-4.4.4/nucs/solvers/__init__.py +0 -0
  99. nucs-4.4.4/nucs/solvers/backtrack_solver.py +602 -0
  100. nucs-4.4.4/nucs/solvers/bound_consistency_algorithm.py +136 -0
  101. nucs-4.4.4/nucs/solvers/choice_points.py +133 -0
  102. nucs-4.4.4/nucs/solvers/consistency_algorithms.py +32 -0
  103. nucs-4.4.4/nucs/solvers/multiprocessing_solver.py +132 -0
  104. nucs-4.4.4/nucs/solvers/shaving_consistency_algorithm.py +213 -0
  105. nucs-4.4.4/nucs/solvers/solver.py +121 -0
  106. nucs-4.4.4/pyproject.toml +46 -0
  107. nucs-4.4.4/setup.cfg +4 -0
  108. nucs-4.4.4/tests/__init__.py +0 -0
  109. nucs-4.4.4/tests/examples/test_alpha.py +54 -0
  110. nucs-4.4.4/tests/examples/test_bibd.py +28 -0
  111. nucs-4.4.4/tests/examples/test_donald.py +27 -0
  112. nucs-4.4.4/tests/examples/test_golomb.py +35 -0
  113. nucs-4.4.4/tests/examples/test_knapsack.py +30 -0
  114. nucs-4.4.4/tests/examples/test_latin_square.py +51 -0
  115. nucs-4.4.4/tests/examples/test_magic_sequence.py +35 -0
  116. nucs-4.4.4/tests/examples/test_magic_square.py +36 -0
  117. nucs-4.4.4/tests/examples/test_quasigroup.py +62 -0
  118. nucs-4.4.4/tests/examples/test_queens.py +37 -0
  119. nucs-4.4.4/tests/examples/test_schur_lemma.py +48 -0
  120. nucs-4.4.4/tests/examples/test_sports_tournament_scheduling.py +107 -0
  121. nucs-4.4.4/tests/examples/test_sudokus.py +54 -0
  122. nucs-4.4.4/tests/examples/test_tsp.py +57 -0
  123. nucs-4.4.4/tests/heuristics/__init__.py +0 -0
  124. nucs-4.4.4/tests/heuristics/test_max_value_dom_heuristic.py +24 -0
  125. nucs-4.4.4/tests/heuristics/test_mid_value_dom_heuristic.py +24 -0
  126. nucs-4.4.4/tests/heuristics/test_min_value_dom_heuristic.py +24 -0
  127. nucs-4.4.4/tests/problems/__init__.py +0 -0
  128. nucs-4.4.4/tests/problems/test_circuit_problem.py +36 -0
  129. nucs-4.4.4/tests/problems/test_permutation_problem.py +35 -0
  130. nucs-4.4.4/tests/problems/test_problem.py +40 -0
  131. nucs-4.4.4/tests/propagators/__init__.py +0 -0
  132. nucs-4.4.4/tests/propagators/test_affine_eq.py +58 -0
  133. nucs-4.4.4/tests/propagators/test_affine_geq.py +41 -0
  134. nucs-4.4.4/tests/propagators/test_affine_leq.py +41 -0
  135. nucs-4.4.4/tests/propagators/test_alldifferent.py +58 -0
  136. nucs-4.4.4/tests/propagators/test_count_eq.py +54 -0
  137. nucs-4.4.4/tests/propagators/test_element_iv.py +36 -0
  138. nucs-4.4.4/tests/propagators/test_element_lic.py +36 -0
  139. nucs-4.4.4/tests/propagators/test_element_liv.py +42 -0
  140. nucs-4.4.4/tests/propagators/test_exactly_eq.py +42 -0
  141. nucs-4.4.4/tests/propagators/test_gcc.py +54 -0
  142. nucs-4.4.4/tests/propagators/test_lexicographic_leq.py +85 -0
  143. nucs-4.4.4/tests/propagators/test_max_eq.py +46 -0
  144. nucs-4.4.4/tests/propagators/test_max_leq.py +47 -0
  145. nucs-4.4.4/tests/propagators/test_min_eq.py +46 -0
  146. nucs-4.4.4/tests/propagators/test_min_geq.py +47 -0
  147. nucs-4.4.4/tests/propagators/test_no_sub_cycle.py +32 -0
  148. nucs-4.4.4/tests/propagators/test_relation.py +53 -0
  149. nucs-4.4.4/tests/propagators/test_scc.py +32 -0
  150. nucs-4.4.4/tests/solvers/__init__.py +0 -0
  151. nucs-4.4.4/tests/solvers/test_backtrack_solver.py +106 -0
  152. nucs-4.4.4/tests/solvers/test_multiprocessing_solver.py +65 -0
nucs-4.4.4/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ # MIT License
2
+
3
+ ## Copyright (c) 2024 Yan Georget
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,152 @@
1
+ Metadata-Version: 2.1
2
+ Name: NuCS
3
+ Version: 4.4.4
4
+ Summary: A Numpy and Numba based Python library for solving Constraint Satisfaction Problems over finite domains
5
+ Author-email: Yan Georget <yan.georget@gmail.com>
6
+ Project-URL: Homepage, https://github.com/yangeorget/nucs
7
+ Project-URL: Issues, https://github.com/yangeorget/nucs/issues
8
+ Classifier: Development Status :: 5 - Production/Stable
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: Intended Audience :: Science/Research
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.9
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
19
+ Classifier: Topic :: Scientific/Engineering :: Mathematics
20
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
+ Requires-Python: >=3.9
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE.md
24
+ Requires-Dist: numba==0.60.0
25
+ Requires-Dist: numpy<2.1
26
+ Requires-Dist: rich
27
+
28
+ ![NucS logo](https://github.com/yangeorget/nucs/blob/main/assets/nucs.png?raw=true)
29
+
30
+
31
+ ![pypi version](https://img.shields.io/pypi/v/nucs?color=blue&label=pypi%20version&logo=pypi&logoColor=white)
32
+ ![pypi downloads](https://img.shields.io/pypi/dm/NUCS)
33
+
34
+ ![numba version](https://img.shields.io/badge/numba-v0.60-blue)
35
+ ![numpy version](https://img.shields.io/badge/numpy-v2.0-blue)
36
+
37
+ ![tests](https://github.com/yangeorget/nucs/actions/workflows/test.yml/badge.svg)
38
+ ![doc](https://img.shields.io/readthedocs/nucs)
39
+ ![license](https://img.shields.io/github/license/yangeorget/nucs)
40
+
41
+ ## TLDR
42
+ NuCS is a Python library for solving Constraint Satisfaction and Optimization Problems.
43
+ Because it is 100% written in Python,
44
+ NuCS is easy to install and allows to model complex problems in a few lines of code.
45
+ The NuCS solver is also very fast because it is powered by [Numpy](https://numpy.org/) and [Numba](https://numba.pydata.org/).
46
+
47
+ ## Installation
48
+ ```bash
49
+ pip install nucs
50
+ ```
51
+ ## Documentation
52
+ Check out [NUCS documentation](https://nucs.readthedocs.io/).
53
+
54
+ ## With NuCS, in a few seconds you can ...
55
+ ### Find all 14200 solutions to the [12-queens problem](https://www.csplib.org/Problems/prob054/)
56
+ ```bash
57
+ NUMBA_CACHE_DIR=.numba/cache python -m nucs.examples.queens -n 12 --log_level=INFO
58
+ ```
59
+ ```bash
60
+ 2024-11-12 17:24:49,061 - INFO - nucs.solvers.solver - Problem has 3 propagators
61
+ 2024-11-12 17:24:49,061 - INFO - nucs.solvers.solver - Problem has 12 variables
62
+ 2024-11-12 17:24:49,061 - INFO - nucs.solvers.backtrack_solver - BacktrackSolver uses variable heuristic 0
63
+ 2024-11-12 17:24:49,061 - INFO - nucs.solvers.backtrack_solver - BacktrackSolver uses domain heuristic 0
64
+ 2024-11-12 17:24:49,061 - INFO - nucs.solvers.backtrack_solver - BacktrackSolver uses consistency algorithm 0
65
+ 2024-11-12 17:24:49,061 - INFO - nucs.solvers.backtrack_solver - Choice points stack has a maximal height of 128
66
+ 2024-11-12 17:24:49,200 - INFO - nucs.solvers.multiprocessing_solver - MultiprocessingSolver has 1 processors
67
+ {
68
+ 'ALG_BC_NB': 262011,
69
+ 'ALG_BC_WITH_SHAVING_NB': 0,
70
+ 'ALG_SHAVING_NB': 0,
71
+ 'ALG_SHAVING_CHANGE_NB': 0,
72
+ 'ALG_SHAVING_NO_CHANGE_NB': 0,
73
+ 'PROPAGATOR_ENTAILMENT_NB': 0,
74
+ 'PROPAGATOR_FILTER_NB': 2269980,
75
+ 'PROPAGATOR_FILTER_NO_CHANGE_NB': 990450,
76
+ 'PROPAGATOR_INCONSISTENCY_NB': 116806,
77
+ 'SOLVER_BACKTRACK_NB': 131005,
78
+ 'SOLVER_CHOICE_NB': 131005,
79
+ 'SOLVER_CHOICE_DEPTH': 10,
80
+ 'SOLVER_SOLUTION_NB': 14200
81
+ }
82
+ ```
83
+
84
+ ### Compute the 92 solutions to the [BIBD(8,14,7,4,3) problem](https://www.csplib.org/Problems/prob028/)
85
+ ```bash
86
+ NUMBA_CACHE_DIR=.numba/cache python -m nucs.examples.bibd -v 8 -b 14 -r 7 -k 4 -l 3 --symmetry_breaking --log_level=INFO
87
+ ```
88
+ ```bash
89
+ 2024-11-12 17:26:39,734 - INFO - nucs.solvers.solver - Problem has 462 propagators
90
+ 2024-11-12 17:26:39,734 - INFO - nucs.solvers.solver - Problem has 504 variables
91
+ 2024-11-12 17:26:39,734 - INFO - nucs.solvers.backtrack_solver - BacktrackSolver uses variable heuristic 0
92
+ 2024-11-12 17:26:39,734 - INFO - nucs.solvers.backtrack_solver - BacktrackSolver uses domain heuristic 1
93
+ 2024-11-12 17:26:39,734 - INFO - nucs.solvers.backtrack_solver - BacktrackSolver uses consistency algorithm 0
94
+ 2024-11-12 17:26:39,734 - INFO - nucs.solvers.backtrack_solver - Choice points stack has a maximal height of 128
95
+ {
96
+ 'ALG_BC_NB': 1425,
97
+ 'ALG_BC_WITH_SHAVING_NB': 0,
98
+ 'ALG_SHAVING_NB': 0,
99
+ 'ALG_SHAVING_CHANGE_NB': 0,
100
+ 'ALG_SHAVING_NO_CHANGE_NB': 0,
101
+ 'PROPAGATOR_ENTAILMENT_NB': 4711,
102
+ 'PROPAGATOR_FILTER_NB': 104392,
103
+ 'PROPAGATOR_FILTER_NO_CHANGE_NB': 73792,
104
+ 'PROPAGATOR_INCONSISTENCY_NB': 621,
105
+ 'SOLVER_BACKTRACK_NB': 712,
106
+ 'SOLVER_CHOICE_NB': 712,
107
+ 'SOLVER_CHOICE_DEPTH': 19,
108
+ 'SOLVER_SOLUTION_NB': 92
109
+ }
110
+ ```
111
+
112
+ ### Demonstrate that the optimal [10-marks Golomb ruler](https://www.csplib.org/Problems/prob006/) length is 55
113
+ ```bash
114
+ NUMBA_CACHE_DIR=.numba/cache python -m nucs.examples.golomb -n 10 --symmetry_breaking --log_level=INFO
115
+ ```
116
+ ```bash
117
+ 2024-11-12 17:27:45,110 - INFO - nucs.solvers.solver - Problem has 82 propagators
118
+ 2024-11-12 17:27:45,110 - INFO - nucs.solvers.solver - Problem has 45 variables
119
+ 2024-11-12 17:27:45,110 - INFO - nucs.solvers.backtrack_solver - BacktrackSolver uses variable heuristic 0
120
+ 2024-11-12 17:27:45,110 - INFO - nucs.solvers.backtrack_solver - BacktrackSolver uses domain heuristic 0
121
+ 2024-11-12 17:27:45,110 - INFO - nucs.solvers.backtrack_solver - BacktrackSolver uses consistency algorithm 2
122
+ 2024-11-12 17:27:45,110 - INFO - nucs.solvers.backtrack_solver - Choice points stack has a maximal height of 128
123
+ 2024-11-12 17:27:45,172 - INFO - nucs.solvers.backtrack_solver - Minimizing variable 8
124
+ 2024-11-12 17:27:45,644 - INFO - nucs.solvers.backtrack_solver - Found a (new) solution: 80
125
+ 2024-11-12 17:27:45,677 - INFO - nucs.solvers.backtrack_solver - Found a (new) solution: 75
126
+ 2024-11-12 17:27:45,677 - INFO - nucs.solvers.backtrack_solver - Found a (new) solution: 73
127
+ 2024-11-12 17:27:45,678 - INFO - nucs.solvers.backtrack_solver - Found a (new) solution: 72
128
+ 2024-11-12 17:27:45,679 - INFO - nucs.solvers.backtrack_solver - Found a (new) solution: 70
129
+ 2024-11-12 17:27:45,682 - INFO - nucs.solvers.backtrack_solver - Found a (new) solution: 68
130
+ 2024-11-12 17:27:45,687 - INFO - nucs.solvers.backtrack_solver - Found a (new) solution: 66
131
+ 2024-11-12 17:27:45,693 - INFO - nucs.solvers.backtrack_solver - Found a (new) solution: 62
132
+ 2024-11-12 17:27:45,717 - INFO - nucs.solvers.backtrack_solver - Found a (new) solution: 60
133
+ 2024-11-12 17:27:45,977 - INFO - nucs.solvers.backtrack_solver - Found a (new) solution: 55
134
+ {
135
+ 'ALG_BC_NB': 22652,
136
+ 'ALG_BC_WITH_SHAVING_NB': 0,
137
+ 'ALG_SHAVING_NB': 0,
138
+ 'ALG_SHAVING_CHANGE_NB': 0,
139
+ 'ALG_SHAVING_NO_CHANGE_NB': 0,
140
+ 'PROPAGATOR_ENTAILMENT_NB': 107911,
141
+ 'PROPAGATOR_FILTER_NB': 2813035,
142
+ 'PROPAGATOR_FILTER_NO_CHANGE_NB': 1745836,
143
+ 'PROPAGATOR_INCONSISTENCY_NB': 11289,
144
+ 'SOLVER_BACKTRACK_NB': 11288,
145
+ 'SOLVER_CHOICE_NB': 11353,
146
+ 'SOLVER_CHOICE_DEPTH': 9,
147
+ 'SOLVER_SOLUTION_NB': 10
148
+ }
149
+ [ 1 6 10 23 26 34 41 53 55]
150
+ ```
151
+
152
+
@@ -0,0 +1,150 @@
1
+ LICENSE.md
2
+ README.md
3
+ pyproject.toml
4
+ NuCS.egg-info/PKG-INFO
5
+ NuCS.egg-info/SOURCES.txt
6
+ NuCS.egg-info/dependency_links.txt
7
+ NuCS.egg-info/requires.txt
8
+ NuCS.egg-info/top_level.txt
9
+ docs/source/conf.py
10
+ nucs/__init__.py
11
+ nucs/constants.py
12
+ nucs/numba_helper.py
13
+ nucs/numpy_helper.py
14
+ nucs/examples/__init__.py
15
+ nucs/examples/alpha/__init__.py
16
+ nucs/examples/alpha/__main__.py
17
+ nucs/examples/alpha/alpha_problem.py
18
+ nucs/examples/bibd/__init__.py
19
+ nucs/examples/bibd/__main__.py
20
+ nucs/examples/bibd/bibd_problem.py
21
+ nucs/examples/donald/__init__.py
22
+ nucs/examples/donald/__main__.py
23
+ nucs/examples/donald/donald_problem.py
24
+ nucs/examples/golomb/__init__.py
25
+ nucs/examples/golomb/__main__.py
26
+ nucs/examples/golomb/golomb_problem.py
27
+ nucs/examples/knapsack/__init__.py
28
+ nucs/examples/knapsack/__main__.py
29
+ nucs/examples/knapsack/knapsack_problem.py
30
+ nucs/examples/magic_sequence/__init__.py
31
+ nucs/examples/magic_sequence/__main__.py
32
+ nucs/examples/magic_sequence/magic_sequence_problem.py
33
+ nucs/examples/magic_square/__init__.py
34
+ nucs/examples/magic_square/__main__.py
35
+ nucs/examples/magic_square/magic_square_problem.py
36
+ nucs/examples/quasigroup/__init__.py
37
+ nucs/examples/quasigroup/__main__.py
38
+ nucs/examples/quasigroup/quasigroup_problem.py
39
+ nucs/examples/queens/__init__.py
40
+ nucs/examples/queens/__main__.py
41
+ nucs/examples/queens/queens_problem.py
42
+ nucs/examples/schur_lemma/__init__.py
43
+ nucs/examples/schur_lemma/__main__.py
44
+ nucs/examples/schur_lemma/schur_lemma_problem.py
45
+ nucs/examples/sports_tournament_scheduling/__init__.py
46
+ nucs/examples/sports_tournament_scheduling/__main__.py
47
+ nucs/examples/sports_tournament_scheduling/sports_tournament_scheduling_problem.py
48
+ nucs/examples/sudoku/__init__.py
49
+ nucs/examples/sudoku/sudoku_problem.py
50
+ nucs/examples/tsp/__init__.py
51
+ nucs/examples/tsp/__main__.py
52
+ nucs/examples/tsp/total_cost_propagator.py
53
+ nucs/examples/tsp/tsp_instances.py
54
+ nucs/examples/tsp/tsp_problem.py
55
+ nucs/examples/tsp/tsp_var_heuristic.py
56
+ nucs/heuristics/__init__.py
57
+ nucs/heuristics/first_not_instantiated_var_heuristic.py
58
+ nucs/heuristics/greatest_domain_var_heuristic.py
59
+ nucs/heuristics/heuristics.py
60
+ nucs/heuristics/max_regret_var_heuristic.py
61
+ nucs/heuristics/max_value_dom_heuristic.py
62
+ nucs/heuristics/mid_value_dom_heuristic.py
63
+ nucs/heuristics/min_cost_dom_heuristic.py
64
+ nucs/heuristics/min_value_dom_heuristic.py
65
+ nucs/heuristics/smallest_domain_var_heuristic.py
66
+ nucs/heuristics/split_high_dom_heuristic.py
67
+ nucs/heuristics/split_low_dom_heuristic.py
68
+ nucs/heuristics/value_dom_heuristic.py
69
+ nucs/problems/__init__.py
70
+ nucs/problems/circuit_problem.py
71
+ nucs/problems/latin_square_problem.py
72
+ nucs/problems/permutation_problem.py
73
+ nucs/problems/problem.py
74
+ nucs/propagators/__init__.py
75
+ nucs/propagators/affine_eq_propagator.py
76
+ nucs/propagators/affine_geq_propagator.py
77
+ nucs/propagators/affine_leq_propagator.py
78
+ nucs/propagators/alldifferent_propagator.py
79
+ nucs/propagators/and_propagator.py
80
+ nucs/propagators/count_eq_propagator.py
81
+ nucs/propagators/dummy_propagator.py
82
+ nucs/propagators/element_iv_propagator.py
83
+ nucs/propagators/element_lic_propagator.py
84
+ nucs/propagators/element_liv_propagator.py
85
+ nucs/propagators/exactly_eq_propagator.py
86
+ nucs/propagators/exactly_true_propagator.py
87
+ nucs/propagators/gcc_propagator.py
88
+ nucs/propagators/lexicographic_leq_propagator.py
89
+ nucs/propagators/max_eq_propagator.py
90
+ nucs/propagators/max_leq_propagator.py
91
+ nucs/propagators/min_eq_propagator.py
92
+ nucs/propagators/min_geq_propagator.py
93
+ nucs/propagators/no_sub_cycle_propagator.py
94
+ nucs/propagators/permutation_aux_propagator.py
95
+ nucs/propagators/propagators.py
96
+ nucs/propagators/relation_propagator.py
97
+ nucs/propagators/scc_propagator.py
98
+ nucs/solvers/__init__.py
99
+ nucs/solvers/backtrack_solver.py
100
+ nucs/solvers/bound_consistency_algorithm.py
101
+ nucs/solvers/choice_points.py
102
+ nucs/solvers/consistency_algorithms.py
103
+ nucs/solvers/multiprocessing_solver.py
104
+ nucs/solvers/shaving_consistency_algorithm.py
105
+ nucs/solvers/solver.py
106
+ tests/__init__.py
107
+ tests/examples/test_alpha.py
108
+ tests/examples/test_bibd.py
109
+ tests/examples/test_donald.py
110
+ tests/examples/test_golomb.py
111
+ tests/examples/test_knapsack.py
112
+ tests/examples/test_latin_square.py
113
+ tests/examples/test_magic_sequence.py
114
+ tests/examples/test_magic_square.py
115
+ tests/examples/test_quasigroup.py
116
+ tests/examples/test_queens.py
117
+ tests/examples/test_schur_lemma.py
118
+ tests/examples/test_sports_tournament_scheduling.py
119
+ tests/examples/test_sudokus.py
120
+ tests/examples/test_tsp.py
121
+ tests/heuristics/__init__.py
122
+ tests/heuristics/test_max_value_dom_heuristic.py
123
+ tests/heuristics/test_mid_value_dom_heuristic.py
124
+ tests/heuristics/test_min_value_dom_heuristic.py
125
+ tests/problems/__init__.py
126
+ tests/problems/test_circuit_problem.py
127
+ tests/problems/test_permutation_problem.py
128
+ tests/problems/test_problem.py
129
+ tests/propagators/__init__.py
130
+ tests/propagators/test_affine_eq.py
131
+ tests/propagators/test_affine_geq.py
132
+ tests/propagators/test_affine_leq.py
133
+ tests/propagators/test_alldifferent.py
134
+ tests/propagators/test_count_eq.py
135
+ tests/propagators/test_element_iv.py
136
+ tests/propagators/test_element_lic.py
137
+ tests/propagators/test_element_liv.py
138
+ tests/propagators/test_exactly_eq.py
139
+ tests/propagators/test_gcc.py
140
+ tests/propagators/test_lexicographic_leq.py
141
+ tests/propagators/test_max_eq.py
142
+ tests/propagators/test_max_leq.py
143
+ tests/propagators/test_min_eq.py
144
+ tests/propagators/test_min_geq.py
145
+ tests/propagators/test_no_sub_cycle.py
146
+ tests/propagators/test_relation.py
147
+ tests/propagators/test_scc.py
148
+ tests/solvers/__init__.py
149
+ tests/solvers/test_backtrack_solver.py
150
+ tests/solvers/test_multiprocessing_solver.py
@@ -0,0 +1,3 @@
1
+ numba==0.60.0
2
+ numpy<2.1
3
+ rich
@@ -0,0 +1,6 @@
1
+ assets
2
+ dist
3
+ docs
4
+ nucs
5
+ scripts
6
+ tests
nucs-4.4.4/PKG-INFO ADDED
@@ -0,0 +1,152 @@
1
+ Metadata-Version: 2.1
2
+ Name: NuCS
3
+ Version: 4.4.4
4
+ Summary: A Numpy and Numba based Python library for solving Constraint Satisfaction Problems over finite domains
5
+ Author-email: Yan Georget <yan.georget@gmail.com>
6
+ Project-URL: Homepage, https://github.com/yangeorget/nucs
7
+ Project-URL: Issues, https://github.com/yangeorget/nucs/issues
8
+ Classifier: Development Status :: 5 - Production/Stable
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: Intended Audience :: Science/Research
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.9
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
19
+ Classifier: Topic :: Scientific/Engineering :: Mathematics
20
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
+ Requires-Python: >=3.9
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE.md
24
+ Requires-Dist: numba==0.60.0
25
+ Requires-Dist: numpy<2.1
26
+ Requires-Dist: rich
27
+
28
+ ![NucS logo](https://github.com/yangeorget/nucs/blob/main/assets/nucs.png?raw=true)
29
+
30
+
31
+ ![pypi version](https://img.shields.io/pypi/v/nucs?color=blue&label=pypi%20version&logo=pypi&logoColor=white)
32
+ ![pypi downloads](https://img.shields.io/pypi/dm/NUCS)
33
+
34
+ ![numba version](https://img.shields.io/badge/numba-v0.60-blue)
35
+ ![numpy version](https://img.shields.io/badge/numpy-v2.0-blue)
36
+
37
+ ![tests](https://github.com/yangeorget/nucs/actions/workflows/test.yml/badge.svg)
38
+ ![doc](https://img.shields.io/readthedocs/nucs)
39
+ ![license](https://img.shields.io/github/license/yangeorget/nucs)
40
+
41
+ ## TLDR
42
+ NuCS is a Python library for solving Constraint Satisfaction and Optimization Problems.
43
+ Because it is 100% written in Python,
44
+ NuCS is easy to install and allows to model complex problems in a few lines of code.
45
+ The NuCS solver is also very fast because it is powered by [Numpy](https://numpy.org/) and [Numba](https://numba.pydata.org/).
46
+
47
+ ## Installation
48
+ ```bash
49
+ pip install nucs
50
+ ```
51
+ ## Documentation
52
+ Check out [NUCS documentation](https://nucs.readthedocs.io/).
53
+
54
+ ## With NuCS, in a few seconds you can ...
55
+ ### Find all 14200 solutions to the [12-queens problem](https://www.csplib.org/Problems/prob054/)
56
+ ```bash
57
+ NUMBA_CACHE_DIR=.numba/cache python -m nucs.examples.queens -n 12 --log_level=INFO
58
+ ```
59
+ ```bash
60
+ 2024-11-12 17:24:49,061 - INFO - nucs.solvers.solver - Problem has 3 propagators
61
+ 2024-11-12 17:24:49,061 - INFO - nucs.solvers.solver - Problem has 12 variables
62
+ 2024-11-12 17:24:49,061 - INFO - nucs.solvers.backtrack_solver - BacktrackSolver uses variable heuristic 0
63
+ 2024-11-12 17:24:49,061 - INFO - nucs.solvers.backtrack_solver - BacktrackSolver uses domain heuristic 0
64
+ 2024-11-12 17:24:49,061 - INFO - nucs.solvers.backtrack_solver - BacktrackSolver uses consistency algorithm 0
65
+ 2024-11-12 17:24:49,061 - INFO - nucs.solvers.backtrack_solver - Choice points stack has a maximal height of 128
66
+ 2024-11-12 17:24:49,200 - INFO - nucs.solvers.multiprocessing_solver - MultiprocessingSolver has 1 processors
67
+ {
68
+ 'ALG_BC_NB': 262011,
69
+ 'ALG_BC_WITH_SHAVING_NB': 0,
70
+ 'ALG_SHAVING_NB': 0,
71
+ 'ALG_SHAVING_CHANGE_NB': 0,
72
+ 'ALG_SHAVING_NO_CHANGE_NB': 0,
73
+ 'PROPAGATOR_ENTAILMENT_NB': 0,
74
+ 'PROPAGATOR_FILTER_NB': 2269980,
75
+ 'PROPAGATOR_FILTER_NO_CHANGE_NB': 990450,
76
+ 'PROPAGATOR_INCONSISTENCY_NB': 116806,
77
+ 'SOLVER_BACKTRACK_NB': 131005,
78
+ 'SOLVER_CHOICE_NB': 131005,
79
+ 'SOLVER_CHOICE_DEPTH': 10,
80
+ 'SOLVER_SOLUTION_NB': 14200
81
+ }
82
+ ```
83
+
84
+ ### Compute the 92 solutions to the [BIBD(8,14,7,4,3) problem](https://www.csplib.org/Problems/prob028/)
85
+ ```bash
86
+ NUMBA_CACHE_DIR=.numba/cache python -m nucs.examples.bibd -v 8 -b 14 -r 7 -k 4 -l 3 --symmetry_breaking --log_level=INFO
87
+ ```
88
+ ```bash
89
+ 2024-11-12 17:26:39,734 - INFO - nucs.solvers.solver - Problem has 462 propagators
90
+ 2024-11-12 17:26:39,734 - INFO - nucs.solvers.solver - Problem has 504 variables
91
+ 2024-11-12 17:26:39,734 - INFO - nucs.solvers.backtrack_solver - BacktrackSolver uses variable heuristic 0
92
+ 2024-11-12 17:26:39,734 - INFO - nucs.solvers.backtrack_solver - BacktrackSolver uses domain heuristic 1
93
+ 2024-11-12 17:26:39,734 - INFO - nucs.solvers.backtrack_solver - BacktrackSolver uses consistency algorithm 0
94
+ 2024-11-12 17:26:39,734 - INFO - nucs.solvers.backtrack_solver - Choice points stack has a maximal height of 128
95
+ {
96
+ 'ALG_BC_NB': 1425,
97
+ 'ALG_BC_WITH_SHAVING_NB': 0,
98
+ 'ALG_SHAVING_NB': 0,
99
+ 'ALG_SHAVING_CHANGE_NB': 0,
100
+ 'ALG_SHAVING_NO_CHANGE_NB': 0,
101
+ 'PROPAGATOR_ENTAILMENT_NB': 4711,
102
+ 'PROPAGATOR_FILTER_NB': 104392,
103
+ 'PROPAGATOR_FILTER_NO_CHANGE_NB': 73792,
104
+ 'PROPAGATOR_INCONSISTENCY_NB': 621,
105
+ 'SOLVER_BACKTRACK_NB': 712,
106
+ 'SOLVER_CHOICE_NB': 712,
107
+ 'SOLVER_CHOICE_DEPTH': 19,
108
+ 'SOLVER_SOLUTION_NB': 92
109
+ }
110
+ ```
111
+
112
+ ### Demonstrate that the optimal [10-marks Golomb ruler](https://www.csplib.org/Problems/prob006/) length is 55
113
+ ```bash
114
+ NUMBA_CACHE_DIR=.numba/cache python -m nucs.examples.golomb -n 10 --symmetry_breaking --log_level=INFO
115
+ ```
116
+ ```bash
117
+ 2024-11-12 17:27:45,110 - INFO - nucs.solvers.solver - Problem has 82 propagators
118
+ 2024-11-12 17:27:45,110 - INFO - nucs.solvers.solver - Problem has 45 variables
119
+ 2024-11-12 17:27:45,110 - INFO - nucs.solvers.backtrack_solver - BacktrackSolver uses variable heuristic 0
120
+ 2024-11-12 17:27:45,110 - INFO - nucs.solvers.backtrack_solver - BacktrackSolver uses domain heuristic 0
121
+ 2024-11-12 17:27:45,110 - INFO - nucs.solvers.backtrack_solver - BacktrackSolver uses consistency algorithm 2
122
+ 2024-11-12 17:27:45,110 - INFO - nucs.solvers.backtrack_solver - Choice points stack has a maximal height of 128
123
+ 2024-11-12 17:27:45,172 - INFO - nucs.solvers.backtrack_solver - Minimizing variable 8
124
+ 2024-11-12 17:27:45,644 - INFO - nucs.solvers.backtrack_solver - Found a (new) solution: 80
125
+ 2024-11-12 17:27:45,677 - INFO - nucs.solvers.backtrack_solver - Found a (new) solution: 75
126
+ 2024-11-12 17:27:45,677 - INFO - nucs.solvers.backtrack_solver - Found a (new) solution: 73
127
+ 2024-11-12 17:27:45,678 - INFO - nucs.solvers.backtrack_solver - Found a (new) solution: 72
128
+ 2024-11-12 17:27:45,679 - INFO - nucs.solvers.backtrack_solver - Found a (new) solution: 70
129
+ 2024-11-12 17:27:45,682 - INFO - nucs.solvers.backtrack_solver - Found a (new) solution: 68
130
+ 2024-11-12 17:27:45,687 - INFO - nucs.solvers.backtrack_solver - Found a (new) solution: 66
131
+ 2024-11-12 17:27:45,693 - INFO - nucs.solvers.backtrack_solver - Found a (new) solution: 62
132
+ 2024-11-12 17:27:45,717 - INFO - nucs.solvers.backtrack_solver - Found a (new) solution: 60
133
+ 2024-11-12 17:27:45,977 - INFO - nucs.solvers.backtrack_solver - Found a (new) solution: 55
134
+ {
135
+ 'ALG_BC_NB': 22652,
136
+ 'ALG_BC_WITH_SHAVING_NB': 0,
137
+ 'ALG_SHAVING_NB': 0,
138
+ 'ALG_SHAVING_CHANGE_NB': 0,
139
+ 'ALG_SHAVING_NO_CHANGE_NB': 0,
140
+ 'PROPAGATOR_ENTAILMENT_NB': 107911,
141
+ 'PROPAGATOR_FILTER_NB': 2813035,
142
+ 'PROPAGATOR_FILTER_NO_CHANGE_NB': 1745836,
143
+ 'PROPAGATOR_INCONSISTENCY_NB': 11289,
144
+ 'SOLVER_BACKTRACK_NB': 11288,
145
+ 'SOLVER_CHOICE_NB': 11353,
146
+ 'SOLVER_CHOICE_DEPTH': 9,
147
+ 'SOLVER_SOLUTION_NB': 10
148
+ }
149
+ [ 1 6 10 23 26 34 41 53 55]
150
+ ```
151
+
152
+
nucs-4.4.4/README.md ADDED
@@ -0,0 +1,125 @@
1
+ ![NucS logo](https://github.com/yangeorget/nucs/blob/main/assets/nucs.png?raw=true)
2
+
3
+
4
+ ![pypi version](https://img.shields.io/pypi/v/nucs?color=blue&label=pypi%20version&logo=pypi&logoColor=white)
5
+ ![pypi downloads](https://img.shields.io/pypi/dm/NUCS)
6
+
7
+ ![numba version](https://img.shields.io/badge/numba-v0.60-blue)
8
+ ![numpy version](https://img.shields.io/badge/numpy-v2.0-blue)
9
+
10
+ ![tests](https://github.com/yangeorget/nucs/actions/workflows/test.yml/badge.svg)
11
+ ![doc](https://img.shields.io/readthedocs/nucs)
12
+ ![license](https://img.shields.io/github/license/yangeorget/nucs)
13
+
14
+ ## TLDR
15
+ NuCS is a Python library for solving Constraint Satisfaction and Optimization Problems.
16
+ Because it is 100% written in Python,
17
+ NuCS is easy to install and allows to model complex problems in a few lines of code.
18
+ The NuCS solver is also very fast because it is powered by [Numpy](https://numpy.org/) and [Numba](https://numba.pydata.org/).
19
+
20
+ ## Installation
21
+ ```bash
22
+ pip install nucs
23
+ ```
24
+ ## Documentation
25
+ Check out [NUCS documentation](https://nucs.readthedocs.io/).
26
+
27
+ ## With NuCS, in a few seconds you can ...
28
+ ### Find all 14200 solutions to the [12-queens problem](https://www.csplib.org/Problems/prob054/)
29
+ ```bash
30
+ NUMBA_CACHE_DIR=.numba/cache python -m nucs.examples.queens -n 12 --log_level=INFO
31
+ ```
32
+ ```bash
33
+ 2024-11-12 17:24:49,061 - INFO - nucs.solvers.solver - Problem has 3 propagators
34
+ 2024-11-12 17:24:49,061 - INFO - nucs.solvers.solver - Problem has 12 variables
35
+ 2024-11-12 17:24:49,061 - INFO - nucs.solvers.backtrack_solver - BacktrackSolver uses variable heuristic 0
36
+ 2024-11-12 17:24:49,061 - INFO - nucs.solvers.backtrack_solver - BacktrackSolver uses domain heuristic 0
37
+ 2024-11-12 17:24:49,061 - INFO - nucs.solvers.backtrack_solver - BacktrackSolver uses consistency algorithm 0
38
+ 2024-11-12 17:24:49,061 - INFO - nucs.solvers.backtrack_solver - Choice points stack has a maximal height of 128
39
+ 2024-11-12 17:24:49,200 - INFO - nucs.solvers.multiprocessing_solver - MultiprocessingSolver has 1 processors
40
+ {
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
+ 'PROPAGATOR_ENTAILMENT_NB': 0,
47
+ 'PROPAGATOR_FILTER_NB': 2269980,
48
+ 'PROPAGATOR_FILTER_NO_CHANGE_NB': 990450,
49
+ 'PROPAGATOR_INCONSISTENCY_NB': 116806,
50
+ 'SOLVER_BACKTRACK_NB': 131005,
51
+ 'SOLVER_CHOICE_NB': 131005,
52
+ 'SOLVER_CHOICE_DEPTH': 10,
53
+ 'SOLVER_SOLUTION_NB': 14200
54
+ }
55
+ ```
56
+
57
+ ### Compute the 92 solutions to the [BIBD(8,14,7,4,3) problem](https://www.csplib.org/Problems/prob028/)
58
+ ```bash
59
+ NUMBA_CACHE_DIR=.numba/cache python -m nucs.examples.bibd -v 8 -b 14 -r 7 -k 4 -l 3 --symmetry_breaking --log_level=INFO
60
+ ```
61
+ ```bash
62
+ 2024-11-12 17:26:39,734 - INFO - nucs.solvers.solver - Problem has 462 propagators
63
+ 2024-11-12 17:26:39,734 - INFO - nucs.solvers.solver - Problem has 504 variables
64
+ 2024-11-12 17:26:39,734 - INFO - nucs.solvers.backtrack_solver - BacktrackSolver uses variable heuristic 0
65
+ 2024-11-12 17:26:39,734 - INFO - nucs.solvers.backtrack_solver - BacktrackSolver uses domain heuristic 1
66
+ 2024-11-12 17:26:39,734 - INFO - nucs.solvers.backtrack_solver - BacktrackSolver uses consistency algorithm 0
67
+ 2024-11-12 17:26:39,734 - INFO - nucs.solvers.backtrack_solver - Choice points stack has a maximal height of 128
68
+ {
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
+ 'PROPAGATOR_ENTAILMENT_NB': 4711,
75
+ 'PROPAGATOR_FILTER_NB': 104392,
76
+ 'PROPAGATOR_FILTER_NO_CHANGE_NB': 73792,
77
+ 'PROPAGATOR_INCONSISTENCY_NB': 621,
78
+ 'SOLVER_BACKTRACK_NB': 712,
79
+ 'SOLVER_CHOICE_NB': 712,
80
+ 'SOLVER_CHOICE_DEPTH': 19,
81
+ 'SOLVER_SOLUTION_NB': 92
82
+ }
83
+ ```
84
+
85
+ ### Demonstrate that the optimal [10-marks Golomb ruler](https://www.csplib.org/Problems/prob006/) length is 55
86
+ ```bash
87
+ NUMBA_CACHE_DIR=.numba/cache python -m nucs.examples.golomb -n 10 --symmetry_breaking --log_level=INFO
88
+ ```
89
+ ```bash
90
+ 2024-11-12 17:27:45,110 - INFO - nucs.solvers.solver - Problem has 82 propagators
91
+ 2024-11-12 17:27:45,110 - INFO - nucs.solvers.solver - Problem has 45 variables
92
+ 2024-11-12 17:27:45,110 - INFO - nucs.solvers.backtrack_solver - BacktrackSolver uses variable heuristic 0
93
+ 2024-11-12 17:27:45,110 - INFO - nucs.solvers.backtrack_solver - BacktrackSolver uses domain heuristic 0
94
+ 2024-11-12 17:27:45,110 - INFO - nucs.solvers.backtrack_solver - BacktrackSolver uses consistency algorithm 2
95
+ 2024-11-12 17:27:45,110 - INFO - nucs.solvers.backtrack_solver - Choice points stack has a maximal height of 128
96
+ 2024-11-12 17:27:45,172 - INFO - nucs.solvers.backtrack_solver - Minimizing variable 8
97
+ 2024-11-12 17:27:45,644 - INFO - nucs.solvers.backtrack_solver - Found a (new) solution: 80
98
+ 2024-11-12 17:27:45,677 - INFO - nucs.solvers.backtrack_solver - Found a (new) solution: 75
99
+ 2024-11-12 17:27:45,677 - INFO - nucs.solvers.backtrack_solver - Found a (new) solution: 73
100
+ 2024-11-12 17:27:45,678 - INFO - nucs.solvers.backtrack_solver - Found a (new) solution: 72
101
+ 2024-11-12 17:27:45,679 - INFO - nucs.solvers.backtrack_solver - Found a (new) solution: 70
102
+ 2024-11-12 17:27:45,682 - INFO - nucs.solvers.backtrack_solver - Found a (new) solution: 68
103
+ 2024-11-12 17:27:45,687 - INFO - nucs.solvers.backtrack_solver - Found a (new) solution: 66
104
+ 2024-11-12 17:27:45,693 - INFO - nucs.solvers.backtrack_solver - Found a (new) solution: 62
105
+ 2024-11-12 17:27:45,717 - INFO - nucs.solvers.backtrack_solver - Found a (new) solution: 60
106
+ 2024-11-12 17:27:45,977 - INFO - nucs.solvers.backtrack_solver - Found a (new) solution: 55
107
+ {
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
+ 'PROPAGATOR_ENTAILMENT_NB': 107911,
114
+ 'PROPAGATOR_FILTER_NB': 2813035,
115
+ 'PROPAGATOR_FILTER_NO_CHANGE_NB': 1745836,
116
+ 'PROPAGATOR_INCONSISTENCY_NB': 11289,
117
+ 'SOLVER_BACKTRACK_NB': 11288,
118
+ 'SOLVER_CHOICE_NB': 11353,
119
+ 'SOLVER_CHOICE_DEPTH': 9,
120
+ 'SOLVER_SOLUTION_NB': 10
121
+ }
122
+ [ 1 6 10 23 26 34 41 53 55]
123
+ ```
124
+
125
+
@@ -0,0 +1,54 @@
1
+ # Configuration file for the Sphinx documentation builder.
2
+
3
+ # -- Project information
4
+
5
+ project = 'NuCS'
6
+ copyright = '2024, Yan Georget'
7
+ author = 'Yan Georget'
8
+
9
+ release = '4.4.4'
10
+ version = '4.4.4'
11
+
12
+ # -- General configuration
13
+
14
+ tls_verify = False
15
+
16
+ extensions = [
17
+ 'sphinx.ext.linkcode',
18
+ 'sphinx.ext.duration',
19
+ 'sphinx.ext.doctest',
20
+ 'sphinx.ext.autodoc',
21
+ 'sphinx.ext.autosummary',
22
+ 'sphinx.ext.intersphinx',
23
+ ]
24
+
25
+ intersphinx_mapping = {
26
+ 'python': ('https://docs.python.org/3/', None),
27
+ 'sphinx': ('https://www.sphinx-doc.org/en/master/', None),
28
+ }
29
+ intersphinx_disabled_domains = ['std']
30
+
31
+ templates_path = ['_templates']
32
+
33
+ # -- Options for HTML output
34
+
35
+ html_theme = 'sphinx_rtd_theme'
36
+
37
+ html_context = {
38
+ "display_github": True, # Integrate GitHub
39
+ "github_user": "yangeorget", # Username
40
+ "github_repo": "nucs", # Repo name
41
+ "github_version": "main", # Version
42
+ "conf_py_path": "/docs/source/", # Path in the checkout to the docs root
43
+ }
44
+
45
+ # -- Options for EPUB output
46
+ epub_show_urls = 'footnote'
47
+
48
+ def linkcode_resolve(domain, info):
49
+ if domain != 'py':
50
+ return None
51
+ if info['module']:
52
+ filename = info['module'].replace('.', '/')
53
+ return f"https://github.com/yangeorget/nucs/tree/main/{filename}.py"
54
+ return None
File without changes