@elaraai/east-py-datascience 0.0.2-beta.7 → 0.0.2-beta.71

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 (83) hide show
  1. package/README.md +42 -1
  2. package/dist/alns/alns.d.ts +528 -0
  3. package/dist/alns/alns.d.ts.map +1 -0
  4. package/dist/alns/alns.js +238 -0
  5. package/dist/alns/alns.js.map +1 -0
  6. package/dist/google_or/google_or.d.ts +2422 -0
  7. package/dist/google_or/google_or.d.ts.map +1 -0
  8. package/dist/google_or/google_or.js +542 -0
  9. package/dist/google_or/google_or.js.map +1 -0
  10. package/dist/gp/gp.d.ts +185 -136
  11. package/dist/gp/gp.d.ts.map +1 -1
  12. package/dist/gp/gp.js +64 -12
  13. package/dist/gp/gp.js.map +1 -1
  14. package/dist/index.d.ts +11 -4
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +20 -4
  17. package/dist/index.js.map +1 -1
  18. package/dist/lightgbm/lightgbm.d.ts +277 -196
  19. package/dist/lightgbm/lightgbm.d.ts.map +1 -1
  20. package/dist/lightgbm/lightgbm.js +104 -18
  21. package/dist/lightgbm/lightgbm.js.map +1 -1
  22. package/dist/lightning/lightning.d.ts +1594 -0
  23. package/dist/lightning/lightning.d.ts.map +1 -0
  24. package/dist/lightning/lightning.js +468 -0
  25. package/dist/lightning/lightning.js.map +1 -0
  26. package/dist/mads/mads.d.ts +109 -112
  27. package/dist/mads/mads.d.ts.map +1 -1
  28. package/dist/mads/mads.js +6 -8
  29. package/dist/mads/mads.js.map +1 -1
  30. package/dist/mapie/mapie.d.ts +3680 -0
  31. package/dist/mapie/mapie.d.ts.map +1 -0
  32. package/dist/mapie/mapie.js +616 -0
  33. package/dist/mapie/mapie.js.map +1 -0
  34. package/dist/ngboost/ngboost.d.ts +192 -142
  35. package/dist/ngboost/ngboost.d.ts.map +1 -1
  36. package/dist/ngboost/ngboost.js +67 -14
  37. package/dist/ngboost/ngboost.js.map +1 -1
  38. package/dist/optimization/optimization.d.ts +420 -0
  39. package/dist/optimization/optimization.d.ts.map +1 -0
  40. package/dist/optimization/optimization.js +257 -0
  41. package/dist/optimization/optimization.js.map +1 -0
  42. package/dist/optuna/optuna.d.ts +374 -314
  43. package/dist/optuna/optuna.d.ts.map +1 -1
  44. package/dist/optuna/optuna.js +2 -0
  45. package/dist/optuna/optuna.js.map +1 -1
  46. package/dist/pymc/pymc.d.ts +2932 -0
  47. package/dist/pymc/pymc.d.ts.map +1 -0
  48. package/dist/pymc/pymc.js +688 -0
  49. package/dist/pymc/pymc.js.map +1 -0
  50. package/dist/scipy/scipy.d.ts +1502 -463
  51. package/dist/scipy/scipy.d.ts.map +1 -1
  52. package/dist/scipy/scipy.js +554 -34
  53. package/dist/scipy/scipy.js.map +1 -1
  54. package/dist/shap/shap.d.ts +2623 -377
  55. package/dist/shap/shap.d.ts.map +1 -1
  56. package/dist/shap/shap.js +268 -26
  57. package/dist/shap/shap.js.map +1 -1
  58. package/dist/simanneal/simanneal.d.ts +257 -160
  59. package/dist/simanneal/simanneal.d.ts.map +1 -1
  60. package/dist/simanneal/simanneal.js +105 -8
  61. package/dist/simanneal/simanneal.js.map +1 -1
  62. package/dist/simulation/simulation.d.ts +431 -0
  63. package/dist/simulation/simulation.d.ts.map +1 -0
  64. package/dist/simulation/simulation.js +306 -0
  65. package/dist/simulation/simulation.js.map +1 -0
  66. package/dist/sklearn/sklearn.d.ts +5039 -1400
  67. package/dist/sklearn/sklearn.d.ts.map +1 -1
  68. package/dist/sklearn/sklearn.js +1042 -90
  69. package/dist/sklearn/sklearn.js.map +1 -1
  70. package/dist/torch/torch.d.ts +540 -416
  71. package/dist/torch/torch.d.ts.map +1 -1
  72. package/dist/torch/torch.js +109 -18
  73. package/dist/torch/torch.js.map +1 -1
  74. package/dist/tsconfig.tsbuildinfo +1 -1
  75. package/dist/types.d.ts +8 -45
  76. package/dist/types.d.ts.map +1 -1
  77. package/dist/types.js +8 -45
  78. package/dist/types.js.map +1 -1
  79. package/dist/xgboost/xgboost.d.ts +1109 -189
  80. package/dist/xgboost/xgboost.d.ts.map +1 -1
  81. package/dist/xgboost/xgboost.js +273 -18
  82. package/dist/xgboost/xgboost.js.map +1 -1
  83. package/package.json +4 -4
