@elaraai/east-py-datascience 0.0.2-beta.8 → 0.0.2-beta.81

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 (123) hide show
  1. package/README.md +58 -1
  2. package/dist/src/alns/alns.d.ts +528 -0
  3. package/dist/src/alns/alns.d.ts.map +1 -0
  4. package/dist/src/alns/alns.js +238 -0
  5. package/dist/src/alns/alns.js.map +1 -0
  6. package/dist/src/google_or/google_or.d.ts +2422 -0
  7. package/dist/src/google_or/google_or.d.ts.map +1 -0
  8. package/dist/src/google_or/google_or.js +542 -0
  9. package/dist/src/google_or/google_or.js.map +1 -0
  10. package/dist/{gp → src/gp}/gp.d.ts +185 -136
  11. package/dist/src/gp/gp.d.ts.map +1 -0
  12. package/dist/{gp → src/gp}/gp.js +64 -12
  13. package/dist/src/gp/gp.js.map +1 -0
  14. package/dist/src/index.d.ts +34 -0
  15. package/dist/src/index.d.ts.map +1 -0
  16. package/dist/src/index.js +57 -0
  17. package/dist/src/index.js.map +1 -0
  18. package/dist/src/lightgbm/lightgbm.d.ts +575 -0
  19. package/dist/src/lightgbm/lightgbm.d.ts.map +1 -0
  20. package/dist/{lightgbm → src/lightgbm}/lightgbm.js +104 -18
  21. package/dist/src/lightgbm/lightgbm.js.map +1 -0
  22. package/dist/src/lightning/lightning.d.ts +1594 -0
  23. package/dist/src/lightning/lightning.d.ts.map +1 -0
  24. package/dist/src/lightning/lightning.js +468 -0
  25. package/dist/src/lightning/lightning.js.map +1 -0
  26. package/dist/{mads → src/mads}/mads.d.ts +109 -112
  27. package/dist/src/mads/mads.d.ts.map +1 -0
  28. package/dist/{mads → src/mads}/mads.js +6 -8
  29. package/dist/src/mads/mads.js.map +1 -0
  30. package/dist/src/mapie/mapie.d.ts +3680 -0
  31. package/dist/src/mapie/mapie.d.ts.map +1 -0
  32. package/dist/src/mapie/mapie.js +616 -0
  33. package/dist/src/mapie/mapie.js.map +1 -0
  34. package/dist/{ngboost → src/ngboost}/ngboost.d.ts +192 -142
  35. package/dist/src/ngboost/ngboost.d.ts.map +1 -0
  36. package/dist/{ngboost → src/ngboost}/ngboost.js +67 -14
  37. package/dist/src/ngboost/ngboost.js.map +1 -0
  38. package/dist/src/optimization/optimization.d.ts +420 -0
  39. package/dist/src/optimization/optimization.d.ts.map +1 -0
  40. package/dist/src/optimization/optimization.js +257 -0
  41. package/dist/src/optimization/optimization.js.map +1 -0
  42. package/dist/{optuna → src/optuna}/optuna.d.ts +374 -314
  43. package/dist/src/optuna/optuna.d.ts.map +1 -0
  44. package/dist/{optuna → src/optuna}/optuna.js +2 -0
  45. package/dist/src/optuna/optuna.js.map +1 -0
  46. package/dist/src/pymc/pymc.d.ts +2932 -0
  47. package/dist/src/pymc/pymc.d.ts.map +1 -0
  48. package/dist/src/pymc/pymc.js +688 -0
  49. package/dist/src/pymc/pymc.js.map +1 -0
  50. package/dist/src/scipy/scipy.d.ts +2205 -0
  51. package/dist/src/scipy/scipy.d.ts.map +1 -0
  52. package/dist/src/scipy/scipy.js +884 -0
  53. package/dist/src/scipy/scipy.js.map +1 -0
  54. package/dist/src/shap/shap.d.ts +4611 -0
  55. package/dist/src/shap/shap.d.ts.map +1 -0
  56. package/dist/src/shap/shap.js +552 -0
  57. package/dist/src/shap/shap.js.map +1 -0
  58. package/dist/{simanneal → src/simanneal}/simanneal.d.ts +257 -160
  59. package/dist/src/simanneal/simanneal.d.ts.map +1 -0
  60. package/dist/{simanneal → src/simanneal}/simanneal.js +105 -8
  61. package/dist/src/simanneal/simanneal.js.map +1 -0
  62. package/dist/src/simulation/simulation.d.ts +431 -0
  63. package/dist/src/simulation/simulation.d.ts.map +1 -0
  64. package/dist/src/simulation/simulation.js +306 -0
  65. package/dist/src/simulation/simulation.js.map +1 -0
  66. package/dist/src/sklearn/sklearn.d.ts +6362 -0
  67. package/dist/src/sklearn/sklearn.d.ts.map +1 -0
  68. package/dist/src/sklearn/sklearn.js +1508 -0
  69. package/dist/src/sklearn/sklearn.js.map +1 -0
  70. package/dist/src/torch/torch.d.ts +1205 -0
  71. package/dist/src/torch/torch.d.ts.map +1 -0
  72. package/dist/{torch → src/torch}/torch.js +109 -18
  73. package/dist/src/torch/torch.js.map +1 -0
  74. package/dist/src/types.d.ts +43 -0
  75. package/dist/src/types.d.ts.map +1 -0
  76. package/dist/src/types.js +44 -0
  77. package/dist/src/types.js.map +1 -0
  78. package/dist/src/xgboost/xgboost.d.ts +1424 -0
  79. package/dist/src/xgboost/xgboost.d.ts.map +1 -0
  80. package/dist/src/xgboost/xgboost.js +432 -0
  81. package/dist/src/xgboost/xgboost.js.map +1 -0
  82. package/package.json +12 -12
  83. package/dist/gp/gp.d.ts.map +0 -1
  84. package/dist/gp/gp.js.map +0 -1
  85. package/dist/index.d.ts +0 -27
  86. package/dist/index.d.ts.map +0 -1
  87. package/dist/index.js +0 -41
  88. package/dist/index.js.map +0 -1
  89. package/dist/lightgbm/lightgbm.d.ts +0 -494
  90. package/dist/lightgbm/lightgbm.d.ts.map +0 -1
  91. package/dist/lightgbm/lightgbm.js.map +0 -1
  92. package/dist/mads/mads.d.ts.map +0 -1
  93. package/dist/mads/mads.js.map +0 -1
  94. package/dist/ngboost/ngboost.d.ts.map +0 -1
  95. package/dist/ngboost/ngboost.js.map +0 -1
  96. package/dist/optuna/optuna.d.ts.map +0 -1
  97. package/dist/optuna/optuna.js.map +0 -1
  98. package/dist/scipy/scipy.d.ts +0 -1260
  99. package/dist/scipy/scipy.d.ts.map +0 -1
  100. package/dist/scipy/scipy.js +0 -413
  101. package/dist/scipy/scipy.js.map +0 -1
  102. package/dist/shap/shap.d.ts +0 -657
  103. package/dist/shap/shap.d.ts.map +0 -1
  104. package/dist/shap/shap.js +0 -241
  105. package/dist/shap/shap.js.map +0 -1
  106. package/dist/simanneal/simanneal.d.ts.map +0 -1
  107. package/dist/simanneal/simanneal.js.map +0 -1
  108. package/dist/sklearn/sklearn.d.ts +0 -2691
  109. package/dist/sklearn/sklearn.d.ts.map +0 -1
  110. package/dist/sklearn/sklearn.js +0 -524
  111. package/dist/sklearn/sklearn.js.map +0 -1
  112. package/dist/torch/torch.d.ts +0 -1081
  113. package/dist/torch/torch.d.ts.map +0 -1
  114. package/dist/torch/torch.js.map +0 -1
  115. package/dist/tsconfig.tsbuildinfo +0 -1
  116. package/dist/types.d.ts +0 -80
  117. package/dist/types.d.ts.map +0 -1
  118. package/dist/types.js +0 -81
  119. package/dist/types.js.map +0 -1
  120. package/dist/xgboost/xgboost.d.ts +0 -504
  121. package/dist/xgboost/xgboost.d.ts.map +0 -1
  122. package/dist/xgboost/xgboost.js +0 -177
  123. package/dist/xgboost/xgboost.js.map +0 -1
