dsuni 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. dsuni-0.1.0/.cargo/config.toml +4 -0
  2. dsuni-0.1.0/.gitignore +39 -0
  3. dsuni-0.1.0/Cargo.lock +316 -0
  4. dsuni-0.1.0/Cargo.toml +32 -0
  5. dsuni-0.1.0/LICENSE +21 -0
  6. dsuni-0.1.0/PKG-INFO +129 -0
  7. dsuni-0.1.0/README.md +103 -0
  8. dsuni-0.1.0/pyproject.toml +35 -0
  9. dsuni-0.1.0/src/cli/mod.rs +54 -0
  10. dsuni-0.1.0/src/core/assignment.rs +46 -0
  11. dsuni-0.1.0/src/core/config.rs +75 -0
  12. dsuni-0.1.0/src/core/constraint.rs +47 -0
  13. dsuni-0.1.0/src/core/error.rs +77 -0
  14. dsuni-0.1.0/src/core/mod.rs +27 -0
  15. dsuni-0.1.0/src/core/model.rs +21 -0
  16. dsuni-0.1.0/src/core/solver.rs +65 -0
  17. dsuni-0.1.0/src/core/solver_result.rs +132 -0
  18. dsuni-0.1.0/src/core/sort.rs +17 -0
  19. dsuni-0.1.0/src/core/stats.rs +42 -0
  20. dsuni-0.1.0/src/core/term.rs +296 -0
  21. dsuni-0.1.0/src/core/value.rs +30 -0
  22. dsuni-0.1.0/src/core/var.rs +19 -0
  23. dsuni-0.1.0/src/cp/constraints.rs +3 -0
  24. dsuni-0.1.0/src/cp/dom.rs +112 -0
  25. dsuni-0.1.0/src/cp/mod.rs +46 -0
  26. dsuni-0.1.0/src/cp/propagator.rs +226 -0
  27. dsuni-0.1.0/src/cp/search.rs +202 -0
  28. dsuni-0.1.0/src/lib.rs +22 -0
  29. dsuni-0.1.0/src/linear/bound.rs +211 -0
  30. dsuni-0.1.0/src/linear/constraint.rs +210 -0
  31. dsuni-0.1.0/src/linear/expr.rs +310 -0
  32. dsuni-0.1.0/src/linear/mod.rs +21 -0
  33. dsuni-0.1.0/src/linear/normalize.rs +172 -0
  34. dsuni-0.1.0/src/linear/rational.rs +345 -0
  35. dsuni-0.1.0/src/linear/system.rs +229 -0
  36. dsuni-0.1.0/src/lp/mod.rs +27 -0
  37. dsuni-0.1.0/src/lp/solver.rs +452 -0
  38. dsuni-0.1.0/src/lp/tableau.rs +350 -0
  39. dsuni-0.1.0/src/main.rs +148 -0
  40. dsuni-0.1.0/src/milp/mod.rs +21 -0
  41. dsuni-0.1.0/src/milp/solver.rs +321 -0
  42. dsuni-0.1.0/src/minlp/interval.rs +92 -0
  43. dsuni-0.1.0/src/minlp/mod.rs +46 -0
  44. dsuni-0.1.0/src/minlp/solver.rs +342 -0
  45. dsuni-0.1.0/src/normalize/mod.rs +19 -0
  46. dsuni-0.1.0/src/parser/cp_format.rs +151 -0
  47. dsuni-0.1.0/src/parser/dimacs.rs +178 -0
  48. dsuni-0.1.0/src/parser/lp_format.rs +280 -0
  49. dsuni-0.1.0/src/parser/mod.rs +20 -0
  50. dsuni-0.1.0/src/parser/mps.rs +14 -0
  51. dsuni-0.1.0/src/parser/mzn.rs +14 -0
  52. dsuni-0.1.0/src/parser/smtlib.rs +537 -0
  53. dsuni-0.1.0/src/python.rs +163 -0
  54. dsuni-0.1.0/src/sat/clause.rs +192 -0
  55. dsuni-0.1.0/src/sat/heuristics.rs +171 -0
  56. dsuni-0.1.0/src/sat/literal.rs +131 -0
  57. dsuni-0.1.0/src/sat/mod.rs +35 -0
  58. dsuni-0.1.0/src/sat/solver.rs +538 -0
  59. dsuni-0.1.0/src/sat/trail.rs +281 -0
  60. dsuni-0.1.0/src/sat/watch.rs +64 -0
  61. dsuni-0.1.0/src/smt/bool_abstraction.rs +66 -0
  62. dsuni-0.1.0/src/smt/cdclt.rs +171 -0
  63. dsuni-0.1.0/src/smt/lra.rs +149 -0
  64. dsuni-0.1.0/src/smt/mod.rs +52 -0
  65. dsuni-0.1.0/src/smt/theory.rs +74 -0
  66. dsuni-0.1.0/src/smt/uf.rs +346 -0
  67. dsuni-0.1.0/test_data/all_diff_cp.txt +5 -0
  68. dsuni-0.1.0/test_data/infeasible.lp +5 -0
  69. dsuni-0.1.0/test_data/maximize.lp +6 -0
  70. dsuni-0.1.0/test_data/needs_search.cnf +5 -0
  71. dsuni-0.1.0/test_data/non_trivial_unsat.cnf +6 -0
  72. dsuni-0.1.0/test_data/simple.lp +5 -0
  73. dsuni-0.1.0/test_data/simple_cp.txt +4 -0
  74. dsuni-0.1.0/test_data/simple_milp.lp +6 -0
  75. dsuni-0.1.0/test_data/simple_minlp.txt +5 -0
  76. dsuni-0.1.0/test_data/simple_sat.cnf +4 -0
  77. dsuni-0.1.0/test_data/simple_unsat.cnf +5 -0
  78. dsuni-0.1.0/test_data/uf_sat.smt2 +8 -0
  79. dsuni-0.1.0/test_data/uf_unsat.smt2 +8 -0
  80. dsuni-0.1.0/test_data/unit.cnf +3 -0
  81. dsuni-0.1.0/test_data/unsat_unit.cnf +4 -0
