@iyulab/u-metaheur 0.6.3 → 0.8.0

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 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.6"
81
+ u-metaheur = "0.8"
82
82
 
83
83
  # with serde support
84
- u-metaheur = { version = "0.6", features = ["serde"] }
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.min, err.max, err.got); // parameter_out_of_range cooling_rate 0 1 1
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` (or `null`), `got` | `population_size < 2`, `generations` or `iterations` of 0, `initial_temp ≤ 0`, or `cooling_rate` outside (0, 1) — the message says whether a bound is included |
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
 
@@ -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
 
Binary file
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "iyulab"
6
6
  ],
7
7
  "description": "Domain-agnostic metaheuristic optimization framework: GA, BRKGA, SA, ALNS.",
8
- "version": "0.6.3",
8
+ "version": "0.8.0",
9
9
  "license": "MIT",
10
10
  "repository": {
11
11
  "type": "git",
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
 
Binary file