coalns 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.
- coalns-0.1.0/COMMERCIAL_LICENSE.md +25 -0
- coalns-0.1.0/Cargo.lock +270 -0
- coalns-0.1.0/Cargo.toml +31 -0
- coalns-0.1.0/LICENSE +144 -0
- coalns-0.1.0/PKG-INFO +202 -0
- coalns-0.1.0/README.md +160 -0
- coalns-0.1.0/pyproject.toml +80 -0
- coalns-0.1.0/rust/lib.rs +1447 -0
- coalns-0.1.0/src/coalns/__init__.py +104 -0
- coalns-0.1.0/src/coalns/_core.pyi +80 -0
- coalns-0.1.0/src/coalns/accept.py +191 -0
- coalns-0.1.0/src/coalns/archive.py +323 -0
- coalns-0.1.0/src/coalns/components.py +47 -0
- coalns-0.1.0/src/coalns/engine.py +1176 -0
- coalns-0.1.0/src/coalns/experiment.py +209 -0
- coalns-0.1.0/src/coalns/islands.py +522 -0
- coalns-0.1.0/src/coalns/kernels.py +253 -0
- coalns-0.1.0/src/coalns/operators.py +765 -0
- coalns-0.1.0/src/coalns/problem.py +206 -0
- coalns-0.1.0/src/coalns/py.typed +0 -0
- coalns-0.1.0/src/coalns/select.py +396 -0
- coalns-0.1.0/src/coalns/state.py +349 -0
- coalns-0.1.0/src/coalns/strategies.py +279 -0
- coalns-0.1.0/src/coalns/telemetry.py +207 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Commercial Licensing for CoALNS
|
|
2
|
+
|
|
3
|
+
`CoALNS` is source-visible and free to use for **academic research, teaching,
|
|
4
|
+
personal experimentation, and non-commercial benchmarking** under the
|
|
5
|
+
`PolyForm-Noncommercial-1.0.0` license (see [LICENSE](LICENSE)).
|
|
6
|
+
|
|
7
|
+
## When a Commercial License Is Required
|
|
8
|
+
|
|
9
|
+
A commercial license is required if you or your organization use `CoALNS` to:
|
|
10
|
+
|
|
11
|
+
- Deploy optimization services or decision-support tools inside a for-profit business;
|
|
12
|
+
- Embed `CoALNS` in a commercial software product, library, or SaaS offering;
|
|
13
|
+
- Deliver paid consulting or industrial optimization engagements powered by `CoALNS`.
|
|
14
|
+
|
|
15
|
+
## Academic & Citation Policy
|
|
16
|
+
|
|
17
|
+
Academic researchers using `CoALNS` in scientific publications are encouraged
|
|
18
|
+
to cite the accompanying *CoALNS* methodology paper (BibTeX provided in
|
|
19
|
+
[README.md](README.md)).
|
|
20
|
+
|
|
21
|
+
## Inquiries
|
|
22
|
+
|
|
23
|
+
To request a commercial license, custom solver engineering, or enterprise
|
|
24
|
+
support, please contact Mikele Gajda via the repository issue tracker or
|
|
25
|
+
institutional email listed in the paper.
|
coalns-0.1.0/Cargo.lock
ADDED
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
# This file is automatically @generated by Cargo.
|
|
2
|
+
# It is not intended for manual editing.
|
|
3
|
+
version = 4
|
|
4
|
+
|
|
5
|
+
[[package]]
|
|
6
|
+
name = "autocfg"
|
|
7
|
+
version = "1.5.1"
|
|
8
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
9
|
+
checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53"
|
|
10
|
+
|
|
11
|
+
[[package]]
|
|
12
|
+
name = "cfg-if"
|
|
13
|
+
version = "1.0.5"
|
|
14
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
15
|
+
checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600"
|
|
16
|
+
|
|
17
|
+
[[package]]
|
|
18
|
+
name = "coalns_core"
|
|
19
|
+
version = "0.1.0"
|
|
20
|
+
dependencies = [
|
|
21
|
+
"numpy",
|
|
22
|
+
"pyo3",
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
[[package]]
|
|
26
|
+
name = "heck"
|
|
27
|
+
version = "0.5.0"
|
|
28
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
29
|
+
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
|
30
|
+
|
|
31
|
+
[[package]]
|
|
32
|
+
name = "indoc"
|
|
33
|
+
version = "2.0.8"
|
|
34
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
35
|
+
checksum = "a37b2691796cffeb8a8cd305ac66e65841559f147f4e63231d0eafa4db5384d1"
|
|
36
|
+
dependencies = [
|
|
37
|
+
"rustversion",
|
|
38
|
+
]
|
|
39
|
+
|
|
40
|
+
[[package]]
|
|
41
|
+
name = "libc"
|
|
42
|
+
version = "0.2.191"
|
|
43
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
44
|
+
checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a"
|
|
45
|
+
|
|
46
|
+
[[package]]
|
|
47
|
+
name = "matrixmultiply"
|
|
48
|
+
version = "0.3.11"
|
|
49
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
50
|
+
checksum = "3f607c237553f086e7043417a51df26b2eb899d3caff94e6a67592ff992fedc7"
|
|
51
|
+
dependencies = [
|
|
52
|
+
"autocfg",
|
|
53
|
+
"rawpointer",
|
|
54
|
+
]
|
|
55
|
+
|
|
56
|
+
[[package]]
|
|
57
|
+
name = "memoffset"
|
|
58
|
+
version = "0.9.1"
|
|
59
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
60
|
+
checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a"
|
|
61
|
+
dependencies = [
|
|
62
|
+
"autocfg",
|
|
63
|
+
]
|
|
64
|
+
|
|
65
|
+
[[package]]
|
|
66
|
+
name = "ndarray"
|
|
67
|
+
version = "0.16.1"
|
|
68
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
69
|
+
checksum = "882ed72dce9365842bf196bdeedf5055305f11fc8c03dee7bb0194a6cad34841"
|
|
70
|
+
dependencies = [
|
|
71
|
+
"matrixmultiply",
|
|
72
|
+
"num-complex",
|
|
73
|
+
"num-integer",
|
|
74
|
+
"num-traits",
|
|
75
|
+
"portable-atomic",
|
|
76
|
+
"portable-atomic-util",
|
|
77
|
+
"rawpointer",
|
|
78
|
+
]
|
|
79
|
+
|
|
80
|
+
[[package]]
|
|
81
|
+
name = "num-complex"
|
|
82
|
+
version = "0.4.6"
|
|
83
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
84
|
+
checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495"
|
|
85
|
+
dependencies = [
|
|
86
|
+
"num-traits",
|
|
87
|
+
]
|
|
88
|
+
|
|
89
|
+
[[package]]
|
|
90
|
+
name = "num-integer"
|
|
91
|
+
version = "0.1.47"
|
|
92
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
93
|
+
checksum = "7ce2d95d4b3734dc35aa2f45e1aa22cd416814592a4f9d9205e11affd5b8e10b"
|
|
94
|
+
dependencies = [
|
|
95
|
+
"num-traits",
|
|
96
|
+
]
|
|
97
|
+
|
|
98
|
+
[[package]]
|
|
99
|
+
name = "num-traits"
|
|
100
|
+
version = "0.2.19"
|
|
101
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
102
|
+
checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
|
|
103
|
+
dependencies = [
|
|
104
|
+
"autocfg",
|
|
105
|
+
]
|
|
106
|
+
|
|
107
|
+
[[package]]
|
|
108
|
+
name = "numpy"
|
|
109
|
+
version = "0.24.0"
|
|
110
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
111
|
+
checksum = "a7cfbf3f0feededcaa4d289fe3079b03659e85c5b5a177f4ba6fb01ab4fb3e39"
|
|
112
|
+
dependencies = [
|
|
113
|
+
"libc",
|
|
114
|
+
"ndarray",
|
|
115
|
+
"num-complex",
|
|
116
|
+
"num-integer",
|
|
117
|
+
"num-traits",
|
|
118
|
+
"pyo3",
|
|
119
|
+
"pyo3-build-config",
|
|
120
|
+
"rustc-hash",
|
|
121
|
+
]
|
|
122
|
+
|
|
123
|
+
[[package]]
|
|
124
|
+
name = "once_cell"
|
|
125
|
+
version = "1.21.4"
|
|
126
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
127
|
+
checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
|
|
128
|
+
|
|
129
|
+
[[package]]
|
|
130
|
+
name = "portable-atomic"
|
|
131
|
+
version = "1.15.0"
|
|
132
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
133
|
+
checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85"
|
|
134
|
+
|
|
135
|
+
[[package]]
|
|
136
|
+
name = "portable-atomic-util"
|
|
137
|
+
version = "0.2.8"
|
|
138
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
139
|
+
checksum = "10ab3eb7f3becc3a1cbc4f2c6f20267996cfc1a6467a873763411b136a122715"
|
|
140
|
+
dependencies = [
|
|
141
|
+
"portable-atomic",
|
|
142
|
+
]
|
|
143
|
+
|
|
144
|
+
[[package]]
|
|
145
|
+
name = "proc-macro2"
|
|
146
|
+
version = "1.0.107"
|
|
147
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
148
|
+
checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"
|
|
149
|
+
dependencies = [
|
|
150
|
+
"unicode-ident",
|
|
151
|
+
]
|
|
152
|
+
|
|
153
|
+
[[package]]
|
|
154
|
+
name = "pyo3"
|
|
155
|
+
version = "0.24.2"
|
|
156
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
157
|
+
checksum = "e5203598f366b11a02b13aa20cab591229ff0a89fd121a308a5df751d5fc9219"
|
|
158
|
+
dependencies = [
|
|
159
|
+
"cfg-if",
|
|
160
|
+
"indoc",
|
|
161
|
+
"libc",
|
|
162
|
+
"memoffset",
|
|
163
|
+
"once_cell",
|
|
164
|
+
"portable-atomic",
|
|
165
|
+
"pyo3-build-config",
|
|
166
|
+
"pyo3-ffi",
|
|
167
|
+
"pyo3-macros",
|
|
168
|
+
"unindent",
|
|
169
|
+
]
|
|
170
|
+
|
|
171
|
+
[[package]]
|
|
172
|
+
name = "pyo3-build-config"
|
|
173
|
+
version = "0.24.2"
|
|
174
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
175
|
+
checksum = "99636d423fa2ca130fa5acde3059308006d46f98caac629418e53f7ebb1e9999"
|
|
176
|
+
dependencies = [
|
|
177
|
+
"once_cell",
|
|
178
|
+
"target-lexicon",
|
|
179
|
+
]
|
|
180
|
+
|
|
181
|
+
[[package]]
|
|
182
|
+
name = "pyo3-ffi"
|
|
183
|
+
version = "0.24.2"
|
|
184
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
185
|
+
checksum = "78f9cf92ba9c409279bc3305b5409d90db2d2c22392d443a87df3a1adad59e33"
|
|
186
|
+
dependencies = [
|
|
187
|
+
"libc",
|
|
188
|
+
"pyo3-build-config",
|
|
189
|
+
]
|
|
190
|
+
|
|
191
|
+
[[package]]
|
|
192
|
+
name = "pyo3-macros"
|
|
193
|
+
version = "0.24.2"
|
|
194
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
195
|
+
checksum = "0b999cb1a6ce21f9a6b147dcf1be9ffedf02e0043aec74dc390f3007047cecd9"
|
|
196
|
+
dependencies = [
|
|
197
|
+
"proc-macro2",
|
|
198
|
+
"pyo3-macros-backend",
|
|
199
|
+
"quote",
|
|
200
|
+
"syn",
|
|
201
|
+
]
|
|
202
|
+
|
|
203
|
+
[[package]]
|
|
204
|
+
name = "pyo3-macros-backend"
|
|
205
|
+
version = "0.24.2"
|
|
206
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
207
|
+
checksum = "822ece1c7e1012745607d5cf0bcb2874769f0f7cb34c4cde03b9358eb9ef911a"
|
|
208
|
+
dependencies = [
|
|
209
|
+
"heck",
|
|
210
|
+
"proc-macro2",
|
|
211
|
+
"pyo3-build-config",
|
|
212
|
+
"quote",
|
|
213
|
+
"syn",
|
|
214
|
+
]
|
|
215
|
+
|
|
216
|
+
[[package]]
|
|
217
|
+
name = "quote"
|
|
218
|
+
version = "1.0.47"
|
|
219
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
220
|
+
checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001"
|
|
221
|
+
dependencies = [
|
|
222
|
+
"proc-macro2",
|
|
223
|
+
]
|
|
224
|
+
|
|
225
|
+
[[package]]
|
|
226
|
+
name = "rawpointer"
|
|
227
|
+
version = "0.2.1"
|
|
228
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
229
|
+
checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3"
|
|
230
|
+
|
|
231
|
+
[[package]]
|
|
232
|
+
name = "rustc-hash"
|
|
233
|
+
version = "2.1.3"
|
|
234
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
235
|
+
checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d"
|
|
236
|
+
|
|
237
|
+
[[package]]
|
|
238
|
+
name = "rustversion"
|
|
239
|
+
version = "1.0.23"
|
|
240
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
241
|
+
checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f"
|
|
242
|
+
|
|
243
|
+
[[package]]
|
|
244
|
+
name = "syn"
|
|
245
|
+
version = "2.0.119"
|
|
246
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
247
|
+
checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297"
|
|
248
|
+
dependencies = [
|
|
249
|
+
"proc-macro2",
|
|
250
|
+
"quote",
|
|
251
|
+
"unicode-ident",
|
|
252
|
+
]
|
|
253
|
+
|
|
254
|
+
[[package]]
|
|
255
|
+
name = "target-lexicon"
|
|
256
|
+
version = "0.13.6"
|
|
257
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
258
|
+
checksum = "8c447be3a2abfa84b2d91680c56600bd6b2873866de27b36ec911be705e291da"
|
|
259
|
+
|
|
260
|
+
[[package]]
|
|
261
|
+
name = "unicode-ident"
|
|
262
|
+
version = "1.0.27"
|
|
263
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
264
|
+
checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563"
|
|
265
|
+
|
|
266
|
+
[[package]]
|
|
267
|
+
name = "unindent"
|
|
268
|
+
version = "0.2.4"
|
|
269
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
270
|
+
checksum = "7264e107f553ccae879d21fbea1d6724ac785e8c3bfc762137959b5802826ef3"
|
coalns-0.1.0/Cargo.toml
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
[package]
|
|
2
|
+
name = "coalns_core"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
edition = "2021"
|
|
5
|
+
license = "PolyForm-Noncommercial-1.0.0"
|
|
6
|
+
description = "Compiled Rust structural distance and optimization kernels for CoALNS"
|
|
7
|
+
repository = "https://github.com/mikelegajda/CoALNS"
|
|
8
|
+
homepage = "https://github.com/mikelegajda/CoALNS"
|
|
9
|
+
documentation = "https://mikelegajda.github.io/CoALNS/"
|
|
10
|
+
include = [
|
|
11
|
+
"/rust/**",
|
|
12
|
+
"/Cargo.toml",
|
|
13
|
+
"/Cargo.lock",
|
|
14
|
+
"/LICENSE",
|
|
15
|
+
"/COMMERCIAL_LICENSE.md",
|
|
16
|
+
]
|
|
17
|
+
readme = "README.md"
|
|
18
|
+
|
|
19
|
+
[lib]
|
|
20
|
+
name = "_core"
|
|
21
|
+
path = "rust/lib.rs"
|
|
22
|
+
crate-type = ["cdylib"]
|
|
23
|
+
|
|
24
|
+
[dependencies]
|
|
25
|
+
pyo3 = { version = "0.24", features = ["extension-module", "abi3-py311"] }
|
|
26
|
+
numpy = "0.24"
|
|
27
|
+
|
|
28
|
+
[profile.release]
|
|
29
|
+
opt-level = 3
|
|
30
|
+
lto = "thin"
|
|
31
|
+
codegen-units = 1
|
coalns-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
CoALNS Dual License Notice
|
|
2
|
+
==========================
|
|
3
|
+
|
|
4
|
+
Copyright (c) 2026 Mikele Gajda.
|
|
5
|
+
|
|
6
|
+
This software is dual-licensed:
|
|
7
|
+
1. Non-commercial / academic / research use is governed by the PolyForm
|
|
8
|
+
Noncommercial License 1.0.0 reproduced in full below.
|
|
9
|
+
2. Commercial use requires a separate commercial license (see
|
|
10
|
+
COMMERCIAL_LICENSE.md).
|
|
11
|
+
|
|
12
|
+
==============================================================================
|
|
13
|
+
|
|
14
|
+
# PolyForm Noncommercial License 1.0.0
|
|
15
|
+
|
|
16
|
+
<https://polyformproject.org/licenses/noncommercial/1.0.0>
|
|
17
|
+
|
|
18
|
+
## Acceptance
|
|
19
|
+
|
|
20
|
+
In order to get any license under these terms, you must agree
|
|
21
|
+
to them as both strict obligations and conditions to all
|
|
22
|
+
your licenses.
|
|
23
|
+
|
|
24
|
+
## Copyright License
|
|
25
|
+
|
|
26
|
+
The licensor grants you a copyright license for the
|
|
27
|
+
software to do everything you might do with the software
|
|
28
|
+
that would otherwise infringe the licensor's copyright
|
|
29
|
+
in it for any permitted purpose. However, you may
|
|
30
|
+
only distribute the software according to [Distribution
|
|
31
|
+
License](#distribution-license) and make changes or new works
|
|
32
|
+
based on the software according to [Changes and New Works
|
|
33
|
+
License](#changes-and-new-works-license).
|
|
34
|
+
|
|
35
|
+
## Distribution License
|
|
36
|
+
|
|
37
|
+
The licensor grants you an additional copyright license
|
|
38
|
+
to distribute copies of the software. Your license
|
|
39
|
+
to distribute covers distributing the software with
|
|
40
|
+
changes and new works permitted by [Changes and New Works
|
|
41
|
+
License](#changes-and-new-works-license).
|
|
42
|
+
|
|
43
|
+
## Notices
|
|
44
|
+
|
|
45
|
+
You must ensure that anyone who gets a copy of any part of
|
|
46
|
+
the software from you also gets a copy of these terms or the
|
|
47
|
+
URL for them above, as well as copies of any plain-text lines
|
|
48
|
+
beginning with `Required Notice:` that the licensor provided
|
|
49
|
+
with the software. For example:
|
|
50
|
+
|
|
51
|
+
> Required Notice: Copyright Yoyodyne, Inc. (http://example.com)
|
|
52
|
+
|
|
53
|
+
## Changes and New Works License
|
|
54
|
+
|
|
55
|
+
The licensor grants you an additional copyright license to
|
|
56
|
+
make changes and new works based on the software for any
|
|
57
|
+
permitted purpose.
|
|
58
|
+
|
|
59
|
+
## Patent License
|
|
60
|
+
|
|
61
|
+
The licensor grants you a patent license for the software that
|
|
62
|
+
covers patent claims the licensor can license, or becomes able
|
|
63
|
+
to license, that you would infringe by using the software.
|
|
64
|
+
|
|
65
|
+
## Noncommercial Purposes
|
|
66
|
+
|
|
67
|
+
Any noncommercial purpose is a permitted purpose.
|
|
68
|
+
|
|
69
|
+
## Personal Uses
|
|
70
|
+
|
|
71
|
+
Personal use for research, experiment, and testing for
|
|
72
|
+
the benefit of public knowledge, personal study, private
|
|
73
|
+
entertainment, hobby projects, amateur pursuits, or religious
|
|
74
|
+
observance, without any anticipated commercial application,
|
|
75
|
+
is use for a permitted purpose.
|
|
76
|
+
|
|
77
|
+
## Noncommercial Organizations
|
|
78
|
+
|
|
79
|
+
Use by any charitable organization, educational institution,
|
|
80
|
+
public research organization, public safety or health
|
|
81
|
+
organization, environmental protection organization,
|
|
82
|
+
or government institution is use for a permitted purpose
|
|
83
|
+
regardless of the source of funding or obligations resulting
|
|
84
|
+
from the funding.
|
|
85
|
+
|
|
86
|
+
## Fair Use
|
|
87
|
+
|
|
88
|
+
You may have "fair use" rights for the software under the
|
|
89
|
+
law. These terms do not limit them.
|
|
90
|
+
|
|
91
|
+
## No Other Rights
|
|
92
|
+
|
|
93
|
+
These terms do not allow you to sublicense or transfer any of
|
|
94
|
+
your licenses to anyone else, or prevent the licensor from
|
|
95
|
+
granting licenses to anyone else. These terms do not imply
|
|
96
|
+
any other licenses.
|
|
97
|
+
|
|
98
|
+
## Patent Defense
|
|
99
|
+
|
|
100
|
+
If you make any written claim that the software infringes or
|
|
101
|
+
contributes to infringement of any patent, your patent license
|
|
102
|
+
for the software granted under these terms ends immediately. If
|
|
103
|
+
your company makes such a claim, your patent license ends
|
|
104
|
+
immediately for work on behalf of your company.
|
|
105
|
+
|
|
106
|
+
## Violations
|
|
107
|
+
|
|
108
|
+
The first time you are notified in writing that you have
|
|
109
|
+
violated any of these terms, or done anything with the software
|
|
110
|
+
not covered by your licenses, your licenses can nonetheless
|
|
111
|
+
continue if you come into full compliance with these terms,
|
|
112
|
+
and take practical steps to correct past violations, within
|
|
113
|
+
32 days of receiving notice. Otherwise, all your licenses
|
|
114
|
+
end immediately.
|
|
115
|
+
|
|
116
|
+
## No Liability
|
|
117
|
+
|
|
118
|
+
***As far as the law allows, the software comes as is, without
|
|
119
|
+
any warranty or condition, and the licensor will not be liable
|
|
120
|
+
to you for any damages arising out of these terms or the use
|
|
121
|
+
or nature of the software, under any kind of legal claim.***
|
|
122
|
+
|
|
123
|
+
## Definitions
|
|
124
|
+
|
|
125
|
+
The **licensor** is the individual or entity offering these
|
|
126
|
+
terms, and the **software** is the software the licensor makes
|
|
127
|
+
available under these terms.
|
|
128
|
+
|
|
129
|
+
**You** refers to the individual or entity agreeing to these
|
|
130
|
+
terms.
|
|
131
|
+
|
|
132
|
+
**Your company** is any legal entity, sole proprietorship,
|
|
133
|
+
or other kind of organization that you work for, plus all
|
|
134
|
+
organizations that have control over, are under the control of,
|
|
135
|
+
or are under common control with that organization. **Control**
|
|
136
|
+
means ownership of substantially all the assets of an entity,
|
|
137
|
+
or the power to direct its management and policies by vote,
|
|
138
|
+
contract, or otherwise. Control can be direct or indirect.
|
|
139
|
+
|
|
140
|
+
**Your licenses** are all the licenses granted to you for the
|
|
141
|
+
software under these terms.
|
|
142
|
+
|
|
143
|
+
**Use** means anything you do with the software requiring one
|
|
144
|
+
of your licenses.
|
coalns-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: coalns
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Classifier: Development Status :: 4 - Beta
|
|
5
|
+
Classifier: Intended Audience :: Science/Research
|
|
6
|
+
Classifier: Intended Audience :: Developers
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
11
|
+
Classifier: Programming Language :: Rust
|
|
12
|
+
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
13
|
+
Classifier: Typing :: Typed
|
|
14
|
+
Requires-Dist: numpy>=2.0.0
|
|
15
|
+
Requires-Dist: alns>=6.0.0 ; extra == 'alns-compat'
|
|
16
|
+
Requires-Dist: pytest>=8.0.0 ; extra == 'dev'
|
|
17
|
+
Requires-Dist: scipy>=1.13.0 ; extra == 'dev'
|
|
18
|
+
Requires-Dist: alns>=6.0.0 ; extra == 'dev'
|
|
19
|
+
Requires-Dist: maturin>=1.7.0 ; extra == 'dev'
|
|
20
|
+
Requires-Dist: mkdocs>=1.6.0 ; extra == 'docs'
|
|
21
|
+
Requires-Dist: mkdocs-material>=9.5.0 ; extra == 'docs'
|
|
22
|
+
Requires-Dist: mkdocstrings[python]>=0.26.0 ; extra == 'docs'
|
|
23
|
+
Requires-Dist: ruff>=0.8.0 ; extra == 'docs'
|
|
24
|
+
Requires-Dist: scipy>=1.13.0 ; extra == 'stats'
|
|
25
|
+
Provides-Extra: alns-compat
|
|
26
|
+
Provides-Extra: dev
|
|
27
|
+
Provides-Extra: docs
|
|
28
|
+
Provides-Extra: stats
|
|
29
|
+
License-File: LICENSE
|
|
30
|
+
Summary: CoALNS: Cooperative Adaptive Large Neighborhood Search in Python with Rust-accelerated structural kernels
|
|
31
|
+
Keywords: optimization,metaheuristics,alns,parallel-computing,operations-research,combinatorial-optimization,quality-diversity
|
|
32
|
+
Home-Page: https://github.com/mikelegajda/CoALNS
|
|
33
|
+
Author: Mikele Gajda
|
|
34
|
+
License: PolyForm-Noncommercial-1.0.0
|
|
35
|
+
Requires-Python: >=3.11
|
|
36
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
37
|
+
Project-URL: Documentation, https://mikelegajda.github.io/CoALNS/
|
|
38
|
+
Project-URL: Homepage, https://github.com/mikelegajda/CoALNS
|
|
39
|
+
Project-URL: Issues, https://github.com/mikelegajda/CoALNS/issues
|
|
40
|
+
Project-URL: Repository, https://github.com/mikelegajda/CoALNS
|
|
41
|
+
|
|
42
|
+
# CoALNS — Cooperative Adaptive Large Neighborhood Search
|
|
43
|
+
|
|
44
|
+
**[Documentation](https://mikelegajda.github.io/CoALNS/)** · **[Quickstart](https://mikelegajda.github.io/CoALNS/getting_started/quickstart/)** · **[Starter Template](https://mikelegajda.github.io/CoALNS/getting_started/template/)** · **[API Reference](https://mikelegajda.github.io/CoALNS/api/engine/)**
|
|
45
|
+
|
|
46
|
+
`coalns` is a problem-agnostic, multi-core **Cooperative Adaptive Large Neighborhood Search** library in Python (`>=3.11`) with optional Rust-accelerated structural kernels and zero mandatory dependencies beyond `numpy`.
|
|
47
|
+
|
|
48
|
+
Built to accompany the *CoALNS* methodological framework, it lets Operations Research researchers and practitioners:
|
|
49
|
+
|
|
50
|
+
1. **Define any combinatorial optimization problem progressively** — start in 20 lines with just `objective()` (drop-in compatible with `N-Wouda/ALNS`), then optionally add structural `distance()`, `<1 KB` `to_compact()` IPC, and Consensus-Guided Subproblem Relinking (`relink_towards()`).
|
|
51
|
+
2. **Author, compose, and audit operators safely** — use `@destroy` / `@repair`, `OperatorLibrary`, `compose()`, `parameterize()`, or bootstrap 6 standard ALNS operators automatically from an `ElementAdapter`, then run `verify_problem()` to catch mutation, non-determinism, infeasibility, and multiprocessing `pickle` bugs before launching a study.
|
|
52
|
+
3. **Switch and benchmark search strategies in one line** — compare `Strategy.coalns()`, `Strategy.epoch_sync()`, `Strategy.barrier_palns()`, `Strategy.multistart()`, `Strategy.single_alns()`, or `Strategy.custom(...)` fairly via `compare_strategies()`.
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## Installation
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
pip install coalns
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Optional extras:
|
|
63
|
+
```bash
|
|
64
|
+
pip install "coalns[stats]" # Wilcoxon signed-rank tests in compare_strategies()
|
|
65
|
+
pip install "coalns[alns-compat]" # N-Wouda/ALNS State interoperability
|
|
66
|
+
pip install "coalns[docs]" # Build MkDocs documentation locally
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
From source (requires Rust toolchain + `uv` or `maturin`):
|
|
70
|
+
```bash
|
|
71
|
+
uv run maturin develop --release
|
|
72
|
+
uv run pytest -v
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## Quickstart
|
|
78
|
+
|
|
79
|
+
```python
|
|
80
|
+
import numpy as np
|
|
81
|
+
import coalns as co
|
|
82
|
+
|
|
83
|
+
class MySolution(co.Solution):
|
|
84
|
+
def __init__(self, dist: np.ndarray, tour: list[int], removed: list[int] | None = None):
|
|
85
|
+
self.dist = dist
|
|
86
|
+
self.tour = tour
|
|
87
|
+
self.removed = removed or []
|
|
88
|
+
|
|
89
|
+
def copy(self) -> "MySolution":
|
|
90
|
+
return MySolution(self.dist, self.tour.copy(), self.removed.copy())
|
|
91
|
+
|
|
92
|
+
def objective(self) -> float:
|
|
93
|
+
n = len(self.tour)
|
|
94
|
+
return float(sum(self.dist[self.tour[i], self.tour[(i + 1) % n]] for i in range(n))) + 1e5 * len(self.removed)
|
|
95
|
+
|
|
96
|
+
@co.destroy(default_degree=0.20)
|
|
97
|
+
def random_destroy(state: MySolution, rng: np.random.Generator, degree: float = 0.20) -> MySolution:
|
|
98
|
+
out = state.copy()
|
|
99
|
+
k = max(2, int(len(out.tour) * degree))
|
|
100
|
+
idx = set(rng.choice(len(out.tour), size=k, replace=False).tolist())
|
|
101
|
+
out.removed = [out.tour[i] for i in sorted(idx)]
|
|
102
|
+
out.tour = [c for i, c in enumerate(out.tour) if i not in idx]
|
|
103
|
+
return out
|
|
104
|
+
|
|
105
|
+
@co.repair()
|
|
106
|
+
def greedy_repair(state: MySolution, rng: np.random.Generator) -> MySolution:
|
|
107
|
+
out = state.copy()
|
|
108
|
+
pending = out.removed.copy()
|
|
109
|
+
out.removed.clear()
|
|
110
|
+
rng.shuffle(pending)
|
|
111
|
+
for city in pending:
|
|
112
|
+
n = len(out.tour)
|
|
113
|
+
pos = min(range(n), key=lambda i: float(
|
|
114
|
+
out.dist[out.tour[i - 1], city] + out.dist[city, out.tour[i]] - out.dist[out.tour[i - 1], out.tour[i]]
|
|
115
|
+
))
|
|
116
|
+
out.tour.insert(pos, city)
|
|
117
|
+
return out
|
|
118
|
+
|
|
119
|
+
if __name__ == "__main__":
|
|
120
|
+
rng = np.random.default_rng(42)
|
|
121
|
+
coords = rng.uniform(0, 100, size=(60, 2))
|
|
122
|
+
dist = np.hypot(coords[:, None, 0] - coords[None, :, 0], coords[:, None, 1] - coords[None, :, 1])
|
|
123
|
+
|
|
124
|
+
problem = co.Problem(
|
|
125
|
+
name="TSP-60",
|
|
126
|
+
initial_solution=MySolution(dist, list(range(60))),
|
|
127
|
+
destroy_operators=[random_destroy],
|
|
128
|
+
repair_operators=[greedy_repair],
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
# 1. Pre-flight contract, spawn-picklability, and capability tier audit
|
|
132
|
+
report = co.verify_problem(problem)
|
|
133
|
+
print(report.summary())
|
|
134
|
+
|
|
135
|
+
# 2. Solve with Cooperative Asynchronous ALNS
|
|
136
|
+
solver = co.CoALNS(strategy=co.Strategy.coalns(n_workers=4), seed=42)
|
|
137
|
+
result = solver.solve(problem, max_time=1.0)
|
|
138
|
+
print(result.summary())
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
## Progressive 3-Tier Problem Design
|
|
144
|
+
|
|
145
|
+
| Tier | Methods on your `Solution` | What CoALNS Unlocks |
|
|
146
|
+
| :--- | :--- | :--- |
|
|
147
|
+
| **Tier 1** *(Minimal)* | `objective()`, `copy()` | Lock-free multi-core islands, orthogonal $2\times 2$ portfolio, frontier-advancement runtime-aware bandits, scale-invariant SA/RRT calibration |
|
|
148
|
+
| **Tier 2** *(Recommended)* | + `fingerprint()`, `distance(other)` (or `features()`), `to_compact()` / `from_compact()` | $O(1)$ archive deduplication, Quality–Diversity niche preservation, anti-herding stagnation migration, `< 1 KB` cross-process IPC |
|
|
149
|
+
| **Tier 3** *(Full CoALNS)* | + `relink_towards(elite, rng)`, `is_feasible()`, `diagnose()` | **Breakthrough-Gated Consensus Subproblem Search (CMSA)** with Leader Protection, automated feasibility gating, bottleneck telemetry |
|
|
150
|
+
|
|
151
|
+
Call `co.inspect_solution(sol)` or `co.verify_problem(problem)` at any time to see your active tier and tailored upgrade suggestions.
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## Comparing Strategies Fairly
|
|
156
|
+
|
|
157
|
+
```python
|
|
158
|
+
study = co.compare_strategies(
|
|
159
|
+
problem=problem,
|
|
160
|
+
strategies={
|
|
161
|
+
"Single ALNS": co.Strategy.single_alns(),
|
|
162
|
+
"MultiStart 4x": co.Strategy.multistart(n_workers=4),
|
|
163
|
+
"Barrier PALNS 4x": co.Strategy.barrier_palns(n_workers=4),
|
|
164
|
+
"CoALNS 4x": co.Strategy.coalns(n_workers=4),
|
|
165
|
+
},
|
|
166
|
+
seeds=[11, 29, 42, 77, 108],
|
|
167
|
+
max_time=2.0,
|
|
168
|
+
)
|
|
169
|
+
print(study.summary_table())
|
|
170
|
+
study.to_json("comparison.json")
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
## Worked Examples
|
|
176
|
+
|
|
177
|
+
- [`examples/01_quickstart_tsp.py`](examples/01_quickstart_tsp.py) — Tier-1 Euclidean TSP with `verify_problem()` and `Strategy.coalns()`.
|
|
178
|
+
- [`examples/02_archetypes_knapsack.py`](examples/02_archetypes_knapsack.py) — Instant 6-operator ALNS suite via `ElementAdapter` + `build_standard_archetypes()`.
|
|
179
|
+
- [`examples/03_tier3_vrp_cmsa.py`](examples/03_tier3_vrp_cmsa.py) — Full Tier-3 CVRP unlocking QD `broken_pairs_distance`, compact IPC, and CMSA relinking.
|
|
180
|
+
- [`examples/04_compare_strategies.py`](examples/04_compare_strategies.py) — Multi-seed benchmarking across all four canonical strategies.
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## License
|
|
185
|
+
|
|
186
|
+
`CoALNS` is **dual-licensed**:
|
|
187
|
+
- **Non-commercial / Academic / Research use:** Free under `PolyForm-Noncommercial-1.0.0` (see [LICENSE](LICENSE)).
|
|
188
|
+
- **Commercial use:** Requires a commercial license (see [COMMERCIAL_LICENSE.md](COMMERCIAL_LICENSE.md)).
|
|
189
|
+
|
|
190
|
+
## Citation
|
|
191
|
+
|
|
192
|
+
If you use `CoALNS` in academic work, please cite:
|
|
193
|
+
|
|
194
|
+
```bibtex
|
|
195
|
+
@article{gajda2026coalns,
|
|
196
|
+
title={Cooperative Adaptive Large Neighborhood Search: Lock-Free Quality--Diversity Archiving and Breakthrough-Gated Consensus Subproblem Search},
|
|
197
|
+
author={Gajda, Mikele},
|
|
198
|
+
year={2026},
|
|
199
|
+
note={Working paper}
|
|
200
|
+
}
|
|
201
|
+
```
|
|
202
|
+
|