@elaraai/east-py-datascience 1.0.0 → 1.0.1

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. package/package.json +3 -3
  2. package/dist/src/alns/alns.d.ts +0 -528
  3. package/dist/src/alns/alns.d.ts.map +0 -1
  4. package/dist/src/alns/alns.js +0 -238
  5. package/dist/src/alns/alns.js.map +0 -1
  6. package/dist/src/google_or/google_or.d.ts +0 -2457
  7. package/dist/src/google_or/google_or.d.ts.map +0 -1
  8. package/dist/src/google_or/google_or.js +0 -547
  9. package/dist/src/google_or/google_or.js.map +0 -1
  10. package/dist/src/gp/gp.d.ts +0 -447
  11. package/dist/src/gp/gp.d.ts.map +0 -1
  12. package/dist/src/gp/gp.js +0 -222
  13. package/dist/src/gp/gp.js.map +0 -1
  14. package/dist/src/index.d.ts +0 -34
  15. package/dist/src/index.d.ts.map +0 -1
  16. package/dist/src/index.js +0 -57
  17. package/dist/src/index.js.map +0 -1
  18. package/dist/src/lightgbm/lightgbm.d.ts +0 -575
  19. package/dist/src/lightgbm/lightgbm.d.ts.map +0 -1
  20. package/dist/src/lightgbm/lightgbm.js +0 -241
  21. package/dist/src/lightgbm/lightgbm.js.map +0 -1
  22. package/dist/src/lightning/lightning.d.ts +0 -1594
  23. package/dist/src/lightning/lightning.d.ts.map +0 -1
  24. package/dist/src/lightning/lightning.js +0 -468
  25. package/dist/src/lightning/lightning.js.map +0 -1
  26. package/dist/src/mads/mads.d.ts +0 -410
  27. package/dist/src/mads/mads.d.ts.map +0 -1
  28. package/dist/src/mads/mads.js +0 -219
  29. package/dist/src/mads/mads.js.map +0 -1
  30. package/dist/src/mapie/mapie.d.ts +0 -3680
  31. package/dist/src/mapie/mapie.d.ts.map +0 -1
  32. package/dist/src/mapie/mapie.js +0 -616
  33. package/dist/src/mapie/mapie.js.map +0 -1
  34. package/dist/src/ngboost/ngboost.d.ts +0 -483
  35. package/dist/src/ngboost/ngboost.d.ts.map +0 -1
  36. package/dist/src/ngboost/ngboost.js +0 -231
  37. package/dist/src/ngboost/ngboost.js.map +0 -1
  38. package/dist/src/optimization/optimization.d.ts +0 -700
  39. package/dist/src/optimization/optimization.d.ts.map +0 -1
  40. package/dist/src/optimization/optimization.js +0 -411
  41. package/dist/src/optimization/optimization.js.map +0 -1
  42. package/dist/src/optuna/optuna.d.ts +0 -857
  43. package/dist/src/optuna/optuna.d.ts.map +0 -1
  44. package/dist/src/optuna/optuna.js +0 -270
  45. package/dist/src/optuna/optuna.js.map +0 -1
  46. package/dist/src/pymc/pymc.d.ts +0 -2932
  47. package/dist/src/pymc/pymc.d.ts.map +0 -1
  48. package/dist/src/pymc/pymc.js +0 -688
  49. package/dist/src/pymc/pymc.js.map +0 -1
  50. package/dist/src/scipy/scipy.d.ts +0 -2205
  51. package/dist/src/scipy/scipy.d.ts.map +0 -1
  52. package/dist/src/scipy/scipy.js +0 -884
  53. package/dist/src/scipy/scipy.js.map +0 -1
  54. package/dist/src/shap/shap.d.ts +0 -4611
  55. package/dist/src/shap/shap.d.ts.map +0 -1
  56. package/dist/src/shap/shap.js +0 -552
  57. package/dist/src/shap/shap.js.map +0 -1
  58. package/dist/src/simanneal/simanneal.d.ts +0 -628
  59. package/dist/src/simanneal/simanneal.d.ts.map +0 -1
  60. package/dist/src/simanneal/simanneal.js +0 -328
  61. package/dist/src/simanneal/simanneal.js.map +0 -1
  62. package/dist/src/simulation/simulation.d.ts +0 -224
  63. package/dist/src/simulation/simulation.d.ts.map +0 -1
  64. package/dist/src/simulation/simulation.js +0 -189
  65. package/dist/src/simulation/simulation.js.map +0 -1
  66. package/dist/src/sklearn/sklearn.d.ts +0 -6362
  67. package/dist/src/sklearn/sklearn.d.ts.map +0 -1
  68. package/dist/src/sklearn/sklearn.js +0 -1508
  69. package/dist/src/sklearn/sklearn.js.map +0 -1
  70. package/dist/src/torch/torch.d.ts +0 -1205
  71. package/dist/src/torch/torch.d.ts.map +0 -1
  72. package/dist/src/torch/torch.js +0 -440
  73. package/dist/src/torch/torch.js.map +0 -1
  74. package/dist/src/types.d.ts +0 -43
  75. package/dist/src/types.d.ts.map +0 -1
  76. package/dist/src/types.js +0 -44
  77. package/dist/src/types.js.map +0 -1
  78. package/dist/src/xgboost/xgboost.d.ts +0 -1424
  79. package/dist/src/xgboost/xgboost.d.ts.map +0 -1
  80. package/dist/src/xgboost/xgboost.js +0 -432
  81. package/dist/src/xgboost/xgboost.js.map +0 -1
