@iyulab/u-metaheur 0.13.0 → 0.14.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 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.13"
81
+ u-metaheur = "0.14"
82
82
 
83
83
  # with serde support
84
- u-metaheur = { version = "0.13", features = ["serde"] }
84
+ u-metaheur = { version = "0.14", features = ["serde"] }
85
85
  ```
86
86
 
87
87
  ## Build & Test
@@ -143,7 +143,10 @@ console.log(run_ga({ nodes, population_size: 30, generations: 50, seed: 7 }).bes
143
143
  ```
144
144
 
145
145
  `run_ga` also takes `mutation_rate`; `run_sa` takes `initial_temp` and
146
- `cooling_rate`. Both take `seed` (a whole number from 0 to 2^64 − 1 — a run that
146
+ `cooling_rate`. Without `initial_temp` the annealing starts at a twentieth of the
147
+ typical worsening of a 2-opt move (measured before the run), so the same cities
148
+ in other coordinates anneal the same way; give `initial_temp` for an absolute
149
+ temperature in the unit of the tour length. Both take `seed` (a whole number from 0 to 2^64 − 1 — a run that
147
150
  ends on its own budget is reproduced exactly) and `time_limit_ms` (at least 1 —
148
151
  the run returns the best tour found by then). `stop_reason` is
149
152
  `"iteration_limit"` when the run spent its `generations` / `iterations`,
@@ -54,7 +54,10 @@ exports.run_ga = run_ga;
54
54
  * # Arguments
55
55
  * `config` — native JS object with fields:
56
56
  * - `nodes`: `[[x, y], ...]` (required, at least 2)
57
- * - `initial_temp`: float (default 1000.0, > 0)
57
+ * - `initial_temp`: float > 0 (optional) -- an absolute temperature, in the
58
+ * unit of the tour length. Left out, the start is the typical worsening of
59
+ * a 2-opt move from the nearest-neighbour tour, measured before the run, so
60
+ * the same tour in other coordinates anneals the same way
58
61
  * - `cooling_rate`: float in (0, 1) (default 0.995)
59
62
  * - `iterations`: integer (default 5000, at least 1)
60
63
  * - `seed`, `time_limit_ms`: as `run_ga`'s
@@ -64,7 +64,11 @@ export interface GaResult {
64
64
 
65
65
  export interface SaConfig {
66
66
  nodes: [number, number][];
67
- initial_temp?: number;
67
+ /**
68
+ * Starting temperature in the unit of the tour length, `> 0`. Left out,
69
+ * the temperature follows the tour lengths (see `run_sa`).
70
+ */
71
+ initial_temp?: number | null;
68
72
  cooling_rate?: number;
69
73
  /**
70
74
  * At least 1 (`run_sa` checks it; see [`Whole`] for why it is signed).
@@ -130,7 +134,10 @@ export function run_ga(config: GaConfig): GaResult;
130
134
  * # Arguments
131
135
  * `config` — native JS object with fields:
132
136
  * - `nodes`: `[[x, y], ...]` (required, at least 2)
133
- * - `initial_temp`: float (default 1000.0, > 0)
137
+ * - `initial_temp`: float > 0 (optional) -- an absolute temperature, in the
138
+ * unit of the tour length. Left out, the start is the typical worsening of
139
+ * a 2-opt move from the nearest-neighbour tour, measured before the run, so
140
+ * the same tour in other coordinates anneals the same way
134
141
  * - `cooling_rate`: float in (0, 1) (default 0.995)
135
142
  * - `iterations`: integer (default 5000, at least 1)
136
143
  * - `seed`, `time_limit_ms`: as `run_ga`'s
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.13.0",
8
+ "version": "0.14.1",
9
9
  "license": "MIT",
10
10
  "repository": {
11
11
  "type": "git",
package/u_metaheur.d.ts CHANGED
@@ -64,7 +64,11 @@ export interface GaResult {
64
64
 
65
65
  export interface SaConfig {
66
66
  nodes: [number, number][];
67
- initial_temp?: number;
67
+ /**
68
+ * Starting temperature in the unit of the tour length, `> 0`. Left out,
69
+ * the temperature follows the tour lengths (see `run_sa`).
70
+ */
71
+ initial_temp?: number | null;
68
72
  cooling_rate?: number;
69
73
  /**
70
74
  * At least 1 (`run_sa` checks it; see [`Whole`] for why it is signed).
@@ -130,7 +134,10 @@ export function run_ga(config: GaConfig): GaResult;
130
134
  * # Arguments
131
135
  * `config` — native JS object with fields:
132
136
  * - `nodes`: `[[x, y], ...]` (required, at least 2)
133
- * - `initial_temp`: float (default 1000.0, > 0)
137
+ * - `initial_temp`: float > 0 (optional) -- an absolute temperature, in the
138
+ * unit of the tour length. Left out, the start is the typical worsening of
139
+ * a 2-opt move from the nearest-neighbour tour, measured before the run, so
140
+ * the same tour in other coordinates anneals the same way
134
141
  * - `cooling_rate`: float in (0, 1) (default 0.995)
135
142
  * - `iterations`: integer (default 5000, at least 1)
136
143
  * - `seed`, `time_limit_ms`: as `run_ga`'s
package/u_metaheur_bg.js CHANGED
@@ -50,7 +50,10 @@ export function run_ga(config) {
50
50
  * # Arguments
51
51
  * `config` — native JS object with fields:
52
52
  * - `nodes`: `[[x, y], ...]` (required, at least 2)
53
- * - `initial_temp`: float (default 1000.0, > 0)
53
+ * - `initial_temp`: float > 0 (optional) -- an absolute temperature, in the
54
+ * unit of the tour length. Left out, the start is the typical worsening of
55
+ * a 2-opt move from the nearest-neighbour tour, measured before the run, so
56
+ * the same tour in other coordinates anneals the same way
54
57
  * - `cooling_rate`: float in (0, 1) (default 0.995)
55
58
  * - `iterations`: integer (default 5000, at least 1)
56
59
  * - `seed`, `time_limit_ms`: as `run_ga`'s
Binary file