@iyulab/u-metaheur 0.7.0 → 0.8.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.
- package/README.md +5 -5
- package/node/u_metaheur.d.cts +9 -0
- package/node/u_metaheur_bg.wasm +0 -0
- package/package.json +1 -1
- package/u_metaheur.d.ts +9 -0
- package/u_metaheur_bg.wasm +0 -0
package/README.md
CHANGED
|
@@ -78,10 +78,10 @@ assert!((result.best - 3.0).abs() < 0.1);
|
|
|
78
78
|
|
|
79
79
|
```toml
|
|
80
80
|
[dependencies]
|
|
81
|
-
u-metaheur = "0.
|
|
81
|
+
u-metaheur = "0.8"
|
|
82
82
|
|
|
83
83
|
# with serde support
|
|
84
|
-
u-metaheur = { version = "0.
|
|
84
|
+
u-metaheur = { version = "0.8", features = ["serde"] }
|
|
85
85
|
```
|
|
86
86
|
|
|
87
87
|
## Build & Test
|
|
@@ -153,16 +153,16 @@ import { run_sa } from '@iyulab/u-metaheur';
|
|
|
153
153
|
try {
|
|
154
154
|
run_sa({ nodes: [[0, 0], [1, 0], [1, 1]], cooling_rate: 1 });
|
|
155
155
|
} catch (err) {
|
|
156
|
-
console.log(err.code, err.parameter, err.
|
|
156
|
+
console.log(err.code, err.parameter, err.exclusive_min, err.exclusive_max, err.got); // parameter_out_of_range cooling_rate 0 1 1
|
|
157
157
|
}
|
|
158
158
|
```
|
|
159
159
|
|
|
160
160
|
| `code` | Fields | Meaning |
|
|
161
161
|
|---|---|---|
|
|
162
162
|
| `insufficient_data` | `parameter` (`"nodes"`), `min`, `got` | Fewer than 2 nodes |
|
|
163
|
-
| `parameter_out_of_range` | `parameter`, `min`, `max`
|
|
163
|
+
| `parameter_out_of_range` | `parameter`, `min`, `max`, `exclusive_min`, `exclusive_max`, `got` | `population_size < 2`, `generations` or `iterations` below 1 (a negative count included: `population_size: -1` is `{ min: 2, max: null, got: -1 }`, the same as `1`), `initial_temp ≤ 0`, or `cooling_rate` outside (0, 1). `min` / `max` are the closed (included) bounds and are always present — `null` on a side that is open or unbounded; `exclusive_min` / `exclusive_max` are the open (excluded) bounds, present only when that end is open: `initial_temp` (> 0) is refused with `min: null, exclusive_min: 0`, `cooling_rate` with `exclusive_min: 0, exclusive_max: 1` |
|
|
164
164
|
| `value_not_finite` | `parameter`, `index` | A NaN or ±Infinity anywhere in an argument — `parameter` is the path to it (`config.nodes[1]`), `index` its position in that array, or `null` |
|
|
165
|
-
| `malformed_input` | `parameter` | An argument of the wrong shape or type (a missing or unknown key), or a JSON string |
|
|
165
|
+
| `malformed_input` | `parameter` | An argument of the wrong shape or type (a missing or unknown key), a count that is not a whole number (`population_size: 2.5` — `parameter` is the field), or a JSON string |
|
|
166
166
|
|
|
167
167
|
### TypeScript
|
|
168
168
|
|
package/node/u_metaheur.d.cts
CHANGED
|
@@ -2,7 +2,13 @@
|
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export interface GaConfig {
|
|
4
4
|
nodes: [number, number][];
|
|
5
|
+
/**
|
|
6
|
+
* At least 2 (`run_ga` checks it; see [`Whole`] for why it is signed).
|
|
7
|
+
*/
|
|
5
8
|
population_size?: number;
|
|
9
|
+
/**
|
|
10
|
+
* At least 1.
|
|
11
|
+
*/
|
|
6
12
|
generations?: number;
|
|
7
13
|
mutation_rate?: number;
|
|
8
14
|
}
|
|
@@ -17,6 +23,9 @@ export interface SaConfig {
|
|
|
17
23
|
nodes: [number, number][];
|
|
18
24
|
initial_temp?: number;
|
|
19
25
|
cooling_rate?: number;
|
|
26
|
+
/**
|
|
27
|
+
* At least 1 (`run_sa` checks it; see [`Whole`] for why it is signed).
|
|
28
|
+
*/
|
|
20
29
|
iterations?: number;
|
|
21
30
|
}
|
|
22
31
|
|
package/node/u_metaheur_bg.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED
package/u_metaheur.d.ts
CHANGED
|
@@ -2,7 +2,13 @@
|
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export interface GaConfig {
|
|
4
4
|
nodes: [number, number][];
|
|
5
|
+
/**
|
|
6
|
+
* At least 2 (`run_ga` checks it; see [`Whole`] for why it is signed).
|
|
7
|
+
*/
|
|
5
8
|
population_size?: number;
|
|
9
|
+
/**
|
|
10
|
+
* At least 1.
|
|
11
|
+
*/
|
|
6
12
|
generations?: number;
|
|
7
13
|
mutation_rate?: number;
|
|
8
14
|
}
|
|
@@ -17,6 +23,9 @@ export interface SaConfig {
|
|
|
17
23
|
nodes: [number, number][];
|
|
18
24
|
initial_temp?: number;
|
|
19
25
|
cooling_rate?: number;
|
|
26
|
+
/**
|
|
27
|
+
* At least 1 (`run_sa` checks it; see [`Whole`] for why it is signed).
|
|
28
|
+
*/
|
|
20
29
|
iterations?: number;
|
|
21
30
|
}
|
|
22
31
|
|
package/u_metaheur_bg.wasm
CHANGED
|
Binary file
|