@elaraai/east-py-datascience 1.0.1 → 1.0.2

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/dist/src/alns/alns.d.ts +528 -0
  2. package/dist/src/alns/alns.d.ts.map +1 -0
  3. package/dist/src/alns/alns.js +238 -0
  4. package/dist/src/alns/alns.js.map +1 -0
  5. package/dist/src/google_or/google_or.d.ts +2457 -0
  6. package/dist/src/google_or/google_or.d.ts.map +1 -0
  7. package/dist/src/google_or/google_or.js +547 -0
  8. package/dist/src/google_or/google_or.js.map +1 -0
  9. package/dist/src/gp/gp.d.ts +447 -0
  10. package/dist/src/gp/gp.d.ts.map +1 -0
  11. package/dist/src/gp/gp.js +222 -0
  12. package/dist/src/gp/gp.js.map +1 -0
  13. package/dist/src/index.d.ts +34 -0
  14. package/dist/src/index.d.ts.map +1 -0
  15. package/dist/src/index.js +57 -0
  16. package/dist/src/index.js.map +1 -0
  17. package/dist/src/lightgbm/lightgbm.d.ts +575 -0
  18. package/dist/src/lightgbm/lightgbm.d.ts.map +1 -0
  19. package/dist/src/lightgbm/lightgbm.js +241 -0
  20. package/dist/src/lightgbm/lightgbm.js.map +1 -0
  21. package/dist/src/lightning/lightning.d.ts +1594 -0
  22. package/dist/src/lightning/lightning.d.ts.map +1 -0
  23. package/dist/src/lightning/lightning.js +468 -0
  24. package/dist/src/lightning/lightning.js.map +1 -0
  25. package/dist/src/mads/mads.d.ts +410 -0
  26. package/dist/src/mads/mads.d.ts.map +1 -0
  27. package/dist/src/mads/mads.js +219 -0
  28. package/dist/src/mads/mads.js.map +1 -0
  29. package/dist/src/mapie/mapie.d.ts +3680 -0
  30. package/dist/src/mapie/mapie.d.ts.map +1 -0
  31. package/dist/src/mapie/mapie.js +616 -0
  32. package/dist/src/mapie/mapie.js.map +1 -0
  33. package/dist/src/ngboost/ngboost.d.ts +483 -0
  34. package/dist/src/ngboost/ngboost.d.ts.map +1 -0
  35. package/dist/src/ngboost/ngboost.js +231 -0
  36. package/dist/src/ngboost/ngboost.js.map +1 -0
  37. package/dist/src/optimization/optimization.d.ts +700 -0
  38. package/dist/src/optimization/optimization.d.ts.map +1 -0
  39. package/dist/src/optimization/optimization.js +411 -0
  40. package/dist/src/optimization/optimization.js.map +1 -0
  41. package/dist/src/optuna/optuna.d.ts +857 -0
  42. package/dist/src/optuna/optuna.d.ts.map +1 -0
  43. package/dist/src/optuna/optuna.js +270 -0
  44. package/dist/src/optuna/optuna.js.map +1 -0
  45. package/dist/src/pymc/pymc.d.ts +2932 -0
  46. package/dist/src/pymc/pymc.d.ts.map +1 -0
  47. package/dist/src/pymc/pymc.js +688 -0
  48. package/dist/src/pymc/pymc.js.map +1 -0
  49. package/dist/src/scipy/scipy.d.ts +2205 -0
  50. package/dist/src/scipy/scipy.d.ts.map +1 -0
  51. package/dist/src/scipy/scipy.js +884 -0
  52. package/dist/src/scipy/scipy.js.map +1 -0
  53. package/dist/src/shap/shap.d.ts +4611 -0
  54. package/dist/src/shap/shap.d.ts.map +1 -0
  55. package/dist/src/shap/shap.js +552 -0
  56. package/dist/src/shap/shap.js.map +1 -0
  57. package/dist/src/simanneal/simanneal.d.ts +628 -0
  58. package/dist/src/simanneal/simanneal.d.ts.map +1 -0
  59. package/dist/src/simanneal/simanneal.js +328 -0
  60. package/dist/src/simanneal/simanneal.js.map +1 -0
  61. package/dist/src/simulation/simulation.d.ts +224 -0
  62. package/dist/src/simulation/simulation.d.ts.map +1 -0
  63. package/dist/src/simulation/simulation.js +189 -0
  64. package/dist/src/simulation/simulation.js.map +1 -0
  65. package/dist/src/sklearn/sklearn.d.ts +6362 -0
  66. package/dist/src/sklearn/sklearn.d.ts.map +1 -0
  67. package/dist/src/sklearn/sklearn.js +1508 -0
  68. package/dist/src/sklearn/sklearn.js.map +1 -0
  69. package/dist/src/torch/torch.d.ts +1205 -0
  70. package/dist/src/torch/torch.d.ts.map +1 -0
  71. package/dist/src/torch/torch.js +440 -0
  72. package/dist/src/torch/torch.js.map +1 -0
  73. package/dist/src/types.d.ts +43 -0
  74. package/dist/src/types.d.ts.map +1 -0
  75. package/dist/src/types.js +44 -0
  76. package/dist/src/types.js.map +1 -0
  77. package/dist/src/xgboost/xgboost.d.ts +1424 -0
  78. package/dist/src/xgboost/xgboost.d.ts.map +1 -0
  79. package/dist/src/xgboost/xgboost.js +432 -0
  80. package/dist/src/xgboost/xgboost.js.map +1 -0
  81. package/package.json +3 -3
