@reicek/neataptic-ts 0.1.21 → 0.1.22
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/agents/boundary-mapper.agent.md +29 -0
- package/.github/agents/docs-scout.agent.md +29 -0
- package/.github/agents/plan-scout.agent.md +29 -0
- package/.github/agents/solid-split.agent.md +138 -0
- package/.github/copilot-instructions.md +103 -0
- package/package.json +6 -3
- package/plans/ES2023 migration +13 -8
- package/plans/Evolution_Training_Interoperability_Contracts.md +1 -1
- package/plans/Interactive_Examples_and_Learning_Path.md +10 -2
- package/plans/Memory_Optimization.md +3 -3
- package/plans/README.md +63 -0
- package/plans/Roadmap.md +15 -3
- package/plans/asciiMaze_SOLID_split.done.md +130 -0
- package/plans/flappy_bird_SOLID_split.done.md +67 -0
- package/scripts/assets/theme.css +221 -34
- package/scripts/copy-examples.mjs +9 -5
- package/scripts/export-onnx.mjs +3 -3
- package/scripts/generate-bench-tables.mjs +10 -10
- package/scripts/generate-bench-tables.ts +10 -10
- package/scripts/generate-docs.ts +1415 -449
- package/scripts/render-docs-html.ts +15 -8
- package/src/README.md +101 -223
- package/src/architecture/README.md +57 -185
- package/src/architecture/layer/README.md +38 -38
- package/src/architecture/network/README.md +33 -31
- package/src/architecture/network/activate/README.md +77 -77
- package/src/architecture/network/connect/README.md +15 -13
- package/src/architecture/network/deterministic/README.md +7 -7
- package/src/architecture/network/evolve/README.md +44 -44
- package/src/architecture/network/gating/README.md +20 -20
- package/src/architecture/network/genetic/README.md +51 -51
- package/src/architecture/network/mutate/README.md +97 -97
- package/src/architecture/network/onnx/README.md +264 -264
- package/src/architecture/network/prune/README.md +39 -39
- package/src/architecture/network/remove/README.md +26 -26
- package/src/architecture/network/serialize/README.md +56 -56
- package/src/architecture/network/slab/README.md +61 -61
- package/src/architecture/network/standalone/README.md +24 -24
- package/src/architecture/network/stats/README.md +9 -9
- package/src/architecture/network/topology/README.md +46 -46
- package/src/architecture/network/training/README.md +21 -21
- package/src/methods/README.md +9 -87
- package/src/multithreading/README.md +8 -77
- package/src/multithreading/workers/README.md +2 -2
- package/src/multithreading/workers/browser/README.md +0 -6
- package/src/multithreading/workers/node/README.md +0 -3
- package/src/neat/README.md +562 -568
- package/src/utils/README.md +18 -18
- package/test/examples/asciiMaze/README.md +59 -59
- package/test/examples/asciiMaze/asciiMaze.e2e.test.ts +14 -9
- package/test/examples/asciiMaze/browser-entry/README.md +196 -0
- package/test/examples/asciiMaze/browser-entry/browser-entry.abort.services.ts +95 -0
- package/test/examples/asciiMaze/browser-entry/browser-entry.constants.ts +23 -0
- package/test/examples/asciiMaze/browser-entry/browser-entry.curriculum.services.ts +115 -0
- package/test/examples/asciiMaze/browser-entry/browser-entry.globals.services.ts +106 -0
- package/test/examples/asciiMaze/browser-entry/browser-entry.host.services.ts +157 -0
- package/test/examples/asciiMaze/browser-entry/browser-entry.services.ts +14 -0
- package/test/examples/asciiMaze/browser-entry/browser-entry.ts +129 -0
- package/test/examples/asciiMaze/browser-entry/browser-entry.types.ts +120 -0
- package/test/examples/asciiMaze/browser-entry/browser-entry.utils.ts +98 -0
- package/test/examples/asciiMaze/browser-entry.ts +10 -576
- package/test/examples/asciiMaze/dashboardManager/README.md +276 -0
- package/test/examples/asciiMaze/dashboardManager/archive/README.md +16 -0
- package/test/examples/asciiMaze/dashboardManager/archive/dashboardManager.archive.services.ts +267 -0
- package/test/examples/asciiMaze/dashboardManager/dashboardManager.constants.ts +35 -0
- package/test/examples/asciiMaze/dashboardManager/dashboardManager.services.ts +103 -0
- package/test/examples/asciiMaze/dashboardManager/dashboardManager.ts +181 -0
- package/test/examples/asciiMaze/dashboardManager/dashboardManager.types.ts +267 -0
- package/test/examples/asciiMaze/dashboardManager/dashboardManager.utils.ts +254 -0
- package/test/examples/asciiMaze/dashboardManager/live/README.md +14 -0
- package/test/examples/asciiMaze/dashboardManager/live/dashboardManager.live.services.ts +264 -0
- package/test/examples/asciiMaze/dashboardManager/telemetry/README.md +47 -0
- package/test/examples/asciiMaze/dashboardManager/telemetry/dashboardManager.telemetry.services.ts +513 -0
- package/test/examples/asciiMaze/dashboardManager.ts +13 -2335
- package/test/examples/asciiMaze/evolutionEngine/README.md +1058 -0
- package/test/examples/asciiMaze/evolutionEngine/curriculumPhase.ts +90 -0
- package/test/examples/asciiMaze/evolutionEngine/engineState.constants.ts +36 -0
- package/test/examples/asciiMaze/evolutionEngine/engineState.ts +58 -513
- package/test/examples/asciiMaze/evolutionEngine/engineState.types.ts +212 -0
- package/test/examples/asciiMaze/evolutionEngine/engineState.utils.ts +301 -0
- package/test/examples/asciiMaze/evolutionEngine/evolutionEngine.types.ts +445 -0
- package/test/examples/asciiMaze/evolutionEngine/evolutionLoop.ts +81 -50
- package/test/examples/asciiMaze/evolutionEngine/optionsAndSetup.ts +2 -4
- package/test/examples/asciiMaze/evolutionEngine/populationDynamics.ts +17 -33
- package/test/examples/asciiMaze/evolutionEngine/populationPruning.ts +1 -1
- package/test/examples/asciiMaze/evolutionEngine/rngAndTiming.ts +1 -2
- package/test/examples/asciiMaze/evolutionEngine/sampling.ts +1 -1
- package/test/examples/asciiMaze/evolutionEngine/scratchPools.ts +2 -5
- package/test/examples/asciiMaze/evolutionEngine/setupHelpers.ts +30 -37
- package/test/examples/asciiMaze/evolutionEngine/telemetryMetrics.ts +16 -58
- package/test/examples/asciiMaze/evolutionEngine/trainingWarmStart.ts +2 -2
- package/test/examples/asciiMaze/evolutionEngine.ts +55 -55
- package/test/examples/asciiMaze/fitness.ts +2 -2
- package/test/examples/asciiMaze/fitness.types.ts +65 -0
- package/test/examples/asciiMaze/interfaces.ts +64 -1352
- package/test/examples/asciiMaze/mazeMovement/README.md +356 -0
- package/test/examples/asciiMaze/mazeMovement/finalization/README.md +49 -0
- package/test/examples/asciiMaze/mazeMovement/finalization/mazeMovement.finalization.ts +138 -0
- package/test/examples/asciiMaze/mazeMovement/mazeMovement.constants.ts +101 -0
- package/test/examples/asciiMaze/mazeMovement/mazeMovement.services.ts +230 -0
- package/test/examples/asciiMaze/mazeMovement/mazeMovement.ts +299 -0
- package/test/examples/asciiMaze/mazeMovement/mazeMovement.types.ts +185 -0
- package/test/examples/asciiMaze/mazeMovement/mazeMovement.utils.ts +153 -0
- package/test/examples/asciiMaze/mazeMovement/policy/README.md +91 -0
- package/test/examples/asciiMaze/mazeMovement/policy/mazeMovement.policy.ts +467 -0
- package/test/examples/asciiMaze/mazeMovement/runtime/README.md +95 -0
- package/test/examples/asciiMaze/mazeMovement/runtime/mazeMovement.runtime.ts +354 -0
- package/test/examples/asciiMaze/mazeMovement/shaping/README.md +124 -0
- package/test/examples/asciiMaze/mazeMovement/shaping/mazeMovement.shaping.ts +459 -0
- package/test/examples/asciiMaze/mazeMovement.ts +12 -2978
- package/test/examples/flappy_bird/Trace-20260309T191949.json +24124 -0
- package/test/examples/flappy_bird/browser-entry/README.md +1129 -0
- package/test/examples/flappy_bird/browser-entry/browser-entry.host.utils.ts +4 -324
- package/test/examples/flappy_bird/browser-entry/browser-entry.network-view.utils.ts +6 -399
- package/test/examples/flappy_bird/browser-entry/browser-entry.playback.utils.ts +1 -717
- package/test/examples/flappy_bird/browser-entry/browser-entry.spawn.utils.ts +11 -31
- package/test/examples/flappy_bird/browser-entry/browser-entry.visualization.utils.ts +15 -893
- package/test/examples/flappy_bird/browser-entry/host/README.md +307 -0
- package/test/examples/flappy_bird/browser-entry/host/host.resize.service.ts +1 -295
- package/test/examples/flappy_bird/browser-entry/host/host.ts +562 -6
- package/test/examples/flappy_bird/browser-entry/host/resize/README.md +274 -0
- package/test/examples/flappy_bird/browser-entry/host/resize/host.resize.service.constants.ts +31 -0
- package/test/examples/flappy_bird/browser-entry/host/resize/host.resize.service.services.ts +360 -0
- package/test/examples/flappy_bird/browser-entry/host/resize/host.resize.service.ts +117 -0
- package/test/examples/flappy_bird/browser-entry/host/resize/host.resize.service.types.ts +63 -0
- package/test/examples/flappy_bird/browser-entry/host/resize/host.resize.service.utils.ts +250 -0
- package/test/examples/flappy_bird/browser-entry/network-view/README.md +399 -0
- package/test/examples/flappy_bird/browser-entry/network-view/network-view.topology.utils.ts +255 -0
- package/test/examples/flappy_bird/browser-entry/network-view/network-view.ts +802 -7
- package/test/examples/flappy_bird/browser-entry/playback/README.md +684 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/README.md +277 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/README.md +770 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.cache.services.ts +178 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.constants.ts +107 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.geometry.utils.ts +518 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.math.utils.ts +117 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.pulse.utils.ts +233 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.services.ts +211 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.ts +48 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.types.ts +212 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.utils.ts +81 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/playback.background.cache.services.ts +96 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/playback.background.constants.ts +62 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/playback.background.services.ts +244 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/playback.background.ts +53 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/playback.background.types.ts +68 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/playback.background.utils.ts +100 -0
- package/test/examples/flappy_bird/browser-entry/playback/frame-render/README.md +310 -0
- package/test/examples/flappy_bird/browser-entry/playback/frame-render/playback.frame-render.service.ts +92 -0
- package/test/examples/flappy_bird/browser-entry/playback/frame-render/playback.frame-render.services.ts +272 -0
- package/test/examples/flappy_bird/browser-entry/playback/frame-render/playback.frame-render.types.ts +39 -0
- package/test/examples/flappy_bird/browser-entry/playback/frame-render/playback.frame-render.utils.ts +493 -0
- package/test/examples/flappy_bird/browser-entry/playback/playback.constants.ts +1 -1
- package/test/examples/flappy_bird/browser-entry/playback/playback.frame-render.service.ts +4 -0
- package/test/examples/flappy_bird/browser-entry/playback/playback.snapshot.utils.ts +44 -0
- package/test/examples/flappy_bird/browser-entry/playback/playback.starfield.service.ts +39 -122
- package/test/examples/flappy_bird/browser-entry/playback/playback.starfield.services.ts +272 -0
- package/test/examples/flappy_bird/browser-entry/playback/playback.starfield.types.ts +62 -0
- package/test/examples/flappy_bird/browser-entry/playback/playback.starfield.utils.ts +11 -4
- package/test/examples/flappy_bird/browser-entry/playback/playback.ts +409 -8
- package/test/examples/flappy_bird/browser-entry/playback/playback.types.ts +4 -12
- package/test/examples/flappy_bird/browser-entry/runtime/README.md +235 -0
- package/test/examples/flappy_bird/browser-entry/runtime/runtime.evolution-launch.service.ts +45 -0
- package/test/examples/flappy_bird/browser-entry/runtime/runtime.lifecycle.service.ts +81 -0
- package/test/examples/flappy_bird/browser-entry/runtime/runtime.startup.service.ts +74 -0
- package/test/examples/flappy_bird/browser-entry/runtime/runtime.ts +31 -121
- package/test/examples/flappy_bird/browser-entry/runtime/runtime.types.ts +36 -0
- package/test/examples/flappy_bird/browser-entry/visualization/README.md +557 -0
- package/test/examples/flappy_bird/browser-entry/visualization/visualization.constants.ts +110 -0
- package/test/examples/flappy_bird/browser-entry/visualization/visualization.draw.service.ts +957 -19
- package/test/examples/flappy_bird/browser-entry/visualization/visualization.legend.utils.ts +138 -3
- package/test/examples/flappy_bird/browser-entry/visualization/visualization.topology.utils.ts +3 -27
- package/test/examples/flappy_bird/browser-entry/visualization/visualization.ts +1 -23
- package/test/examples/flappy_bird/browser-entry/worker-channel/README.md +156 -0
- package/test/examples/flappy_bird/constants/README.md +1179 -0
- package/test/examples/flappy_bird/constants/constants.network-view.ts +24 -0
- package/test/examples/flappy_bird/constants/constants.palette.ts +7 -0
- package/test/examples/flappy_bird/constants/constants.starfield.ts +78 -3
- package/test/examples/flappy_bird/environment/README.md +143 -0
- package/test/examples/flappy_bird/environment/environment.observation.utils.ts +1 -19
- package/test/examples/flappy_bird/environment/environment.step.service.ts +3 -66
- package/test/examples/flappy_bird/evaluation/README.md +130 -0
- package/test/examples/flappy_bird/evaluation/evaluation.fitness.utils.ts +1 -1
- package/test/examples/flappy_bird/evaluation/evaluation.rollout.service.ts +5 -375
- package/test/examples/flappy_bird/evaluation/rollout/README.md +291 -0
- package/test/examples/flappy_bird/evaluation/rollout/evaluation.rollout.constants.ts +30 -0
- package/test/examples/flappy_bird/evaluation/rollout/evaluation.rollout.service.ts +58 -0
- package/test/examples/flappy_bird/evaluation/rollout/evaluation.rollout.services.ts +310 -0
- package/test/examples/flappy_bird/evaluation/rollout/evaluation.rollout.types.ts +56 -0
- package/test/examples/flappy_bird/evaluation/rollout/evaluation.rollout.utils.ts +368 -0
- package/test/examples/flappy_bird/flappy-evolution-worker/README.md +618 -0
- package/test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.playback.service.ts +7 -7
- package/test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.simulation.frame.service.ts +364 -0
- package/test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.simulation.types.ts +14 -0
- package/test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.simulation.utils.ts +4 -201
- package/test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.ts +184 -345
- package/test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.warm-start.service.ts +291 -0
- package/test/examples/flappy_bird/flappy.simulation.shared.utils.ts +5 -0
- package/test/examples/flappy_bird/simulation-shared/README.md +417 -0
- package/test/examples/flappy_bird/simulation-shared/observation/README.md +183 -0
- package/test/examples/flappy_bird/simulation-shared/observation/observation.features.utils.ts +301 -0
- package/test/examples/flappy_bird/simulation-shared/observation/observation.ts +9 -0
- package/test/examples/flappy_bird/simulation-shared/observation/observation.vector.utils.ts +59 -0
- package/test/examples/flappy_bird/simulation-shared/simulation-shared.observation.utils.ts +5 -403
- package/test/examples/flappy_bird/simulation-shared/simulation-shared.spawn.utils.ts +20 -6
- package/test/examples/flappy_bird/{evaluation/evaluation.statistics.utils.ts → simulation-shared/simulation-shared.statistics.utils.ts} +23 -8
- package/test/examples/flappy_bird/trainer/README.md +563 -0
- package/test/examples/flappy_bird/trainer/evaluation/README.md +199 -0
- package/test/examples/flappy_bird/trainer/evaluation/trainer.evaluation.service.constants.ts +9 -0
- package/test/examples/flappy_bird/trainer/evaluation/trainer.evaluation.service.services.ts +73 -0
- package/test/examples/flappy_bird/trainer/evaluation/trainer.evaluation.service.ts +165 -0
- package/test/examples/flappy_bird/trainer/evaluation/trainer.evaluation.service.types.ts +25 -0
- package/test/examples/flappy_bird/trainer/evaluation/trainer.evaluation.service.utils.ts +161 -0
- package/test/examples/flappy_bird/trainer/trainer.evaluation.service.ts +13 -0
- package/test/examples/flappy_bird/trainer/trainer.report.service.services.ts +181 -0
- package/test/examples/flappy_bird/trainer/trainer.report.service.ts +126 -0
- package/test/examples/flappy_bird/trainer/trainer.selection.utils.ts +89 -0
- package/test/examples/flappy_bird/trainer/trainer.ts +11 -553
- package/test/examples/flappy_bird/browser-entry/browser-entry.utils.ts +0 -12
- package/test/examples/flappy_bird/environment/environment.ts +0 -7
- package/test/examples/flappy_bird/evaluation/evaluation.ts +0 -7
- package/test/examples/flappy_bird/simulation-shared/simulation-shared.ts +0 -15
- package/test/examples/flappy_bird/trainer/trainer.statistics.utils.ts +0 -78
|
@@ -0,0 +1,1058 @@
|
|
|
1
|
+
# evolutionEngine
|
|
2
|
+
|
|
3
|
+
## evolutionEngine/engineState.types.ts
|
|
4
|
+
|
|
5
|
+
### engineState.types
|
|
6
|
+
|
|
7
|
+
Shared contracts for the ASCII maze evolution engine state boundary.
|
|
8
|
+
|
|
9
|
+
This file owns the exported type surface consumed by the engine-state facade,
|
|
10
|
+
telemetry helpers, sampling utilities, and RNG/timing adapters.
|
|
11
|
+
|
|
12
|
+
### EngineProfilingState
|
|
13
|
+
|
|
14
|
+
Aggregated profiling configuration and accumulators shared across the evolution run.
|
|
15
|
+
|
|
16
|
+
### EngineScratchState
|
|
17
|
+
|
|
18
|
+
Shared contracts for the ASCII maze evolution engine state boundary.
|
|
19
|
+
|
|
20
|
+
This file owns the exported type surface consumed by the engine-state facade,
|
|
21
|
+
telemetry helpers, sampling utilities, and RNG/timing adapters.
|
|
22
|
+
|
|
23
|
+
### EngineState
|
|
24
|
+
|
|
25
|
+
Shared engine state instance combining pooled scratch buffers with toggle flags.
|
|
26
|
+
|
|
27
|
+
### EngineToggleState
|
|
28
|
+
|
|
29
|
+
Runtime switches that adjust telemetry verbosity and optional training phases.
|
|
30
|
+
|
|
31
|
+
### RngCacheHandles
|
|
32
|
+
|
|
33
|
+
Handles returned after ensuring the RNG cache is ready for consumption.
|
|
34
|
+
|
|
35
|
+
### RngCacheParameters
|
|
36
|
+
|
|
37
|
+
Parameters controlling the RNG cache refill process.
|
|
38
|
+
|
|
39
|
+
### TelemetryScratchHandles
|
|
40
|
+
|
|
41
|
+
Collection of scratch buffers handed back after initialisation for convenience.
|
|
42
|
+
|
|
43
|
+
### TelemetryScratchRequest
|
|
44
|
+
|
|
45
|
+
Configuration describing which telemetry scratch buffers require capacity guarantees.
|
|
46
|
+
|
|
47
|
+
### VisitedHashScratchHandles
|
|
48
|
+
|
|
49
|
+
Handles exposed after ensuring the visited-coordinate hash table capacity.
|
|
50
|
+
|
|
51
|
+
## evolutionEngine/evolutionEngine.types.ts
|
|
52
|
+
|
|
53
|
+
### DistanceMap
|
|
54
|
+
|
|
55
|
+
Distance map for maze navigation.
|
|
56
|
+
|
|
57
|
+
### EncodedMaze
|
|
58
|
+
|
|
59
|
+
Encoded maze representation with cell values.
|
|
60
|
+
|
|
61
|
+
### EncodedMazeData
|
|
62
|
+
|
|
63
|
+
Encoded maze for simulation.
|
|
64
|
+
|
|
65
|
+
### EvolutionGenomeLike
|
|
66
|
+
|
|
67
|
+
Loose genome shape shared by engine telemetry and population-dynamics helpers.
|
|
68
|
+
|
|
69
|
+
### EvolutionHelpers
|
|
70
|
+
|
|
71
|
+
Helper functions object passed to evolution loop orchestration.
|
|
72
|
+
|
|
73
|
+
### EvolutionHostAdapter
|
|
74
|
+
|
|
75
|
+
Narrow host adapter used by the engine for pause polling and stop notifications.
|
|
76
|
+
|
|
77
|
+
### EvolutionHostStopEvent
|
|
78
|
+
|
|
79
|
+
Host-facing stop event emitted by the engine when a run finishes for a concrete reason.
|
|
80
|
+
|
|
81
|
+
### EvolutionLoopHelpers
|
|
82
|
+
|
|
83
|
+
Helper functions for evolution.
|
|
84
|
+
|
|
85
|
+
### EvolutionOptions
|
|
86
|
+
|
|
87
|
+
Options object passed to evolution functions.
|
|
88
|
+
|
|
89
|
+
### EvolutionStopReason
|
|
90
|
+
|
|
91
|
+
Canonical stop reasons reported by the engine to host adapters.
|
|
92
|
+
|
|
93
|
+
### FileSystem
|
|
94
|
+
|
|
95
|
+
Node.js fs module type for file operations.
|
|
96
|
+
|
|
97
|
+
### IAgentSimulationConfig
|
|
98
|
+
|
|
99
|
+
Agent simulation configuration.
|
|
100
|
+
|
|
101
|
+
### IEvolutionAlgorithmConfig
|
|
102
|
+
|
|
103
|
+
Configuration options for the evolutionary algorithm used in the ASCII Maze demos.
|
|
104
|
+
|
|
105
|
+
### IMazeConfig
|
|
106
|
+
|
|
107
|
+
Maze configuration used by the ASCII Maze evolution helpers.
|
|
108
|
+
|
|
109
|
+
### IReportingConfig
|
|
110
|
+
|
|
111
|
+
Reporting configuration used to control logging, dashboard updates and UI pacing.
|
|
112
|
+
|
|
113
|
+
### IRunMazeEvolutionOptions
|
|
114
|
+
|
|
115
|
+
Main options for running a single maze-evolution experiment.
|
|
116
|
+
|
|
117
|
+
### LogitsRingState
|
|
118
|
+
|
|
119
|
+
Ring state for logits tracking.
|
|
120
|
+
|
|
121
|
+
### LoopHelpers
|
|
122
|
+
|
|
123
|
+
Loop helpers returned by prepareLoopHelpers.
|
|
124
|
+
|
|
125
|
+
### MazeDistanceMap
|
|
126
|
+
|
|
127
|
+
Distance map for pathfinding.
|
|
128
|
+
|
|
129
|
+
### MazeEvolutionCurriculumPhaseOutcome
|
|
130
|
+
|
|
131
|
+
Shared curriculum-facing summary derived from one completed evolution phase.
|
|
132
|
+
|
|
133
|
+
### MazeEvolutionRunResult
|
|
134
|
+
|
|
135
|
+
Stable result returned by `EvolutionEngine.runMazeEvolution()`.
|
|
136
|
+
|
|
137
|
+
### MazePosition
|
|
138
|
+
|
|
139
|
+
Position in maze.
|
|
140
|
+
|
|
141
|
+
### MutationOperationLike
|
|
142
|
+
|
|
143
|
+
Mutation-operation surface read from the NEAT driver at runtime.
|
|
144
|
+
|
|
145
|
+
### NeatInstance
|
|
146
|
+
|
|
147
|
+
Type for Neat class instance from the neataptic library.
|
|
148
|
+
|
|
149
|
+
### NetworkConnection
|
|
150
|
+
|
|
151
|
+
Network connection representation used by engine-side runtime adaptation helpers.
|
|
152
|
+
|
|
153
|
+
### NetworkInstance
|
|
154
|
+
|
|
155
|
+
Type for Network class instance from the neataptic library.
|
|
156
|
+
|
|
157
|
+
### NetworkNode
|
|
158
|
+
|
|
159
|
+
Network node representation used by engine-side runtime adaptation helpers.
|
|
160
|
+
|
|
161
|
+
### PathModule
|
|
162
|
+
|
|
163
|
+
Node.js path module type.
|
|
164
|
+
|
|
165
|
+
### Position
|
|
166
|
+
|
|
167
|
+
2D position in maze coordinates.
|
|
168
|
+
|
|
169
|
+
### ProfilingAccumulators
|
|
170
|
+
|
|
171
|
+
Profiling accumulator structure.
|
|
172
|
+
|
|
173
|
+
### ScratchBundle
|
|
174
|
+
|
|
175
|
+
Scratch bundle containing reusable buffers.
|
|
176
|
+
|
|
177
|
+
### SimulationResult
|
|
178
|
+
|
|
179
|
+
Simulation result returned by generation evaluation helpers.
|
|
180
|
+
|
|
181
|
+
### SnapshotEntry
|
|
182
|
+
|
|
183
|
+
Snapshot entry for persistence.
|
|
184
|
+
|
|
185
|
+
### SpeciesHistoryHost
|
|
186
|
+
|
|
187
|
+
Static host used to read optional species-history state from the engine facade.
|
|
188
|
+
|
|
189
|
+
### TelemetryNeatLike
|
|
190
|
+
|
|
191
|
+
NEAT runtime shape needed by telemetry helpers that inspect the population.
|
|
192
|
+
|
|
193
|
+
### TrackedNetworkInstance
|
|
194
|
+
|
|
195
|
+
Network instance annotated with telemetry fields during a generation.
|
|
196
|
+
|
|
197
|
+
### TrainingConstants
|
|
198
|
+
|
|
199
|
+
Training constants used by Lamarckian warm-start and refinement helpers.
|
|
200
|
+
|
|
201
|
+
## evolutionEngine/sampling.ts
|
|
202
|
+
|
|
203
|
+
### sampling
|
|
204
|
+
|
|
205
|
+
Sampling and history helpers extracted from the ASCII maze evolution façade.
|
|
206
|
+
|
|
207
|
+
Responsibilities:
|
|
208
|
+
1. Provide allocation-light array sampling utilities that reuse the shared `EngineState` scratch pools.
|
|
209
|
+
2. Expose history helpers that mirror the façade behaviour while keeping pooled buffers centralised.
|
|
210
|
+
3. Centralise RNG parameter resolution for sampling paths to keep behaviour deterministic under shared state.
|
|
211
|
+
|
|
212
|
+
### getTail
|
|
213
|
+
|
|
214
|
+
`(state: import("test/examples/asciiMaze/evolutionEngine/engineState.types").EngineState, source: T[] | undefined, count: number) => T[]`
|
|
215
|
+
|
|
216
|
+
### pushHistory
|
|
217
|
+
|
|
218
|
+
`(buffer: T[] | undefined, value: T, maxLength: number) => T[]`
|
|
219
|
+
|
|
220
|
+
### sampleArray
|
|
221
|
+
|
|
222
|
+
`(state: import("test/examples/asciiMaze/evolutionEngine/engineState.types").EngineState, source: T[], sampleCount: number) => T[]`
|
|
223
|
+
|
|
224
|
+
### sampleIntoScratch
|
|
225
|
+
|
|
226
|
+
`(state: import("test/examples/asciiMaze/evolutionEngine/engineState.types").EngineState, source: T[], sampleCount: number) => number`
|
|
227
|
+
|
|
228
|
+
### sampleSegmentIntoScratch
|
|
229
|
+
|
|
230
|
+
`(state: import("test/examples/asciiMaze/evolutionEngine/engineState.types").EngineState, source: T[], segmentStart: number, sampleCount: number) => number`
|
|
231
|
+
|
|
232
|
+
## evolutionEngine/engineState.ts
|
|
233
|
+
|
|
234
|
+
### engineState
|
|
235
|
+
|
|
236
|
+
### createEngineState
|
|
237
|
+
|
|
238
|
+
`() => import("test/examples/asciiMaze/evolutionEngine/engineState.types").EngineState`
|
|
239
|
+
|
|
240
|
+
### createProfilingState
|
|
241
|
+
|
|
242
|
+
`() => import("test/examples/asciiMaze/evolutionEngine/engineState.types").EngineProfilingState`
|
|
243
|
+
|
|
244
|
+
### createScratchState
|
|
245
|
+
|
|
246
|
+
`() => import("test/examples/asciiMaze/evolutionEngine/engineState.types").EngineScratchState`
|
|
247
|
+
|
|
248
|
+
### createToggleState
|
|
249
|
+
|
|
250
|
+
`() => import("test/examples/asciiMaze/evolutionEngine/engineState.types").EngineToggleState`
|
|
251
|
+
|
|
252
|
+
### DEFAULT_RNG_CACHE_BATCH_SIZE
|
|
253
|
+
|
|
254
|
+
### DEFAULT_VISITED_HASH_LOAD_FACTOR
|
|
255
|
+
|
|
256
|
+
### EngineProfilingState
|
|
257
|
+
|
|
258
|
+
Aggregated profiling configuration and accumulators shared across the evolution run.
|
|
259
|
+
|
|
260
|
+
### EngineScratchState
|
|
261
|
+
|
|
262
|
+
Shared contracts for the ASCII maze evolution engine state boundary.
|
|
263
|
+
|
|
264
|
+
This file owns the exported type surface consumed by the engine-state facade,
|
|
265
|
+
telemetry helpers, sampling utilities, and RNG/timing adapters.
|
|
266
|
+
|
|
267
|
+
### EngineState
|
|
268
|
+
|
|
269
|
+
Shared engine state instance combining pooled scratch buffers with toggle flags.
|
|
270
|
+
|
|
271
|
+
### EngineToggleState
|
|
272
|
+
|
|
273
|
+
Runtime switches that adjust telemetry verbosity and optional training phases.
|
|
274
|
+
|
|
275
|
+
### ensureRngCacheBatch
|
|
276
|
+
|
|
277
|
+
`(parameters: import("test/examples/asciiMaze/evolutionEngine/engineState.types").RngCacheParameters, state: import("test/examples/asciiMaze/evolutionEngine/engineState.types").EngineState) => import("test/examples/asciiMaze/evolutionEngine/engineState.types").RngCacheHandles`
|
|
278
|
+
|
|
279
|
+
### ensureVisitedHashCapacity
|
|
280
|
+
|
|
281
|
+
`(targetEntryCount: number, state: import("test/examples/asciiMaze/evolutionEngine/engineState.types").EngineState) => import("test/examples/asciiMaze/evolutionEngine/engineState.types").VisitedHashScratchHandles`
|
|
282
|
+
|
|
283
|
+
### initialiseTelemetryScratch
|
|
284
|
+
|
|
285
|
+
`(request: import("test/examples/asciiMaze/evolutionEngine/engineState.types").TelemetryScratchRequest, state: import("test/examples/asciiMaze/evolutionEngine/engineState.types").EngineState) => import("test/examples/asciiMaze/evolutionEngine/engineState.types").TelemetryScratchHandles`
|
|
286
|
+
|
|
287
|
+
### reseedRngState
|
|
288
|
+
|
|
289
|
+
`(seed: number, state: import("test/examples/asciiMaze/evolutionEngine/engineState.types").EngineState) => number`
|
|
290
|
+
|
|
291
|
+
### RngCacheHandles
|
|
292
|
+
|
|
293
|
+
Handles returned after ensuring the RNG cache is ready for consumption.
|
|
294
|
+
|
|
295
|
+
### RngCacheParameters
|
|
296
|
+
|
|
297
|
+
Parameters controlling the RNG cache refill process.
|
|
298
|
+
|
|
299
|
+
### setBaldwinPhaseDisabledFlag
|
|
300
|
+
|
|
301
|
+
`(isDisabled: boolean) => void`
|
|
302
|
+
|
|
303
|
+
### setReducedTelemetryFlag
|
|
304
|
+
|
|
305
|
+
`(isEnabled: boolean) => void`
|
|
306
|
+
|
|
307
|
+
### setTelemetryMinimalFlag
|
|
308
|
+
|
|
309
|
+
`(isMinimal: boolean) => void`
|
|
310
|
+
|
|
311
|
+
### TelemetryScratchHandles
|
|
312
|
+
|
|
313
|
+
Collection of scratch buffers handed back after initialisation for convenience.
|
|
314
|
+
|
|
315
|
+
### TelemetryScratchRequest
|
|
316
|
+
|
|
317
|
+
Configuration describing which telemetry scratch buffers require capacity guarantees.
|
|
318
|
+
|
|
319
|
+
### VisitedHashScratchHandles
|
|
320
|
+
|
|
321
|
+
Handles exposed after ensuring the visited-coordinate hash table capacity.
|
|
322
|
+
|
|
323
|
+
## evolutionEngine/rngAndTiming.ts
|
|
324
|
+
|
|
325
|
+
### rngAndTiming
|
|
326
|
+
|
|
327
|
+
RNG and timing helpers extracted from the evolution façade.
|
|
328
|
+
@remarks
|
|
329
|
+
All helpers accept an {@link EngineState} instance so they can read and mutate
|
|
330
|
+
shared state without relying on class statics.
|
|
331
|
+
|
|
332
|
+
### accumulateProfilingDuration
|
|
333
|
+
|
|
334
|
+
`(state: import("test/examples/asciiMaze/evolutionEngine/engineState.types").EngineState, category: string, deltaMs: number) => void`
|
|
335
|
+
|
|
336
|
+
### clearDeterministicMode
|
|
337
|
+
|
|
338
|
+
`(state: import("test/examples/asciiMaze/evolutionEngine/engineState.types").EngineState) => void`
|
|
339
|
+
|
|
340
|
+
### drawFastRandom
|
|
341
|
+
|
|
342
|
+
`(state: import("test/examples/asciiMaze/evolutionEngine/engineState.types").EngineState, parameters: import("test/examples/asciiMaze/evolutionEngine/engineState.types").RngCacheParameters) => number`
|
|
343
|
+
|
|
344
|
+
### getProfilingAccumulators
|
|
345
|
+
|
|
346
|
+
`(state: import("test/examples/asciiMaze/evolutionEngine/engineState.types").EngineState) => Record<string, number>`
|
|
347
|
+
|
|
348
|
+
### isDeterministicModeEnabled
|
|
349
|
+
|
|
350
|
+
`(state: import("test/examples/asciiMaze/evolutionEngine/engineState.types").EngineState) => boolean`
|
|
351
|
+
|
|
352
|
+
### isProfilingDetailsEnabled
|
|
353
|
+
|
|
354
|
+
`(state: import("test/examples/asciiMaze/evolutionEngine/engineState.types").EngineState) => boolean`
|
|
355
|
+
|
|
356
|
+
### profilingStartTimestamp
|
|
357
|
+
|
|
358
|
+
`() => number`
|
|
359
|
+
|
|
360
|
+
### readHighResolutionTime
|
|
361
|
+
|
|
362
|
+
`() => number`
|
|
363
|
+
|
|
364
|
+
### resolveRngParameters
|
|
365
|
+
|
|
366
|
+
`() => import("test/examples/asciiMaze/evolutionEngine/engineState.types").RngCacheParameters`
|
|
367
|
+
|
|
368
|
+
### setDeterministicMode
|
|
369
|
+
|
|
370
|
+
`(state: import("test/examples/asciiMaze/evolutionEngine/engineState.types").EngineState, seed: number | undefined) => void`
|
|
371
|
+
|
|
372
|
+
## evolutionEngine/scratchPools.ts
|
|
373
|
+
|
|
374
|
+
### scratchPools
|
|
375
|
+
|
|
376
|
+
Scratch pool management helpers extracted from the maze evolution façade.
|
|
377
|
+
|
|
378
|
+
These utilities centralise the logic that grows and shrinks pooled buffers attached to the
|
|
379
|
+
shared {@link EngineState}. They keep the façade lean by encapsulating heuristics for logits
|
|
380
|
+
ring sizing, telemetry scratch sizing, and connection flag pooling.
|
|
381
|
+
|
|
382
|
+
### allocateLogitsRing
|
|
383
|
+
|
|
384
|
+
`(capacity: number, actionDimension: number) => Float32Array<ArrayBufferLike>[]`
|
|
385
|
+
|
|
386
|
+
### ensureConnFlagsCapacity
|
|
387
|
+
|
|
388
|
+
`(state: import("test/examples/asciiMaze/evolutionEngine/engineState.types").EngineState, minimumCapacity: number) => Int8Array<ArrayBufferLike> | null`
|
|
389
|
+
|
|
390
|
+
### ensureLogitsRingCapacity
|
|
391
|
+
|
|
392
|
+
`(capacityRequest: import("test/examples/asciiMaze/evolutionEngine/scratchPools").LogitsRingCapacityOptions) => import("test/examples/asciiMaze/evolutionEngine/scratchPools").LogitsRingCapacityResult`
|
|
393
|
+
|
|
394
|
+
### ensureScratchCapacity
|
|
395
|
+
|
|
396
|
+
`(state: import("test/examples/asciiMaze/evolutionEngine/engineState.types").EngineState, request: import("test/examples/asciiMaze/evolutionEngine/scratchPools").ScratchCapacityRequest) => void`
|
|
397
|
+
|
|
398
|
+
### initialiseSharedLogitsRing
|
|
399
|
+
|
|
400
|
+
`(state: import("test/examples/asciiMaze/evolutionEngine/engineState.types").EngineState, config: import("test/examples/asciiMaze/evolutionEngine/scratchPools").SharedLogitsConfig) => boolean`
|
|
401
|
+
|
|
402
|
+
### LogitsRingCapacityOptions
|
|
403
|
+
|
|
404
|
+
Shape describing the parameters used when ensuring the logits ring capacity.
|
|
405
|
+
|
|
406
|
+
### LogitsRingCapacityResult
|
|
407
|
+
|
|
408
|
+
Result returned after resizing the logits ring.
|
|
409
|
+
|
|
410
|
+
### maybeShrinkScratch
|
|
411
|
+
|
|
412
|
+
`(state: import("test/examples/asciiMaze/evolutionEngine/engineState.types").EngineState, populationSize: number) => void`
|
|
413
|
+
|
|
414
|
+
### ScratchCapacityRequest
|
|
415
|
+
|
|
416
|
+
Parameters describing the scratch sizing requirements for ensureScratchCapacity.
|
|
417
|
+
|
|
418
|
+
### SharedLogitsConfig
|
|
419
|
+
|
|
420
|
+
Parameters passed when attempting to initialise the shared logits ring buffers.
|
|
421
|
+
|
|
422
|
+
## evolutionEngine/setupHelpers.ts
|
|
423
|
+
|
|
424
|
+
### DashboardManagerLike
|
|
425
|
+
|
|
426
|
+
Dashboard manager shape for logging (optional log function).
|
|
427
|
+
|
|
428
|
+
### FilesystemModule
|
|
429
|
+
|
|
430
|
+
Setup helpers for the ASCII maze evolution engine.
|
|
431
|
+
|
|
432
|
+
Responsibilities:
|
|
433
|
+
- Create cooperative frame-yielding helpers for async evolution loops.
|
|
434
|
+
- Initialize Node.js persistence helpers when available.
|
|
435
|
+
- Build resilient logging writers with dashboard and console fallbacks.
|
|
436
|
+
|
|
437
|
+
### initPersistence
|
|
438
|
+
|
|
439
|
+
`(persistDir: string | undefined) => { fs: import("test/examples/asciiMaze/evolutionEngine/setupHelpers").FilesystemModule | null; path: import("test/examples/asciiMaze/evolutionEngine/setupHelpers").PathModule | null; }`
|
|
440
|
+
|
|
441
|
+
### isPauseRequested
|
|
442
|
+
|
|
443
|
+
`(hostAdapter: import("test/examples/asciiMaze/evolutionEngine/evolutionEngine.types").EvolutionHostAdapter | undefined) => boolean`
|
|
444
|
+
|
|
445
|
+
Read host-controlled pause state without letting host errors break the engine.
|
|
446
|
+
|
|
447
|
+
Parameters:
|
|
448
|
+
- `hostAdapter` - - Optional host adapter implementing pause polling.
|
|
449
|
+
|
|
450
|
+
Returns: True when the host asks the engine to remain paused.
|
|
451
|
+
|
|
452
|
+
### makeFlushToFrame
|
|
453
|
+
|
|
454
|
+
`(hostAdapter: import("test/examples/asciiMaze/evolutionEngine/evolutionEngine.types").EvolutionHostAdapter | undefined) => () => Promise<void>`
|
|
455
|
+
|
|
456
|
+
### makeSafeWriter
|
|
457
|
+
|
|
458
|
+
`(dashboardManager: import("test/examples/asciiMaze/evolutionEngine/setupHelpers").DashboardManagerLike | undefined) => (msg: string) => void`
|
|
459
|
+
|
|
460
|
+
### PathModule
|
|
461
|
+
|
|
462
|
+
Minimal path module shape for type safety (Node.js path module subset).
|
|
463
|
+
|
|
464
|
+
## evolutionEngine/evolutionLoop.ts
|
|
465
|
+
|
|
466
|
+
### evolutionLoop
|
|
467
|
+
|
|
468
|
+
Evolution Loop Module
|
|
469
|
+
|
|
470
|
+
Purpose:
|
|
471
|
+
-------
|
|
472
|
+
Provides utilities for running the main NEAT evolution loop, including
|
|
473
|
+
generation orchestration, cancellation checking, and loop helper preparation.
|
|
474
|
+
|
|
475
|
+
This module encapsulates:
|
|
476
|
+
- Cancellation detection (AbortSignal and legacy cancellation API)
|
|
477
|
+
- Loop helper preparation (frame flushing, persistence, logging)
|
|
478
|
+
- Generation execution and orchestration
|
|
479
|
+
- Stop condition evaluation
|
|
480
|
+
|
|
481
|
+
ES2023 Policy:
|
|
482
|
+
-------------
|
|
483
|
+
- Uses nullish coalescing `??` and optional chaining `?.`
|
|
484
|
+
- Descriptive variable names (no short identifiers)
|
|
485
|
+
- Async/await for generation loops
|
|
486
|
+
- Best-effort error handling (swallow non-fatal errors)
|
|
487
|
+
|
|
488
|
+
@module evolutionEngine/evolutionLoop
|
|
489
|
+
|
|
490
|
+
### checkCancellation
|
|
491
|
+
|
|
492
|
+
`(options: import("test/examples/asciiMaze/evolutionEngine/evolutionEngine.types").EvolutionOptions, bestResult: import("test/examples/asciiMaze/interfaces").IMazeRunResult | undefined) => string | undefined`
|
|
493
|
+
|
|
494
|
+
### checkStopConditions
|
|
495
|
+
|
|
496
|
+
`(bestResult: import("test/examples/asciiMaze/interfaces").IMazeRunResult | undefined, bestNetwork: import("src/architecture/network").default | null, maze: string[], completedGenerations: number, neat: import("src/neat").default, dashboardManager: import("test/examples/asciiMaze/interfaces").IDashboardManager | undefined, flushToFrame: () => Promise<void>, hostAdapter: import("test/examples/asciiMaze/evolutionEngine/evolutionEngine.types").EvolutionHostAdapter | undefined, minProgressToPass: number, autoPauseOnSolve: boolean, stopOnlyOnSolve: boolean, stagnantGenerations: number, maxStagnantGenerations: number, maxGenerations: number) => Promise<string | undefined>`
|
|
497
|
+
|
|
498
|
+
### emitProfileSummary
|
|
499
|
+
|
|
500
|
+
`(engineState: import("test/examples/asciiMaze/evolutionEngine/engineState.types").EngineState, safeWrite: (msg: string) => void, completedGenerations: number, totalEvolveMs: number, totalLamarckMs: number, totalSimMs: number, isProfilingDetailsEnabledFn: (state: import("test/examples/asciiMaze/evolutionEngine/engineState.types").EngineState) => boolean, getProfilingAccumulatorsFn: (state: import("test/examples/asciiMaze/evolutionEngine/engineState.types").EngineState) => import("test/examples/asciiMaze/evolutionEngine/evolutionEngine.types").ProfilingAccumulators) => void`
|
|
501
|
+
|
|
502
|
+
### EvolutionLoopResult
|
|
503
|
+
|
|
504
|
+
Evolution loop result
|
|
505
|
+
|
|
506
|
+
### GenerationOutcome
|
|
507
|
+
|
|
508
|
+
Generation outcome with profiling timings
|
|
509
|
+
|
|
510
|
+
### MutableMazeResult
|
|
511
|
+
|
|
512
|
+
Evolution Loop Module
|
|
513
|
+
|
|
514
|
+
Purpose:
|
|
515
|
+
-------
|
|
516
|
+
Provides utilities for running the main NEAT evolution loop, including
|
|
517
|
+
generation orchestration, cancellation checking, and loop helper preparation.
|
|
518
|
+
|
|
519
|
+
This module encapsulates:
|
|
520
|
+
- Cancellation detection (AbortSignal and legacy cancellation API)
|
|
521
|
+
- Loop helper preparation (frame flushing, persistence, logging)
|
|
522
|
+
- Generation execution and orchestration
|
|
523
|
+
- Stop condition evaluation
|
|
524
|
+
|
|
525
|
+
ES2023 Policy:
|
|
526
|
+
-------------
|
|
527
|
+
- Uses nullish coalescing `??` and optional chaining `?.`
|
|
528
|
+
- Descriptive variable names (no short identifiers)
|
|
529
|
+
- Async/await for generation loops
|
|
530
|
+
- Best-effort error handling (swallow non-fatal errors)
|
|
531
|
+
|
|
532
|
+
### persistSnapshotIfNeeded
|
|
533
|
+
|
|
534
|
+
`(engineState: import("test/examples/asciiMaze/evolutionEngine/engineState.types").EngineState, fs: { writeFileSync?: ((path: string, data: string) => void) | undefined; } | null, pathModule: { join?: ((...paths: string[]) => string) | undefined; } | null, persistDir: string | undefined, persistTopK: number, completedGenerations: number, persistEvery: number, neat: import("src/neat").default, bestFitness: number, simplifyMode: boolean, plateauCounter: number, scratchSnapshotObj: Record<string, unknown>, scratchSnapshotTop: import("test/examples/asciiMaze/evolutionEngine/evolutionEngine.types").SnapshotEntry[], collectTelemetryTailFn: (state: import("test/examples/asciiMaze/evolutionEngine/engineState.types").EngineState, neat: import("src/neat").default, count: number) => unknown, getSortedIndicesByScoreFn: (state: import("test/examples/asciiMaze/evolutionEngine/engineState.types").EngineState, population: import("src/architecture/network").default[]) => number[], isProfilingDetailsEnabledFn: (state: import("test/examples/asciiMaze/evolutionEngine/engineState.types").EngineState) => boolean, profilingStartTimestampFn: (state: import("test/examples/asciiMaze/evolutionEngine/engineState.types").EngineState) => number, accumulateProfilingDurationFn: (state: import("test/examples/asciiMaze/evolutionEngine/engineState.types").EngineState, label: string, duration: number) => void) => void`
|
|
535
|
+
|
|
536
|
+
### prepareLoopHelpers
|
|
537
|
+
|
|
538
|
+
`(opts: import("test/examples/asciiMaze/evolutionEngine/evolutionEngine.types").EvolutionOptions, scratchBundle: import("test/examples/asciiMaze/evolutionEngine/evolutionEngine.types").ScratchBundle) => import("test/examples/asciiMaze/evolutionEngine/evolutionEngine.types").LoopHelpers`
|
|
539
|
+
|
|
540
|
+
### runEvolutionLoop
|
|
541
|
+
|
|
542
|
+
`(engineState: import("test/examples/asciiMaze/evolutionEngine/engineState.types").EngineState, neat: import("src/neat").default, opts: import("test/examples/asciiMaze/evolutionEngine/evolutionEngine.types").EvolutionOptions, lamarckianTrainingSet: { input: number[]; output: number[]; }[], encodedMaze: number[][], startPosition: readonly [number, number], exitPosition: readonly [number, number], distanceMap: number[][], helpers: import("test/examples/asciiMaze/evolutionEngine/evolutionEngine.types").LoopHelpers, doProfile: boolean, scratchLogitsRing: Float32Array<ArrayBufferLike>[], logitsRingCap: number, logitsRingCapMax: number, actionDim: number, logitsRingShared: boolean, scratchLogitsShared: Float32Array<ArrayBufferLike> | undefined, scratchLogitsSharedW: Int32Array<ArrayBufferLike> | undefined, scratchLogitsRingW: number, emptyVec: import("src/architecture/network").default[], scratchNodeIdx: Int32Array<ArrayBufferLike>, scratchSnapshotObj: Record<string, unknown>, scratchSnapshotTop: import("test/examples/asciiMaze/evolutionEngine/evolutionEngine.types").SnapshotEntry[], getNodeIndicesByType: (nodes: import("test/examples/asciiMaze/evolutionEngine/evolutionEngine.types").NetworkNode[], type: string) => number, collectHiddenToOutputConns: (hiddenNode: import("test/examples/asciiMaze/evolutionEngine/evolutionEngine.types").NetworkNode, nodesRef: import("test/examples/asciiMaze/evolutionEngine/evolutionEngine.types").NetworkNode[], outputCount: number) => import("test/examples/asciiMaze/evolutionEngine/evolutionEngine.types").NetworkConnection[], constants: import("test/examples/asciiMaze/evolutionEngine/evolutionEngine.types").TrainingConstants & { DEFAULT_TRAIN_BATCH_LARGE: number; FITTEST_TRAIN_ITERATIONS: number; TELEMETRY_MINIMAL: boolean; SATURATION_PRUNE_THRESHOLD: number; RECENT_WINDOW: number; REDUCED_TELEMETRY: boolean; DISABLE_BALDWIN: boolean; }, speciesHistoryRef: number[]) => Promise<EvolutionLoopResult>`
|
|
543
|
+
|
|
544
|
+
### runGeneration
|
|
545
|
+
|
|
546
|
+
`(engineState: import("test/examples/asciiMaze/evolutionEngine/engineState.types").EngineState, neat: import("src/neat").default, doProfile: boolean, lamarckianIterations: number, lamarckianTrainingSet: { input: number[]; output: number[]; }[], lamarckianSampleSize: number | undefined, safeWrite: (msg: string) => void, completedGenerations: number, dynamicPopEnabled: boolean, dynamicPopMax: number, plateauGenerations: number, plateauCounter: number, dynamicPopExpandInterval: number, dynamicPopExpandFactor: number, dynamicPopPlateauSlack: number, speciesHistoryRef: number[], emptyVec: import("src/architecture/network").default[], scratchNodeIdx: Int32Array<ArrayBufferLike>, getNodeIndicesByType: (nodes: import("test/examples/asciiMaze/evolutionEngine/evolutionEngine.types").NetworkNode[], type: string) => number, constants: import("test/examples/asciiMaze/evolutionEngine/evolutionEngine.types").TrainingConstants) => Promise<GenerationOutcome>`
|
|
547
|
+
|
|
548
|
+
### SimResultWithOutputs
|
|
549
|
+
|
|
550
|
+
Simulation result with step outputs
|
|
551
|
+
|
|
552
|
+
### simulateAndPostprocess
|
|
553
|
+
|
|
554
|
+
`(engineState: import("test/examples/asciiMaze/evolutionEngine/engineState.types").EngineState, fittest: import("src/architecture/network").default, encodedMaze: number[][], startPosition: readonly [number, number], exitPosition: readonly [number, number], distanceMap: number[][], maxSteps: number | undefined, doProfile: boolean, safeWrite: (msg: string) => void, logEvery: number, completedGenerations: number, neat: import("src/neat").default, scratchLogitsRing: Float32Array<ArrayBufferLike>[], logitsRingCap: number, logitsRingCapMax: number, actionDim: number, logitsRingShared: boolean, scratchLogitsShared: Float32Array<ArrayBufferLike> | undefined, scratchLogitsSharedW: Int32Array<ArrayBufferLike> | undefined, scratchLogitsRingW: number, telemetryMinimal: boolean, saturationPruneThreshold: number, recentWindow: number, reducedTelemetry: boolean, getNodeIndicesByType: (nodes: import("test/examples/asciiMaze/evolutionEngine/evolutionEngine.types").NetworkNode[], type: string) => number, collectHiddenToOutputConns: (hiddenNode: import("test/examples/asciiMaze/evolutionEngine/evolutionEngine.types").NetworkNode, nodesRef: import("test/examples/asciiMaze/evolutionEngine/evolutionEngine.types").NetworkNode[], outputCount: number) => import("test/examples/asciiMaze/evolutionEngine/evolutionEngine.types").NetworkConnection[]) => import("test/examples/asciiMaze/evolutionEngine/evolutionEngine.types").SimulationResult`
|
|
555
|
+
|
|
556
|
+
### SimulationOutcome
|
|
557
|
+
|
|
558
|
+
Simulation result with profiling and ring state
|
|
559
|
+
|
|
560
|
+
### updateDashboardAndMaybeFlush
|
|
561
|
+
|
|
562
|
+
`(maze: string[], result: import("test/examples/asciiMaze/interfaces").IMazeRunResult | undefined, network: import("src/architecture/network").default | null, completedGenerations: number, neat: import("src/neat").default, dashboardManager: import("test/examples/asciiMaze/interfaces").IDashboardManager | undefined, flushToFrame: (() => Promise<void>) | undefined) => Promise<void>`
|
|
563
|
+
|
|
564
|
+
### updateDashboardPeriodic
|
|
565
|
+
|
|
566
|
+
`(maze: string[], bestResult: import("test/examples/asciiMaze/interfaces").IMazeRunResult | undefined, bestNetwork: import("src/architecture/network").default | null, completedGenerations: number, neat: import("src/neat").default, dashboardManager: import("test/examples/asciiMaze/interfaces").IDashboardManager | undefined, flushToFrame: (() => Promise<void>) | undefined) => Promise<void>`
|
|
567
|
+
|
|
568
|
+
## evolutionEngine/curriculumPhase.ts
|
|
569
|
+
|
|
570
|
+
### hasMazeEvolutionReachedCurriculumThreshold
|
|
571
|
+
|
|
572
|
+
`(progress: unknown, minProgressToPass: number) => boolean`
|
|
573
|
+
|
|
574
|
+
### refineMazeEvolutionCarryOverNetwork
|
|
575
|
+
|
|
576
|
+
`(bestNetwork: import("test/examples/asciiMaze/interfaces").INetwork | undefined, previousBestNetwork: import("test/examples/asciiMaze/interfaces").INetwork | undefined) => import("test/examples/asciiMaze/interfaces").INetwork | undefined`
|
|
577
|
+
|
|
578
|
+
### resolveMazeEvolutionPhaseOutcome
|
|
579
|
+
|
|
580
|
+
`(evolutionResult: import("test/examples/asciiMaze/evolutionEngine/evolutionEngine.types").MazeEvolutionRunResult, previousBestNetwork: import("test/examples/asciiMaze/interfaces").INetwork | undefined, minProgressToPass: number) => import("test/examples/asciiMaze/evolutionEngine/evolutionEngine.types").MazeEvolutionCurriculumPhaseOutcome`
|
|
581
|
+
|
|
582
|
+
## evolutionEngine/optionsAndSetup.ts
|
|
583
|
+
|
|
584
|
+
### optionsAndSetup
|
|
585
|
+
|
|
586
|
+
Options and Setup Module
|
|
587
|
+
|
|
588
|
+
Purpose:
|
|
589
|
+
-------
|
|
590
|
+
Provides utilities for normalizing run options, preparing maze environment,
|
|
591
|
+
and orchestrating NEAT driver creation with population seeding.
|
|
592
|
+
|
|
593
|
+
This module encapsulates:
|
|
594
|
+
- Run options validation and normalization with sensible defaults
|
|
595
|
+
- Environment preparation (maze encoding, distance maps, I/O sizing)
|
|
596
|
+
- NEAT driver creation and population seeding orchestration
|
|
597
|
+
|
|
598
|
+
ES2023 Policy:
|
|
599
|
+
-------------
|
|
600
|
+
- Uses nullish coalescing `??` for default values (never `||`)
|
|
601
|
+
- Descriptive variable names (no short identifiers)
|
|
602
|
+
- Optional chaining `?.` for safe property access
|
|
603
|
+
- Spread operator for object composition
|
|
604
|
+
|
|
605
|
+
@module evolutionEngine/optionsAndSetup
|
|
606
|
+
|
|
607
|
+
### createAndSeedNeat
|
|
608
|
+
|
|
609
|
+
`(opts: any, inputSize: number, outputSize: number, fitnessContext: import("test/examples/asciiMaze/fitness.types").IFitnessEvaluationContext, scratchPopClone: any[], scratchSample: any[]) => any`
|
|
610
|
+
|
|
611
|
+
### normalizeRunOptions
|
|
612
|
+
|
|
613
|
+
`(options: import("test/examples/asciiMaze/evolutionEngine/evolutionEngine.types").IRunMazeEvolutionOptions, setDeterministic: (seed: number) => void, setReducedTelemetry: (enabled: boolean) => void, setMinimalTelemetry: (enabled: boolean) => void, setDisableBaldwin: (disabled: boolean) => void) => any`
|
|
614
|
+
|
|
615
|
+
### prepareEnvironmentForRun
|
|
616
|
+
|
|
617
|
+
`(opts: any, scratchBundle: any) => any`
|
|
618
|
+
|
|
619
|
+
## evolutionEngine/telemetryMetrics.ts
|
|
620
|
+
|
|
621
|
+
### telemetryMetrics
|
|
622
|
+
|
|
623
|
+
Telemetry logging and metric computation helpers extracted from the ASCII maze evolution engine.
|
|
624
|
+
|
|
625
|
+
The helpers in this module operate on the shared {@link EngineState} scratch buffers to avoid
|
|
626
|
+
per-call allocations while keeping the main façade lighter. All telemetry is best-effort: any
|
|
627
|
+
internal error is swallowed so that logging never impacts the evolution loop.
|
|
628
|
+
|
|
629
|
+
### ActionEntropyStats
|
|
630
|
+
|
|
631
|
+
Structure describing the result of action-entropy computation.
|
|
632
|
+
|
|
633
|
+
### collectTelemetryTail
|
|
634
|
+
|
|
635
|
+
`(state: import("test/examples/asciiMaze/evolutionEngine/engineState.types").EngineState, neat: unknown, tailLength: number) => unknown`
|
|
636
|
+
|
|
637
|
+
### GenerationResult
|
|
638
|
+
|
|
639
|
+
Minimal structure representing a generation evolution result.
|
|
640
|
+
Expected to have a path property containing the movement history.
|
|
641
|
+
|
|
642
|
+
### LOG_TAG_ACTION_ENTROPY
|
|
643
|
+
|
|
644
|
+
### LOG_TAG_LOGITS
|
|
645
|
+
|
|
646
|
+
### LOG_TAG_OUTPUT_BIAS
|
|
647
|
+
|
|
648
|
+
### logActionEntropy
|
|
649
|
+
|
|
650
|
+
`(__0: import("test/examples/asciiMaze/evolutionEngine/telemetryMetrics").LogActionEntropyParams) => void`
|
|
651
|
+
|
|
652
|
+
### LogActionEntropyParams
|
|
653
|
+
|
|
654
|
+
Parameters required to emit action-entropy telemetry.
|
|
655
|
+
|
|
656
|
+
### logDiversity
|
|
657
|
+
|
|
658
|
+
`(__0: import("test/examples/asciiMaze/evolutionEngine/telemetryMetrics").LogDiversityParams) => void`
|
|
659
|
+
|
|
660
|
+
### LogDiversityParams
|
|
661
|
+
|
|
662
|
+
Parameters required to emit population diversity telemetry.
|
|
663
|
+
|
|
664
|
+
### logExploration
|
|
665
|
+
|
|
666
|
+
`(__0: import("test/examples/asciiMaze/evolutionEngine/telemetryMetrics").LogExplorationParams) => void`
|
|
667
|
+
|
|
668
|
+
### LogExplorationParams
|
|
669
|
+
|
|
670
|
+
Parameters required to emit exploration telemetry.
|
|
671
|
+
|
|
672
|
+
### logGenerationTelemetry
|
|
673
|
+
|
|
674
|
+
`(engineState: import("test/examples/asciiMaze/evolutionEngine/engineState.types").EngineState, neat: import("src/neat").default, fittest: import("src/architecture/network").default | undefined, genResult: GenerationResult | undefined, generationIndex: number, writeLog: (msg: string) => void, actionDimension: number, recentWindow: number, reducedTelemetry: boolean, telemetryMinimal: boolean, onCollapseRecovery: () => void, isProfilingDetailsEnabledFn: (state: import("test/examples/asciiMaze/evolutionEngine/engineState.types").EngineState) => boolean, profilingStartTimestampFn: (state: import("test/examples/asciiMaze/evolutionEngine/engineState.types").EngineState) => number, accumulateProfilingDurationFn: (state: import("test/examples/asciiMaze/evolutionEngine/engineState.types").EngineState, label: string, duration: number) => void) => void`
|
|
675
|
+
|
|
676
|
+
### LogitStatsParams
|
|
677
|
+
|
|
678
|
+
Input parameters for computing logit statistics.
|
|
679
|
+
|
|
680
|
+
### LogitStatsResult
|
|
681
|
+
|
|
682
|
+
Structure describing aggregated logit statistics.
|
|
683
|
+
|
|
684
|
+
### logLogitsAndCollapse
|
|
685
|
+
|
|
686
|
+
`(__0: import("test/examples/asciiMaze/evolutionEngine/telemetryMetrics").LogLogitsParams) => void`
|
|
687
|
+
|
|
688
|
+
### LogLogitsParams
|
|
689
|
+
|
|
690
|
+
Parameters required to emit logits statistics, perform collapse detection and trigger recovery.
|
|
691
|
+
|
|
692
|
+
### LogOutputBiasParams
|
|
693
|
+
|
|
694
|
+
Parameters required to emit output-bias telemetry.
|
|
695
|
+
|
|
696
|
+
### logOutputBiasStats
|
|
697
|
+
|
|
698
|
+
`(__0: import("test/examples/asciiMaze/evolutionEngine/telemetryMetrics").LogOutputBiasParams) => void`
|
|
699
|
+
|
|
700
|
+
### TelemetryBaseParams
|
|
701
|
+
|
|
702
|
+
Parameters shared by telemetry helpers that require access to the shared state and writer.
|
|
703
|
+
|
|
704
|
+
### TelemetryWriter
|
|
705
|
+
|
|
706
|
+
`(message: string) => void`
|
|
707
|
+
|
|
708
|
+
Writer signature reused across telemetry helpers.
|
|
709
|
+
|
|
710
|
+
## evolutionEngine/neatConfiguration.ts
|
|
711
|
+
|
|
712
|
+
### neatConfiguration
|
|
713
|
+
|
|
714
|
+
NEAT Configuration Module
|
|
715
|
+
|
|
716
|
+
Purpose:
|
|
717
|
+
-------
|
|
718
|
+
Provides utilities for instantiating and seeding NEAT (NeuroEvolution of Augmenting Topologies)
|
|
719
|
+
instances with standardized configuration and optional initial populations.
|
|
720
|
+
|
|
721
|
+
This module encapsulates:
|
|
722
|
+
- NEAT driver creation with opinionated defaults (elitism, provenance, mutation operators)
|
|
723
|
+
- Population seeding with defensive cloning and best-effort error handling
|
|
724
|
+
- Configuration normalization and validation
|
|
725
|
+
|
|
726
|
+
ES2023 Policy:
|
|
727
|
+
-------------
|
|
728
|
+
- Uses nullish coalescing `??` for default values (never `||`)
|
|
729
|
+
- Descriptive variable names (no short identifiers like `i`, `c`, `p`)
|
|
730
|
+
- Optional chaining `?.` for safe property access
|
|
731
|
+
- Spread operator for array/object operations
|
|
732
|
+
|
|
733
|
+
@module evolutionEngine/neatConfiguration
|
|
734
|
+
|
|
735
|
+
### createNeat
|
|
736
|
+
|
|
737
|
+
`(inputCount: number, outputCount: number, fitnessCallback: (net: import("src/architecture/network").default) => number, cfg: import("test/examples/asciiMaze/evolutionEngine/neatConfiguration").NeatConfig | undefined) => import("src/neat").default`
|
|
738
|
+
|
|
739
|
+
### NeatConfig
|
|
740
|
+
|
|
741
|
+
NEAT configuration object shape for type safety.
|
|
742
|
+
|
|
743
|
+
### seedInitialPopulation
|
|
744
|
+
|
|
745
|
+
`(neat: import("src/neat").default, initialPopulation: import("src/architecture/network").default[] | undefined, initialBestNetwork: import("src/architecture/network").default | undefined, targetPopSize: number, scratchPopClone: import("src/architecture/network").default[]) => import("src/architecture/network").default[]`
|
|
746
|
+
|
|
747
|
+
## evolutionEngine/networkInspection.ts
|
|
748
|
+
|
|
749
|
+
### networkInspection
|
|
750
|
+
|
|
751
|
+
Network Inspection Module
|
|
752
|
+
|
|
753
|
+
Purpose:
|
|
754
|
+
-------
|
|
755
|
+
Provides utilities for inspecting and analyzing neural network topology,
|
|
756
|
+
including node classification, activation function detection, and connection
|
|
757
|
+
analysis (recurrent/gated detection).
|
|
758
|
+
|
|
759
|
+
This module encapsulates:
|
|
760
|
+
- Node classification (input/hidden/output buckets)
|
|
761
|
+
- Activation function name gathering
|
|
762
|
+
- Recurrent and gated connection detection
|
|
763
|
+
- Network structure printing for debugging
|
|
764
|
+
|
|
765
|
+
ES2023 Policy:
|
|
766
|
+
-------------
|
|
767
|
+
- Uses nullish coalescing `??` and optional chaining `?.`
|
|
768
|
+
- Descriptive variable names (no short identifiers)
|
|
769
|
+
- Pooled scratch buffers to avoid allocations
|
|
770
|
+
- Best-effort error handling (swallow non-fatal errors)
|
|
771
|
+
|
|
772
|
+
@module evolutionEngine/networkInspection
|
|
773
|
+
|
|
774
|
+
### printNetworkStructure
|
|
775
|
+
|
|
776
|
+
`(engineState: import("test/examples/asciiMaze/evolutionEngine/engineState.types").EngineState, network: import("test/examples/asciiMaze/interfaces").INetwork) => void`
|
|
777
|
+
|
|
778
|
+
### swallowError
|
|
779
|
+
|
|
780
|
+
`(error: unknown) => void`
|
|
781
|
+
|
|
782
|
+
## evolutionEngine/populationPruning.ts
|
|
783
|
+
|
|
784
|
+
### populationPruning
|
|
785
|
+
|
|
786
|
+
Population pruning and network warm-start helpers for the ASCII maze evolution engine.
|
|
787
|
+
|
|
788
|
+
This module centralizes genome connection pruning (simplification phase), output bias maintenance,
|
|
789
|
+
and warm-start initialization logic. All helpers operate on the shared {@link EngineState} scratch
|
|
790
|
+
buffers to avoid per-call allocations while keeping pruning logic modular and testable.
|
|
791
|
+
|
|
792
|
+
Responsibilities:
|
|
793
|
+
1. Apply simplify-phase pruning to entire populations via strategy-driven connection disabling.
|
|
794
|
+
2. Collect, sort, and selectively disable weak connections based on absolute weight.
|
|
795
|
+
3. Initialize compass warm-start wiring for directional inputs.
|
|
796
|
+
4. Re-center and clamp output node biases to prevent drift.
|
|
797
|
+
5. Provide allocation-light helpers that reuse pooled buffers (connection candidates, node indices).
|
|
798
|
+
|
|
799
|
+
All functions are best-effort: internal errors are swallowed to avoid destabilizing the evolution loop.
|
|
800
|
+
|
|
801
|
+
### applyCompassWarmStart
|
|
802
|
+
|
|
803
|
+
`(__0: import("test/examples/asciiMaze/evolutionEngine/populationPruning").ApplyCompassWarmStartParams) => void`
|
|
804
|
+
|
|
805
|
+
### ApplyCompassWarmStartParams
|
|
806
|
+
|
|
807
|
+
Parameters for warm-starting compass wiring.
|
|
808
|
+
|
|
809
|
+
### ApplySimplifyPruningParams
|
|
810
|
+
|
|
811
|
+
Parameters for applying simplify pruning to a population.
|
|
812
|
+
|
|
813
|
+
### applySimplifyPruningToPopulation
|
|
814
|
+
|
|
815
|
+
`(__0: import("test/examples/asciiMaze/evolutionEngine/populationPruning").ApplySimplifyPruningParams) => void`
|
|
816
|
+
|
|
817
|
+
### centerOutputBiases
|
|
818
|
+
|
|
819
|
+
`(__0: import("test/examples/asciiMaze/evolutionEngine/populationPruning").CenterOutputBiasesParams) => void`
|
|
820
|
+
|
|
821
|
+
### CenterOutputBiasesParams
|
|
822
|
+
|
|
823
|
+
Parameters for re-centering output biases.
|
|
824
|
+
|
|
825
|
+
## evolutionEngine/trainingWarmStart.ts
|
|
826
|
+
|
|
827
|
+
### trainingWarmStart
|
|
828
|
+
|
|
829
|
+
trainingWarmStart.ts
|
|
830
|
+
|
|
831
|
+
Lamarckian warm-start and population pretraining subsystem.
|
|
832
|
+
|
|
833
|
+
Responsibilities:
|
|
834
|
+
- Build supervised training datasets for compass-guided navigation
|
|
835
|
+
- Apply Lamarckian backpropagation training to populations
|
|
836
|
+
- Adjust output biases after training to maintain exploration
|
|
837
|
+
- Orchestrate conditional warm-start pretraining with buffer management
|
|
838
|
+
|
|
839
|
+
All functions are pure/side-effect-free except where explicitly documented.
|
|
840
|
+
Mutations are limited to NEAT population networks and engine scratch buffers.
|
|
841
|
+
|
|
842
|
+
@module trainingWarmStart
|
|
843
|
+
|
|
844
|
+
### adjustOutputBiasesAfterTraining
|
|
845
|
+
|
|
846
|
+
`(network: import("src/architecture/network").default, state: import("test/examples/asciiMaze/evolutionEngine/engineState.types").EngineState, constants: { DEFAULT_STD_SMALL: number; DEFAULT_STD_ADJUST_MULT: number; }, scratchNodeIdx: Int32Array<ArrayBufferLike>, getNodeIndicesByType: (nodes: any[], nodeType: string) => number) => void`
|
|
847
|
+
|
|
848
|
+
### applyLamarckianTraining
|
|
849
|
+
|
|
850
|
+
`(neat: import("src/neat").default, trainingSet: any[], iterations: number, sampleSize: number | undefined, safeWrite: (msg: string) => void, profileEnabled: boolean, completedGenerations: number, state: import("test/examples/asciiMaze/evolutionEngine/engineState.types").EngineState, constants: { DEFAULT_TRAIN_ERROR: number; DEFAULT_TRAIN_RATE: number; DEFAULT_TRAIN_MOMENTUM: number; DEFAULT_TRAIN_BATCH_SMALL: number; }, adjustOutputBiases: (network: any) => void) => number`
|
|
851
|
+
|
|
852
|
+
### buildLamarckianTrainingSet
|
|
853
|
+
|
|
854
|
+
`(state: import("test/examples/asciiMaze/evolutionEngine/engineState.types").EngineState, constants: { TRAIN_OUT_PROB_HIGH: number; TRAIN_OUT_PROB_LOW: number; PROGRESS_MEDIUM: number; PROGRESS_STRONG: number; PROGRESS_JUNCTION: number; PROGRESS_FOURWAY: number; PROGRESS_REGRESS: number; PROGRESS_MIN_SIGNAL: number; PROGRESS_MILD_REGRESS: number; DEFAULT_JITTER_PROB: number; AUGMENT_JITTER_BASE: number; AUGMENT_JITTER_RANGE: number; AUGMENT_PROGRESS_JITTER_PROB: number; AUGMENT_PROGRESS_DELTA_RANGE: number; AUGMENT_PROGRESS_DELTA_HALF: number; RNG_PARAMETERS: import("test/examples/asciiMaze/evolutionEngine/engineState.types").RngCacheParameters; }) => { input: number[]; output: number[]; }[]`
|
|
855
|
+
|
|
856
|
+
### pretrainPopulationWarmStart
|
|
857
|
+
|
|
858
|
+
`(neat: import("src/neat").default, lamarckianTrainingSet: any[], constants: { PRETRAIN_MAX_ITER: number; PRETRAIN_BASE_ITER: number; DEFAULT_TRAIN_ERROR: number; DEFAULT_PRETRAIN_RATE: number; DEFAULT_PRETRAIN_MOMENTUM: number; DEFAULT_TRAIN_BATCH_SMALL: number; }, applyCompassWarmStart: (network: any) => void, centerOutputBiases: (network: any) => void) => void`
|
|
859
|
+
|
|
860
|
+
### warmStartPopulationIfNeeded
|
|
861
|
+
|
|
862
|
+
`(neat: import("src/neat").default, trainingSet: any[], state: import("test/examples/asciiMaze/evolutionEngine/engineState.types").EngineState, pretrainPopulation: (neat: any, trainingSet: any[]) => void) => void`
|
|
863
|
+
|
|
864
|
+
## evolutionEngine/populationDynamics.ts
|
|
865
|
+
|
|
866
|
+
### populationDynamics
|
|
867
|
+
|
|
868
|
+
populationDynamics.ts
|
|
869
|
+
|
|
870
|
+
Population-level dynamics for NEAT evolution: generation state management,
|
|
871
|
+
population expansion/compaction, mutation application, sorting, species tracking,
|
|
872
|
+
and anti-collapse recovery.
|
|
873
|
+
|
|
874
|
+
Responsibilities:
|
|
875
|
+
- Plateau detection and simplify-phase orchestration
|
|
876
|
+
- Population expansion with parent sampling and mutation
|
|
877
|
+
- Genome sorting by fitness (iterative quicksort with pooled scratch)
|
|
878
|
+
- Species history tracking and collapse detection
|
|
879
|
+
- Connection compaction and anti-collapse recovery
|
|
880
|
+
|
|
881
|
+
All functions accept `EngineState` to access shared scratch buffers and RNG.
|
|
882
|
+
Follows ES2023 idioms: `toSorted`, `.at(-1)`, numeric separators, etc.
|
|
883
|
+
|
|
884
|
+
### antiCollapseRecovery
|
|
885
|
+
|
|
886
|
+
`(state: import("test/examples/asciiMaze/evolutionEngine/engineState.types").EngineState, neat: any, completedGenerations: number, safeWrite: (msg: string) => void, sampleSegmentIntoScratchFn: (state: import("test/examples/asciiMaze/evolutionEngine/engineState.types").EngineState, array: any[], startIdx: number, count: number) => number) => void`
|
|
887
|
+
|
|
888
|
+
### applyMutationsToClone
|
|
889
|
+
|
|
890
|
+
`(state: import("test/examples/asciiMaze/evolutionEngine/engineState.types").EngineState, clone: any, neat: any, mutateCount: number) => void`
|
|
891
|
+
|
|
892
|
+
### compactGenomeConnections
|
|
893
|
+
|
|
894
|
+
`(genome: any) => number`
|
|
895
|
+
|
|
896
|
+
### compactPopulation
|
|
897
|
+
|
|
898
|
+
`(state: import("test/examples/asciiMaze/evolutionEngine/engineState.types").EngineState, neat: any) => number`
|
|
899
|
+
|
|
900
|
+
### createChildFromParent
|
|
901
|
+
|
|
902
|
+
`(state: import("test/examples/asciiMaze/evolutionEngine/engineState.types").EngineState, neat: any, parent: any) => any`
|
|
903
|
+
|
|
904
|
+
### determineMutateCount
|
|
905
|
+
|
|
906
|
+
`(state: import("test/examples/asciiMaze/evolutionEngine/engineState.types").EngineState) => number`
|
|
907
|
+
|
|
908
|
+
### ensureOutputIdentity
|
|
909
|
+
|
|
910
|
+
`(neat: any) => void`
|
|
911
|
+
|
|
912
|
+
### expandPopulation
|
|
913
|
+
|
|
914
|
+
`(state: import("test/examples/asciiMaze/evolutionEngine/engineState.types").EngineState, neat: any, targetAdd: number, safeWrite: (msg: string) => void, completedGenerations: number) => void`
|
|
915
|
+
|
|
916
|
+
### getSortedIndicesByScore
|
|
917
|
+
|
|
918
|
+
`(state: import("test/examples/asciiMaze/evolutionEngine/engineState.types").EngineState, population: any[]) => number[]`
|
|
919
|
+
|
|
920
|
+
### handleSimplifyState
|
|
921
|
+
|
|
922
|
+
`(state: import("test/examples/asciiMaze/evolutionEngine/engineState.types").EngineState, neat: any, plateauCounter: number, plateauGenerations: number, simplifyDuration: number, simplifyMode: boolean, simplifyRemaining: number, simplifyStrategy: string, simplifyPruneFraction: number) => { simplifyMode: boolean; simplifyRemaining: number; plateauCounter: number; }`
|
|
923
|
+
|
|
924
|
+
### handleSpeciesHistory
|
|
925
|
+
|
|
926
|
+
`(state: import("test/examples/asciiMaze/evolutionEngine/engineState.types").EngineState, neat: any, speciesHistory: number[]) => boolean`
|
|
927
|
+
|
|
928
|
+
### IndexBuffer
|
|
929
|
+
|
|
930
|
+
Typed or array-based index buffer for sorting
|
|
931
|
+
|
|
932
|
+
### maybeExpandPopulation
|
|
933
|
+
|
|
934
|
+
`(state: import("test/examples/asciiMaze/evolutionEngine/engineState.types").EngineState, neat: any, dynamicPopEnabled: boolean, completedGenerations: number, dynamicPopMax: number, plateauGenerations: number, plateauCounter: number, dynamicPopExpandInterval: number, dynamicPopExpandFactor: number, dynamicPopPlateauSlack: number, safeWrite: (msg: string) => void) => void`
|
|
935
|
+
|
|
936
|
+
### maybeStartSimplify
|
|
937
|
+
|
|
938
|
+
`(plateauCounter: number, plateauGenerations: number, simplifyDuration: number) => number`
|
|
939
|
+
|
|
940
|
+
### prepareExpansion
|
|
941
|
+
|
|
942
|
+
`(state: import("test/examples/asciiMaze/evolutionEngine/engineState.types").EngineState, neat: any) => { populationRef: any[]; sortedIdx: number[]; parentPoolSize: number; }`
|
|
943
|
+
|
|
944
|
+
### pruneSaturatedHiddenOutputs
|
|
945
|
+
|
|
946
|
+
`(state: import("test/examples/asciiMaze/evolutionEngine/engineState.types").EngineState, genome: unknown, getNodeIndicesByType: (nodes: import("test/examples/asciiMaze/evolutionEngine/evolutionEngine.types").NetworkNode[], nodeType: string) => number, collectHiddenToOutputConns: (hiddenNode: import("test/examples/asciiMaze/evolutionEngine/evolutionEngine.types").NetworkNode, nodes: import("test/examples/asciiMaze/evolutionEngine/evolutionEngine.types").NetworkNode[], outputCount: number) => import("test/examples/asciiMaze/evolutionEngine/evolutionEngine.types").NetworkConnection[]) => void`
|
|
947
|
+
|
|
948
|
+
### registerClone
|
|
949
|
+
|
|
950
|
+
`(neat: any, clone: any, parentId: any) => void`
|
|
951
|
+
|
|
952
|
+
### reinitializeGenomeOutputsAndWeights
|
|
953
|
+
|
|
954
|
+
`(state: import("test/examples/asciiMaze/evolutionEngine/engineState.types").EngineState, genome: unknown) => { connReset: number; biasReset: number; }`
|
|
955
|
+
|
|
956
|
+
### runSimplifyCycle
|
|
957
|
+
|
|
958
|
+
`(state: import("test/examples/asciiMaze/evolutionEngine/engineState.types").EngineState, neat: any, simplifyRemaining: number, simplifyStrategy: string, simplifyPruneFraction: number) => number`
|
|
959
|
+
|
|
960
|
+
### updatePlateauState
|
|
961
|
+
|
|
962
|
+
`(fitness: number, lastBestFitnessForPlateau: number, plateauCounter: number, plateauImprovementThreshold: number) => { plateauCounter: number; lastBestFitnessForPlateau: number; }`
|
|
963
|
+
|
|
964
|
+
## evolutionEngine/engineState.constants.ts
|
|
965
|
+
|
|
966
|
+
### engineState.constants
|
|
967
|
+
|
|
968
|
+
Constant values shared by the ASCII maze engine-state facade and its helper utilities.
|
|
969
|
+
|
|
970
|
+
### ACTION_OUTPUT_DIMENSION
|
|
971
|
+
|
|
972
|
+
### DEFAULT_CONNECTION_FLAG_CAPACITY
|
|
973
|
+
|
|
974
|
+
### DEFAULT_HISTORY_BUFFER_CAPACITY
|
|
975
|
+
|
|
976
|
+
### DEFAULT_LOGITS_RING_CAPACITY
|
|
977
|
+
|
|
978
|
+
### DEFAULT_NODE_INDEX_BUFFER_CAPACITY
|
|
979
|
+
|
|
980
|
+
### DEFAULT_QUICKSORT_STACK_CAPACITY
|
|
981
|
+
|
|
982
|
+
### DEFAULT_RNG_CACHE_BATCH_SIZE
|
|
983
|
+
|
|
984
|
+
### DEFAULT_SAMPLE_POOL_SIZE
|
|
985
|
+
|
|
986
|
+
### DEFAULT_SMALL_EXPLORE_TABLE_CAPACITY
|
|
987
|
+
|
|
988
|
+
### DEFAULT_SORTED_INDEX_CAPACITY
|
|
989
|
+
|
|
990
|
+
### DEFAULT_SPECIES_SCRATCH_CAPACITY
|
|
991
|
+
|
|
992
|
+
### DEFAULT_STRING_BUFFER_CAPACITY
|
|
993
|
+
|
|
994
|
+
### DEFAULT_VISITED_HASH_LOAD_FACTOR
|
|
995
|
+
|
|
996
|
+
### MAX_VISITED_HASH_LOAD_FACTOR
|
|
997
|
+
|
|
998
|
+
### MIN_VISITED_HASH_LOAD_FACTOR
|
|
999
|
+
|
|
1000
|
+
### RNG_GOLDEN_RATIO_SEED
|
|
1001
|
+
|
|
1002
|
+
## evolutionEngine/engineState.utils.ts
|
|
1003
|
+
|
|
1004
|
+
### engineState.utils
|
|
1005
|
+
|
|
1006
|
+
Pure utility helpers shared by the ASCII maze engine-state facade.
|
|
1007
|
+
|
|
1008
|
+
### buildTelemetryHandles
|
|
1009
|
+
|
|
1010
|
+
`(scratch: import("test/examples/asciiMaze/evolutionEngine/engineState.types").EngineScratchState) => import("test/examples/asciiMaze/evolutionEngine/engineState.types").TelemetryScratchHandles`
|
|
1011
|
+
|
|
1012
|
+
### createLogitsRing
|
|
1013
|
+
|
|
1014
|
+
`() => Float32Array<ArrayBufferLike>[]`
|
|
1015
|
+
|
|
1016
|
+
### createProfilingAccumulators
|
|
1017
|
+
|
|
1018
|
+
`() => Record<string, number>`
|
|
1019
|
+
|
|
1020
|
+
### createSnapshotReusableObject
|
|
1021
|
+
|
|
1022
|
+
`() => { generation: number; bestFitness: number; simplifyMode: boolean; plateauCounter: number; timestamp: number; telemetryTail: undefined; top: undefined; }`
|
|
1023
|
+
|
|
1024
|
+
### ensureTelemetryFloatPools
|
|
1025
|
+
|
|
1026
|
+
`(scratch: import("test/examples/asciiMaze/evolutionEngine/engineState.types").EngineScratchState, hints: TelemetryCapacityHints) => void`
|
|
1027
|
+
|
|
1028
|
+
### ensureTelemetryStringBuffer
|
|
1029
|
+
|
|
1030
|
+
`(buffer: string[], required: number) => string[]`
|
|
1031
|
+
|
|
1032
|
+
### nextPowerOfTwo
|
|
1033
|
+
|
|
1034
|
+
`(candidate: number) => number`
|
|
1035
|
+
|
|
1036
|
+
### normaliseRngBatchSize
|
|
1037
|
+
|
|
1038
|
+
`(requestedBatchSize: number) => number`
|
|
1039
|
+
|
|
1040
|
+
### normaliseRngSeed
|
|
1041
|
+
|
|
1042
|
+
`(rawSeed: number) => number`
|
|
1043
|
+
|
|
1044
|
+
### normaliseTelemetryCapacityHints
|
|
1045
|
+
|
|
1046
|
+
`(request: import("test/examples/asciiMaze/evolutionEngine/engineState.types").TelemetryScratchRequest) => TelemetryCapacityHints`
|
|
1047
|
+
|
|
1048
|
+
### normaliseVisitedHashEntries
|
|
1049
|
+
|
|
1050
|
+
`(requestedEntries: number) => number`
|
|
1051
|
+
|
|
1052
|
+
### normaliseVisitedHashLoad
|
|
1053
|
+
|
|
1054
|
+
`(requestedLoadFactor: number) => number`
|
|
1055
|
+
|
|
1056
|
+
### resolveProfilingEnabled
|
|
1057
|
+
|
|
1058
|
+
`() => boolean`
|