@@ -0,0 +1,4 @@
1
+ # dsuni cargo configuration
2
+ # Explicitly disable any system proxy that may interfere with crate downloads.
3
+ [http]
4
+ proxy = ""
dsuni-0.1.0/.gitignore ADDED
@@ -0,0 +1,39 @@
1
+ # Rust
2
+ target/
3
+ *.o
4
+ *.so
5
+ *.dylib
6
+ *.dll
7
+ *.pyd
8
+
9
+ # Python
10
+ __pycache__/
11
+ *.pyc
12
+ *.pyo
13
+ *.egg-info/
14
+ dist/
15
+ build/
16
+ *.whl
17
+
18
+ # IDE
19
+ .vscode/
20
+ .idea/
21
+ *.swp
22
+ *.swo
23
+ *~
24
+
25
+ # OS
26
+ .DS_Store
27
+ Thumbs.db
28
+
29
+ # Maturin
30
+ .maturin/
31
+ python/
32
+
33
+ # Cargo lock (keep for reproducible builds)
34
+ # Cargo.lock
35
+
36
+ # Local planning documents (keep private)
37
+ cxv.md
38
+ ROADMAP.md
39
+ zxv.md
dsuni-0.1.0/Cargo.lock ADDED
@@ -0,0 +1,316 @@
1
+ # This file is automatically @generated by Cargo.
2
+ # It is not intended for manual editing.
3
+ version = 4
4
+
5
+ [[package]]
6
+ name = "anstream"
7
+ version = "1.0.0"
8
+ source = "registry+https://github.com/rust-lang/crates.io-index"
9
+ checksum = "824a212faf96e9acacdbd09febd34438f8f711fb84e09a8916013cd7815ca28d"
10
+ dependencies = [
11
+ "anstyle",
12
+ "anstyle-parse",
13
+ "anstyle-query",
14
+ "anstyle-wincon",
15
+ "colorchoice",
16
+ "is_terminal_polyfill",
17
+ "utf8parse",
18
+ ]
19
+
20
+ [[package]]
21
+ name = "anstyle"
22
+ version = "1.0.14"
23
+ source = "registry+https://github.com/rust-lang/crates.io-index"
24
+ checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000"
25
+
26
+ [[package]]
27
+ name = "anstyle-parse"
28
+ version = "1.0.0"
29
+ source = "registry+https://github.com/rust-lang/crates.io-index"
30
+ checksum = "52ce7f38b242319f7cabaa6813055467063ecdc9d355bbb4ce0c68908cd8130e"
31
+ dependencies = [
32
+ "utf8parse",
33
+ ]
34
+
35
+ [[package]]
36
+ name = "anstyle-query"
37
+ version = "1.1.5"
38
+ source = "registry+https://github.com/rust-lang/crates.io-index"
39
+ checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc"
40
+ dependencies = [
41
+ "windows-sys",
42
+ ]
43
+
44
+ [[package]]
45
+ name = "anstyle-wincon"
46
+ version = "3.0.11"
47
+ source = "registry+https://github.com/rust-lang/crates.io-index"
48
+ checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d"
49
+ dependencies = [
50
+ "anstyle",
51
+ "once_cell_polyfill",
52
+ "windows-sys",
53
+ ]
54
+
55
+ [[package]]
56
+ name = "autocfg"
57
+ version = "1.5.1"
58
+ source = "registry+https://github.com/rust-lang/crates.io-index"
59
+ checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53"
60
+
61
+ [[package]]
62
+ name = "cfg-if"
63
+ version = "1.0.4"
64
+ source = "registry+https://github.com/rust-lang/crates.io-index"
65
+ checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
66
+
67
+ [[package]]
68
+ name = "clap"
69
+ version = "4.6.1"
70
+ source = "registry+https://github.com/rust-lang/crates.io-index"
71
+ checksum = "1ddb117e43bbf7dacf0a4190fef4d345b9bad68dfc649cb349e7d17d28428e51"
72
+ dependencies = [
73
+ "clap_builder",
74
+ "clap_derive",
75
+ ]
76
+
77
+ [[package]]
78
+ name = "clap_builder"
79
+ version = "4.6.0"
80
+ source = "registry+https://github.com/rust-lang/crates.io-index"
81
+ checksum = "714a53001bf66416adb0e2ef5ac857140e7dc3a0c48fb28b2f10762fc4b5069f"
82
+ dependencies = [
83
+ "anstream",
84
+ "anstyle",
85
+ "clap_lex",
86
+ "strsim",
87
+ ]
88
+
89
+ [[package]]
90
+ name = "clap_derive"
91
+ version = "4.6.1"
92
+ source = "registry+https://github.com/rust-lang/crates.io-index"
93
+ checksum = "f2ce8604710f6733aa641a2b3731eaa1e8b3d9973d5e3565da11800813f997a9"
94
+ dependencies = [
95
+ "heck",
96
+ "proc-macro2",
97
+ "quote",
98
+ "syn",
99
+ ]
100
+
101
+ [[package]]
102
+ name = "clap_lex"
103
+ version = "1.1.0"
104
+ source = "registry+https://github.com/rust-lang/crates.io-index"
105
+ checksum = "c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9"
106
+
107
+ [[package]]
108
+ name = "colorchoice"
109
+ version = "1.0.5"
110
+ source = "registry+https://github.com/rust-lang/crates.io-index"
111
+ checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570"
112
+
113
+ [[package]]
114
+ name = "dsuni"
115
+ version = "0.1.0"
116
+ dependencies = [
117
+ "clap",
118
+ "pyo3",
119
+ ]
120
+
121
+ [[package]]
122
+ name = "heck"
123
+ version = "0.5.0"
124
+ source = "registry+https://github.com/rust-lang/crates.io-index"
125
+ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
126
+
127
+ [[package]]
128
+ name = "indoc"
129
+ version = "2.0.7"
130
+ source = "registry+https://github.com/rust-lang/crates.io-index"
131
+ checksum = "79cf5c93f93228cf8efb3ba362535fb11199ac548a09ce117c9b1adc3030d706"
132
+ dependencies = [
133
+ "rustversion",
134
+ ]
135
+
136
+ [[package]]
137
+ name = "is_terminal_polyfill"
138
+ version = "1.70.2"
139
+ source = "registry+https://github.com/rust-lang/crates.io-index"
140
+ checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695"
141
+
142
+ [[package]]
143
+ name = "libc"
144
+ version = "0.2.186"
145
+ source = "registry+https://github.com/rust-lang/crates.io-index"
146
+ checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66"
147
+
148
+ [[package]]
149
+ name = "memoffset"
150
+ version = "0.9.1"
151
+ source = "registry+https://github.com/rust-lang/crates.io-index"
152
+ checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a"
153
+ dependencies = [
154
+ "autocfg",
155
+ ]
156
+
157
+ [[package]]
158
+ name = "once_cell"
159
+ version = "1.21.4"
160
+ source = "registry+https://github.com/rust-lang/crates.io-index"
161
+ checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
162
+
163
+ [[package]]
164
+ name = "once_cell_polyfill"
165
+ version = "1.70.2"
166
+ source = "registry+https://github.com/rust-lang/crates.io-index"
167
+ checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe"
168
+
169
+ [[package]]
170
+ name = "portable-atomic"
171
+ version = "1.13.1"
172
+ source = "registry+https://github.com/rust-lang/crates.io-index"
173
+ checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49"
174
+
175
+ [[package]]
176
+ name = "proc-macro2"
177
+ version = "1.0.106"
178
+ source = "registry+https://github.com/rust-lang/crates.io-index"
179
+ checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934"
180
+ dependencies = [
181
+ "unicode-ident",
182
+ ]
183
+
184
+ [[package]]
185
+ name = "pyo3"
186
+ version = "0.23.5"
187
+ source = "registry+https://github.com/rust-lang/crates.io-index"
188
+ checksum = "7778bffd85cf38175ac1f545509665d0b9b92a198ca7941f131f85f7a4f9a872"
189
+ dependencies = [
190
+ "cfg-if",
191
+ "indoc",
192
+ "libc",
193
+ "memoffset",
194
+ "once_cell",
195
+ "portable-atomic",
196
+ "pyo3-build-config",
197
+ "pyo3-ffi",
198
+ "pyo3-macros",
199
+ "unindent",
200
+ ]
201
+
202
+ [[package]]
203
+ name = "pyo3-build-config"
204
+ version = "0.23.5"
205
+ source = "registry+https://github.com/rust-lang/crates.io-index"
206
+ checksum = "94f6cbe86ef3bf18998d9df6e0f3fc1050a8c5efa409bf712e661a4366e010fb"
207
+ dependencies = [
208
+ "once_cell",
209
+ "target-lexicon",
210
+ ]
211
+
212
+ [[package]]
213
+ name = "pyo3-ffi"
214
+ version = "0.23.5"
215
+ source = "registry+https://github.com/rust-lang/crates.io-index"
216
+ checksum = "e9f1b4c431c0bb1c8fb0a338709859eed0d030ff6daa34368d3b152a63dfdd8d"
217
+ dependencies = [
218
+ "libc",
219
+ "pyo3-build-config",
220
+ ]
221
+
222
+ [[package]]
223
+ name = "pyo3-macros"
224
+ version = "0.23.5"
225
+ source = "registry+https://github.com/rust-lang/crates.io-index"
226
+ checksum = "fbc2201328f63c4710f68abdf653c89d8dbc2858b88c5d88b0ff38a75288a9da"
227
+ dependencies = [
228
+ "proc-macro2",
229
+ "pyo3-macros-backend",
230
+ "quote",
231
+ "syn",
232
+ ]
233
+
234
+ [[package]]
235
+ name = "pyo3-macros-backend"
236
+ version = "0.23.5"
237
+ source = "registry+https://github.com/rust-lang/crates.io-index"
238
+ checksum = "fca6726ad0f3da9c9de093d6f116a93c1a38e417ed73bf138472cf4064f72028"
239
+ dependencies = [
240
+ "heck",
241
+ "proc-macro2",
242
+ "pyo3-build-config",
243
+ "quote",
244
+ "syn",
245
+ ]
246
+
247
+ [[package]]
248
+ name = "quote"
249
+ version = "1.0.45"
250
+ source = "registry+https://github.com/rust-lang/crates.io-index"
251
+ checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924"
252
+ dependencies = [
253
+ "proc-macro2",
254
+ ]
255
+
256
+ [[package]]
257
+ name = "rustversion"
258
+ version = "1.0.22"
259
+ source = "registry+https://github.com/rust-lang/crates.io-index"
260
+ checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"
261
+
262
+ [[package]]
263
+ name = "strsim"
264
+ version = "0.11.1"
265
+ source = "registry+https://github.com/rust-lang/crates.io-index"
266
+ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
267
+
268
+ [[package]]
269
+ name = "syn"
270
+ version = "2.0.117"
271
+ source = "registry+https://github.com/rust-lang/crates.io-index"
272
+ checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99"
273
+ dependencies = [
274
+ "proc-macro2",
275
+ "quote",
276
+ "unicode-ident",
277
+ ]
278
+
279
+ [[package]]
280
+ name = "target-lexicon"
281
+ version = "0.12.16"
282
+ source = "registry+https://github.com/rust-lang/crates.io-index"
283
+ checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1"
284
+
285
+ [[package]]
286
+ name = "unicode-ident"
287
+ version = "1.0.24"
288
+ source = "registry+https://github.com/rust-lang/crates.io-index"
289
+ checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
290
+
291
+ [[package]]
292
+ name = "unindent"
293
+ version = "0.2.4"
294
+ source = "registry+https://github.com/rust-lang/crates.io-index"
295
+ checksum = "7264e107f553ccae879d21fbea1d6724ac785e8c3bfc762137959b5802826ef3"
296
+
297
+ [[package]]
298
+ name = "utf8parse"
299
+ version = "0.2.2"
300
+ source = "registry+https://github.com/rust-lang/crates.io-index"
301
+ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
302
+
303
+ [[package]]
304
+ name = "windows-link"
305
+ version = "0.2.1"
306
+ source = "registry+https://github.com/rust-lang/crates.io-index"
307
+ checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
308
+
309
+ [[package]]
310
+ name = "windows-sys"
311
+ version = "0.61.2"
312
+ source = "registry+https://github.com/rust-lang/crates.io-index"
313
+ checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc"
314
+ dependencies = [
315
+ "windows-link",
316
+ ]
dsuni-0.1.0/Cargo.toml ADDED
@@ -0,0 +1,32 @@
1
+ [package]
2
+ name = "dsuni"
3
+ version = "0.1.0"
4
+ edition = "2021"
5
+ description = "A modular constraint solver in pure Rust — SAT, SMT, LP, MILP, CP, MINLP"
6
+ license = "MIT"
7
+ repository = "https://github.com/MBpanzz/dsuni"
8
+ readme = "README.md"
9
+
10
+ [lib]
11
+ name = "dsuni"
12
+ crate-type = ["cdylib", "rlib"]
13
+
14
+ [[bin]]
15
+ name = "dsuni"
16
+ path = "src/main.rs"
17
+ required-features = ["cli"]
18
+
19
+ [features]
20
+ default = ["cli"]
21
+ cli = ["clap"]
22
+ python = ["dep:pyo3"]
23
+
24
+ [dependencies]
25
+ clap = { version = "4", features = ["derive"], optional = true }
26
+ pyo3 = { version = "0.23", default-features = false, features = ["extension-module", "macros"], optional = true }
27
+
28
+ [dev-dependencies]
29
+
30
+ [profile.release]
31
+ opt-level = 3
32
+ lto = true
dsuni-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 MBpanzz
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.
dsuni-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,129 @@
1
+ Metadata-Version: 2.4
2
+ Name: dsuni
3
+ Version: 0.1.0
4
+ Classifier: Development Status :: 3 - Alpha
5
+ Classifier: Intended Audience :: Science/Research
6
+ Classifier: License :: OSI Approved :: MIT License
7
+ Classifier: Programming Language :: Rust
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Python :: 3.8
10
+ Classifier: Programming Language :: Python :: 3.9
11
+ Classifier: Programming Language :: Python :: 3.10
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Programming Language :: Python :: 3.13
15
+ Classifier: Topic :: Scientific/Engineering :: Mathematics
16
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
17
+ License-File: LICENSE
18
+ Summary: A modular constraint solver — SAT, SMT, LP, MILP, CP, MINLP
19
+ Keywords: solver,sat,smt,linear-programming,optimization,constraint-programming
20
+ License: MIT
21
+ Requires-Python: >=3.8
22
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
23
+ Project-URL: Homepage, https://github.com/MBpanzz/dsuni
24
+ Project-URL: Repository, https://github.com/MBpanzz/dsuni
25
+
26
+ # dsuni
27
+
28
+ **纯 Rust 模块化约束求解器 / Modular Constraint Solver in Pure Rust**
29
+
30
+ [![Rust](https://img.shields.io/badge/Rust-1.80%2B-orange)](https://rust-lang.org)
31
+ [![Python](https://img.shields.io/badge/Python-3.8%2B-blue)](https://python.org)
32
+ [![License](https://img.shields.io/badge/License-MIT-green)](LICENSE)
33
+ [![Tests](https://img.shields.io/badge/Tests-150%20passed-brightgreen)]()
34
+
35
+ 覆盖 8 个求解器模块,全部纯 Rust 实现,无外部求解器依赖。提供 Rust 库、CLI 命令行和 Python wheel 三种使用方式。
36
+
37
+ ### 求解器模块
38
+
39
+ | 模块 | 算法 | 输入格式 |
40
+ |------|------|----------|
41
+ | **SAT** | CDCL + Two-Watched Literals + VSIDS | DIMACS CNF |
42
+ | **LP** | 两阶段单纯形法(精确有理数) | 自定义文本格式 |
43
+ | **SMT** | CDCL(T) + Congruence Closure(QF_UF)| SMT-LIB |
44
+ | **MILP** | 分支定界(LP Relaxation + McCormick)| 自定义文本格式 |
45
+ | **CP** | 传播 + 回溯(First-Fail 搜索)| 自定义文本格式 |
46
+ | **MINLP** | 区间传播 + McCormick 松弛 | 自定义文本格式 |
47
+
48
+ ### 安装
49
+
50
+ #### Rust
51
+ ```bash
52
+ git clone https://github.com/MBpanzz/dsuni.git
53
+ cd dsuni
54
+ cargo build --release
55
+ cargo test # 150 tests
56
+ ```
57
+
58
+ #### Python(从源码)
59
+ ```bash
60
+ pip install maturin
61
+ maturin build --release
62
+ pip install target/wheels/dsuni-*.whl
63
+ ```
64
+
65
+ #### Python(从 PyPI)
66
+ ```bash
67
+ pip install dsuni
68
+ ```
69
+
70
+ ### 快速开始
71
+
72
+ #### CLI
73
+ ```bash
74
+ # SAT
75
+ dsuni sat test_data/unsat_unit.cnf
76
+ # → UNSAT
77
+
78
+ # LP
79
+ dsuni lp test_data/simple.lp
80
+ # → OPTIMAL (obj=-5) / Model: [x0 -> 5]
81
+
82
+ # MILP
83
+ dsuni milp test_data/simple_milp.lp
84
+ # → OPTIMAL (obj=-5) / Model: [x0 -> 5]
85
+ ```
86
+
87
+ #### Python
88
+ ```python
89
+ import dsuni
90
+
91
+ # SAT (DIMACS CNF)
92
+ r = dsuni.solve_sat("p cnf 1 2\n1 0\n-1 0\n")
93
+ print(r) # {'status': 'UNSAT'}
94
+
95
+ # LP
96
+ r = dsuni.solve_lp_text("min -1*x0\nx0 <= 5\nx0 >= 0\n")
97
+ print(r) # {'status': 'OPTIMAL', 'model': {'x0': 5}, 'objective': -5.0}
98
+
99
+ # MILP
100
+ r = dsuni.solve_milp_text("int x0\nmin -1*x0\nx0 <= 5\nx0 >= 0\n")
101
+ print(r) # {'status': 'OPTIMAL', 'model': {'x0': 5}, 'objective': -5.0}
102
+
103
+ # CP
104
+ r = dsuni.solve_cp_text("var x 0 10\nvar y 0 10\neq x y\n")
105
+ print(r) # {'status': 'SAT', 'model': {'x0': 0, 'x1': 0}}
106
+ ```
107
+
108
+ ### 项目结构
109
+
110
+ ```
111
+ src/
112
+ ├── core/ → 基础类型(Var / Term / Config / SolverResult)
113
+ ├── sat/ → CDCL SAT 求解器
114
+ ├── linear/ → Rational / 线性表达式 / 线性系统
115
+ ├── lp/ → 两阶段单纯形法
116
+ ├── milp/ → 分支定界 MILP
117
+ ├── smt/ → CDCL(T) + QF_UF / QF_LRA
118
+ ├── cp/ → 传播 + 回溯 CP
119
+ ├── minlp/ → 区间传播 + McCormick 松弛
120
+ ├── parser/ → DIMACS / LP / SMT-LIB / CP 格式解析器
121
+ ├── cli/ → CLI 命令定义
122
+ └── python.rs → PyO3 Python 绑定
123
+ test_data/ → 14 个测试输入文件
124
+ ```
125
+
126
+ ### 许可证
127
+
128
+ MIT License © 2025 MBpanzz
129
+
dsuni-0.1.0/README.md ADDED
@@ -0,0 +1,103 @@
1
+ # dsuni
2
+
3
+ **纯 Rust 模块化约束求解器 / Modular Constraint Solver in Pure Rust**
4
+
5
+ [![Rust](https://img.shields.io/badge/Rust-1.80%2B-orange)](https://rust-lang.org)
6
+ [![Python](https://img.shields.io/badge/Python-3.8%2B-blue)](https://python.org)
7
+ [![License](https://img.shields.io/badge/License-MIT-green)](LICENSE)
8
+ [![Tests](https://img.shields.io/badge/Tests-150%20passed-brightgreen)]()
9
+
10
+ 覆盖 8 个求解器模块,全部纯 Rust 实现,无外部求解器依赖。提供 Rust 库、CLI 命令行和 Python wheel 三种使用方式。
11
+
12
+ ### 求解器模块
13
+
14
+ | 模块 | 算法 | 输入格式 |
15
+ |------|------|----------|
16
+ | **SAT** | CDCL + Two-Watched Literals + VSIDS | DIMACS CNF |
17
+ | **LP** | 两阶段单纯形法(精确有理数) | 自定义文本格式 |
18
+ | **SMT** | CDCL(T) + Congruence Closure(QF_UF)| SMT-LIB |
19
+ | **MILP** | 分支定界(LP Relaxation + McCormick)| 自定义文本格式 |
20
+ | **CP** | 传播 + 回溯(First-Fail 搜索)| 自定义文本格式 |
21
+ | **MINLP** | 区间传播 + McCormick 松弛 | 自定义文本格式 |
22
+
23
+ ### 安装
24
+
25
+ #### Rust
26
+ ```bash
27
+ git clone https://github.com/MBpanzz/dsuni.git
28
+ cd dsuni
29
+ cargo build --release
30
+ cargo test # 150 tests
31
+ ```
32
+
33
+ #### Python(从源码)
34
+ ```bash
35
+ pip install maturin
36
+ maturin build --release
37
+ pip install target/wheels/dsuni-*.whl
38
+ ```
39
+
40
+ #### Python(从 PyPI)
41
+ ```bash
42
+ pip install dsuni
43
+ ```
44
+
45
+ ### 快速开始
46
+
47
+ #### CLI
48
+ ```bash
49
+ # SAT
50
+ dsuni sat test_data/unsat_unit.cnf
51
+ # → UNSAT
52
+
53
+ # LP
54
+ dsuni lp test_data/simple.lp
55
+ # → OPTIMAL (obj=-5) / Model: [x0 -> 5]
56
+
57
+ # MILP
58
+ dsuni milp test_data/simple_milp.lp
59
+ # → OPTIMAL (obj=-5) / Model: [x0 -> 5]
60
+ ```
61
+
62
+ #### Python
63
+ ```python
64
+ import dsuni
65
+
66
+ # SAT (DIMACS CNF)
67
+ r = dsuni.solve_sat("p cnf 1 2\n1 0\n-1 0\n")
68
+ print(r) # {'status': 'UNSAT'}
69
+
70
+ # LP
71
+ r = dsuni.solve_lp_text("min -1*x0\nx0 <= 5\nx0 >= 0\n")
72
+ print(r) # {'status': 'OPTIMAL', 'model': {'x0': 5}, 'objective': -5.0}
73
+
74
+ # MILP
75
+ r = dsuni.solve_milp_text("int x0\nmin -1*x0\nx0 <= 5\nx0 >= 0\n")
76
+ print(r) # {'status': 'OPTIMAL', 'model': {'x0': 5}, 'objective': -5.0}
77
+
78
+ # CP
79
+ r = dsuni.solve_cp_text("var x 0 10\nvar y 0 10\neq x y\n")
80
+ print(r) # {'status': 'SAT', 'model': {'x0': 0, 'x1': 0}}
81
+ ```
82
+
83
+ ### 项目结构
84
+
85
+ ```
86
+ src/
87
+ ├── core/ → 基础类型(Var / Term / Config / SolverResult)
88
+ ├── sat/ → CDCL SAT 求解器
89
+ ├── linear/ → Rational / 线性表达式 / 线性系统
90
+ ├── lp/ → 两阶段单纯形法
91
+ ├── milp/ → 分支定界 MILP
92
+ ├── smt/ → CDCL(T) + QF_UF / QF_LRA
93
+ ├── cp/ → 传播 + 回溯 CP
94
+ ├── minlp/ → 区间传播 + McCormick 松弛
95
+ ├── parser/ → DIMACS / LP / SMT-LIB / CP 格式解析器
96
+ ├── cli/ → CLI 命令定义
97
+ └── python.rs → PyO3 Python 绑定
98
+ test_data/ → 14 个测试输入文件
99
+ ```
100
+
101
+ ### 许可证
102
+
103
+ MIT License © 2025 MBpanzz
@@ -0,0 +1,35 @@
1
+ [build-system]
2
+ requires = ["maturin>=1.0,<2.0"]
3
+ build-backend = "maturin"
4
+
5
+ [project]
6
+ name = "dsuni"
7
+ version = "0.1.0"
8
+ description = "A modular constraint solver — SAT, SMT, LP, MILP, CP, MINLP"
9
+ readme = "README.md"
10
+ license = { text = "MIT" }
11
+ requires-python = ">=3.8"
12
+ keywords = ["solver", "sat", "smt", "linear-programming", "optimization", "constraint-programming"]
13
+ classifiers = [
14
+ "Development Status :: 3 - Alpha",
15
+ "Intended Audience :: Science/Research",
16
+ "License :: OSI Approved :: MIT License",
17
+ "Programming Language :: Rust",
18
+ "Programming Language :: Python :: 3",
19
+ "Programming Language :: Python :: 3.8",
20
+ "Programming Language :: Python :: 3.9",
21
+ "Programming Language :: Python :: 3.10",
22
+ "Programming Language :: Python :: 3.11",
23
+ "Programming Language :: Python :: 3.12",
24
+ "Programming Language :: Python :: 3.13",
25
+ "Topic :: Scientific/Engineering :: Mathematics",
26
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
27
+ ]
28
+
29
+ [project.urls]
30
+ Homepage = "https://github.com/MBpanzz/dsuni"
31
+ Repository = "https://github.com/MBpanzz/dsuni"
32
+
33
+ [tool.maturin]
34
+ features = ["python"]
35
+ default-features = false