@@ -62,13 +62,13 @@ export const NGBoostPredictConfigType = StructType({
62
62
  */
63
63
  export const NGBoostPredictResultType = StructType({
64
64
  /** Point predictions (mean) */
65
- predictions: VectorType,
65
+ predictions: VectorType(FloatType),
66
66
  /** Standard deviation */
67
- std: OptionType(VectorType),
67
+ std: OptionType(VectorType(FloatType)),
68
68
  /** Lower confidence interval */
69
- lower: OptionType(VectorType),
69
+ lower: OptionType(VectorType(FloatType)),
70
70
  /** Upper confidence interval */
71
- upper: OptionType(VectorType),
71
+ upper: OptionType(VectorType(FloatType)),
72
72
  });
73
73
  // ============================================================================
74
74
  // Model Blob Types
@@ -98,7 +98,7 @@ export const NGBoostModelBlobType = VariantType({
98
98
  * @param config - NGBoost configuration
99
99
  * @returns Model blob containing trained regressor
100
100
  */
101
- export const ngboost_train_regressor = East.platform("ngboost_train_regressor", [MatrixType, VectorType, NGBoostConfigType], NGBoostModelBlobType);
101
+ export const ngboost_train_regressor = East.platform("ngboost_train_regressor", [MatrixType(FloatType), VectorType(FloatType), NGBoostConfigType], NGBoostModelBlobType);
102
102
  /**
103
103
  * Make point predictions (mean) with a trained NGBoost regressor.
104
104
  *
@@ -106,7 +106,7 @@ export const ngboost_train_regressor = East.platform("ngboost_train_regressor",
106
106
  * @param X - Feature matrix
107
107
  * @returns Predicted values (mean of predictive distribution)
108
108
  */
109
- export const ngboost_predict = East.platform("ngboost_predict", [NGBoostModelBlobType, MatrixType], VectorType);
109
+ export const ngboost_predict = East.platform("ngboost_predict", [NGBoostModelBlobType, MatrixType(FloatType)], VectorType(FloatType));
110
110
  /**
111
111
  * Get predictions with full uncertainty from NGBoost regressor.
112
112
  *
@@ -117,7 +117,7 @@ export const ngboost_predict = East.platform("ngboost_predict", [NGBoostModelBlo
117
117
  * @param config - Prediction configuration (confidence level)
118
118
  * @returns Predictions with uncertainty estimates
119
119
  */
120
- export const ngboost_predict_dist = East.platform("ngboost_predict_dist", [NGBoostModelBlobType, MatrixType, NGBoostPredictConfigType], NGBoostPredictResultType);
120
+ export const ngboost_predict_dist = East.platform("ngboost_predict_dist", [NGBoostModelBlobType, MatrixType(FloatType), NGBoostPredictConfigType], NGBoostPredictResultType);
121
121
  // ============================================================================
122
122
  // Grouped Export
123
123
  // ============================================================================
@@ -125,10 +125,6 @@ export const ngboost_predict_dist = East.platform("ngboost_predict_dist", [NGBoo
125
125
  * Type definitions for NGBoost functions.
126
126
  */
127
127
  export const NGBoostTypes = {
128
- /** Vector type (array of floats) */
129
- VectorType,
130
- /** Matrix type (2D array of floats) */
131
- MatrixType,
132
128
  /** Distribution type for NGBoost */
133
129
  NGBoostDistributionType,
134
130
  /** NGBoost configuration type */
@@ -166,11 +162,68 @@ export const NGBoostTypes = {
166
162
  * ```
167
163
  */
168
164
  export const NGBoost = {
169
- /** Train NGBoost regressor */
165
+ /**
166
+ * Train an NGBoost regression model with probabilistic output.
167
+ *
168
+ * @example
169
+ * ```ts
170
+ * import { East, FloatType, MatrixType, VectorType, variant } from "@elaraai/east";
171
+ * import { NGBoost, NGBoostConfigType } from "@elaraai/east-py-datascience";
172
+ *
173
+ * const train = East.function([], NGBoost.Types.ModelBlobType, ($) => {
174
+ * const X = $.let([[1.0, 2.0], [3.0, 4.0], [5.0, 6.0], [7.0, 8.0]]);
175
+ * const y = $.let(new Float64Array([1.0, 2.0, 3.0, 4.0]));
176
+ * const config = $.let({
177
+ * n_estimators: variant("some", 100n), learning_rate: variant("some", 0.01),
178
+ * minibatch_frac: variant("none", null), col_sample: variant("none", null),
179
+ * random_state: variant("some", 42n), distribution: variant("none", null),
180
+ * }, NGBoostConfigType);
181
+ * return $.return(NGBoost.trainRegressor(X, y, config));
182
+ * });
183
+ * ```
184
+ */
170
185
  trainRegressor: ngboost_train_regressor,
171
- /** Make point predictions with regressor */
186
+ /**
187
+ * Make point predictions with a trained NGBoost regressor.
188
+ *
189
+ * @example
190
+ * ```ts
191
+ * import { East, FloatType, MatrixType, VectorType } from "@elaraai/east";
192
+ * import { NGBoost } from "@elaraai/east-py-datascience";
193
+ *
194
+ * const predictFn = East.function(
195
+ * [NGBoost.Types.ModelBlobType, MatrixType(FloatType)],
196
+ * VectorType(FloatType),
197
+ * ($, model, X) => {
198
+ * return $.return(NGBoost.predict(model, X));
199
+ * }
200
+ * );
201
+ * ```
202
+ */
172
203
  predict: ngboost_predict,
173
- /** Get predictions with uncertainty */
204
+ /**
205
+ * Get predictions with uncertainty estimates (confidence intervals, std).
206
+ *
207
+ * @example
208
+ * ```ts
209
+ * import { East, FloatType, MatrixType, variant } from "@elaraai/east";
210
+ * import { NGBoost, NGBoostPredictConfigType } from "@elaraai/east-py-datascience";
211
+ *
212
+ * const predictFn = East.function(
213
+ * [NGBoost.Types.ModelBlobType, MatrixType(FloatType)],
214
+ * NGBoost.Types.NGBoostPredictResultType,
215
+ * ($, model, X) => {
216
+ * const config = $.let({
217
+ * confidence_level: variant("some", 0.95),
218
+ * }, NGBoostPredictConfigType);
219
+ * const result = $.let(NGBoost.predictDist(model, X, config));
220
+ * // result.predictions => point predictions
221
+ * // result.lower, result.upper => confidence interval
222
+ * return $.return(result);
223
+ * }
224
+ * );
225
+ * ```
226
+ */
174
227
  predictDist: ngboost_predict_dist,
175
228
  /** Type definitions */
176
229
  Types: NGBoostTypes,
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ngboost.js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wB,CAAC,EACvE,wBAAwB,CAC3B,CAAC;AAEF,+EAA+E;AAC/E,iBAAiB;AACjB,+EAA+E;AAE/E;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;IACxB,oCAAoC;IACpC,uBAAuB;IACvB,iCAAiC;IACjC,iBAAiB;IACjB,oCAAoC;IACpC,wBAAwB;IACxB,6BAA6B;IAC7B,wBAAwB;IACxB,yCAAyC;IACzC,aAAa,EAAE,oBAAoB;CAC7B,CAAC;AAEX;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG;IACnB;;;;;;;;;;;;;;;;;;;OAmBG;IACH,cAAc,EAAE,uBAAuB;IAEvC;;;;;;;;;;;;;;;;OAgBG;IACH,OAAO,EAAE,eAAe;IAExB;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,WAAW,EAAE,oBAAoB;IACjC,uBAAuB;IACvB,KAAK,EAAE,YAAY;CACb,CAAC"}
@@ -0,0 +1,420 @@
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
+ * Iterative coordinate descent optimization for discrete combinatorial problems.
7
+ *
8
+ * Provides element-wise optimization over vectors of discrete integer values.
9
+ * Each element is independently optimized by trying all candidate values
10
+ * while holding other elements fixed. Multi-start sampling improves
11
+ * exploration of the search space.
12
+ *
13
+ * Ported from the Julia IterativeDecisionAlgorithm (ArrayParameterSpace branch).
14
+ *
15
+ * @packageDocumentation
16
+ */
17
+ import { StructType, VariantType, OptionType, ArrayType, VectorType, IntegerType, BooleanType, FloatType, NullType, FunctionType } from "@elaraai/east";
18
+ /** Parameter vector: Vector<Integer> */
19
+ export declare const ParameterVectorType: VectorType<IntegerType>;
20
+ /** Objective function: Vector<Integer> -> Float */
21
+ export declare const IterativeObjectiveType: FunctionType<[VectorType<IntegerType>], FloatType>;
22
+ /** Per-element candidate spaces: Array<Vector<Integer>> */
23
+ export declare const ParameterSpacesType: ArrayType<VectorType<IntegerType>>;
24
+ /**
25
+ * Initial value strategy for parameters.
26
+ *
27
+ * - `first`: Use the first candidate value from each space
28
+ * - `random`: Randomly select from each space
29
+ */
30
+ export declare const InitialStrategyType: VariantType<{
31
+ readonly first: NullType;
32
+ readonly random: NullType;
33
+ }>;
34
+ /**
35
+ * Evaluation order for candidate values within each element's space.
36
+ *
37
+ * - `sequential`: Try candidates in the order they appear
38
+ * - `random`: Shuffle candidates before trying
39
+ */
40
+ export declare const EvaluationOrderType: VariantType<{
41
+ readonly sequential: NullType;
42
+ readonly random: NullType;
43
+ }>;
44
+ /**
45
+ * Optimization mode.
46
+ *
47
+ * - `coordinate`: Standard coordinate descent — optimize each element independently (default)
48
+ * - `swap`: Swap-based moves — swap pairs of elements, preserving valid permutations
49
+ */
50
+ export declare const ModeType: VariantType<{
51
+ readonly coordinate: NullType;
52
+ readonly swap: NullType;
53
+ }>;
54
+ /**
55
+ * Configuration for iterative optimization.
56
+ *
57
+ * All fields are optional with sensible defaults.
58
+ */
59
+ export declare const IterativeConfigType: StructType<{
60
+ /** Maximum coordinate descent iterations per sample (default: 100) */
61
+ readonly iterations: OptionType<IntegerType>;
62
+ /** Number of independent restarts (default: 1) */
63
+ readonly samples: OptionType<IntegerType>;
64
+ /** How to initialize parameter values (default: first) */
65
+ readonly initial: OptionType<VariantType<{
66
+ readonly first: NullType;
67
+ readonly random: NullType;
68
+ }>>;
69
+ /** Order to evaluate candidates (default: sequential) */
70
+ readonly order: OptionType<VariantType<{
71
+ readonly sequential: NullType;
72
+ readonly random: NullType;
73
+ }>>;
74
+ /** Random seed for reproducibility */
75
+ readonly random_state: OptionType<IntegerType>;
76
+ /** Optimization mode: coordinate (default) or swap for permutations */
77
+ readonly mode: OptionType<VariantType<{
78
+ readonly coordinate: NullType;
79
+ readonly swap: NullType;
80
+ }>>;
81
+ }>;
82
+ /**
83
+ * Result of iterative optimization.
84
+ */
85
+ export declare const IterativeResultType: StructType<{
86
+ /** Best parameter values found */
87
+ readonly best_parameters: VectorType<IntegerType>;
88
+ /** Objective value at best parameters */
89
+ readonly best_objective: FloatType;
90
+ /** Total coordinate descent iterations across all samples */
91
+ readonly iterations: IntegerType;
92
+ /** Total number of objective evaluations */
93
+ readonly evaluations: IntegerType;
94
+ /** Whether optimization succeeded */
95
+ readonly success: BooleanType;
96
+ }>;
97
+ /**
98
+ * Iterative optimization over integer parameter vectors.
99
+ *
100
+ * Maximizes an objective function over a vector of discrete integer parameters.
101
+ * Each parameter position has its own set of candidate values (vector).
102
+ *
103
+ * Two modes are available:
104
+ * - **coordinate** (default): Coordinate descent — optimizes each element independently
105
+ * by trying all candidate values while holding others fixed. Best for assignment problems
106
+ * where each position can take any value independently.
107
+ * - **swap**: Swap-based moves — swaps pairs of elements, preserving valid permutations.
108
+ * Use this for permutation problems (scheduling, ordering) where each value must appear
109
+ * exactly once.
110
+ *
111
+ * @example Coordinate mode (assignment)
112
+ * ```ts
113
+ * const config = $.let({
114
+ * iterations: variant('some', 10n),
115
+ * samples: variant('some', 3n),
116
+ * initial: variant('some', variant('random', null)),
117
+ * order: variant('some', variant('sequential', null)),
118
+ * random_state: variant('some', 42n),
119
+ * mode: variant('none', null), // coordinate is the default
120
+ * });
121
+ * const result = $.let(Optimization.iterative(objective, spaces, config));
122
+ * ```
123
+ *
124
+ * @example Swap mode (permutation)
125
+ * ```ts
126
+ * const config = $.let({
127
+ * iterations: variant('some', 50n),
128
+ * samples: variant('some', 10n),
129
+ * initial: variant('some', variant('random', null)),
130
+ * order: variant('some', variant('random', null)),
131
+ * random_state: variant('some', 42n),
132
+ * mode: variant('some', variant('swap', null)),
133
+ * });
134
+ * const result = $.let(Optimization.iterative(objective, spaces, config));
135
+ * ```
136
+ */
137
+ export declare const optimization_iterative: import("@elaraai/east").PlatformDefinition<[FunctionType<[VectorType<IntegerType>], FloatType>, ArrayType<VectorType<IntegerType>>, StructType<{
138
+ /** Maximum coordinate descent iterations per sample (default: 100) */
139
+ readonly iterations: OptionType<IntegerType>;
140
+ /** Number of independent restarts (default: 1) */
141
+ readonly samples: OptionType<IntegerType>;
142
+ /** How to initialize parameter values (default: first) */
143
+ readonly initial: OptionType<VariantType<{
144
+ readonly first: NullType;
145
+ readonly random: NullType;
146
+ }>>;
147
+ /** Order to evaluate candidates (default: sequential) */
148
+ readonly order: OptionType<VariantType<{
149
+ readonly sequential: NullType;
150
+ readonly random: NullType;
151
+ }>>;
152
+ /** Random seed for reproducibility */
153
+ readonly random_state: OptionType<IntegerType>;
154
+ /** Optimization mode: coordinate (default) or swap for permutations */
155
+ readonly mode: OptionType<VariantType<{
156
+ readonly coordinate: NullType;
157
+ readonly swap: NullType;
158
+ }>>;
159
+ }>], StructType<{
160
+ /** Best parameter values found */
161
+ readonly best_parameters: VectorType<IntegerType>;
162
+ /** Objective value at best parameters */
163
+ readonly best_objective: FloatType;
164
+ /** Total coordinate descent iterations across all samples */
165
+ readonly iterations: IntegerType;
166
+ /** Total number of objective evaluations */
167
+ readonly evaluations: IntegerType;
168
+ /** Whether optimization succeeded */
169
+ readonly success: BooleanType;
170
+ }>>;
171
+ /**
172
+ * Type definitions for iterative optimization.
173
+ */
174
+ export declare const OptimizationTypes: {
175
+ /** Parameter vector type */
176
+ readonly ParameterVectorType: VectorType<IntegerType>;
177
+ /** Objective function type */
178
+ readonly ObjectiveType: FunctionType<[VectorType<IntegerType>], FloatType>;
179
+ /** Parameter spaces type */
180
+ readonly SpacesType: ArrayType<VectorType<IntegerType>>;
181
+ /** Initial value strategy variant */
182
+ readonly InitialStrategyType: VariantType<{
183
+ readonly first: NullType;
184
+ readonly random: NullType;
185
+ }>;
186
+ /** Evaluation order variant */
187
+ readonly EvaluationOrderType: VariantType<{
188
+ readonly sequential: NullType;
189
+ readonly random: NullType;
190
+ }>;
191
+ /** Optimization mode variant */
192
+ readonly ModeType: VariantType<{
193
+ readonly coordinate: NullType;
194
+ readonly swap: NullType;
195
+ }>;
196
+ /** Configuration type */
197
+ readonly ConfigType: StructType<{
198
+ /** Maximum coordinate descent iterations per sample (default: 100) */
199
+ readonly iterations: OptionType<IntegerType>;
200
+ /** Number of independent restarts (default: 1) */
201
+ readonly samples: OptionType<IntegerType>;
202
+ /** How to initialize parameter values (default: first) */
203
+ readonly initial: OptionType<VariantType<{
204
+ readonly first: NullType;
205
+ readonly random: NullType;
206
+ }>>;
207
+ /** Order to evaluate candidates (default: sequential) */
208
+ readonly order: OptionType<VariantType<{
209
+ readonly sequential: NullType;
210
+ readonly random: NullType;
211
+ }>>;
212
+ /** Random seed for reproducibility */
213
+ readonly random_state: OptionType<IntegerType>;
214
+ /** Optimization mode: coordinate (default) or swap for permutations */
215
+ readonly mode: OptionType<VariantType<{
216
+ readonly coordinate: NullType;
217
+ readonly swap: NullType;
218
+ }>>;
219
+ }>;
220
+ /** Result type */
221
+ readonly ResultType: StructType<{
222
+ /** Best parameter values found */
223
+ readonly best_parameters: VectorType<IntegerType>;
224
+ /** Objective value at best parameters */
225
+ readonly best_objective: FloatType;
226
+ /** Total coordinate descent iterations across all samples */
227
+ readonly iterations: IntegerType;
228
+ /** Total number of objective evaluations */
229
+ readonly evaluations: IntegerType;
230
+ /** Whether optimization succeeded */
231
+ readonly success: BooleanType;
232
+ }>;
233
+ };
234
+ /**
235
+ * Iterative optimization for discrete combinatorial problems.
236
+ *
237
+ * Supports two modes:
238
+ * - **coordinate** (default): Element-wise coordinate descent. Best for
239
+ * assignment problems where positions are independent.
240
+ * - **swap**: Pair-wise swap moves preserving permutations. Best for
241
+ * scheduling/ordering where each value must appear exactly once.
242
+ *
243
+ * Use cases:
244
+ * - Task-worker assignment (coordinate mode)
245
+ * - Scheduling and ordering (swap mode)
246
+ * - Combinatorial selection problems
247
+ * - Any discrete optimization with per-element candidate sets
248
+ */
249
+ export declare const Optimization: {
250
+ /**
251
+ * Iterative optimization over integer parameter vectors.
252
+ *
253
+ * `Optimization.iterative(objective, spaces, config)`
254
+ *
255
+ * @example Coordinate mode — task-worker assignment
256
+ * ```ts
257
+ * // 3 tasks, 2 workers. Maximize total skill match.
258
+ * const skill = $.let([[3.0, 1.0], [1.0, 3.0], [2.0, 2.0]]);
259
+ * const objective = East.function(
260
+ * [VectorType(IntegerType)], FloatType,
261
+ * ($, assignments) => {
262
+ * const total = $.let(0.0);
263
+ * $.for(East.Array.range(0n, East.value(3n)), ($, i) => {
264
+ * $.assign(total, total.add(skill.get(i).get(assignments.get(i))));
265
+ * });
266
+ * return $.return(total);
267
+ * }
268
+ * );
269
+ * const spaces = $.let([
270
+ * new BigInt64Array([0n, 1n]),
271
+ * new BigInt64Array([0n, 1n]),
272
+ * new BigInt64Array([0n, 1n]),
273
+ * ]);
274
+ * const config = $.let({
275
+ * iterations: variant('some', 10n),
276
+ * samples: variant('some', 3n),
277
+ * initial: variant('some', variant('random', null)),
278
+ * order: variant('some', variant('sequential', null)),
279
+ * random_state: variant('some', 42n),
280
+ * mode: variant('none', null),
281
+ * });
282
+ * const result = $.let(Optimization.iterative(objective, spaces, config));
283
+ * // result.best_objective = 8.0 (task 0→worker 0, task 1→worker 1, task 2→either)
284
+ * ```
285
+ *
286
+ * @example Swap mode — scheduling permutation
287
+ * ```ts
288
+ * // 4 jobs: find execution order minimizing weighted completion time.
289
+ * const durations = $.let([10.0, 5.0, 20.0, 3.0]);
290
+ * const values = $.let([1.0, 8.0, 2.0, 10.0]);
291
+ * const objective = East.function(
292
+ * [VectorType(IntegerType)], FloatType,
293
+ * ($, perm) => {
294
+ * const cum = $.let(0.0);
295
+ * const total = $.let(0.0);
296
+ * $.for(East.Array.range(0n, East.value(4n)), ($, i) => {
297
+ * const idx = $.let(perm.get(i));
298
+ * $.assign(cum, cum.add(durations.get(idx)));
299
+ * $.assign(total, total.add(values.get(idx).multiply(cum)));
300
+ * });
301
+ * return $.return(total.negate());
302
+ * }
303
+ * );
304
+ * const spaces = $.let([
305
+ * new BigInt64Array([0n, 1n, 2n, 3n]),
306
+ * new BigInt64Array([0n, 1n, 2n, 3n]),
307
+ * new BigInt64Array([0n, 1n, 2n, 3n]),
308
+ * new BigInt64Array([0n, 1n, 2n, 3n]),
309
+ * ]);
310
+ * const config = $.let({
311
+ * iterations: variant('some', 50n),
312
+ * samples: variant('some', 10n),
313
+ * initial: variant('some', variant('random', null)),
314
+ * order: variant('some', variant('random', null)),
315
+ * random_state: variant('some', 42n),
316
+ * mode: variant('some', variant('swap', null)),
317
+ * });
318
+ * const result = $.let(Optimization.iterative(objective, spaces, config));
319
+ * // result.best_objective = -188.0 (optimal WSPT order)
320
+ * ```
321
+ */
322
+ readonly iterative: import("@elaraai/east").PlatformDefinition<[FunctionType<[VectorType<IntegerType>], FloatType>, ArrayType<VectorType<IntegerType>>, StructType<{
323
+ /** Maximum coordinate descent iterations per sample (default: 100) */
324
+ readonly iterations: OptionType<IntegerType>;
325
+ /** Number of independent restarts (default: 1) */
326
+ readonly samples: OptionType<IntegerType>;
327
+ /** How to initialize parameter values (default: first) */
328
+ readonly initial: OptionType<VariantType<{
329
+ readonly first: NullType;
330
+ readonly random: NullType;
331
+ }>>;
332
+ /** Order to evaluate candidates (default: sequential) */
333
+ readonly order: OptionType<VariantType<{
334
+ readonly sequential: NullType;
335
+ readonly random: NullType;
336
+ }>>;
337
+ /** Random seed for reproducibility */
338
+ readonly random_state: OptionType<IntegerType>;
339
+ /** Optimization mode: coordinate (default) or swap for permutations */
340
+ readonly mode: OptionType<VariantType<{
341
+ readonly coordinate: NullType;
342
+ readonly swap: NullType;
343
+ }>>;
344
+ }>], StructType<{
345
+ /** Best parameter values found */
346
+ readonly best_parameters: VectorType<IntegerType>;
347
+ /** Objective value at best parameters */
348
+ readonly best_objective: FloatType;
349
+ /** Total coordinate descent iterations across all samples */
350
+ readonly iterations: IntegerType;
351
+ /** Total number of objective evaluations */
352
+ readonly evaluations: IntegerType;
353
+ /** Whether optimization succeeded */
354
+ readonly success: BooleanType;
355
+ }>>;
356
+ /**
357
+ * Type definitions for optimization functions.
358
+ */
359
+ readonly Types: {
360
+ /** Parameter vector type */
361
+ readonly ParameterVectorType: VectorType<IntegerType>;
362
+ /** Objective function type */
363
+ readonly ObjectiveType: FunctionType<[VectorType<IntegerType>], FloatType>;
364
+ /** Parameter spaces type */
365
+ readonly SpacesType: ArrayType<VectorType<IntegerType>>;
366
+ /** Initial value strategy variant */
367
+ readonly InitialStrategyType: VariantType<{
368
+ readonly first: NullType;
369
+ readonly random: NullType;
370
+ }>;
371
+ /** Evaluation order variant */
372
+ readonly EvaluationOrderType: VariantType<{
373
+ readonly sequential: NullType;
374
+ readonly random: NullType;
375
+ }>;
376
+ /** Optimization mode variant */
377
+ readonly ModeType: VariantType<{
378
+ readonly coordinate: NullType;
379
+ readonly swap: NullType;
380
+ }>;
381
+ /** Configuration type */
382
+ readonly ConfigType: StructType<{
383
+ /** Maximum coordinate descent iterations per sample (default: 100) */
384
+ readonly iterations: OptionType<IntegerType>;
385
+ /** Number of independent restarts (default: 1) */
386
+ readonly samples: OptionType<IntegerType>;
387
+ /** How to initialize parameter values (default: first) */
388
+ readonly initial: OptionType<VariantType<{
389
+ readonly first: NullType;
390
+ readonly random: NullType;
391
+ }>>;
392
+ /** Order to evaluate candidates (default: sequential) */
393
+ readonly order: OptionType<VariantType<{
394
+ readonly sequential: NullType;
395
+ readonly random: NullType;
396
+ }>>;
397
+ /** Random seed for reproducibility */
398
+ readonly random_state: OptionType<IntegerType>;
399
+ /** Optimization mode: coordinate (default) or swap for permutations */
400
+ readonly mode: OptionType<VariantType<{
401
+ readonly coordinate: NullType;
402
+ readonly swap: NullType;
403
+ }>>;
404
+ }>;
405
+ /** Result type */
406
+ readonly ResultType: StructType<{
407
+ /** Best parameter values found */
408
+ readonly best_parameters: VectorType<IntegerType>;
409
+ /** Objective value at best parameters */
410
+ readonly best_objective: FloatType;
411
+ /** Total coordinate descent iterations across all samples */
412
+ readonly iterations: IntegerType;
413
+ /** Total number of objective evaluations */
414
+ readonly evaluations: IntegerType;
415
+ /** Whether optimization succeeded */
416
+ readonly success: BooleanType;
417
+ }>;
418
+ };
419
+ };
420
+ //# sourceMappingURL=optimization.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"optimization.d.ts","sourceRoot":"","sources":["../../../src/optimization/optimization.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;GAWG;AAEH,OAAO,EAEH,UAAU,EACV,WAAW,EACX,UAAU,EACV,SAAS,EACT,UAAU,EACV,WAAW,EACX,WAAW,EACX,SAAS,EACT,QAAQ,EACR,YAAY,EACf,MAAM,eAAe,CAAC;AAMvB,wCAAwC;AACxC,eAAO,MAAM,mBAAmB,yBAA0B,CAAC;AAE3D,mDAAmD;AACnD,eAAO,MAAM,sBAAsB,oDAAiD,CAAC;AAErF,2DAA2D;AAC3D,eAAO,MAAM,mBAAmB,oCAAiC,CAAC;AAElE;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB;;;EAG9B,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB;;;EAG9B,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,QAAQ;;;EAGnB,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,mBAAmB;IAC5B,sEAAsE;;IAEtE,kDAAkD;;IAElD,0DAA0D;;;;;IAE1D,yDAAyD;;;;;IAEzD,sCAAsC;;IAEtC,uEAAuE;;;;;EAEzE,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,mBAAmB;IAC5B,kCAAkC;;IAElC,yCAAyC;;IAEzC,6DAA6D;;IAE7D,4CAA4C;;IAE5C,qCAAqC;;EAEvC,CAAC;AAMH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,eAAO,MAAM,sBAAsB;IA1E/B,sEAAsE;;IAEtE,kDAAkD;;IAElD,0DAA0D;;;;;IAE1D,yDAAyD;;;;;IAEzD,sCAAsC;;IAEtC,uEAAuE;;;;;;IAQvE,kCAAkC;;IAElC,yCAAyC;;IAEzC,6DAA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