package/README.md CHANGED
@@ -14,6 +14,45 @@
14
14
  npm install @elaraai/east-py-datascience @elaraai/east
15
15
  ```
16
16
 
17
+ ### Python Optional Dependencies
18
+
19
+ Each module has its own optional Python dependencies to avoid installing unnecessary packages. Install only the extras you need:
20
+
21
+ ```bash
22
+ # Single extra
23
+ pip install "east-py-datascience[scipy]"
24
+
25
+ # Multiple extras
26
+ pip install "east-py-datascience[scipy,sklearn,xgboost]"
27
+
28
+ # All extras
29
+ pip install "east-py-datascience[all]"
30
+ ```
31
+
32
+ When using a git dependency in `pyproject.toml`:
33
+ ```toml
34
+ "east-py-datascience[scipy] @ git+https://github.com/elaraai/east-py@main#subdirectory=packages/east-py-datascience"
35
+ ```
36
+
37
+ | Module | Extra | Python Packages |
38
+ |--------|-------|-----------------|
39
+ | **MADS** | `mads` | PyNomadBBO |
40
+ | **Optuna** | `optuna` | optuna |
41
+ | **SimAnneal** | `simanneal` | simanneal |
42
+ | **Scipy** | `scipy` | scipy, cloudpickle |
43
+ | **Optimization** | *(none)* | *(core only — numpy)* |
44
+ | **GoogleOr** | `google-or` | ortools |
45
+ | **Sklearn** | `sklearn` | scikit-learn, skl2onnx, onnxruntime, cloudpickle |
46
+ | **XGBoost** | `xgboost` | xgboost, cloudpickle |
47
+ | **LightGBM** | `lightgbm` | lightgbm, cloudpickle |
48
+ | **NGBoost** | `ngboost` | ngboost, cloudpickle |
49
+ | **Torch** | `torch` | torch, cloudpickle |
50
+ | **GP** | `gp` | scikit-learn, cloudpickle |
51
+ | **Lightning** | `lightning` | torch, pytorch-lightning, cloudpickle |
52
+ | **Shap** | `shap` | shap, cloudpickle |
53
+ | **MAPIE** | `mapie` | mapie, cloudpickle |
54
+ | **ALNS** | `alns` | alns |
55
+
17
56
  ## Quick Start
18
57
 
19
58
  ```typescript