@@ -1,628 +0,0 @@
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
- * Discrete optimization using Simulated Annealing.
7
- *
8
- * Provides combinatorial optimization for discrete state spaces using the
9
- * simanneal library. Ideal for:
10
- * - Permutation problems (TSP, scheduling)
11
- * - Subset selection (feature selection, knapsack)
12
- * - Assignment problems
13
- * - Any discrete optimization where gradient methods don't apply
14
- *
15
- * @packageDocumentation
16
- */
17
- import { StructType, VariantType, OptionType, IntegerType, FloatType, BooleanType, FunctionType, VectorType } from "@elaraai/east";
18
- /**
19
- * Discrete state type for simulated annealing.
20
- *
21
- * Supports different representations for combinatorial problems:
22
- * - int_array: Permutations, assignments, sequences of integers
23
- * - bool_array: Subset selections, binary decisions
24
- */
25
- export declare const DiscreteStateType: VariantType<{
26
- /** Integer array state (permutations, assignments) */
27
- readonly int_array: VectorType<IntegerType>;
28
- /** Boolean array state (subset selection) */
29
- readonly bool_array: VectorType<BooleanType>;
30
- }>;
31
- /**
32
- * Energy function type: state -> score.
33
- *
34
- * Computes the objective value (energy) for a given state.
35
- * Lower energy is better (minimization).
36
- */
37
- export declare const EnergyFunctionType: FunctionType<[VariantType<{
38
- /** Integer array state (permutations, assignments) */
39
- readonly int_array: VectorType<IntegerType>;
40
- /** Boolean array state (subset selection) */
41
- readonly bool_array: VectorType<BooleanType>;
42
- }>], FloatType>;
43
- /**
44
- * Move function type: state -> neighbor state.
45
- *
46
- * Generates a random neighbor of the current state.
47
- * Should make small, local changes (e.g., swap two elements).
48
- */
49
- export declare const MoveFunctionType: FunctionType<[VariantType<{
50
- /** Integer array state (permutations, assignments) */
51
- readonly int_array: VectorType<IntegerType>;
52
- /** Boolean array state (subset selection) */
53
- readonly bool_array: VectorType<BooleanType>;
54
- }>], VariantType<{
55
- /** Integer array state (permutations, assignments) */
56
- readonly int_array: VectorType<IntegerType>;
57
- /** Boolean array state (subset selection) */
58
- readonly bool_array: VectorType<BooleanType>;
59
- }>>;
60
- /**
61
- * Permutation energy function type.
62
- *
63
- * Specialized for permutation-based optimization.
64
- */
65
- export declare const PermutationEnergyType: FunctionType<[VectorType<IntegerType>], FloatType>;
66
- /**
67
- * Subset energy function type.
68
- *
69
- * Specialized for subset selection optimization.
70
- */
71
- export declare const SubsetEnergyType: FunctionType<[VectorType<BooleanType>], FloatType>;
72
- /**
73
- * Simulated annealing configuration.
74
- */
75
- export declare const AnnealConfigType: StructType<{
76
- /** Starting temperature (default: 25000.0) */
77
- readonly t_max: OptionType<FloatType>;
78
- /** Ending temperature (default: 2.5) */
79
- readonly t_min: OptionType<FloatType>;
80
- /** Total iterations (default: 50000) */
81
- readonly steps: OptionType<IntegerType>;
82
- /** Progress report frequency (default: 0 = silent) */
83
- readonly updates: OptionType<IntegerType>;
84
- /** Minutes for auto-calibration (default: none) */
85
- readonly auto_schedule: OptionType<FloatType>;
86
- /** Random seed for reproducibility */
87
- readonly random_state: OptionType<IntegerType>;
88
- }>;
89
- /**
90
- * Simulated annealing result.
91
- */
92
- export declare const AnnealResultType: StructType<{
93
- /** Best state found */
94
- readonly best_state: VariantType<{
95
- /** Integer array state (permutations, assignments) */
96
- readonly int_array: VectorType<IntegerType>;
97
- /** Boolean array state (subset selection) */
98
- readonly bool_array: VectorType<BooleanType>;
99
- }>;
100
- /** Energy of best state */
101
- readonly best_energy: FloatType;
102
- /** Actual iterations performed */
103
- readonly steps_taken: IntegerType;
104
- /** Whether optimization completed successfully */
105
- readonly success: BooleanType;
106
- }>;
107
- /**
108
- * Run simulated annealing on a discrete state space.
109
- *
110
- * Uses custom energy and move functions for flexible optimization.
111
- *
112
- * @param initial_state - Starting state
113
- * @param energy_fn - Function to compute state energy (lower is better)
114
- * @param move_fn - Function to generate neighbor states
115
- * @param config - Annealing schedule configuration
116
- * @returns Result with best state and energy
117
- */
118
- export declare const simanneal_optimize: import("@elaraai/east").PlatformDefinition<[VariantType<{
119
- /** Integer array state (permutations, assignments) */
120
- readonly int_array: VectorType<IntegerType>;
121
- /** Boolean array state (subset selection) */
122
- readonly bool_array: VectorType<BooleanType>;
123
- }>, FunctionType<[VariantType<{
124
- /** Integer array state (permutations, assignments) */
125
- readonly int_array: VectorType<IntegerType>;
126
- /** Boolean array state (subset selection) */
127
- readonly bool_array: VectorType<BooleanType>;
128
- }>], FloatType>, FunctionType<[VariantType<{
129
- /** Integer array state (permutations, assignments) */
130
- readonly int_array: VectorType<IntegerType>;
131
- /** Boolean array state (subset selection) */
132
- readonly bool_array: VectorType<BooleanType>;
133
- }>], VariantType<{
134
- /** Integer array state (permutations, assignments) */
135
- readonly int_array: VectorType<IntegerType>;
136
- /** Boolean array state (subset selection) */
137
- readonly bool_array: VectorType<BooleanType>;
138
- }>>, StructType<{
139
- /** Starting temperature (default: 25000.0) */
140
- readonly t_max: OptionType<FloatType>;
141
- /** Ending temperature (default: 2.5) */
142
- readonly t_min: OptionType<FloatType>;
143
- /** Total iterations (default: 50000) */
144
- readonly steps: OptionType<IntegerType>;
145
- /** Progress report frequency (default: 0 = silent) */
146
- readonly updates: OptionType<IntegerType>;
147
- /** Minutes for auto-calibration (default: none) */
148
- readonly auto_schedule: OptionType<FloatType>;
149
- /** Random seed for reproducibility */
150
- readonly random_state: OptionType<IntegerType>;
151
- }>], StructType<{
152
- /** Best state found */
153
- readonly best_state: VariantType<{
154
- /** Integer array state (permutations, assignments) */
155
- readonly int_array: VectorType<IntegerType>;
156
- /** Boolean array state (subset selection) */
157
- readonly bool_array: VectorType<BooleanType>;
158
- }>;
159
- /** Energy of best state */
160
- readonly best_energy: FloatType;
161
- /** Actual iterations performed */
162
- readonly steps_taken: IntegerType;
163
- /** Whether optimization completed successfully */
164
- readonly success: BooleanType;
165
- }>>;
166
- /**
167
- * Run simulated annealing on a permutation with swap moves.
168
- *
169
- * Convenience function for permutation-based problems (TSP, scheduling).
170
- * Automatically uses swap moves to generate neighbors.
171
- *
172
- * @param initial_perm - Starting permutation
173
- * @param energy_fn - Function to compute permutation energy
174
- * @param config - Annealing schedule configuration
175
- * @returns Result with best permutation and energy
176
- */
177
- export declare const simanneal_optimize_permutation: import("@elaraai/east").PlatformDefinition<[VectorType<IntegerType>, FunctionType<[VectorType<IntegerType>], FloatType>, StructType<{
178
- /** Starting temperature (default: 25000.0) */
179
- readonly t_max: OptionType<FloatType>;
180
- /** Ending temperature (default: 2.5) */
181
- readonly t_min: OptionType<FloatType>;
182
- /** Total iterations (default: 50000) */
183
- readonly steps: OptionType<IntegerType>;
184
- /** Progress report frequency (default: 0 = silent) */
185
- readonly updates: OptionType<IntegerType>;
186
- /** Minutes for auto-calibration (default: none) */
187
- readonly auto_schedule: OptionType<FloatType>;
188
- /** Random seed for reproducibility */
189
- readonly random_state: OptionType<IntegerType>;
190
- }>], StructType<{
191
- /** Best state found */
192
- readonly best_state: VariantType<{
193
- /** Integer array state (permutations, assignments) */
194
- readonly int_array: VectorType<IntegerType>;
195
- /** Boolean array state (subset selection) */
196
- readonly bool_array: VectorType<BooleanType>;
197
- }>;
198
- /** Energy of best state */
199
- readonly best_energy: FloatType;
200
- /** Actual iterations performed */
201
- readonly steps_taken: IntegerType;
202
- /** Whether optimization completed successfully */
203
- readonly success: BooleanType;
204
- }>>;
205
- /**
206
- * Run simulated annealing on a subset selection with bit-flip moves.
207
- *
208
- * Convenience function for subset selection problems (feature selection, knapsack).
209
- * Automatically uses bit-flip moves to generate neighbors.
210
- *
211
- * @param initial_selection - Starting selection (boolean array)
212
- * @param energy_fn - Function to compute selection energy
213
- * @param config - Annealing schedule configuration
214
- * @returns Result with best selection and energy
215
- */
216
- export declare const simanneal_optimize_subset: import("@elaraai/east").PlatformDefinition<[VectorType<BooleanType>, FunctionType<[VectorType<BooleanType>], FloatType>, StructType<{
217
- /** Starting temperature (default: 25000.0) */
218
- readonly t_max: OptionType<FloatType>;
219
- /** Ending temperature (default: 2.5) */
220
- readonly t_min: OptionType<FloatType>;
221
- /** Total iterations (default: 50000) */
222
- readonly steps: OptionType<IntegerType>;
223
- /** Progress report frequency (default: 0 = silent) */
224
- readonly updates: OptionType<IntegerType>;
225
- /** Minutes for auto-calibration (default: none) */
226
- readonly auto_schedule: OptionType<FloatType>;
227
- /** Random seed for reproducibility */
228
- readonly random_state: OptionType<IntegerType>;
229
- }>], StructType<{
230
- /** Best state found */
231
- readonly best_state: VariantType<{
232
- /** Integer array state (permutations, assignments) */
233
- readonly int_array: VectorType<IntegerType>;
234
- /** Boolean array state (subset selection) */
235
- readonly bool_array: VectorType<BooleanType>;
236
- }>;
237
- /** Energy of best state */
238
- readonly best_energy: FloatType;
239
- /** Actual iterations performed */
240
- readonly steps_taken: IntegerType;
241
- /** Whether optimization completed successfully */
242
- readonly success: BooleanType;
243
- }>>;
244
- /**
245
- * Type definitions for Simulated Annealing.
246
- */
247
- export declare const SimAnnealTypes: {
248
- /** Discrete state type */
249
- readonly DiscreteStateType: VariantType<{
250
- /** Integer array state (permutations, assignments) */
251
- readonly int_array: VectorType<IntegerType>;
252
- /** Boolean array state (subset selection) */
253
- readonly bool_array: VectorType<BooleanType>;
254
- }>;
255
- /** Energy function type */
256
- readonly EnergyFunctionType: FunctionType<[VariantType<{
257
- /** Integer array state (permutations, assignments) */
258
- readonly int_array: VectorType<IntegerType>;
259
- /** Boolean array state (subset selection) */
260
- readonly bool_array: VectorType<BooleanType>;
261
- }>], FloatType>;
262
- /** Move function type */
263
- readonly MoveFunctionType: FunctionType<[VariantType<{
264
- /** Integer array state (permutations, assignments) */
265
- readonly int_array: VectorType<IntegerType>;
266
- /** Boolean array state (subset selection) */
267
- readonly bool_array: VectorType<BooleanType>;
268
- }>], VariantType<{
269
- /** Integer array state (permutations, assignments) */
270
- readonly int_array: VectorType<IntegerType>;
271
- /** Boolean array state (subset selection) */
272
- readonly bool_array: VectorType<BooleanType>;
273
- }>>;
274
- /** Permutation energy function type */
275
- readonly PermutationEnergyType: FunctionType<[VectorType<IntegerType>], FloatType>;
276
- /** Subset energy function type */
277
- readonly SubsetEnergyType: FunctionType<[VectorType<BooleanType>], FloatType>;
278
- /** Configuration type */
279
- readonly ConfigType: StructType<{
280
- /** Starting temperature (default: 25000.0) */
281
- readonly t_max: OptionType<FloatType>;
282
- /** Ending temperature (default: 2.5) */
283
- readonly t_min: OptionType<FloatType>;
284
- /** Total iterations (default: 50000) */
285
- readonly steps: OptionType<IntegerType>;
286
- /** Progress report frequency (default: 0 = silent) */
287
- readonly updates: OptionType<IntegerType>;
288
- /** Minutes for auto-calibration (default: none) */
289
- readonly auto_schedule: OptionType<FloatType>;
290
- /** Random seed for reproducibility */
291
- readonly random_state: OptionType<IntegerType>;
292
- }>;
293
- /** Result type */
294
- readonly ResultType: StructType<{
295
- /** Best state found */
296
- readonly best_state: VariantType<{
297
- /** Integer array state (permutations, assignments) */
298
- readonly int_array: VectorType<IntegerType>;
299
- /** Boolean array state (subset selection) */
300
- readonly bool_array: VectorType<BooleanType>;
301
- }>;
302
- /** Energy of best state */
303
- readonly best_energy: FloatType;
304
- /** Actual iterations performed */
305
- readonly steps_taken: IntegerType;
306
- /** Whether optimization completed successfully */
307
- readonly success: BooleanType;
308
- }>;
309
- };
310
- /**
311
- * Discrete optimization using Simulated Annealing.
312
- *
313
- * Provides combinatorial optimization for discrete state spaces.
314
- * Simulated annealing is a probabilistic technique that can escape
315
- * local minima by occasionally accepting worse solutions.
316
- *
317
- * Ideal for:
318
- * - Permutation problems (TSP, job scheduling)
319
- * - Subset selection (feature selection, knapsack)
320
- * - Assignment problems
321
- * - Any discrete optimization with many local minima
322
- *
323
- * @example
324
- * ```ts
325
- * import { East, FloatType, variant } from "@elaraai/east";
326
- * import { SimAnneal } from "@elaraai/east-py-datascience";
327
- *
328
- * // TSP: minimize total route distance
329
- * const energy = East.function(
330
- * [VectorType(IntegerType)],
331
- * FloatType,
332
- * ($, route) => {
333
- * // Calculate total route distance
334
- * return $.return(totalDistance);
335
- * }
336
- * );
337
- *
338
- * const config = $.let({
339
- * t_max: variant("some", 10000.0),
340
- * t_min: variant("some", 1.0),
341
- * steps: variant("some", 50000n),
342
- * updates: variant("none", null),
343
- * auto_schedule: variant("none", null),
344
- * random_state: variant("some", 42n),
345
- * });
346
- *
347
- * const result = SimAnneal.optimizePermutation(initial, energy, config);
348
- * ```
349
- */
350
- export declare const SimAnneal: {
351
- /**
352
- * Run simulated annealing with custom energy and move functions.
353
- *
354
- * @example
355
- * ```ts
356
- * import { East, FloatType, IntegerType, VectorType, variant } from "@elaraai/east";
357
- * import { SimAnneal, AnnealConfigType, DiscreteStateType } from "@elaraai/east-py-datascience";
358
- *
359
- * const solve = East.function([], SimAnneal.Types.ResultType, ($) => {
360
- * const energy = East.function([DiscreteStateType], FloatType, ($, state) => {
361
- * const cost = $.let(0.0);
362
- * $.match(state, {
363
- * int_array: ($, arr) => {
364
- * const a0 = $.let(arr.get(0n));
365
- * $.if(East.equal(a0, 2n), $ => {}).else($ => { $.assign(cost, cost.add(1.0)); });
366
- * },
367
- * bool_array: ($) => { $.assign(cost, 999.0); },
368
- * });
369
- * return $.return(cost);
370
- * });
371
- * const move = East.function([DiscreteStateType], DiscreteStateType, ($, state) => {
372
- * const result = $.let(state);
373
- * $.match(state, {
374
- * int_array: ($, arr) => {
375
- * const new_arr = $.let(East.Vector.fromArray([arr.get(0n).add(1n).remainder(3n), arr.get(1n), arr.get(2n)]));
376
- * $.assign(result, variant("int_array", new_arr));
377
- * },
378
- * bool_array: ($, arr) => { $.assign(result, variant("bool_array", arr)); },
379
- * });
380
- * return $.return(result);
381
- * });
382
- * const initial = $.let(variant("int_array", new BigInt64Array([0n, 0n, 0n])), DiscreteStateType);
383
- * const config = $.let({
384
- * t_max: variant("some", 100.0), t_min: variant("some", 0.01),
385
- * steps: variant("some", 1000n), updates: variant("none", null),
386
- * auto_schedule: variant("none", null), random_state: variant("some", 42n),
387
- * }, AnnealConfigType);
388
- * return $.return(SimAnneal.optimize(initial, energy, move, config));
389
- * });
390
- * ```
391
- */
392
- readonly optimize: import("@elaraai/east").PlatformDefinition<[VariantType<{
393
- /** Integer array state (permutations, assignments) */
394
- readonly int_array: VectorType<IntegerType>;
395
- /** Boolean array state (subset selection) */
396
- readonly bool_array: VectorType<BooleanType>;
397
- }>, FunctionType<[VariantType<{
398
- /** Integer array state (permutations, assignments) */
399
- readonly int_array: VectorType<IntegerType>;
400
- /** Boolean array state (subset selection) */
401
- readonly bool_array: VectorType<BooleanType>;
402
- }>], FloatType>, FunctionType<[VariantType<{
403
- /** Integer array state (permutations, assignments) */
404
- readonly int_array: VectorType<IntegerType>;
405
- /** Boolean array state (subset selection) */
406
- readonly bool_array: VectorType<BooleanType>;
407
- }>], VariantType<{
408
- /** Integer array state (permutations, assignments) */
409
- readonly int_array: VectorType<IntegerType>;
410
- /** Boolean array state (subset selection) */
411
- readonly bool_array: VectorType<BooleanType>;
412
- }>>, StructType<{
413
- /** Starting temperature (default: 25000.0) */
414
- readonly t_max: OptionType<FloatType>;
415
- /** Ending temperature (default: 2.5) */
416
- readonly t_min: OptionType<FloatType>;
417
- /** Total iterations (default: 50000) */
418
- readonly steps: OptionType<IntegerType>;
419
- /** Progress report frequency (default: 0 = silent) */
420
- readonly updates: OptionType<IntegerType>;
421
- /** Minutes for auto-calibration (default: none) */
422
- readonly auto_schedule: OptionType<FloatType>;
423
- /** Random seed for reproducibility */
424
- readonly random_state: OptionType<IntegerType>;
425
- }>], StructType<{
426
- /** Best state found */
427
- readonly best_state: VariantType<{
428
- /** Integer array state (permutations, assignments) */
429
- readonly int_array: VectorType<IntegerType>;
430
- /** Boolean array state (subset selection) */
431
- readonly bool_array: VectorType<BooleanType>;
432
- }>;
433
- /** Energy of best state */
434
- readonly best_energy: FloatType;
435
- /** Actual iterations performed */
436
- readonly steps_taken: IntegerType;
437
- /** Whether optimization completed successfully */
438
- readonly success: BooleanType;
439
- }>>;
440
- /**
441
- * Run simulated annealing on a permutation with swap moves.
442
- *
443
- * Convenience function for permutation-based problems (TSP, scheduling).
444
- * Automatically uses swap moves to generate neighbors.
445
- *
446
- * @example
447
- * ```ts
448
- * import { East, FloatType, IntegerType, VectorType, variant } from "@elaraai/east";
449
- * import { SimAnneal, AnnealConfigType } from "@elaraai/east-py-datascience";
450
- *
451
- * const solve = East.function([], SimAnneal.Types.ResultType, ($) => {
452
- * const energy = East.function([VectorType(IntegerType)], FloatType, ($, route) => {
453
- * const total = $.let(0.0);
454
- * $.for(East.Array.range(0n, route.length()), ($, i) => {
455
- * const from = $.let(route.get(i));
456
- * const to = $.let(route.get(i.add(1n).remainder(route.length())));
457
- * const diff = $.let(from.subtract(to).abs());
458
- * $.if(East.equal(diff, 1n).or(() => East.equal(diff, 3n)), $ => {
459
- * $.assign(total, total.add(1.0));
460
- * }).else($ => { $.assign(total, total.add(1.414)); });
461
- * });
462
- * return $.return(total);
463
- * });
464
- * const initial = $.let(new BigInt64Array([0n, 1n, 2n, 3n]));
465
- * const config = $.let({
466
- * t_max: variant("some", 1000.0), t_min: variant("some", 0.1),
467
- * steps: variant("some", 5000n), updates: variant("none", null),
468
- * auto_schedule: variant("none", null), random_state: variant("some", 42n),
469
- * }, AnnealConfigType);
470
- * return $.return(SimAnneal.optimizePermutation(initial, energy, config));
471
- * });
472
- * ```
473
- */
474
- readonly optimizePermutation: import("@elaraai/east").PlatformDefinition<[VectorType<IntegerType>, FunctionType<[VectorType<IntegerType>], FloatType>, StructType<{
475
- /** Starting temperature (default: 25000.0) */
476
- readonly t_max: OptionType<FloatType>;
477
- /** Ending temperature (default: 2.5) */
478
- readonly t_min: OptionType<FloatType>;
479
- /** Total iterations (default: 50000) */
480
- readonly steps: OptionType<IntegerType>;
481
- /** Progress report frequency (default: 0 = silent) */
482
- readonly updates: OptionType<IntegerType>;
483
- /** Minutes for auto-calibration (default: none) */
484
- readonly auto_schedule: OptionType<FloatType>;
485
- /** Random seed for reproducibility */
486
- readonly random_state: OptionType<IntegerType>;
487
- }>], StructType<{
488
- /** Best state found */
489
- readonly best_state: VariantType<{
490
- /** Integer array state (permutations, assignments) */
491
- readonly int_array: VectorType<IntegerType>;
492
- /** Boolean array state (subset selection) */
493
- readonly bool_array: VectorType<BooleanType>;
494
- }>;
495
- /** Energy of best state */
496
- readonly best_energy: FloatType;
497
- /** Actual iterations performed */
498
- readonly steps_taken: IntegerType;
499
- /** Whether optimization completed successfully */
500
- readonly success: BooleanType;
501
- }>>;
502
- /**
503
- * Run simulated annealing on a subset selection with bit-flip moves.
504
- *
505
- * Convenience function for subset selection problems (feature selection, knapsack).
506
- * Automatically uses bit-flip moves to generate neighbors.
507
- *
508
- * @example
509
- * ```ts
510
- * import { East, FloatType, BooleanType, VectorType, variant } from "@elaraai/east";
511
- * import { SimAnneal, AnnealConfigType } from "@elaraai/east-py-datascience";
512
- *
513
- * const solve = East.function([], SimAnneal.Types.ResultType, ($) => {
514
- * const items = $.let(new Float64Array([3.0, 7.0, 1.0, 8.0, 4.0]));
515
- * const target = $.let(12.0);
516
- * const energy = East.function([VectorType(BooleanType)], FloatType, ($, selection) => {
517
- * const sum = $.let(0.0);
518
- * $.for(East.Array.range(0n, selection.length()), ($, i) => {
519
- * $.if(selection.get(i), $ => { $.assign(sum, sum.add(items.get(i))); });
520
- * });
521
- * return $.return(sum.subtract(target).abs());
522
- * });
523
- * const initial = $.let(East.Vector.fromArray([true, true, true, true, true]));
524
- * const config = $.let({
525
- * t_max: variant("some", 500.0), t_min: variant("some", 0.1),
526
- * steps: variant("some", 2000n), updates: variant("none", null),
527
- * auto_schedule: variant("none", null), random_state: variant("some", 123n),
528
- * }, AnnealConfigType);
529
- * return $.return(SimAnneal.optimizeSubset(initial, energy, config));
530
- * });
531
- * ```
532
- */
533
- readonly optimizeSubset: import("@elaraai/east").PlatformDefinition<[VectorType<BooleanType>, FunctionType<[VectorType<BooleanType>], FloatType>, StructType<{
534
- /** Starting temperature (default: 25000.0) */
535
- readonly t_max: OptionType<FloatType>;
536
- /** Ending temperature (default: 2.5) */
537
- readonly t_min: OptionType<FloatType>;
538
- /** Total iterations (default: 50000) */
539
- readonly steps: OptionType<IntegerType>;
540
- /** Progress report frequency (default: 0 = silent) */
541
- readonly updates: OptionType<IntegerType>;
542
- /** Minutes for auto-calibration (default: none) */
543
- readonly auto_schedule: OptionType<FloatType>;
544
- /** Random seed for reproducibility */
545
- readonly random_state: OptionType<IntegerType>;
546
- }>], StructType<{
547
- /** Best state found */
548
- readonly best_state: VariantType<{
549
- /** Integer array state (permutations, assignments) */
550
- readonly int_array: VectorType<IntegerType>;
551
- /** Boolean array state (subset selection) */
552
- readonly bool_array: VectorType<BooleanType>;
553
- }>;
554
- /** Energy of best state */
555
- readonly best_energy: FloatType;
556
- /** Actual iterations performed */
557
- readonly steps_taken: IntegerType;
558
- /** Whether optimization completed successfully */
559
- readonly success: BooleanType;
560
- }>>;
561
- /**
562
- * Type definitions for SimAnneal functions.
563
- */
564
- readonly Types: {
565
- /** Discrete state type */
566
- readonly DiscreteStateType: VariantType<{
567
- /** Integer array state (permutations, assignments) */
568
- readonly int_array: VectorType<IntegerType>;
569
- /** Boolean array state (subset selection) */
570
- readonly bool_array: VectorType<BooleanType>;
571
- }>;
572
- /** Energy function type */
573
- readonly EnergyFunctionType: FunctionType<[VariantType<{
574
- /** Integer array state (permutations, assignments) */
575
- readonly int_array: VectorType<IntegerType>;
576
- /** Boolean array state (subset selection) */
577
- readonly bool_array: VectorType<BooleanType>;
578
- }>], FloatType>;
579
- /** Move function type */
580
- readonly MoveFunctionType: FunctionType<[VariantType<{
581
- /** Integer array state (permutations, assignments) */
582
- readonly int_array: VectorType<IntegerType>;
583
- /** Boolean array state (subset selection) */
584
- readonly bool_array: VectorType<BooleanType>;
585
- }>], VariantType<{
586
- /** Integer array state (permutations, assignments) */
587
- readonly int_array: VectorType<IntegerType>;
588
- /** Boolean array state (subset selection) */
589
- readonly bool_array: VectorType<BooleanType>;
590
- }>>;
591
- /** Permutation energy function type */
592
- readonly PermutationEnergyType: FunctionType<[VectorType<IntegerType>], FloatType>;
593
- /** Subset energy function type */
594
- readonly SubsetEnergyType: FunctionType<[VectorType<BooleanType>], FloatType>;
595
- /** Configuration type */
596
- readonly ConfigType: StructType<{
597
- /** Starting temperature (default: 25000.0) */
598
- readonly t_max: OptionType<FloatType>;
599
- /** Ending temperature (default: 2.5) */
600
- readonly t_min: OptionType<FloatType>;
601
- /** Total iterations (default: 50000) */
602
- readonly steps: OptionType<IntegerType>;
603
- /** Progress report frequency (default: 0 = silent) */
604
- readonly updates: OptionType<IntegerType>;
605
- /** Minutes for auto-calibration (default: none) */
606
- readonly auto_schedule: OptionType<FloatType>;
607
- /** Random seed for reproducibility */
608
- readonly random_state: OptionType<IntegerType>;
609
- }>;
610
- /** Result type */
611
- readonly ResultType: StructType<{
612
- /** Best state found */
613
- readonly best_state: VariantType<{
614
- /** Integer array state (permutations, assignments) */
615
- readonly int_array: VectorType<IntegerType>;
616
- /** Boolean array state (subset selection) */
617
- readonly bool_array: VectorType<BooleanType>;
618
- }>;
619
- /** Energy of best state */
620
- readonly best_energy: FloatType;
621
- /** Actual iterations performed */
622
- readonly steps_taken: IntegerType;
623
- /** Whether optimization completed successfully */
624
- readonly success: BooleanType;
625
- }>;
626
- };
627
- };
628
- //# sourceMappingURL=simanneal.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"simanneal.d.ts","sourceRoot":"","sources":["../../../src/simanneal/simanneal.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;GAWG;AAEH,OAAO,EAEH,UAAU,EACV,WAAW,EACX,UAAU,EACV,WAAW,EACX,SAAS,EACT,WAAW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