@reicek/neataptic-ts 0.1.25 → 0.1.26
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/.github/copilot-instructions.md +11 -0
- package/.github/skills/trace-analyzer-extension/SKILL.md +3 -3
- package/.github/skills/trace-analyzer-extension/assets/extension-checklist.md +1 -1
- package/.github/skills/trace-analyzer-extension/references/analyzer-extension-workflow.md +1 -1
- package/.github/skills/trace-audit-reporting/SKILL.md +3 -3
- package/.github/skills/trace-audit-reporting/references/trace-analysis-workflow.md +1 -1
- package/package.json +19 -13
- package/plans/Flappy_Bird_Folder_Documentation_Pass.md +4 -4
- package/plans/README.md +24 -0
- package/plans/Roadmap.md +62 -40
- package/plans/analyze-trace-solid-split.plans.md +66 -0
- package/plans/architecture-solid-split.plans.md +9 -15
- package/plans/asciiMaze-typescript-repair.plans.md +1 -1
- package/plans/generate-docs-solid-split.plans.md +87 -0
- package/plans/methods-docs.plans.md +25 -1
- package/plans/methods-solid-split.plans.md +14 -14
- package/plans/neat-docs.plans.md +9 -1
- package/plans/neat-test-surface-repair.plans.md +1 -1
- package/plans/render-docs-html-solid-split.plans.md +68 -0
- package/plans/src-no-explicit-any-cleanup.plans.md +1 -1
- package/plans/utils-docs.plans.md +6 -1
- package/scripts/analyze-trace/analyze-trace.analysis.ts +479 -0
- package/scripts/analyze-trace/analyze-trace.constants.ts +35 -0
- package/scripts/analyze-trace/analyze-trace.io.ts +69 -0
- package/scripts/analyze-trace/analyze-trace.report.ts +100 -0
- package/scripts/analyze-trace/analyze-trace.shared.ts +116 -0
- package/scripts/analyze-trace/analyze-trace.ts +45 -0
- package/scripts/analyze-trace/analyze-trace.types.ts +72 -0
- package/scripts/assets/theme.css +80 -23
- package/scripts/copy-examples.ts +239 -0
- package/scripts/export-onnx.ts +223 -0
- package/scripts/generate-bench-tables.ts +378 -37
- package/scripts/generate-docs/generate-docs.constants.ts +107 -0
- package/scripts/generate-docs/generate-docs.order.ts +355 -0
- package/scripts/generate-docs/generate-docs.state.ts +31 -0
- package/scripts/generate-docs/generate-docs.targets.ts +165 -0
- package/scripts/generate-docs/generate-docs.ts +63 -0
- package/scripts/generate-docs/generate-docs.types.ts +112 -0
- package/scripts/generate-docs/output/generate-docs.output.folder-index.utils.ts +167 -0
- package/scripts/generate-docs/output/generate-docs.output.ordering.utils.ts +353 -0
- package/scripts/generate-docs/output/generate-docs.output.readme.utils.ts +420 -0
- package/scripts/generate-docs/output/generate-docs.output.ts +123 -0
- package/scripts/generate-docs/output/generate-docs.output.warnings.utils.ts +219 -0
- package/scripts/generate-docs/symbols/generate-docs.symbols.collection.utils.ts +365 -0
- package/scripts/generate-docs/symbols/generate-docs.symbols.jsdoc.utils.ts +373 -0
- package/scripts/generate-docs/symbols/generate-docs.symbols.normalize.utils.ts +155 -0
- package/scripts/generate-docs/symbols/generate-docs.symbols.render.utils.ts +149 -0
- package/scripts/generate-docs/symbols/generate-docs.symbols.signature.utils.ts +289 -0
- package/scripts/generate-docs/symbols/generate-docs.symbols.ts +11 -0
- package/scripts/mermaid-cli.mjs +102 -22
- package/scripts/mermaid-cli.ts +736 -0
- package/scripts/render-docs-html/render-docs-html.assets.ts +54 -0
- package/scripts/render-docs-html/render-docs-html.mermaid.ts +245 -0
- package/scripts/{render-docs-html.sidebar.ts → render-docs-html/render-docs-html.navigation.ts} +141 -144
- package/scripts/render-docs-html/render-docs-html.pages.ts +333 -0
- package/scripts/render-docs-html/render-docs-html.shared.ts +333 -0
- package/scripts/render-docs-html/render-docs-html.types.ts +42 -0
- package/scripts/render-docs-html.ts +23 -587
- package/scripts/run-docs.ts +238 -0
- package/scripts/write-dist-docs-pkg.ts +40 -0
- package/src/README.md +75 -75
- package/src/architecture/connection/README.md +5 -5
- package/src/architecture/layer/README.md +508 -508
- package/src/architecture/network/README.md +1458 -1458
- package/src/architecture/network/activate/README.md +694 -694
- package/src/architecture/network/bootstrap/README.md +77 -77
- package/src/architecture/network/connect/README.md +74 -74
- package/src/architecture/network/deterministic/README.md +135 -135
- package/src/architecture/network/evolve/README.md +364 -364
- package/src/architecture/network/gating/README.md +130 -130
- package/src/architecture/network/genetic/README.md +399 -399
- package/src/architecture/network/mutate/README.md +897 -897
- package/src/architecture/network/onnx/README.md +720 -720
- package/src/architecture/network/onnx/export/README.md +728 -728
- package/src/architecture/network/onnx/export/layers/README.md +450 -450
- package/src/architecture/network/onnx/import/README.md +618 -618
- package/src/architecture/network/onnx/schema/README.md +32 -32
- package/src/architecture/network/prune/README.md +245 -245
- package/src/architecture/network/remove/README.md +135 -135
- package/src/architecture/network/runtime/README.md +106 -106
- package/src/architecture/network/serialize/README.md +542 -542
- package/src/architecture/network/slab/README.md +608 -608
- package/src/architecture/network/standalone/README.md +212 -212
- package/src/architecture/network/stats/README.md +84 -84
- package/src/architecture/network/topology/README.md +465 -465
- package/src/architecture/network/training/README.md +200 -200
- package/src/architecture/node/README.md +5 -5
- package/src/architecture/nodePool/README.md +14 -14
- package/src/methods/README.md +99 -99
- package/src/methods/activation/README.md +189 -189
- package/src/methods/cost/README.md +131 -131
- package/src/methods/rate/README.md +86 -86
- package/src/multithreading/README.md +77 -77
- package/src/multithreading/workers/browser/README.md +8 -8
- package/src/multithreading/workers/node/README.md +8 -8
- package/src/neat/README.md +148 -148
- package/src/neat/adaptive/README.md +120 -120
- package/src/neat/adaptive/acceptance/README.md +40 -40
- package/src/neat/adaptive/complexity/README.md +137 -137
- package/src/neat/adaptive/core/README.md +197 -197
- package/src/neat/adaptive/lineage/README.md +90 -90
- package/src/neat/adaptive/mutation/README.md +284 -284
- package/src/neat/compat/README.md +43 -43
- package/src/neat/compat/core/README.md +90 -90
- package/src/neat/diversity/README.md +35 -35
- package/src/neat/diversity/core/README.md +88 -88
- package/src/neat/evaluate/README.md +85 -85
- package/src/neat/evaluate/auto-distance/README.md +75 -75
- package/src/neat/evaluate/entropy-compat/README.md +37 -37
- package/src/neat/evaluate/entropy-sharing/README.md +43 -43
- package/src/neat/evaluate/fitness/README.md +23 -23
- package/src/neat/evaluate/novelty/README.md +120 -120
- package/src/neat/evaluate/objectives/README.md +17 -17
- package/src/neat/evaluate/shared/README.md +94 -94
- package/src/neat/evolve/README.md +96 -96
- package/src/neat/evolve/adaptive/README.md +60 -60
- package/src/neat/evolve/objectives/README.md +63 -63
- package/src/neat/evolve/offspring/README.md +56 -56
- package/src/neat/evolve/population/README.md +171 -171
- package/src/neat/evolve/runtime/README.md +79 -79
- package/src/neat/evolve/speciation/README.md +74 -74
- package/src/neat/evolve/warnings/README.md +10 -10
- package/src/neat/export/README.md +114 -114
- package/src/neat/helpers/README.md +50 -50
- package/src/neat/init/README.md +9 -9
- package/src/neat/lineage/core/README.md +101 -101
- package/src/neat/multiobjective/category/README.md +74 -74
- package/src/neat/multiobjective/crowding/README.md +272 -272
- package/src/neat/multiobjective/dominance/README.md +171 -171
- package/src/neat/multiobjective/fronts/README.md +68 -68
- package/src/neat/multiobjective/metrics/README.md +43 -43
- package/src/neat/multiobjective/objectives/README.md +31 -31
- package/src/neat/multiobjective/shared/README.md +27 -27
- package/src/neat/mutation/README.md +97 -97
- package/src/neat/mutation/add-conn/README.md +115 -115
- package/src/neat/mutation/add-node/README.md +126 -126
- package/src/neat/mutation/flow/README.md +149 -149
- package/src/neat/mutation/repair/README.md +185 -185
- package/src/neat/mutation/select/README.md +117 -117
- package/src/neat/mutation/shared/README.md +32 -32
- package/src/neat/objectives/README.md +25 -25
- package/src/neat/objectives/core/README.md +67 -67
- package/src/neat/pruning/README.md +40 -40
- package/src/neat/pruning/core/README.md +171 -171
- package/src/neat/pruning/facade/README.md +32 -32
- package/src/neat/rng/README.md +104 -104
- package/src/neat/rng/core/README.md +137 -137
- package/src/neat/rng/facade/README.md +50 -50
- package/src/neat/selection/README.md +111 -111
- package/src/neat/selection/core/README.md +227 -227
- package/src/neat/selection/facade/README.md +61 -61
- package/src/neat/shared/README.md +163 -163
- package/src/neat/speciation/README.md +31 -31
- package/src/neat/speciation/threshold/README.md +35 -35
- package/src/neat/species/README.md +25 -25
- package/src/neat/species/core/README.md +20 -20
- package/src/neat/species/core/shared/README.md +18 -18
- package/src/neat/species/history/context/README.md +22 -22
- package/src/neat/telemetry/accessors/README.md +58 -58
- package/src/neat/telemetry/exports/README.md +233 -233
- package/src/neat/telemetry/facade/README.md +252 -252
- package/src/neat/telemetry/facade/archive/README.md +57 -57
- package/src/neat/telemetry/facade/buffer/README.md +43 -43
- package/src/neat/telemetry/facade/lineage/README.md +12 -12
- package/src/neat/telemetry/facade/objectives/README.md +44 -44
- package/src/neat/telemetry/facade/runtime/README.md +26 -26
- package/src/neat/telemetry/facade/species/README.md +27 -27
- package/src/neat/telemetry/metrics/README.md +696 -696
- package/src/neat/telemetry/recorder/README.md +57 -57
- package/src/neat/telemetry/types/README.md +32 -32
- package/src/neat/topology-intent/README.md +75 -75
- package/src/utils/README.md +193 -193
- package/test/examples/asciiMaze/browser-entry/README.md +92 -92
- package/test/examples/asciiMaze/dashboardManager/README.md +109 -109
- package/test/examples/asciiMaze/dashboardManager/telemetry/README.md +28 -28
- package/test/examples/asciiMaze/evolutionEngine/README.md +1527 -1527
- package/test/examples/asciiMaze/mazeMovement/README.md +105 -105
- package/test/examples/asciiMaze/mazeMovement/finalization/README.md +16 -16
- package/test/examples/asciiMaze/mazeMovement/policy/README.md +57 -57
- package/test/examples/asciiMaze/mazeMovement/runtime/README.md +52 -52
- package/test/examples/asciiMaze/mazeMovement/shaping/README.md +46 -46
- package/test/examples/flappy_bird/browser-entry/README.md +508 -508
- package/test/examples/flappy_bird/browser-entry/host/README.md +101 -101
- package/test/examples/flappy_bird/browser-entry/host/resize/README.md +144 -144
- package/test/examples/flappy_bird/browser-entry/network-view/README.md +194 -194
- package/test/examples/flappy_bird/browser-entry/playback/README.md +278 -278
- package/test/examples/flappy_bird/browser-entry/playback/background/README.md +129 -129
- package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/README.md +502 -502
- package/test/examples/flappy_bird/browser-entry/playback/frame-render/README.md +139 -139
- package/test/examples/flappy_bird/browser-entry/playback/snapshot/README.md +10 -10
- package/test/examples/flappy_bird/browser-entry/playback/trail/README.md +43 -43
- package/test/examples/flappy_bird/browser-entry/playback/worker-channel/README.md +30 -30
- package/test/examples/flappy_bird/browser-entry/runtime/README.md +59 -59
- package/test/examples/flappy_bird/browser-entry/visualization/README.md +276 -276
- package/test/examples/flappy_bird/browser-entry/worker-channel/README.md +16 -16
- package/test/examples/flappy_bird/constants/README.md +1070 -1070
- package/test/examples/flappy_bird/environment/README.md +22 -22
- package/test/examples/flappy_bird/evaluation/README.md +32 -32
- package/test/examples/flappy_bird/evaluation/rollout/README.md +141 -141
- package/test/examples/flappy_bird/flappy-evolution-worker/README.md +425 -425
- package/test/examples/flappy_bird/simulation-shared/README.md +170 -170
- package/test/examples/flappy_bird/simulation-shared/observation/README.md +109 -109
- package/test/examples/flappy_bird/trainer/README.md +325 -325
- package/test/examples/flappy_bird/trainer/evaluation/README.md +74 -74
- package/scripts/analyze-trace.ts +0 -590
- package/scripts/copy-examples.mjs +0 -114
- package/scripts/export-onnx.mjs +0 -86
- package/scripts/generate-bench-tables.mjs +0 -182
- package/scripts/generate-docs.ts +0 -2900
- package/scripts/write-dist-docs-pkg.mjs +0 -16
|
@@ -13,6 +13,14 @@ Shared type surface for the dedicated mazeMovement module.
|
|
|
13
13
|
Step 2 moves internal simulation contracts here first so later helper files
|
|
14
14
|
can depend on one narrow typed surface.
|
|
15
15
|
|
|
16
|
+
### DirectionSelectionStats
|
|
17
|
+
|
|
18
|
+
Diagnostic telemetry produced when selecting a direction from network logits.
|
|
19
|
+
|
|
20
|
+
Encapsulates the chosen direction along with entropy and probability data so
|
|
21
|
+
downstream helpers can apply shaping rewards and penalties without
|
|
22
|
+
rederiving softmax statistics on hot paths.
|
|
23
|
+
|
|
16
24
|
### MazeMovementBufferPools
|
|
17
25
|
|
|
18
26
|
Initialized pooled buffers shared across maze movement simulations.
|
|
@@ -28,13 +36,13 @@ The dedicated services module owns these counters so later runtime, policy,
|
|
|
28
36
|
and shaping helpers can depend on one explicit mutable surface instead of
|
|
29
37
|
directly reaching into class-private state.
|
|
30
38
|
|
|
31
|
-
###
|
|
39
|
+
### MazeMovementSimulationResult
|
|
32
40
|
|
|
33
|
-
|
|
41
|
+
Result shape returned by `MazeMovement.simulateAgent`.
|
|
34
42
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
43
|
+
This contract matches the legacy inline return annotation so callers can
|
|
44
|
+
keep depending on the current fields while the dedicated module boundary is
|
|
45
|
+
being extracted.
|
|
38
46
|
|
|
39
47
|
### SimulationState
|
|
40
48
|
|
|
@@ -49,14 +57,6 @@ Notes:
|
|
|
49
57
|
- This interface remains internal to the mazeMovement module boundary.
|
|
50
58
|
- Property descriptions are explicit to surface helpful tooltips in editors.
|
|
51
59
|
|
|
52
|
-
### MazeMovementSimulationResult
|
|
53
|
-
|
|
54
|
-
Result shape returned by `MazeMovement.simulateAgent`.
|
|
55
|
-
|
|
56
|
-
This contract matches the legacy inline return annotation so callers can
|
|
57
|
-
keep depending on the current fields while the dedicated module boundary is
|
|
58
|
-
being extracted.
|
|
59
|
-
|
|
60
60
|
## mazeMovement/mazeMovement.ts
|
|
61
61
|
|
|
62
62
|
### MazeMovement
|
|
@@ -202,6 +202,16 @@ This module owns the pooled buffers, PRNG state, output-history plumbing,
|
|
|
202
202
|
and shared run-scoped counters used by the legacy MazeMovement facade while
|
|
203
203
|
Step 2 incrementally moves helper categories into the dedicated boundary.
|
|
204
204
|
|
|
205
|
+
### getMazeMovementBufferMetadata
|
|
206
|
+
|
|
207
|
+
```ts
|
|
208
|
+
getMazeMovementBufferMetadata(): { cachedWidth: number; cachedHeight: number; }
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
Read the currently cached maze dimensions for bounds and index helpers.
|
|
212
|
+
|
|
213
|
+
Returns: Cached width and height for the active pooled buffers.
|
|
214
|
+
|
|
205
215
|
### getMazeMovementRunServiceState
|
|
206
216
|
|
|
207
217
|
```ts
|
|
@@ -212,15 +222,22 @@ Expose the shared mutable run-scoped state used across helper categories.
|
|
|
212
222
|
|
|
213
223
|
Returns: The singleton mutable run-state object for the current process.
|
|
214
224
|
|
|
215
|
-
###
|
|
225
|
+
### indexMazeMovementCell
|
|
216
226
|
|
|
217
227
|
```ts
|
|
218
|
-
|
|
228
|
+
indexMazeMovementCell(
|
|
229
|
+
x: number,
|
|
230
|
+
y: number,
|
|
231
|
+
): number
|
|
219
232
|
```
|
|
220
233
|
|
|
221
|
-
|
|
234
|
+
Convert a cell coordinate into the pooled linear grid index.
|
|
222
235
|
|
|
223
|
-
|
|
236
|
+
Parameters:
|
|
237
|
+
- `x` - - Zero-based maze column.
|
|
238
|
+
- `y` - - Zero-based maze row.
|
|
239
|
+
|
|
240
|
+
Returns: Linearized index used by pooled grid buffers.
|
|
224
241
|
|
|
225
242
|
### initializeMazeMovementBufferPools
|
|
226
243
|
|
|
@@ -241,42 +258,20 @@ Parameters:
|
|
|
241
258
|
|
|
242
259
|
Returns: The initialized pooled buffer surface.
|
|
243
260
|
|
|
244
|
-
###
|
|
245
|
-
|
|
246
|
-
```ts
|
|
247
|
-
requireMazeMovementBufferPools(): MazeMovementBufferPools
|
|
248
|
-
```
|
|
249
|
-
|
|
250
|
-
Return the initialized pooled buffer surface for the current run.
|
|
251
|
-
|
|
252
|
-
Returns: The shared buffer pools.
|
|
253
|
-
|
|
254
|
-
### getMazeMovementBufferMetadata
|
|
255
|
-
|
|
256
|
-
```ts
|
|
257
|
-
getMazeMovementBufferMetadata(): { cachedWidth: number; cachedHeight: number; }
|
|
258
|
-
```
|
|
259
|
-
|
|
260
|
-
Read the currently cached maze dimensions for bounds and index helpers.
|
|
261
|
-
|
|
262
|
-
Returns: Cached width and height for the active pooled buffers.
|
|
263
|
-
|
|
264
|
-
### indexMazeMovementCell
|
|
261
|
+
### materializeMazeMovementPath
|
|
265
262
|
|
|
266
263
|
```ts
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
): number
|
|
264
|
+
materializeMazeMovementPath(
|
|
265
|
+
length: number,
|
|
266
|
+
): [number, number][]
|
|
271
267
|
```
|
|
272
268
|
|
|
273
|
-
|
|
269
|
+
Materialize the active pooled path buffers into a fresh tuple array.
|
|
274
270
|
|
|
275
271
|
Parameters:
|
|
276
|
-
- `
|
|
277
|
-
- `y` - - Zero-based maze row.
|
|
272
|
+
- `length` - - Number of active path entries to copy.
|
|
278
273
|
|
|
279
|
-
Returns:
|
|
274
|
+
Returns: A newly allocated materialized path snapshot.
|
|
280
275
|
|
|
281
276
|
### randomMazeMovementUnit
|
|
282
277
|
|
|
@@ -303,6 +298,26 @@ Parameters:
|
|
|
303
298
|
|
|
304
299
|
Returns: Sanitized output history or `undefined` when absent or invalid.
|
|
305
300
|
|
|
301
|
+
### requireMazeMovementBufferPools
|
|
302
|
+
|
|
303
|
+
```ts
|
|
304
|
+
requireMazeMovementBufferPools(): MazeMovementBufferPools
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
Return the initialized pooled buffer surface for the current run.
|
|
308
|
+
|
|
309
|
+
Returns: The shared buffer pools.
|
|
310
|
+
|
|
311
|
+
### resetMazeMovementRunServiceState
|
|
312
|
+
|
|
313
|
+
```ts
|
|
314
|
+
resetMazeMovementRunServiceState(): MazeMovementRunServiceState
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
Reset the shared mutable run-scoped state before a new simulation begins.
|
|
318
|
+
|
|
319
|
+
Returns: The reused singleton state after reset.
|
|
320
|
+
|
|
306
321
|
### writeMazeMovementOutputHistory
|
|
307
322
|
|
|
308
323
|
```ts
|
|
@@ -318,21 +333,6 @@ Parameters:
|
|
|
318
333
|
- `network` - - Network receiving the reflected output history.
|
|
319
334
|
- `history` - - Bounded output-history payload to persist.
|
|
320
335
|
|
|
321
|
-
### materializeMazeMovementPath
|
|
322
|
-
|
|
323
|
-
```ts
|
|
324
|
-
materializeMazeMovementPath(
|
|
325
|
-
length: number,
|
|
326
|
-
): [number, number][]
|
|
327
|
-
```
|
|
328
|
-
|
|
329
|
-
Materialize the active pooled path buffers into a fresh tuple array.
|
|
330
|
-
|
|
331
|
-
Parameters:
|
|
332
|
-
- `length` - - Number of active path entries to copy.
|
|
333
|
-
|
|
334
|
-
Returns: A newly allocated materialized path snapshot.
|
|
335
|
-
|
|
336
336
|
## mazeMovement/mazeMovement.constants.ts
|
|
337
337
|
|
|
338
338
|
Frozen tuning surface for the dedicated mazeMovement module.
|
|
@@ -349,20 +349,24 @@ tables in one place so the public facade can stay focused on orchestration.
|
|
|
349
349
|
|
|
350
350
|
## mazeMovement/mazeMovement.utils.ts
|
|
351
351
|
|
|
352
|
-
###
|
|
352
|
+
### computeActionEntropyFromCounts
|
|
353
353
|
|
|
354
354
|
```ts
|
|
355
|
-
|
|
356
|
-
|
|
355
|
+
computeActionEntropyFromCounts(
|
|
356
|
+
directionCounts: number[],
|
|
357
|
+
logActions: number,
|
|
358
|
+
scratch: Float64Array<ArrayBufferLike>,
|
|
357
359
|
): number
|
|
358
360
|
```
|
|
359
361
|
|
|
360
|
-
|
|
362
|
+
Compute normalized action entropy from direction counts.
|
|
361
363
|
|
|
362
364
|
Parameters:
|
|
363
|
-
- `
|
|
365
|
+
- `directionCounts` - - Number of moves taken in each direction.
|
|
366
|
+
- `logActions` - - Precomputed normalization factor for the action space.
|
|
367
|
+
- `scratch` - - Single-value floating-point scratch buffer reused by the caller.
|
|
364
368
|
|
|
365
|
-
Returns:
|
|
369
|
+
Returns: Normalized entropy in the range `[0, 1]`.
|
|
366
370
|
|
|
367
371
|
### isFiniteNumberArray
|
|
368
372
|
|
|
@@ -379,54 +383,54 @@ Parameters:
|
|
|
379
383
|
|
|
380
384
|
Returns: True when the input is an array of finite numbers.
|
|
381
385
|
|
|
382
|
-
###
|
|
386
|
+
### materializePath
|
|
383
387
|
|
|
384
388
|
```ts
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
389
|
+
materializePath(
|
|
390
|
+
length: number,
|
|
391
|
+
pathX: Int32Array<ArrayBufferLike>,
|
|
392
|
+
pathY: Int32Array<ArrayBufferLike>,
|
|
393
|
+
): [number, number][]
|
|
388
394
|
```
|
|
389
395
|
|
|
390
|
-
|
|
396
|
+
Materialize the active prefix of pooled path buffers into a fresh array.
|
|
391
397
|
|
|
392
398
|
Parameters:
|
|
393
|
-
- `
|
|
399
|
+
- `length` - - Number of path entries to materialize.
|
|
400
|
+
- `pathX` - - Pooled X-coordinate buffer.
|
|
401
|
+
- `pathY` - - Pooled Y-coordinate buffer.
|
|
394
402
|
|
|
395
|
-
Returns:
|
|
403
|
+
Returns: A newly allocated array of path tuples.
|
|
396
404
|
|
|
397
|
-
###
|
|
405
|
+
### nextPowerOfTwo
|
|
398
406
|
|
|
399
407
|
```ts
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
): void
|
|
408
|
+
nextPowerOfTwo(
|
|
409
|
+
n: number,
|
|
410
|
+
): number
|
|
404
411
|
```
|
|
405
412
|
|
|
406
|
-
|
|
413
|
+
Return the smallest power-of-two integer greater than or equal to `n`.
|
|
407
414
|
|
|
408
415
|
Parameters:
|
|
409
|
-
- `
|
|
410
|
-
- `history` - - Updated history buffer.
|
|
416
|
+
- `n` - - Target minimum integer capacity.
|
|
411
417
|
|
|
412
|
-
|
|
418
|
+
Returns: The smallest power of two greater than or equal to `n`.
|
|
419
|
+
|
|
420
|
+
### readOutputHistory
|
|
413
421
|
|
|
414
422
|
```ts
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
pathY: Int32Array<ArrayBufferLike>,
|
|
419
|
-
): [number, number][]
|
|
423
|
+
readOutputHistory(
|
|
424
|
+
network: INetwork,
|
|
425
|
+
): number[][] | undefined
|
|
420
426
|
```
|
|
421
427
|
|
|
422
|
-
|
|
428
|
+
Read the optional `_lastStepOutputs` history stored on a network.
|
|
423
429
|
|
|
424
430
|
Parameters:
|
|
425
|
-
- `
|
|
426
|
-
- `pathX` - - Pooled X-coordinate buffer.
|
|
427
|
-
- `pathY` - - Pooled Y-coordinate buffer.
|
|
431
|
+
- `network` - - Network instance that may expose a reflected outputs history.
|
|
428
432
|
|
|
429
|
-
Returns:
|
|
433
|
+
Returns: Sanitized history buffer or `undefined` when absent or invalid.
|
|
430
434
|
|
|
431
435
|
### sumVisionGroup
|
|
432
436
|
|
|
@@ -449,21 +453,17 @@ Parameters:
|
|
|
449
453
|
|
|
450
454
|
Returns: Numeric sum of the selected group.
|
|
451
455
|
|
|
452
|
-
###
|
|
456
|
+
### writeOutputHistory
|
|
453
457
|
|
|
454
458
|
```ts
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
): number
|
|
459
|
+
writeOutputHistory(
|
|
460
|
+
network: INetwork,
|
|
461
|
+
history: number[][],
|
|
462
|
+
): void
|
|
460
463
|
```
|
|
461
464
|
|
|
462
|
-
|
|
465
|
+
Persist a bounded outputs history on the network via reflection.
|
|
463
466
|
|
|
464
467
|
Parameters:
|
|
465
|
-
- `
|
|
466
|
-
- `
|
|
467
|
-
- `scratch` - - Single-value floating-point scratch buffer reused by the caller.
|
|
468
|
-
|
|
469
|
-
Returns: Normalized entropy in the range `[0, 1]`.
|
|
468
|
+
- `network` - - Target network to mutate.
|
|
469
|
+
- `history` - - Updated history buffer.
|
|
@@ -20,22 +20,20 @@ pile of counters.
|
|
|
20
20
|
|
|
21
21
|
## mazeMovement/finalization/mazeMovement.finalization.ts
|
|
22
22
|
|
|
23
|
-
###
|
|
23
|
+
### computeMazeMovementActionEntropy
|
|
24
24
|
|
|
25
25
|
```ts
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
): MazeMovementSimulationResult
|
|
26
|
+
computeMazeMovementActionEntropy(
|
|
27
|
+
directionCounts: number[],
|
|
28
|
+
): number
|
|
30
29
|
```
|
|
31
30
|
|
|
32
|
-
|
|
31
|
+
Compute the normalized action-entropy summary for a finished run.
|
|
33
32
|
|
|
34
33
|
Parameters:
|
|
35
|
-
- `
|
|
36
|
-
- `maxSteps` - - Maximum allowed step budget for the run.
|
|
34
|
+
- `directionCounts` - - Per-direction action counts recorded during the run.
|
|
37
35
|
|
|
38
|
-
Returns:
|
|
36
|
+
Returns: Normalized entropy in the range `[0, 1]`.
|
|
39
37
|
|
|
40
38
|
### finalizeFailedMazeMovementRun
|
|
41
39
|
|
|
@@ -60,17 +58,19 @@ Parameters:
|
|
|
60
58
|
|
|
61
59
|
Returns: Failure result with shaped fitness, path, and diagnostic summaries.
|
|
62
60
|
|
|
63
|
-
###
|
|
61
|
+
### finalizeSuccessfulMazeMovementRun
|
|
64
62
|
|
|
65
63
|
```ts
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
64
|
+
finalizeSuccessfulMazeMovementRun(
|
|
65
|
+
state: SimulationState,
|
|
66
|
+
maxSteps: number,
|
|
67
|
+
): MazeMovementSimulationResult
|
|
69
68
|
```
|
|
70
69
|
|
|
71
|
-
|
|
70
|
+
Build the finalized payload for a successful maze run.
|
|
72
71
|
|
|
73
72
|
Parameters:
|
|
74
|
-
- `
|
|
73
|
+
- `state` - - Completed simulation state for the successful run.
|
|
74
|
+
- `maxSteps` - - Maximum allowed step budget for the run.
|
|
75
75
|
|
|
76
|
-
Returns:
|
|
76
|
+
Returns: Success result with fitness, path, and diagnostic summaries.
|
|
@@ -18,57 +18,39 @@ trainer judges the consequences of that choice.
|
|
|
18
18
|
|
|
19
19
|
## mazeMovement/policy/mazeMovement.policy.ts
|
|
20
20
|
|
|
21
|
-
###
|
|
22
|
-
|
|
23
|
-
```ts
|
|
24
|
-
computeMazeMovementEpsilon(
|
|
25
|
-
stepNumber: number,
|
|
26
|
-
stepsSinceImprovement: number,
|
|
27
|
-
distHere: number,
|
|
28
|
-
saturations: number,
|
|
29
|
-
): number
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
Compute the adaptive epsilon used for policy exploration.
|
|
33
|
-
|
|
34
|
-
Parameters:
|
|
35
|
-
- `stepNumber` - - Global step number inside the active simulation.
|
|
36
|
-
- `stepsSinceImprovement` - - Number of steps without improvement.
|
|
37
|
-
- `distHere` - - Current distance to goal for the active position.
|
|
38
|
-
- `saturations` - - Rolling saturation count from the shared run state.
|
|
39
|
-
|
|
40
|
-
Returns: Exploration epsilon in the range `[0, 1]`.
|
|
41
|
-
|
|
42
|
-
### selectMazeMovementDirection
|
|
21
|
+
### applyMazeMovementEpsilonExploration
|
|
43
22
|
|
|
44
23
|
```ts
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
24
|
+
applyMazeMovementEpsilonExploration(
|
|
25
|
+
state: SimulationState,
|
|
26
|
+
encodedMaze: number[][],
|
|
27
|
+
coordinateScratch: Int32Array<ArrayBufferLike>,
|
|
28
|
+
): void
|
|
48
29
|
```
|
|
49
30
|
|
|
50
|
-
|
|
31
|
+
Apply epsilon-greedy exploration to the current action choice.
|
|
51
32
|
|
|
52
33
|
Parameters:
|
|
53
|
-
- `
|
|
54
|
-
|
|
55
|
-
|
|
34
|
+
- `state` - - Mutable simulation state for the active run.
|
|
35
|
+
- `encodedMaze` - - Maze grid used for move validity checks.
|
|
36
|
+
- `coordinateScratch` - - Reused coordinate scratch buffer.
|
|
56
37
|
|
|
57
|
-
###
|
|
38
|
+
### applyMazeMovementForcedExploration
|
|
58
39
|
|
|
59
40
|
```ts
|
|
60
|
-
|
|
41
|
+
applyMazeMovementForcedExploration(
|
|
61
42
|
state: SimulationState,
|
|
62
|
-
|
|
43
|
+
encodedMaze: number[][],
|
|
63
44
|
coordinateScratch: Int32Array<ArrayBufferLike>,
|
|
64
45
|
): void
|
|
65
46
|
```
|
|
66
47
|
|
|
67
|
-
|
|
48
|
+
Force a random valid move when the policy has stalled with repeated no-move outputs.
|
|
68
49
|
|
|
69
50
|
Parameters:
|
|
70
51
|
- `state` - - Mutable simulation state for the active run.
|
|
71
|
-
- `
|
|
52
|
+
- `encodedMaze` - - Maze grid used for move validity checks.
|
|
53
|
+
- `coordinateScratch` - - Reused coordinate scratch buffer.
|
|
72
54
|
|
|
73
55
|
### applyMazeMovementProximityGreedy
|
|
74
56
|
|
|
@@ -89,55 +71,73 @@ Parameters:
|
|
|
89
71
|
- `distanceMap` - - Optional precomputed distance map.
|
|
90
72
|
- `coordinateScratch` - - Reused coordinate scratch buffer.
|
|
91
73
|
|
|
92
|
-
###
|
|
74
|
+
### applyMazeMovementSaturationAndBiasAdjust
|
|
93
75
|
|
|
94
76
|
```ts
|
|
95
|
-
|
|
77
|
+
applyMazeMovementSaturationAndBiasAdjust(
|
|
96
78
|
state: SimulationState,
|
|
97
|
-
|
|
79
|
+
outputs: number[],
|
|
80
|
+
network: INetwork,
|
|
98
81
|
coordinateScratch: Int32Array<ArrayBufferLike>,
|
|
99
82
|
): void
|
|
100
83
|
```
|
|
101
84
|
|
|
102
|
-
|
|
85
|
+
Detect saturation and optionally damp output-node biases.
|
|
103
86
|
|
|
104
87
|
Parameters:
|
|
105
88
|
- `state` - - Mutable simulation state for the active run.
|
|
106
|
-
- `
|
|
107
|
-
- `
|
|
89
|
+
- `outputs` - - Raw network logits for the current step.
|
|
90
|
+
- `network` - - Policy network that produced the logits.
|
|
91
|
+
- `coordinateScratch` - - Reused scratch buffer for temporary penalties.
|
|
108
92
|
|
|
109
|
-
###
|
|
93
|
+
### computeMazeMovementEpsilon
|
|
110
94
|
|
|
111
95
|
```ts
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
96
|
+
computeMazeMovementEpsilon(
|
|
97
|
+
stepNumber: number,
|
|
98
|
+
stepsSinceImprovement: number,
|
|
99
|
+
distHere: number,
|
|
100
|
+
saturations: number,
|
|
101
|
+
): number
|
|
117
102
|
```
|
|
118
103
|
|
|
119
|
-
|
|
104
|
+
Compute the adaptive epsilon used for policy exploration.
|
|
120
105
|
|
|
121
106
|
Parameters:
|
|
122
|
-
- `
|
|
123
|
-
- `
|
|
124
|
-
- `
|
|
107
|
+
- `stepNumber` - - Global step number inside the active simulation.
|
|
108
|
+
- `stepsSinceImprovement` - - Number of steps without improvement.
|
|
109
|
+
- `distHere` - - Current distance to goal for the active position.
|
|
110
|
+
- `saturations` - - Rolling saturation count from the shared run state.
|
|
125
111
|
|
|
126
|
-
|
|
112
|
+
Returns: Exploration epsilon in the range `[0, 1]`.
|
|
113
|
+
|
|
114
|
+
### decideMazeMovementDirection
|
|
127
115
|
|
|
128
116
|
```ts
|
|
129
|
-
|
|
117
|
+
decideMazeMovementDirection(
|
|
130
118
|
state: SimulationState,
|
|
131
|
-
outputs: number[],
|
|
132
119
|
network: INetwork,
|
|
133
120
|
coordinateScratch: Int32Array<ArrayBufferLike>,
|
|
134
121
|
): void
|
|
135
122
|
```
|
|
136
123
|
|
|
137
|
-
|
|
124
|
+
Activate the network, record output history, and choose the next direction.
|
|
138
125
|
|
|
139
126
|
Parameters:
|
|
140
127
|
- `state` - - Mutable simulation state for the active run.
|
|
141
|
-
- `
|
|
142
|
-
|
|
143
|
-
|
|
128
|
+
- `network` - - Policy network used for the current step.
|
|
129
|
+
|
|
130
|
+
### selectMazeMovementDirection
|
|
131
|
+
|
|
132
|
+
```ts
|
|
133
|
+
selectMazeMovementDirection(
|
|
134
|
+
outputs: number[],
|
|
135
|
+
): DirectionSelectionStats
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Convert raw network outputs into a chosen direction plus diagnostics.
|
|
139
|
+
|
|
140
|
+
Parameters:
|
|
141
|
+
- `outputs` - - Raw action logits for the four maze directions.
|
|
142
|
+
|
|
143
|
+
Returns: Chosen direction plus softmax and entropy diagnostics.
|