@iyulab/u-metaheur 0.2.0 → 0.3.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/package.json +2 -2
- package/u_metaheur.d.ts +4 -4
- package/u_metaheur_bg.js +29 -22
- package/u_metaheur_bg.wasm +0 -0
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.
|
|
8
|
+
"version": "0.3.0",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
@@ -29,4 +29,4 @@
|
|
|
29
29
|
"metaheuristic",
|
|
30
30
|
"evolutionary"
|
|
31
31
|
]
|
|
32
|
-
}
|
|
32
|
+
}
|
package/u_metaheur.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Runs a Genetic Algorithm for TSP.
|
|
6
6
|
*
|
|
7
7
|
* # Arguments
|
|
8
|
-
* `
|
|
8
|
+
* `config` — native JS object with fields:
|
|
9
9
|
* - `nodes`: `[[x, y], ...]` (required)
|
|
10
10
|
* - `population_size`: integer (default 100)
|
|
11
11
|
* - `generations`: integer (default 200)
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* # Returns
|
|
15
15
|
* JS object with `best_distance`, `best_tour`, `generations_run`.
|
|
16
16
|
*/
|
|
17
|
-
export function run_ga(
|
|
17
|
+
export function run_ga(config: any): any;
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* Runs Simulated Annealing for TSP.
|
|
@@ -23,7 +23,7 @@ export function run_ga(config_json: any): any;
|
|
|
23
23
|
* Neighbour move: 2-opt segment reversal between two random positions.
|
|
24
24
|
*
|
|
25
25
|
* # Arguments
|
|
26
|
-
* `
|
|
26
|
+
* `config` — native JS object with fields:
|
|
27
27
|
* - `nodes`: `[[x, y], ...]` (required)
|
|
28
28
|
* - `initial_temp`: float (default 1000.0)
|
|
29
29
|
* - `cooling_rate`: float in (0, 1) (default 0.995)
|
|
@@ -32,4 +32,4 @@ export function run_ga(config_json: any): any;
|
|
|
32
32
|
* # Returns
|
|
33
33
|
* JS object with `best_distance`, `best_tour`, `iterations_run`.
|
|
34
34
|
*/
|
|
35
|
-
export function run_sa(
|
|
35
|
+
export function run_sa(config: any): any;
|
package/u_metaheur_bg.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Runs a Genetic Algorithm for TSP.
|
|
3
3
|
*
|
|
4
4
|
* # Arguments
|
|
5
|
-
* `
|
|
5
|
+
* `config` — native JS object with fields:
|
|
6
6
|
* - `nodes`: `[[x, y], ...]` (required)
|
|
7
7
|
* - `population_size`: integer (default 100)
|
|
8
8
|
* - `generations`: integer (default 200)
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
*
|
|
11
11
|
* # Returns
|
|
12
12
|
* JS object with `best_distance`, `best_tour`, `generations_run`.
|
|
13
|
-
* @param {any}
|
|
13
|
+
* @param {any} config
|
|
14
14
|
* @returns {any}
|
|
15
15
|
*/
|
|
16
|
-
export function run_ga(
|
|
17
|
-
const ret = wasm.run_ga(
|
|
16
|
+
export function run_ga(config) {
|
|
17
|
+
const ret = wasm.run_ga(config);
|
|
18
18
|
if (ret[2]) {
|
|
19
19
|
throw takeFromExternrefTable0(ret[1]);
|
|
20
20
|
}
|
|
@@ -28,7 +28,7 @@ export function run_ga(config_json) {
|
|
|
28
28
|
* Neighbour move: 2-opt segment reversal between two random positions.
|
|
29
29
|
*
|
|
30
30
|
* # Arguments
|
|
31
|
-
* `
|
|
31
|
+
* `config` — native JS object with fields:
|
|
32
32
|
* - `nodes`: `[[x, y], ...]` (required)
|
|
33
33
|
* - `initial_temp`: float (default 1000.0)
|
|
34
34
|
* - `cooling_rate`: float in (0, 1) (default 0.995)
|
|
@@ -36,11 +36,11 @@ export function run_ga(config_json) {
|
|
|
36
36
|
*
|
|
37
37
|
* # Returns
|
|
38
38
|
* JS object with `best_distance`, `best_tour`, `iterations_run`.
|
|
39
|
-
* @param {any}
|
|
39
|
+
* @param {any} config
|
|
40
40
|
* @returns {any}
|
|
41
41
|
*/
|
|
42
|
-
export function run_sa(
|
|
43
|
-
const ret = wasm.run_sa(
|
|
42
|
+
export function run_sa(config) {
|
|
43
|
+
const ret = wasm.run_sa(config);
|
|
44
44
|
if (ret[2]) {
|
|
45
45
|
throw takeFromExternrefTable0(ret[1]);
|
|
46
46
|
}
|
|
@@ -50,10 +50,6 @@ export function __wbg_Error_8c4e43fe74559d73(arg0, arg1) {
|
|
|
50
50
|
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
51
51
|
return ret;
|
|
52
52
|
}
|
|
53
|
-
export function __wbg_Number_04624de7d0e8332d(arg0) {
|
|
54
|
-
const ret = Number(arg0);
|
|
55
|
-
return ret;
|
|
56
|
-
}
|
|
57
53
|
export function __wbg_String_8f0eb39a4a4c2f66(arg0, arg1) {
|
|
58
54
|
const ret = String(arg1);
|
|
59
55
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
@@ -96,10 +92,6 @@ export function __wbg___wbindgen_is_object_5ae8e5880f2c1fbd(arg0) {
|
|
|
96
92
|
const ret = typeof(val) === 'object' && val !== null;
|
|
97
93
|
return ret;
|
|
98
94
|
}
|
|
99
|
-
export function __wbg___wbindgen_is_undefined_9e4d92534c42d778(arg0) {
|
|
100
|
-
const ret = arg0 === undefined;
|
|
101
|
-
return ret;
|
|
102
|
-
}
|
|
103
95
|
export function __wbg___wbindgen_jsval_eq_11888390b0186270(arg0, arg1) {
|
|
104
96
|
const ret = arg0 === arg1;
|
|
105
97
|
return ret;
|
|
@@ -133,6 +125,10 @@ export function __wbg_done_57b39ecd9addfe81(arg0) {
|
|
|
133
125
|
const ret = arg0.done;
|
|
134
126
|
return ret;
|
|
135
127
|
}
|
|
128
|
+
export function __wbg_entries_58c7934c745daac7(arg0) {
|
|
129
|
+
const ret = Object.entries(arg0);
|
|
130
|
+
return ret;
|
|
131
|
+
}
|
|
136
132
|
export function __wbg_getRandomValues_1c61fac11405ffdc() { return handleError(function (arg0, arg1) {
|
|
137
133
|
globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
|
|
138
134
|
}, arguments); }
|
|
@@ -144,10 +140,6 @@ export function __wbg_get_b3ed3ad4be2bc8ac() { return handleError(function (arg0
|
|
|
144
140
|
const ret = Reflect.get(arg0, arg1);
|
|
145
141
|
return ret;
|
|
146
142
|
}, arguments); }
|
|
147
|
-
export function __wbg_get_with_ref_key_1dc361bd10053bfe(arg0, arg1) {
|
|
148
|
-
const ret = arg0[arg1];
|
|
149
|
-
return ret;
|
|
150
|
-
}
|
|
151
143
|
export function __wbg_instanceof_ArrayBuffer_c367199e2fa2aa04(arg0) {
|
|
152
144
|
let result;
|
|
153
145
|
try {
|
|
@@ -158,6 +150,16 @@ export function __wbg_instanceof_ArrayBuffer_c367199e2fa2aa04(arg0) {
|
|
|
158
150
|
const ret = result;
|
|
159
151
|
return ret;
|
|
160
152
|
}
|
|
153
|
+
export function __wbg_instanceof_Map_53af74335dec57f4(arg0) {
|
|
154
|
+
let result;
|
|
155
|
+
try {
|
|
156
|
+
result = arg0 instanceof Map;
|
|
157
|
+
} catch (_) {
|
|
158
|
+
result = false;
|
|
159
|
+
}
|
|
160
|
+
const ret = result;
|
|
161
|
+
return ret;
|
|
162
|
+
}
|
|
161
163
|
export function __wbg_instanceof_Uint8Array_9b9075935c74707c(arg0) {
|
|
162
164
|
let result;
|
|
163
165
|
try {
|
|
@@ -226,12 +228,17 @@ export function __wbindgen_cast_0000000000000001(arg0) {
|
|
|
226
228
|
const ret = arg0;
|
|
227
229
|
return ret;
|
|
228
230
|
}
|
|
229
|
-
export function __wbindgen_cast_0000000000000002(arg0
|
|
231
|
+
export function __wbindgen_cast_0000000000000002(arg0) {
|
|
232
|
+
// Cast intrinsic for `I64 -> Externref`.
|
|
233
|
+
const ret = arg0;
|
|
234
|
+
return ret;
|
|
235
|
+
}
|
|
236
|
+
export function __wbindgen_cast_0000000000000003(arg0, arg1) {
|
|
230
237
|
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
231
238
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
232
239
|
return ret;
|
|
233
240
|
}
|
|
234
|
-
export function
|
|
241
|
+
export function __wbindgen_cast_0000000000000004(arg0) {
|
|
235
242
|
// Cast intrinsic for `U64 -> Externref`.
|
|
236
243
|
const ret = BigInt.asUintN(64, arg0);
|
|
237
244
|
return ret;
|
package/u_metaheur_bg.wasm
CHANGED
|
Binary file
|