@@ -0,0 +1,410 @@
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
+ * MADS (Mesh Adaptive Direct Search) derivative-free optimization.
7
+ *
8
+ * Provides blackbox optimization using the NOMAD MADS algorithm via PyNomadBBO.
9
+ * MADS is designed for difficult optimization problems where:
10
+ * - Functions have no exploitable derivatives
11
+ * - Evaluations are computationally expensive
12
+ * - Functions may be contaminated by noise
13
+ * - Functions may fail for some feasible points
14
+ *
15
+ * @packageDocumentation
16
+ */
17
+ import { StructType, VariantType, OptionType, ArrayType, IntegerType, BooleanType, FloatType, NullType } from "@elaraai/east";
18
+ import { VectorType } from "../types.js";
19
+ export { VectorType, ScalarObjectiveType } from "../types.js";
20
+ /**
21
+ * MADS optimization bounds.
22
+ *
23
+ * Defines the lower and upper bounds for each dimension of the search space.
24
+ */
25
+ export declare const MADSBoundsType: StructType<{
26
+ /** Lower bounds for each dimension */
27
+ readonly lower: VectorType<FloatType>;
28
+ /** Upper bounds for each dimension */
29
+ readonly upper: VectorType<FloatType>;
30
+ }>;
31
+ /**
32
+ * MADS constraint type.
33
+ *
34
+ * A variant where the tag indicates the constraint handling method:
35
+ * - `eb` (Extreme Barrier): Infeasible points are rejected entirely
36
+ * - `pb` (Progressive Barrier): Allows temporary constraint violations during search
37
+ *
38
+ * The value is the constraint function: g(x) <= 0 is feasible.
39
+ */
40
+ export declare const MADSConstraintType: VariantType<{
41
+ /** Extreme barrier constraint - infeasible points rejected */
42
+ readonly eb: import("@elaraai/east").FunctionType<[VectorType<FloatType>], FloatType>;
43
+ /** Progressive barrier constraint - temporary violations allowed */
44
+ readonly pb: import("@elaraai/east").FunctionType<[VectorType<FloatType>], FloatType>;
45
+ }>;
46
+ /**
47
+ * MADS direction type for poll step.
48
+ *
49
+ * Controls how search directions are generated during the poll step.
50
+ */
51
+ export declare const MADSDirectionType: VariantType<{
52
+ /** ORTHO 2N: 2n orthogonal directions (default) */
53
+ readonly ortho_2n: NullType;
54
+ /** ORTHO N+1: n+1 directions forming a simplex */
55
+ readonly ortho_n_plus_1: NullType;
56
+ /** LT 2N: Lower triangular with 2n directions */
57
+ readonly lt_2n: NullType;
58
+ /** Single direction */
59
+ readonly single: NullType;
60
+ }>;
61
+ /**
62
+ * MADS optimization configuration.
63
+ *
64
+ * Configures the MADS algorithm parameters.
65
+ */
66
+ export declare const MADSConfigType: StructType<{
67
+ /** Maximum number of blackbox evaluations */
68
+ readonly max_bb_eval: OptionType<IntegerType>;
69
+ /** Display verbosity level (0 = silent) */
70
+ readonly display_degree: OptionType<IntegerType>;
71
+ /** Direction type for poll step */
72
+ readonly direction_type: OptionType<VariantType<{
73
+ /** ORTHO 2N: 2n orthogonal directions (default) */
74
+ readonly ortho_2n: NullType;
75
+ /** ORTHO N+1: n+1 directions forming a simplex */
76
+ readonly ortho_n_plus_1: NullType;
77
+ /** LT 2N: Lower triangular with 2n directions */
78
+ readonly lt_2n: NullType;
79
+ /** Single direction */
80
+ readonly single: NullType;
81
+ }>>;
82
+ /** Initial mesh size */
83
+ readonly initial_mesh_size: OptionType<FloatType>;
84
+ /** Minimum mesh size (stopping criterion) */
85
+ readonly min_mesh_size: OptionType<FloatType>;
86
+ /** Random seed for reproducibility */
87
+ readonly seed: OptionType<IntegerType>;
88
+ }>;
89
+ /**
90
+ * MADS single-objective optimization result.
91
+ *
92
+ * Contains the best solution found and optimization statistics.
93
+ */
94
+ export declare const MADSResultType: StructType<{
95
+ /** Best solution vector found */
96
+ readonly x_best: VectorType<FloatType>;
97
+ /** Best objective value */
98
+ readonly f_best: FloatType;
99
+ /** Number of blackbox evaluations performed */
100
+ readonly bb_eval: IntegerType;
101
+ /** Whether optimization succeeded */
102
+ readonly success: BooleanType;
103
+ }>;
104
+ /**
105
+ * Single-objective MADS optimization with optional constraints.
106
+ *
107
+ * Minimizes an objective function subject to bound constraints and optional
108
+ * nonlinear constraints using the MADS algorithm.
109
+ *
110
+ * @param objective - Objective function to minimize: x -> f(x)
111
+ * @param x0 - Initial starting point
112
+ * @param bounds - Lower and upper bounds for each dimension
113
+ * @param constraints - Optional array of constraint functions (g(x) <= 0 is feasible)
114
+ * @param config - Optimization configuration
115
+ * @returns Optimization result with best solution found
116
+ *
117
+ * @example
118
+ * ```ts
119
+ * import { East, FloatType, variant } from "@elaraai/east";
120
+ * import { MADS } from "@elaraai/east-py-datascience";
121
+ *
122
+ * // Minimize sum of squares
123
+ * const objective = East.function([MADS.Types.VectorType(FloatType)], FloatType, ($, x) => {
124
+ * return x.reduce((acc, xi) => acc.add(xi.multiply(xi)), East.value(0.0));
125
+ * });
126
+ *
127
+ * const optimize = East.function([], MADS.Types.ResultType, $ => {
128
+ * const x0 = $.let([0.71, 0.51, 0.51]);
129
+ * const bounds = $.let({ lower: [-1.0, -1.0, -1.0], upper: [1.0, 1.0, 1.0] });
130
+ * const config = $.let({
131
+ * max_bb_eval: variant('some', 100n),
132
+ * display_degree: variant('some', 0n),
133
+ * direction_type: variant('none', null),
134
+ * initial_mesh_size: variant('none', null),
135
+ * min_mesh_size: variant('none', null),
136
+ * seed: variant('some', 42n),
137
+ * });
138
+ * return $.return(MADS.optimize(objective, x0, bounds, variant('none', null), config));
139
+ * });
140
+ *
141
+ * const compiled = await East.compileAsync(optimize.toIR(), MADS.Implementation);
142
+ * const result = await compiled();
143
+ * console.log(`Best: ${result.f_best}`);
144
+ * ```
145
+ */
146
+ export declare const mads_optimize: import("@elaraai/east").PlatformDefinition<[import("@elaraai/east").FunctionType<[VectorType<FloatType>], FloatType>, VectorType<FloatType>, StructType<{
147
+ /** Lower bounds for each dimension */
148
+ readonly lower: VectorType<FloatType>;
149
+ /** Upper bounds for each dimension */
150
+ readonly upper: VectorType<FloatType>;
151
+ }>, OptionType<ArrayType<VariantType<{
152
+ /** Extreme barrier constraint - infeasible points rejected */
153
+ readonly eb: import("@elaraai/east").FunctionType<[VectorType<FloatType>], FloatType>;
154
+ /** Progressive barrier constraint - temporary violations allowed */
155
+ readonly pb: import("@elaraai/east").FunctionType<[VectorType<FloatType>], FloatType>;
156
+ }>>>, StructType<{
157
+ /** Maximum number of blackbox evaluations */
158
+ readonly max_bb_eval: OptionType<IntegerType>;
159
+ /** Display verbosity level (0 = silent) */
160
+ readonly display_degree: OptionType<IntegerType>;
161
+ /** Direction type for poll step */
162
+ readonly direction_type: OptionType<VariantType<{
163
+ /** ORTHO 2N: 2n orthogonal directions (default) */
164
+ readonly ortho_2n: NullType;
165
+ /** ORTHO N+1: n+1 directions forming a simplex */
166
+ readonly ortho_n_plus_1: NullType;
167
+ /** LT 2N: Lower triangular with 2n directions */
168
+ readonly lt_2n: NullType;
169
+ /** Single direction */
170
+ readonly single: NullType;
171
+ }>>;
172
+ /** Initial mesh size */
173
+ readonly initial_mesh_size: OptionType<FloatType>;
174
+ /** Minimum mesh size (stopping criterion) */
175
+ readonly min_mesh_size: OptionType<FloatType>;
176
+ /** Random seed for reproducibility */
177
+ readonly seed: OptionType<IntegerType>;
178
+ }>], StructType<{
179
+ /** Best solution vector found */
180
+ readonly x_best: VectorType<FloatType>;
181
+ /** Best objective value */
182
+ readonly f_best: FloatType;
183
+ /** Number of blackbox evaluations performed */
184
+ readonly bb_eval: IntegerType;
185
+ /** Whether optimization succeeded */
186
+ readonly success: BooleanType;
187
+ }>>;
188
+ /**
189
+ * Type definitions for MADS optimization.
190
+ */
191
+ export declare const MADSTypes: {
192
+ /** Scalar objective function type */
193
+ readonly ScalarObjectiveType: import("@elaraai/east").FunctionType<[VectorType<FloatType>], FloatType>;
194
+ /** Bounds type with lower and upper vectors */
195
+ readonly BoundsType: StructType<{
196
+ /** Lower bounds for each dimension */
197
+ readonly lower: VectorType<FloatType>;
198
+ /** Upper bounds for each dimension */
199
+ readonly upper: VectorType<FloatType>;
200
+ }>;
201
+ /** Constraint type (eb or pb variant) */
202
+ readonly ConstraintType: VariantType<{
203
+ /** Extreme barrier constraint - infeasible points rejected */
204
+ readonly eb: import("@elaraai/east").FunctionType<[VectorType<FloatType>], FloatType>;
205
+ /** Progressive barrier constraint - temporary violations allowed */
206
+ readonly pb: import("@elaraai/east").FunctionType<[VectorType<FloatType>], FloatType>;
207
+ }>;
208
+ /** Direction type for poll step */
209
+ readonly DirectionType: VariantType<{
210
+ /** ORTHO 2N: 2n orthogonal directions (default) */
211
+ readonly ortho_2n: NullType;
212
+ /** ORTHO N+1: n+1 directions forming a simplex */
213
+ readonly ortho_n_plus_1: NullType;
214
+ /** LT 2N: Lower triangular with 2n directions */
215
+ readonly lt_2n: NullType;
216
+ /** Single direction */
217
+ readonly single: NullType;
218
+ }>;
219
+ /** Configuration type */
220
+ readonly ConfigType: StructType<{
221
+ /** Maximum number of blackbox evaluations */
222
+ readonly max_bb_eval: OptionType<IntegerType>;
223
+ /** Display verbosity level (0 = silent) */
224
+ readonly display_degree: OptionType<IntegerType>;
225
+ /** Direction type for poll step */
226
+ readonly direction_type: OptionType<VariantType<{
227
+ /** ORTHO 2N: 2n orthogonal directions (default) */
228
+ readonly ortho_2n: NullType;
229
+ /** ORTHO N+1: n+1 directions forming a simplex */
230
+ readonly ortho_n_plus_1: NullType;
231
+ /** LT 2N: Lower triangular with 2n directions */
232
+ readonly lt_2n: NullType;
233
+ /** Single direction */
234
+ readonly single: NullType;
235
+ }>>;
236
+ /** Initial mesh size */
237
+ readonly initial_mesh_size: OptionType<FloatType>;
238
+ /** Minimum mesh size (stopping criterion) */
239
+ readonly min_mesh_size: OptionType<FloatType>;
240
+ /** Random seed for reproducibility */
241
+ readonly seed: OptionType<IntegerType>;
242
+ }>;
243
+ /** Single-objective result type */
244
+ readonly ResultType: StructType<{
245
+ /** Best solution vector found */
246
+ readonly x_best: VectorType<FloatType>;
247
+ /** Best objective value */
248
+ readonly f_best: FloatType;
249
+ /** Number of blackbox evaluations performed */
250
+ readonly bb_eval: IntegerType;
251
+ /** Whether optimization succeeded */
252
+ readonly success: BooleanType;
253
+ }>;
254
+ };
255
+ /**
256
+ * MADS derivative-free blackbox optimization.
257
+ *
258
+ * Provides optimization algorithms for expensive blackbox functions
259
+ * where gradient information is unavailable using the NOMAD MADS algorithm.
260
+ *
261
+ * MADS is particularly effective for:
262
+ * - Expensive blackbox functions (simulations, experiments)
263
+ * - Functions with no exploitable derivatives
264
+ * - Noisy or stochastic functions
265
+ * - Functions that may fail for some inputs
266
+ *
267
+ * @example
268
+ * ```ts
269
+ * import { East, FloatType, variant } from "@elaraai/east";
270
+ * import { MADS } from "@elaraai/east-py-datascience";
271
+ *
272
+ * const objective = East.function([MADS.Types.VectorType(FloatType)], FloatType, ($, x) => {
273
+ * return x.reduce((acc, xi) => acc.add(xi.multiply(xi)), East.value(0.0));
274
+ * });
275
+ *
276
+ * const optimize = East.function([], MADS.Types.ResultType, $ => {
277
+ * const x0 = $.let([0.5, 0.5]);
278
+ * const bounds = $.let({ lower: [-1.0, -1.0], upper: [1.0, 1.0] });
279
+ * const config = $.let({
280
+ * max_bb_eval: variant('some', 100n),
281
+ * display_degree: variant('some', 0n),
282
+ * direction_type: variant('none', null),
283
+ * initial_mesh_size: variant('none', null),
284
+ * min_mesh_size: variant('none', null),
285
+ * seed: variant('some', 42n),
286
+ * });
287
+ * return $.return(MADS.optimize(objective, x0, bounds, variant('none', null), config));
288
+ * });
289
+ *
290
+ * const compiled = await East.compileAsync(optimize.toIR(), MADS.Implementation);
291
+ * const result = await compiled();
292
+ * ```
293
+ */
294
+ export declare const MADS: {
295
+ /**
296
+ * Single-objective optimization with optional constraints.
297
+ *
298
+ * Minimizes an objective function subject to bound and nonlinear constraints.
299
+ */
300
+ readonly optimize: import("@elaraai/east").PlatformDefinition<[import("@elaraai/east").FunctionType<[VectorType<FloatType>], FloatType>, VectorType<FloatType>, StructType<{
301
+ /** Lower bounds for each dimension */
302
+ readonly lower: VectorType<FloatType>;
303
+ /** Upper bounds for each dimension */
304
+ readonly upper: VectorType<FloatType>;
305
+ }>, OptionType<ArrayType<VariantType<{
306
+ /** Extreme barrier constraint - infeasible points rejected */
307
+ readonly eb: import("@elaraai/east").FunctionType<[VectorType<FloatType>], FloatType>;
308
+ /** Progressive barrier constraint - temporary violations allowed */
309
+ readonly pb: import("@elaraai/east").FunctionType<[VectorType<FloatType>], FloatType>;
310
+ }>>>, StructType<{
311
+ /** Maximum number of blackbox evaluations */
312
+ readonly max_bb_eval: OptionType<IntegerType>;
313
+ /** Display verbosity level (0 = silent) */
314
+ readonly display_degree: OptionType<IntegerType>;
315
+ /** Direction type for poll step */
316
+ readonly direction_type: OptionType<VariantType<{
317
+ /** ORTHO 2N: 2n orthogonal directions (default) */
318
+ readonly ortho_2n: NullType;
319
+ /** ORTHO N+1: n+1 directions forming a simplex */
320
+ readonly ortho_n_plus_1: NullType;
321
+ /** LT 2N: Lower triangular with 2n directions */
322
+ readonly lt_2n: NullType;
323
+ /** Single direction */
324
+ readonly single: NullType;
325
+ }>>;
326
+ /** Initial mesh size */
327
+ readonly initial_mesh_size: OptionType<FloatType>;
328
+ /** Minimum mesh size (stopping criterion) */
329
+ readonly min_mesh_size: OptionType<FloatType>;
330
+ /** Random seed for reproducibility */
331
+ readonly seed: OptionType<IntegerType>;
332
+ }>], StructType<{
333
+ /** Best solution vector found */
334
+ readonly x_best: VectorType<FloatType>;
335
+ /** Best objective value */
336
+ readonly f_best: FloatType;
337
+ /** Number of blackbox evaluations performed */
338
+ readonly bb_eval: IntegerType;
339
+ /** Whether optimization succeeded */
340
+ readonly success: BooleanType;
341
+ }>>;
342
+ /**
343
+ * Type definitions for MADS functions.
344
+ */
345
+ readonly Types: {
346
+ /** Scalar objective function type */
347
+ readonly ScalarObjectiveType: import("@elaraai/east").FunctionType<[VectorType<FloatType>], FloatType>;
348
+ /** Bounds type with lower and upper vectors */
349
+ readonly BoundsType: StructType<{
350
+ /** Lower bounds for each dimension */
351
+ readonly lower: VectorType<FloatType>;
352
+ /** Upper bounds for each dimension */
353
+ readonly upper: VectorType<FloatType>;
354
+ }>;
355
+ /** Constraint type (eb or pb variant) */
356
+ readonly ConstraintType: VariantType<{
357
+ /** Extreme barrier constraint - infeasible points rejected */
358
+ readonly eb: import("@elaraai/east").FunctionType<[VectorType<FloatType>], FloatType>;
359
+ /** Progressive barrier constraint - temporary violations allowed */
360
+ readonly pb: import("@elaraai/east").FunctionType<[VectorType<FloatType>], FloatType>;
361
+ }>;
362
+ /** Direction type for poll step */
363
+ readonly DirectionType: VariantType<{
364
+ /** ORTHO 2N: 2n orthogonal directions (default) */
365
+ readonly ortho_2n: NullType;
366
+ /** ORTHO N+1: n+1 directions forming a simplex */
367
+ readonly ortho_n_plus_1: NullType;
368
+ /** LT 2N: Lower triangular with 2n directions */
369
+ readonly lt_2n: NullType;
370
+ /** Single direction */
371
+ readonly single: NullType;
372
+ }>;
373
+ /** Configuration type */
374
+ readonly ConfigType: StructType<{
375
+ /** Maximum number of blackbox evaluations */
376
+ readonly max_bb_eval: OptionType<IntegerType>;
377
+ /** Display verbosity level (0 = silent) */
378
+ readonly display_degree: OptionType<IntegerType>;
379
+ /** Direction type for poll step */
380
+ readonly direction_type: OptionType<VariantType<{
381
+ /** ORTHO 2N: 2n orthogonal directions (default) */
382
+ readonly ortho_2n: NullType;
383
+ /** ORTHO N+1: n+1 directions forming a simplex */
384
+ readonly ortho_n_plus_1: NullType;
385
+ /** LT 2N: Lower triangular with 2n directions */
386
+ readonly lt_2n: NullType;
387
+ /** Single direction */
388
+ readonly single: NullType;
389
+ }>>;
390
+ /** Initial mesh size */
391
+ readonly initial_mesh_size: OptionType<FloatType>;
392
+ /** Minimum mesh size (stopping criterion) */
393
+ readonly min_mesh_size: OptionType<FloatType>;
394
+ /** Random seed for reproducibility */
395
+ readonly seed: OptionType<IntegerType>;
396
+ }>;
397
+ /** Single-objective result type */
398
+ readonly ResultType: StructType<{
399
+ /** Best solution vector found */
400
+ readonly x_best: VectorType<FloatType>;
401
+ /** Best objective value */
402
+ readonly f_best: FloatType;
403
+ /** Number of blackbox evaluations performed */
404
+ readonly bb_eval: IntegerType;
405
+ /** Whether optimization succeeded */
406
+ readonly success: BooleanType;
407
+ }>;
408
+ };
409
+ };
410
+ //# sourceMappingURL=mads.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mads.d.ts","sourceRoot":"","sources":["../../../src/mads/mads.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;GAWG;AAEH,OAAO,EAEH,UAAU,EACV,WAAW,EACX,UAAU,EACV,SAAS,EACT,WAAW,EACX,WAAW,EACX,SAAS,EACT,QAAQ,EACX,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,UAAU,EAAuB,MAAM,aAAa,CAAC;AAG9D,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAE9D;;;;GAIG;AACH,eAAO,MAAM,cAAc;IACvB,sCAAsC;;IAEtC,sCAAsC;;EAExC,CAAC;AAEH;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB;IAC3B,8DAA8D;;IAE9D,oEAAoE;;EAEtE,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,iBAAiB;IAC1B,mDAAmD;;IAEnD,kDAAkD;;IAElD,iDAAiD;;IAEjD,uBAAuB;;EAEzB,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,cAAc;IACvB,6CAA6C;;IAE7C,2CAA2C;;IAE3C,mCAAmC;;QApBnC,mDAAmD;;QAEnD,kDAAkD;;QAElD,iDAAiD;;QAEjD,uBAAuB;;;IAgBvB,wBAAwB;;IAExB,6CAA6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8D;;QAE9D,oEAAoE;;;QA0BpE,6CAA6C;;QAE7C,2CAA2C;;QAE3C,mCAAmC;;YApBnC,mDAAmD;;YAEnD,kDAAkD;;YAElD,iDAAiD;;YAEjD,uBAAuB;;;QAgBvB,wBAAwB;;QAExB,6CAA6C;;QAE7C,sCAAsC;;;QAUtC,iCAAiC;;QAEjC,2BAA2B;;QAE3B,+CAA+C;;QAE/C,qCAAqC;;;IAmIrC;;OAEG;;QA/DH,qCAAqC;;QAErC,+CAA+C;;YA9I/C,sCAAsC;;YAEtC,sCAAsC;;;QA8ItC,yCAAyC;;YAhIzC,8DAA8D;;YAE9D,oEAAoE;;;QAgIpE,mCAAmC;;YAtHnC,mDAAmD;;YAEnD,kDAAkD;;YAElD,iDAAiD;;YAEjD,uBAAuB;;;QAkHvB,yBAAyB;;YAxGzB,6CAA6C;;YAE7C,2CAA2C;;YAE3C,mCAAmC;;gBApBnC,mDAAmD;;gBAEnD,kDAAkD;;gBAElD,iDAAiD;;gBAEjD,uBAAuB;;;YAgBvB,wBAAwB;;YAExB,6CAA6C;;YAE7C,sCAAsC;;;QAgGtC,mCAAmC;;YAtFnC,iCAAiC;;YAEjC,2BAA2B;;YAE3B,+CAA+C;;YAE/C,qCAAqC;;;;CAwI/B,CAAC"}
@@ -0,0 +1,219 @@
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
+ * MADS (Mesh Adaptive Direct Search) derivative-free optimization.
7
+ *
8
+ * Provides blackbox optimization using the NOMAD MADS algorithm via PyNomadBBO.
9
+ * MADS is designed for difficult optimization problems where:
10
+ * - Functions have no exploitable derivatives
11
+ * - Evaluations are computationally expensive
12
+ * - Functions may be contaminated by noise
13
+ * - Functions may fail for some feasible points
14
+ *
15
+ * @packageDocumentation
16
+ */
17
+ import { East, StructType, VariantType, OptionType, ArrayType, IntegerType, BooleanType, FloatType, NullType, } from "@elaraai/east";
18
+ import { VectorType, ScalarObjectiveType } from "../types.js";
19
+ // Re-export shared types for convenience
20
+ export { VectorType, ScalarObjectiveType } from "../types.js";
21
+ /**
22
+ * MADS optimization bounds.
23
+ *
24
+ * Defines the lower and upper bounds for each dimension of the search space.
25
+ */
26
+ export const MADSBoundsType = StructType({
27
+ /** Lower bounds for each dimension */
28
+ lower: VectorType(FloatType),
29
+ /** Upper bounds for each dimension */
30
+ upper: VectorType(FloatType),
31
+ });
32
+ /**
33
+ * MADS constraint type.
34
+ *
35
+ * A variant where the tag indicates the constraint handling method:
36
+ * - `eb` (Extreme Barrier): Infeasible points are rejected entirely
37
+ * - `pb` (Progressive Barrier): Allows temporary constraint violations during search
38
+ *
39
+ * The value is the constraint function: g(x) <= 0 is feasible.
40
+ */
41
+ export const MADSConstraintType = VariantType({
42
+ /** Extreme barrier constraint - infeasible points rejected */
43
+ eb: ScalarObjectiveType,
44
+ /** Progressive barrier constraint - temporary violations allowed */
45
+ pb: ScalarObjectiveType,
46
+ });
47
+ /**
48
+ * MADS direction type for poll step.
49
+ *
50
+ * Controls how search directions are generated during the poll step.
51
+ */
52
+ export const MADSDirectionType = VariantType({
53
+ /** ORTHO 2N: 2n orthogonal directions (default) */
54
+ ortho_2n: NullType,
55
+ /** ORTHO N+1: n+1 directions forming a simplex */
56
+ ortho_n_plus_1: NullType,
57
+ /** LT 2N: Lower triangular with 2n directions */
58
+ lt_2n: NullType,
59
+ /** Single direction */
60
+ single: NullType,
61
+ });
62
+ /**
63
+ * MADS optimization configuration.
64
+ *
65
+ * Configures the MADS algorithm parameters.
66
+ */
67
+ export const MADSConfigType = StructType({
68
+ /** Maximum number of blackbox evaluations */
69
+ max_bb_eval: OptionType(IntegerType),
70
+ /** Display verbosity level (0 = silent) */
71
+ display_degree: OptionType(IntegerType),
72
+ /** Direction type for poll step */
73
+ direction_type: OptionType(MADSDirectionType),
74
+ /** Initial mesh size */
75
+ initial_mesh_size: OptionType(FloatType),
76
+ /** Minimum mesh size (stopping criterion) */
77
+ min_mesh_size: OptionType(FloatType),
78
+ /** Random seed for reproducibility */
79
+ seed: OptionType(IntegerType),
80
+ });
81
+ /**
82
+ * MADS single-objective optimization result.
83
+ *
84
+ * Contains the best solution found and optimization statistics.
85
+ */
86
+ export const MADSResultType = StructType({
87
+ /** Best solution vector found */
88
+ x_best: VectorType(FloatType),
89
+ /** Best objective value */
90
+ f_best: FloatType,
91
+ /** Number of blackbox evaluations performed */
92
+ bb_eval: IntegerType,
93
+ /** Whether optimization succeeded */
94
+ success: BooleanType,
95
+ });
96
+ // ============================================================================
97
+ // Platform Functions
98
+ // ============================================================================
99
+ /**
100
+ * Single-objective MADS optimization with optional constraints.
101
+ *
102
+ * Minimizes an objective function subject to bound constraints and optional
103
+ * nonlinear constraints using the MADS algorithm.
104
+ *
105
+ * @param objective - Objective function to minimize: x -> f(x)
106
+ * @param x0 - Initial starting point
107
+ * @param bounds - Lower and upper bounds for each dimension
108
+ * @param constraints - Optional array of constraint functions (g(x) <= 0 is feasible)
109
+ * @param config - Optimization configuration
110
+ * @returns Optimization result with best solution found
111
+ *
112
+ * @example
113
+ * ```ts
114
+ * import { East, FloatType, variant } from "@elaraai/east";
115
+ * import { MADS } from "@elaraai/east-py-datascience";
116
+ *
117
+ * // Minimize sum of squares
118
+ * const objective = East.function([MADS.Types.VectorType(FloatType)], FloatType, ($, x) => {
119
+ * return x.reduce((acc, xi) => acc.add(xi.multiply(xi)), East.value(0.0));
120
+ * });
121
+ *
122
+ * const optimize = East.function([], MADS.Types.ResultType, $ => {
123
+ * const x0 = $.let([0.71, 0.51, 0.51]);
124
+ * const bounds = $.let({ lower: [-1.0, -1.0, -1.0], upper: [1.0, 1.0, 1.0] });
125
+ * const config = $.let({
126
+ * max_bb_eval: variant('some', 100n),
127
+ * display_degree: variant('some', 0n),
128
+ * direction_type: variant('none', null),
129
+ * initial_mesh_size: variant('none', null),
130
+ * min_mesh_size: variant('none', null),
131
+ * seed: variant('some', 42n),
132
+ * });
133
+ * return $.return(MADS.optimize(objective, x0, bounds, variant('none', null), config));
134
+ * });
135
+ *
136
+ * const compiled = await East.compileAsync(optimize.toIR(), MADS.Implementation);
137
+ * const result = await compiled();
138
+ * console.log(`Best: ${result.f_best}`);
139
+ * ```
140
+ */
141
+ export const mads_optimize = East.platform("mads_optimize", [
142
+ ScalarObjectiveType,
143
+ VectorType(FloatType),
144
+ MADSBoundsType,
145
+ OptionType(ArrayType(MADSConstraintType)),
146
+ MADSConfigType,
147
+ ], MADSResultType);
148
+ // ============================================================================
149
+ // Grouped Export
150
+ // ============================================================================
151
+ /**
152
+ * Type definitions for MADS optimization.
153
+ */
154
+ export const MADSTypes = {
155
+ /** Scalar objective function type */
156
+ ScalarObjectiveType,
157
+ /** Bounds type with lower and upper vectors */
158
+ BoundsType: MADSBoundsType,
159
+ /** Constraint type (eb or pb variant) */
160
+ ConstraintType: MADSConstraintType,
161
+ /** Direction type for poll step */
162
+ DirectionType: MADSDirectionType,
163
+ /** Configuration type */
164
+ ConfigType: MADSConfigType,
165
+ /** Single-objective result type */
166
+ ResultType: MADSResultType,
167
+ };
168
+ /**
169
+ * MADS derivative-free blackbox optimization.
170
+ *
171
+ * Provides optimization algorithms for expensive blackbox functions
172
+ * where gradient information is unavailable using the NOMAD MADS algorithm.
173
+ *
174
+ * MADS is particularly effective for:
175
+ * - Expensive blackbox functions (simulations, experiments)
176
+ * - Functions with no exploitable derivatives
177
+ * - Noisy or stochastic functions
178
+ * - Functions that may fail for some inputs
179
+ *
180
+ * @example
181
+ * ```ts
182
+ * import { East, FloatType, variant } from "@elaraai/east";
183
+ * import { MADS } from "@elaraai/east-py-datascience";
184
+ *
185
+ * const objective = East.function([MADS.Types.VectorType(FloatType)], FloatType, ($, x) => {
186
+ * return x.reduce((acc, xi) => acc.add(xi.multiply(xi)), East.value(0.0));
187
+ * });
188
+ *
189
+ * const optimize = East.function([], MADS.Types.ResultType, $ => {
190
+ * const x0 = $.let([0.5, 0.5]);
191
+ * const bounds = $.let({ lower: [-1.0, -1.0], upper: [1.0, 1.0] });
192
+ * const config = $.let({
193
+ * max_bb_eval: variant('some', 100n),
194
+ * display_degree: variant('some', 0n),
195
+ * direction_type: variant('none', null),
196
+ * initial_mesh_size: variant('none', null),
197
+ * min_mesh_size: variant('none', null),
198
+ * seed: variant('some', 42n),
199
+ * });
200
+ * return $.return(MADS.optimize(objective, x0, bounds, variant('none', null), config));
201
+ * });
202
+ *
203
+ * const compiled = await East.compileAsync(optimize.toIR(), MADS.Implementation);
204
+ * const result = await compiled();
205
+ * ```
206
+ */
207
+ export const MADS = {
208
+ /**
209
+ * Single-objective optimization with optional constraints.
210
+ *
211
+ * Minimizes an objective function subject to bound and nonlinear constraints.
212
+ */
213
+ optimize: mads_optimize,
214
+ /**
215
+ * Type definitions for MADS functions.
216
+ */
217
+ Types: MADSTypes,
218
+ };
219
+ //# sourceMappingURL=mads.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mads.js","sourceRoot":"","sources":["../../../src/mads/mads.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;GAWG;AAEH,OAAO,EACH,IAAI,EACJ,UAAU,EACV,WAAW,EACX,UAAU,EACV,SAAS,EACT,WAAW,EACX,WAAW,EACX,SAAS,EACT,QAAQ,GACX,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAE9D,yCAAyC;AACzC,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAE9D;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,UAAU,CAAC;IACrC,sCAAsC;IACtC,KAAK,EAAE,UAAU,CAAC,SAAS,CAAC;IAC5B,sCAAsC;IACtC,KAAK,EAAE,UAAU,CAAC,SAAS,CAAC;CAC/B,CAAC,CAAC;AAEH;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,WAAW,CAAC;IAC1C,8D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