@@ -57,12 +96,14 @@ const optimize = East.function([], MADS.Types.ResultType, $ => {
57
96
  | **Optuna** | Bayesian optimization with TPE sampler | Hyperparameter tuning, mixed-type parameters, efficient search with few evaluations |
58
97
  | **SimAnneal** | Simulated annealing for discrete optimization | TSP, scheduling, subset selection, knapsack, assignment problems |
59
98
  | **Scipy** | Scientific optimization and curve fitting | Gradient-based minimization, curve fitting, interpolation, statistics |
99
+ | **Optimization** | Iterative coordinate descent optimization | Parameter tuning, sequential optimization across parameter groups |
100
+ | **GoogleOr** | Google OR-Tools constraint programming, routing, LP, and graph algorithms | CP-SAT, vehicle routing (TSP/VRP), linear/mixed-integer programming, min-cost flow, max flow, assignment |
60
101
 
61
102
  ### Machine Learning
62
103
 
63
104
  | Module | Description | Use Cases |
64
105
  |--------|-------------|-----------|
65
- | **Sklearn** | Core ML utilities from scikit-learn | Train/test split, preprocessing (StandardScaler, MinMaxScaler), metrics, multi-target regression |
106
+ | **Sklearn** | Core ML utilities from scikit-learn | Train/test split, preprocessing (StandardScaler, MinMaxScaler), metrics, multi-target regression, Gaussian Mixture Models |
66
107
  | **XGBoost** | Gradient boosting with XGBoost | Regression, classification, feature importance, fast training |
67
108
  | **LightGBM** | Fast gradient boosting with leaf-wise growth | Large datasets, high cardinality features, faster than XGBoost on big data |
68
109
  | **NGBoost** | Natural gradient boosting with uncertainty | Probabilistic predictions, confidence intervals, uncertainty quantification |
@@ -0,0 +1,528 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
+ */
5
+ /**
6
+ * ALNS (Adaptive Large Neighborhood Search) metaheuristic optimization.
7
+ *
8
+ * Provides combinatorial optimization using destroy-repair operators.
9
+ * ALNS is designed for discrete optimization problems where:
10
+ * - Solutions are combinatorial (assignments, schedules, routes)
11
+ * - Domain-specific destroy/repair operators can be defined
12
+ * - The objective function may be complex or black-box
13
+ * - Local search alone gets stuck in local minima
14
+ *
15
+ * @packageDocumentation
16
+ */
17
+ import { StructType, VariantType, OptionType, ArrayType, IntegerType, BooleanType, FloatType, NullType, FunctionType } from "@elaraai/east";
18
+ /**
19
+ * Simulated annealing acceptance configuration.
20
+ */
21
+ export declare const SimulatedAnnealingConfigType: StructType<{
22
+ /** Starting temperature (default: 100.0) */
23
+ readonly start_temperature: OptionType<FloatType>;
24
+ /** Ending temperature (default: 0.01) */
25
+ readonly end_temperature: OptionType<FloatType>;
26
+ /** Cooling step multiplier (default: 0.99) */
27
+ readonly step: OptionType<FloatType>;
28
+ }>;
29
+ /**
30
+ * Record-to-record travel acceptance configuration.
31
+ */
32
+ export declare const RecordToRecordConfigType: StructType<{
33
+ /** Threshold as fraction of best objective (default: 0.05) */
34
+ readonly threshold: OptionType<FloatType>;
35
+ }>;
36
+ /**
37
+ * Acceptance criterion variant.
38
+ *
39
+ * Controls whether to accept or reject new solutions:
40
+ * - `simulated_annealing`: Probabilistic acceptance based on temperature
41
+ * - `hill_climbing`: Only accept improving solutions
42
+ * - `record_to_record`: Accept if within threshold of best
43
+ */
44
+ export declare const AcceptanceCriterionType: VariantType<{
45
+ readonly simulated_annealing: StructType<{
46
+ /** Starting temperature (default: 100.0) */
47
+ readonly start_temperature: OptionType<FloatType>;
48
+ /** Ending temperature (default: 0.01) */
49
+ readonly end_temperature: OptionType<FloatType>;
50
+ /** Cooling step multiplier (default: 0.99) */
51
+ readonly step: OptionType<FloatType>;
52
+ }>;
53
+ readonly hill_climbing: NullType;
54
+ readonly record_to_record: StructType<{
55
+ /** Threshold as fraction of best objective (default: 0.05) */
56
+ readonly threshold: OptionType<FloatType>;
57
+ }>;
58
+ }>;
59
+ /**
60
+ * Roulette wheel selection configuration.
61
+ *
62
+ * Scores are applied when an operator finds: [new_best, better, accepted, rejected]
63
+ */
64
+ export declare const RouletteWheelConfigType: StructType<{
65
+ /** Scores for [new_best, better, accepted, rejected] (default: [33, 9, 3, 0]) */
66
+ readonly scores: OptionType<ArrayType<IntegerType>>;
67
+ /** Weight decay factor (default: 0.8) */
68
+ readonly decay: OptionType<FloatType>;
69
+ }>;
70
+ /**
71
+ * Operator selection strategy variant.
72
+ */
73
+ export declare const OperatorSelectionType: VariantType<{
74
+ readonly roulette_wheel: StructType<{
75
+ /** Scores for [new_best, better, accepted, rejected] (default: [33, 9, 3, 0]) */
76
+ readonly scores: OptionType<ArrayType<IntegerType>>;
77
+ /** Weight decay factor (default: 0.8) */
78
+ readonly decay: OptionType<FloatType>;
79
+ }>;
80
+ }>;
81
+ /**
82
+ * Stopping criterion variant.
83
+ *
84
+ * Controls when to stop the optimization:
85
+ * - `max_iterations`: Stop after N iterations
86
+ * - `max_runtime`: Stop after N seconds
87
+ * - `no_improvement`: Stop after N iterations without improvement
88
+ */
89
+ export declare const StopCriterionType: VariantType<{
90
+ readonly max_iterations: IntegerType;
91
+ readonly max_runtime: FloatType;
92
+ readonly no_improvement: IntegerType;
93
+ }>;
94
+ /**
95
+ * ALNS optimization configuration.
96
+ */
97
+ export declare const ALNSConfigType: StructType<{
98
+ /** Stopping criterion (default: max_iterations 1000) */
99
+ readonly stop: OptionType<VariantType<{
100
+ readonly max_iterations: IntegerType;
101
+ readonly max_runtime: FloatType;
102
+ readonly no_improvement: IntegerType;
103
+ }>>;
104
+ /** Acceptance criterion (default: simulated_annealing) */
105
+ readonly acceptance: OptionType<VariantType<{
106
+ readonly simulated_annealing: StructType<{
107
+ /** Starting temperature (default: 100.0) */
108
+ readonly start_temperature: OptionType<FloatType>;
109
+ /** Ending temperature (default: 0.01) */
110
+ readonly end_temperature: OptionType<FloatType>;
111
+ /** Cooling step multiplier (default: 0.99) */
112
+ readonly step: OptionType<FloatType>;
113
+ }>;
114
+ readonly hill_climbing: NullType;
115
+ readonly record_to_record: StructType<{
116
+ /** Threshold as fraction of best objective (default: 0.05) */
117
+ readonly threshold: OptionType<FloatType>;
118
+ }>;
119
+ }>>;
120
+ /** Operator selection strategy (default: roulette_wheel) */
121
+ readonly operator_selection: OptionType<VariantType<{
122
+ readonly roulette_wheel: StructType<{
123
+ /** Scores for [new_best, better, accepted, rejected] (default: [33, 9, 3, 0]) */
124
+ readonly scores: OptionType<ArrayType<IntegerType>>;
125
+ /** Weight decay factor (default: 0.8) */
126
+ readonly decay: OptionType<FloatType>;
127
+ }>;
128
+ }>>;
129
+ /** Random seed for reproducibility */
130
+ readonly seed: OptionType<IntegerType>;
131
+ }>;
132
+ /**
133
+ * ALNS optimization result type.
134
+ * Note: For generic platform usage, the result type is defined inline
135
+ * with "S" placeholder. This function is kept for backwards compatibility.
136
+ */
137
+ export declare const ALNSResultType: StructType<{
138
+ /** Best solution found */
139
+ readonly best_solution: "S";
140
+ /** Best objective value */
141
+ readonly best_objective: FloatType;
142
+ /** Number of iterations performed */
143
+ readonly iterations: IntegerType;
144
+ /** Total runtime in seconds */
145
+ readonly runtime: FloatType;
146
+ /** Whether optimization succeeded */
147
+ readonly success: BooleanType;
148
+ }>;
149
+ /**
150
+ * ALNS optimization platform function (generic over solution type S).
151
+ *
152
+ * Minimizes an objective function using destroy-repair operators.
153
+ * Operators are defined as S -> S functions that modify the solution.
154
+ *
155
+ * @example
156
+ * ```ts
157
+ * import { East, StructType, ArrayType, StringType, FloatType, variant } from "@elaraai/east";
158
+ * import { ALNS } from "@elaraai/east-py-datascience";
159
+ *
160
+ * const SolutionType = StructType({
161
+ * assignments: ArrayType(StringType),
162
+ * cost: FloatType,
163
+ * });
164
+ *
165
+ * const optimize = East.function([SolutionType], ALNS.Types.ResultType, ($, initial) => {
166
+ * // Define operators inline (they can access outer scope variables)
167
+ * const objective = East.function([SolutionType], FloatType, ($, s) => $.return(s.cost));
168
+ * const destroy = East.function([SolutionType], SolutionType, ($, s) => $.return(s));
169
+ * const repair = East.function([SolutionType], SolutionType, ($, s) => $.return(s));
170
+ *
171
+ * const config = $.let({
172
+ * stop: variant('some', variant('max_iterations', 1000n)),
173
+ * acceptance: variant('none', null),
174
+ * operator_selection: variant('none', null),
175
+ * seed: variant('some', 42n),
176
+ * });
177
+ *
178
+ * const result = $.let(ALNS.optimize([SolutionType], initial, objective, [destroy], [repair], config));
179
+ * $.return(result);
180
+ * });
181
+ * ```
182
+ */
183
+ export declare const alns_optimize: import("@elaraai/east").GenericPlatformDefinition<readonly ["S"], readonly ["S", FunctionType<["S"], FloatType>, ArrayType<FunctionType<["S"], "S">>, ArrayType<FunctionType<["S"], "S">>, StructType<{
184
+ /** Stopping criterion (default: max_iterations 1000) */
185
+ readonly stop: OptionType<VariantType<{
186
+ readonly max_iterations: IntegerType;
187
+ readonly max_runtime: FloatType;
188
+ readonly no_improvement: IntegerType;
189
+ }>>;
190
+ /** Acceptance criterion (default: simulated_annealing) */
191
+ readonly acceptance: OptionType<VariantType<{
192
+ readonly simulated_annealing: StructType<{
193
+ /** Starting temperature (default: 100.0) */
194
+ readonly start_temperature: OptionType<FloatType>;
195
+ /** Ending temperature (default: 0.01) */
196
+ readonly end_temperature: OptionType<FloatType>;
197
+ /** Cooling step multiplier (default: 0.99) */
198
+ readonly step: OptionType<FloatType>;
199
+ }>;
200
+ readonly hill_climbing: NullType;
201
+ readonly record_to_record: StructType<{
202
+ /** Threshold as fraction of best objective (default: 0.05) */
203
+ readonly threshold: OptionType<FloatType>;
204
+ }>;
205
+ }>>;
206
+ /** Operator selection strategy (default: roulette_wheel) */
207
+ readonly operator_selection: OptionType<VariantType<{
208
+ readonly roulette_wheel: StructType<{
209
+ /** Scores for [new_best, better, accepted, rejected] (default: [33, 9, 3, 0]) */
210
+ readonly scores: OptionType<ArrayType<IntegerType>>;
211
+ /** Weight decay factor (default: 0.8) */
212
+ readonly decay: OptionType<FloatType>;
213
+ }>;
214
+ }>>;
215
+ /** Random seed for reproducibility */
216
+ readonly seed: OptionType<IntegerType>;
217
+ }>], StructType<{
218
+ /** Best solution found */
219
+ readonly best_solution: "S";
220
+ /** Best objective value */
221
+ readonly best_objective: FloatType;
222
+ /** Number of iterations performed */
223
+ readonly iterations: IntegerType;
224
+ /** Total runtime in seconds */
225
+ readonly runtime: FloatType;
226
+ /** Whether optimization succeeded */
227
+ readonly success: BooleanType;
228
+ }>>;
229
+ /**
230
+ * Type definitions for ALNS optimization.
231
+ */
232
+ export declare const ALNSTypes: {
233
+ /** Simulated annealing config */
234
+ readonly SimulatedAnnealingConfigType: StructType<{
235
+ /** Starting temperature (default: 100.0) */
236
+ readonly start_temperature: OptionType<FloatType>;
237
+ /** Ending temperature (default: 0.01) */
238
+ readonly end_temperature: OptionType<FloatType>;
239
+ /** Cooling step multiplier (default: 0.99) */
240
+ readonly step: OptionType<FloatType>;
241
+ }>;
242
+ /** Record-to-record config */
243
+ readonly RecordToRecordConfigType: StructType<{
244
+ /** Threshold as fraction of best objective (default: 0.05) */
245
+ readonly threshold: OptionType<FloatType>;
246
+ }>;
247
+ /** Acceptance criterion variant */
248
+ readonly AcceptanceCriterionType: VariantType<{
249
+ readonly simulated_annealing: StructType<{
250
+ /** Starting temperature (default: 100.0) */
251
+ readonly start_temperature: OptionType<FloatType>;
252
+ /** Ending temperature (default: 0.01) */
253
+ readonly end_temperature: OptionType<FloatType>;
254
+ /** Cooling step multiplier (default: 0.99) */
255
+ readonly step: OptionType<FloatType>;
256
+ }>;
257
+ readonly hill_climbing: NullType;
258
+ readonly record_to_record: StructType<{
259
+ /** Threshold as fraction of best objective (default: 0.05) */
260
+ readonly threshold: OptionType<FloatType>;
261
+ }>;
262
+ }>;
263
+ /** Roulette wheel selection config */
264
+ readonly RouletteWheelConfigType: StructType<{
265
+ /** Scores for [new_best, better, accepted, rejected] (default: [33, 9, 3, 0]) */
266
+ readonly scores: OptionType<ArrayType<IntegerType>>;
267
+ /** Weight decay factor (default: 0.8) */
268
+ readonly decay: OptionType<FloatType>;
269
+ }>;
270
+ /** Operator selection variant */
271
+ readonly OperatorSelectionType: VariantType<{
272
+ readonly roulette_wheel: StructType<{
273
+ /** Scores for [new_best, better, accepted, rejected] (default: [33, 9, 3, 0]) */
274
+ readonly scores: OptionType<ArrayType<IntegerType>>;
275
+ /** Weight decay factor (default: 0.8) */
276
+ readonly decay: OptionType<FloatType>;
277
+ }>;
278
+ }>;
279
+ /** Stop criterion variant */
280
+ readonly StopCriterionType: VariantType<{
281
+ readonly max_iterations: IntegerType;
282
+ readonly max_runtime: FloatType;
283
+ readonly no_improvement: IntegerType;
284
+ }>;
285
+ /** Main configuration type */
286
+ readonly ConfigType: StructType<{
287
+ /** Stopping criterion (default: max_iterations 1000) */
288
+ readonly stop: OptionType<VariantType<{
289
+ readonly max_iterations: IntegerType;
290
+ readonly max_runtime: FloatType;
291
+ readonly no_improvement: IntegerType;
292
+ }>>;
293
+ /** Acceptance criterion (default: simulated_annealing) */
294
+ readonly acceptance: OptionType<VariantType<{
295
+ readonly simulated_annealing: StructType<{
296
+ /** Starting temperature (default: 100.0) */
297
+ readonly start_temperature: OptionType<FloatType>;
298
+ /** Ending temperature (default: 0.01) */
299
+ readonly end_temperature: OptionType<FloatType>;
300
+ /** Cooling step multiplier (default: 0.99) */
301
+ readonly step: OptionType<FloatType>;
302
+ }>;
303
+ readonly hill_climbing: NullType;
304
+ readonly record_to_record: StructType<{
305
+ /** Threshold as fraction of best objective (default: 0.05) */
306
+ readonly threshold: OptionType<FloatType>;
307
+ }>;
308
+ }>>;
309
+ /** Operator selection strategy (default: roulette_wheel) */
310
+ readonly operator_selection: OptionType<VariantType<{
311
+ readonly roulette_wheel: StructType<{
312
+ /** Scores for [new_best, better, accepted, rejected] (default: [33, 9, 3, 0]) */
313
+ readonly scores: OptionType<ArrayType<IntegerType>>;
314
+ /** Weight decay factor (default: 0.8) */
315
+ readonly decay: OptionType<FloatType>;
316
+ }>;
317
+ }>>;
318
+ /** Random seed for reproducibility */
319
+ readonly seed: OptionType<IntegerType>;
320
+ }>;
321
+ /** Result type (with "S" placeholder for solution type) */
322
+ readonly ResultType: StructType<{
323
+ /** Best solution found */
324
+ readonly best_solution: "S";
325
+ /** Best objective value */
326
+ readonly best_objective: FloatType;
327
+ /** Number of iterations performed */
328
+ readonly iterations: IntegerType;
329
+ /** Total runtime in seconds */
330
+ readonly runtime: FloatType;
331
+ /** Whether optimization succeeded */
332
+ readonly success: BooleanType;
333
+ }>;
334
+ };
335
+ /**
336
+ * ALNS (Adaptive Large Neighborhood Search) optimization.
337
+ *
338
+ * Provides combinatorial optimization using destroy-repair operators.
339
+ * ALNS is particularly effective for:
340
+ * - Scheduling and rostering problems
341
+ * - Vehicle routing problems
342
+ * - Resource allocation problems
343
+ * - Any problem where domain-specific operators can be designed
344
+ *
345
+ * @example
346
+ * ```ts
347
+ * import { East, StructType, FloatType, variant } from "@elaraai/east";
348
+ * import { ALNS } from "@elaraai/east-py-datascience";
349
+ *
350
+ * const SolutionType = StructType({ value: FloatType });
351
+ *
352
+ * const optimize = East.function([SolutionType], ALNS.Types.ResultType, ($, initial) => {
353
+ * const objective = East.function([SolutionType], FloatType, ($, s) => $.return(s.value));
354
+ * const destroy = East.function([SolutionType], SolutionType, ($, s) => $.return(s));
355
+ * const repair = East.function([SolutionType], SolutionType, ($, s) => $.return(s));
356
+ *
357
+ * const config = $.let({
358
+ * stop: variant('some', variant('max_iterations', 100n)),
359
+ * acceptance: variant('none', null),
360
+ * operator_selection: variant('none', null),
361
+ * seed: variant('some', 42n),
362
+ * });
363
+ *
364
+ * return $.return(ALNS.optimize([SolutionType], initial, objective, [destroy], [repair], config));
365
+ * });
366
+ * ```
367
+ */
368
+ export declare const ALNS: {
369
+ /**
370
+ * ALNS optimization (generic over solution type).
371
+ *
372
+ * Call with type parameter array first, then arguments:
373
+ * `ALNS.optimize([MySolutionType], initial, objective, destroys, repairs, config)`
374
+ */
375
+ readonly optimize: import("@elaraai/east").GenericPlatformDefinition<readonly ["S"], readonly ["S", FunctionType<["S"], FloatType>, ArrayType<FunctionType<["S"], "S">>, ArrayType<FunctionType<["S"], "S">>, StructType<{
376
+ /** Stopping criterion (default: max_iterations 1000) */
377
+ readonly stop: OptionType<VariantType<{
378
+ readonly max_iterations: IntegerType;
379
+ readonly max_runtime: FloatType;
380
+ readonly no_improvement: IntegerType;
381
+ }>>;
382
+ /** Acceptance criterion (default: simulated_annealing) */
383
+ readonly acceptance: OptionType<VariantType<{
384
+ readonly simulated_annealing: StructType<{
385
+ /** Starting temperature (default: 100.0) */
386
+ readonly start_temperature: OptionType<FloatType>;
387
+ /** Ending temperature (default: 0.01) */
388
+ readonly end_temperature: OptionType<FloatType>;
389
+ /** Cooling step multiplier (default: 0.99) */
390
+ readonly step: OptionType<FloatType>;
391
+ }>;
392
+ readonly hill_climbing: NullType;
393
+ readonly record_to_record: StructType<{
394
+ /** Threshold as fraction of best objective (default: 0.05) */
395
+ readonly threshold: OptionType<FloatType>;
396
+ }>;
397
+ }>>;
398
+ /** Operator selection strategy (default: roulette_wheel) */
399
+ readonly operator_selection: OptionType<VariantType<{
400
+ readonly roulette_wheel: StructType<{
401
+ /** Scores for [new_best, better, accepted, rejected] (default: [33, 9, 3, 0]) */
402
+ readonly scores: OptionType<ArrayType<IntegerType>>;
403
+ /** Weight decay factor (default: 0.8) */
404
+ readonly decay: OptionType<FloatType>;
405
+ }>;
406
+ }>>;
407
+ /** Random seed for reproducibility */
408
+ readonly seed: OptionType<IntegerType>;
409
+ }>], StructType<{
410
+ /** Best solution found */
411
+ readonly best_solution: "S";
412
+ /** Best objective value */
413
+ readonly best_objective: FloatType;
414
+ /** Number of iterations performed */
415
+ readonly iterations: IntegerType;
416
+ /** Total runtime in seconds */
417
+ readonly runtime: FloatType;
418
+ /** Whether optimization succeeded */
419
+ readonly success: BooleanType;
420
+ }>>;
421
+ /**
422
+ * Type definitions for ALNS functions.
423
+ */
424
+ readonly Types: {
425
+ /** Simulated annealing config */
426
+ readonly SimulatedAnnealingConfigType: StructType<{
427
+ /** Starting temperature (default: 100.0) */
428
+ readonly start_temperature: OptionType<FloatType>;
429
+ /** Ending temperature (default: 0.01) */
430
+ readonly end_temperature: OptionType<FloatType>;
431
+ /** Cooling step multiplier (default: 0.99) */
432
+ readonly step: OptionType<FloatType>;
433
+ }>;
434
+ /** Record-to-record config */
435
+ readonly RecordToRecordConfigType: StructType<{
436
+ /** Threshold as fraction of best objective (default: 0.05) */
437
+ readonly threshold: OptionType<FloatType>;
438
+ }>;
439
+ /** Acceptance criterion variant */
440
+ readonly AcceptanceCriterionType: VariantType<{
441
+ readonly simulated_annealing: StructType<{
442
+ /** Starting temperature (default: 100.0) */
443
+ readonly start_temperature: OptionType<FloatType>;
444
+ /** Ending temperature (default: 0.01) */
445
+ readonly end_temperature: OptionType<FloatType>;
446
+ /** Cooling step multiplier (default: 0.99) */
447
+ readonly step: OptionType<FloatType>;
448
+ }>;
449
+ readonly hill_climbing: NullType;
450
+ readonly record_to_record: StructType<{
451
+ /** Threshold as fraction of best objective (default: 0.05) */
452
+ readonly threshold: OptionType<FloatType>;
453
+ }>;
454
+ }>;
455
+ /** Roulette wheel selection config */
456
+ readonly RouletteWheelConfigType: StructType<{
457
+ /** Scores for [new_best, better, accepted, rejected] (default: [33, 9, 3, 0]) */
458
+ readonly scores: OptionType<ArrayType<IntegerType>>;
459
+ /** Weight decay factor (default: 0.8) */
460
+ readonly decay: OptionType<FloatType>;
461
+ }>;
462
+ /** Operator selection variant */
463
+ readonly OperatorSelectionType: VariantType<{
464
+ readonly roulette_wheel: StructType<{
465
+ /** Scores for [new_best, better, accepted, rejected] (default: [33, 9, 3, 0]) */
466
+ readonly scores: OptionType<ArrayType<IntegerType>>;
467
+ /** Weight decay factor (default: 0.8) */
468
+ readonly decay: OptionType<FloatType>;
469
+ }>;
470
+ }>;
471
+ /** Stop criterion variant */
472
+ readonly StopCriterionType: VariantType<{
473
+ readonly max_iterations: IntegerType;
474
+ readonly max_runtime: FloatType;
475
+ readonly no_improvement: IntegerType;
476
+ }>;
477
+ /** Main configuration type */
478
+ readonly ConfigType: StructType<{
479
+ /** Stopping criterion (default: max_iterations 1000) */
480
+ readonly stop: OptionType<VariantType<{
481
+ readonly max_iterations: IntegerType;
482
+ readonly max_runtime: FloatType;
483
+ readonly no_improvement: IntegerType;
484
+ }>>;
485
+ /** Acceptance criterion (default: simulated_annealing) */
486
+ readonly acceptance: OptionType<VariantType<{
487
+ readonly simulated_annealing: StructType<{
488
+ /** Starting temperature (default: 100.0) */
489
+ readonly start_temperature: OptionType<FloatType>;
490
+ /** Ending temperature (default: 0.01) */
491
+ readonly end_temperature: OptionType<FloatType>;
492
+ /** Cooling step multiplier (default: 0.99) */
493
+ readonly step: OptionType<FloatType>;
494
+ }>;
495
+ readonly hill_climbing: NullType;
496
+ readonly record_to_record: StructType<{
497
+ /** Threshold as fraction of best objective (default: 0.05) */
498
+ readonly threshold: OptionType<FloatType>;
499
+ }>;
500
+ }>>;
501
+ /** Operator selection strategy (default: roulette_wheel) */
502
+ readonly operator_selection: OptionType<VariantType<{
503
+ readonly roulette_wheel: StructType<{
504
+ /** Scores for [new_best, better, accepted, rejected] (default: [33, 9, 3, 0]) */
505
+ readonly scores: OptionType<ArrayType<IntegerType>>;
506
+ /** Weight decay factor (default: 0.8) */
507
+ readonly decay: OptionType<FloatType>;
508
+ }>;
509
+ }>>;
510
+ /** Random seed for reproducibility */
511
+ readonly seed: OptionType<IntegerType>;
512
+ }>;
513
+ /** Result type (with "S" placeholder for solution type) */
514
+ readonly ResultType: StructType<{
515
+ /** Best solution found */
516
+ readonly best_solution: "S";
517
+ /** Best objective value */
518
+ readonly best_objective: FloatType;
519
+ /** Number of iterations performed */
520
+ readonly iterations: IntegerType;
521
+ /** Total runtime in seconds */
522
+ readonly runtime: FloatType;
523
+ /** Whether optimization succeeded */
524
+ readonly success: BooleanType;
525
+ }>;
526
+ };
527
+ };
528
+ //# sourceMappingURL=alns.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alns.d.ts","sourceRoot":"","sources":["../../src/alns/alns.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;GAWG;AAEH,OAAO,EAEH,UAAU,EACV,WAAW,EACX,UAA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