@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.
Files changed (210) hide show
  1. package/.github/copilot-instructions.md +11 -0
  2. package/.github/skills/trace-analyzer-extension/SKILL.md +3 -3
  3. package/.github/skills/trace-analyzer-extension/assets/extension-checklist.md +1 -1
  4. package/.github/skills/trace-analyzer-extension/references/analyzer-extension-workflow.md +1 -1
  5. package/.github/skills/trace-audit-reporting/SKILL.md +3 -3
  6. package/.github/skills/trace-audit-reporting/references/trace-analysis-workflow.md +1 -1
  7. package/package.json +19 -13
  8. package/plans/Flappy_Bird_Folder_Documentation_Pass.md +4 -4
  9. package/plans/README.md +24 -0
  10. package/plans/Roadmap.md +62 -40
  11. package/plans/analyze-trace-solid-split.plans.md +66 -0
  12. package/plans/architecture-solid-split.plans.md +9 -15
  13. package/plans/asciiMaze-typescript-repair.plans.md +1 -1
  14. package/plans/generate-docs-solid-split.plans.md +87 -0
  15. package/plans/methods-docs.plans.md +25 -1
  16. package/plans/methods-solid-split.plans.md +14 -14
  17. package/plans/neat-docs.plans.md +9 -1
  18. package/plans/neat-test-surface-repair.plans.md +1 -1
  19. package/plans/render-docs-html-solid-split.plans.md +68 -0
  20. package/plans/src-no-explicit-any-cleanup.plans.md +1 -1
  21. package/plans/utils-docs.plans.md +6 -1
  22. package/scripts/analyze-trace/analyze-trace.analysis.ts +479 -0
  23. package/scripts/analyze-trace/analyze-trace.constants.ts +35 -0
  24. package/scripts/analyze-trace/analyze-trace.io.ts +69 -0
  25. package/scripts/analyze-trace/analyze-trace.report.ts +100 -0
  26. package/scripts/analyze-trace/analyze-trace.shared.ts +116 -0
  27. package/scripts/analyze-trace/analyze-trace.ts +45 -0
  28. package/scripts/analyze-trace/analyze-trace.types.ts +72 -0
  29. package/scripts/assets/theme.css +80 -23
  30. package/scripts/copy-examples.ts +239 -0
  31. package/scripts/export-onnx.ts +223 -0
  32. package/scripts/generate-bench-tables.ts +378 -37
  33. package/scripts/generate-docs/generate-docs.constants.ts +107 -0
  34. package/scripts/generate-docs/generate-docs.order.ts +355 -0
  35. package/scripts/generate-docs/generate-docs.state.ts +31 -0
  36. package/scripts/generate-docs/generate-docs.targets.ts +165 -0
  37. package/scripts/generate-docs/generate-docs.ts +63 -0
  38. package/scripts/generate-docs/generate-docs.types.ts +112 -0
  39. package/scripts/generate-docs/output/generate-docs.output.folder-index.utils.ts +167 -0
  40. package/scripts/generate-docs/output/generate-docs.output.ordering.utils.ts +353 -0
  41. package/scripts/generate-docs/output/generate-docs.output.readme.utils.ts +420 -0
  42. package/scripts/generate-docs/output/generate-docs.output.ts +123 -0
  43. package/scripts/generate-docs/output/generate-docs.output.warnings.utils.ts +219 -0
  44. package/scripts/generate-docs/symbols/generate-docs.symbols.collection.utils.ts +365 -0
  45. package/scripts/generate-docs/symbols/generate-docs.symbols.jsdoc.utils.ts +373 -0
  46. package/scripts/generate-docs/symbols/generate-docs.symbols.normalize.utils.ts +155 -0
  47. package/scripts/generate-docs/symbols/generate-docs.symbols.render.utils.ts +149 -0
  48. package/scripts/generate-docs/symbols/generate-docs.symbols.signature.utils.ts +289 -0
  49. package/scripts/generate-docs/symbols/generate-docs.symbols.ts +11 -0
  50. package/scripts/mermaid-cli.mjs +102 -22
  51. package/scripts/mermaid-cli.ts +736 -0
  52. package/scripts/render-docs-html/render-docs-html.assets.ts +54 -0
  53. package/scripts/render-docs-html/render-docs-html.mermaid.ts +245 -0
  54. package/scripts/{render-docs-html.sidebar.ts → render-docs-html/render-docs-html.navigation.ts} +141 -144
  55. package/scripts/render-docs-html/render-docs-html.pages.ts +333 -0
  56. package/scripts/render-docs-html/render-docs-html.shared.ts +333 -0
  57. package/scripts/render-docs-html/render-docs-html.types.ts +42 -0
  58. package/scripts/render-docs-html.ts +23 -587
  59. package/scripts/run-docs.ts +238 -0
  60. package/scripts/write-dist-docs-pkg.ts +40 -0
  61. package/src/README.md +75 -75
  62. package/src/architecture/connection/README.md +5 -5
  63. package/src/architecture/layer/README.md +508 -508
  64. package/src/architecture/network/README.md +1458 -1458
  65. package/src/architecture/network/activate/README.md +694 -694
  66. package/src/architecture/network/bootstrap/README.md +77 -77
  67. package/src/architecture/network/connect/README.md +74 -74
  68. package/src/architecture/network/deterministic/README.md +135 -135
  69. package/src/architecture/network/evolve/README.md +364 -364
  70. package/src/architecture/network/gating/README.md +130 -130
  71. package/src/architecture/network/genetic/README.md +399 -399
  72. package/src/architecture/network/mutate/README.md +897 -897
  73. package/src/architecture/network/onnx/README.md +720 -720
  74. package/src/architecture/network/onnx/export/README.md +728 -728
  75. package/src/architecture/network/onnx/export/layers/README.md +450 -450
  76. package/src/architecture/network/onnx/import/README.md +618 -618
  77. package/src/architecture/network/onnx/schema/README.md +32 -32
  78. package/src/architecture/network/prune/README.md +245 -245
  79. package/src/architecture/network/remove/README.md +135 -135
  80. package/src/architecture/network/runtime/README.md +106 -106
  81. package/src/architecture/network/serialize/README.md +542 -542
  82. package/src/architecture/network/slab/README.md +608 -608
  83. package/src/architecture/network/standalone/README.md +212 -212
  84. package/src/architecture/network/stats/README.md +84 -84
  85. package/src/architecture/network/topology/README.md +465 -465
  86. package/src/architecture/network/training/README.md +200 -200
  87. package/src/architecture/node/README.md +5 -5
  88. package/src/architecture/nodePool/README.md +14 -14
  89. package/src/methods/README.md +99 -99
  90. package/src/methods/activation/README.md +189 -189
  91. package/src/methods/cost/README.md +131 -131
  92. package/src/methods/rate/README.md +86 -86
  93. package/src/multithreading/README.md +77 -77
  94. package/src/multithreading/workers/browser/README.md +8 -8
  95. package/src/multithreading/workers/node/README.md +8 -8
  96. package/src/neat/README.md +148 -148
  97. package/src/neat/adaptive/README.md +120 -120
  98. package/src/neat/adaptive/acceptance/README.md +40 -40
  99. package/src/neat/adaptive/complexity/README.md +137 -137
  100. package/src/neat/adaptive/core/README.md +197 -197
  101. package/src/neat/adaptive/lineage/README.md +90 -90
  102. package/src/neat/adaptive/mutation/README.md +284 -284
  103. package/src/neat/compat/README.md +43 -43
  104. package/src/neat/compat/core/README.md +90 -90
  105. package/src/neat/diversity/README.md +35 -35
  106. package/src/neat/diversity/core/README.md +88 -88
  107. package/src/neat/evaluate/README.md +85 -85
  108. package/src/neat/evaluate/auto-distance/README.md +75 -75
  109. package/src/neat/evaluate/entropy-compat/README.md +37 -37
  110. package/src/neat/evaluate/entropy-sharing/README.md +43 -43
  111. package/src/neat/evaluate/fitness/README.md +23 -23
  112. package/src/neat/evaluate/novelty/README.md +120 -120
  113. package/src/neat/evaluate/objectives/README.md +17 -17
  114. package/src/neat/evaluate/shared/README.md +94 -94
  115. package/src/neat/evolve/README.md +96 -96
  116. package/src/neat/evolve/adaptive/README.md +60 -60
  117. package/src/neat/evolve/objectives/README.md +63 -63
  118. package/src/neat/evolve/offspring/README.md +56 -56
  119. package/src/neat/evolve/population/README.md +171 -171
  120. package/src/neat/evolve/runtime/README.md +79 -79
  121. package/src/neat/evolve/speciation/README.md +74 -74
  122. package/src/neat/evolve/warnings/README.md +10 -10
  123. package/src/neat/export/README.md +114 -114
  124. package/src/neat/helpers/README.md +50 -50
  125. package/src/neat/init/README.md +9 -9
  126. package/src/neat/lineage/core/README.md +101 -101
  127. package/src/neat/multiobjective/category/README.md +74 -74
  128. package/src/neat/multiobjective/crowding/README.md +272 -272
  129. package/src/neat/multiobjective/dominance/README.md +171 -171
  130. package/src/neat/multiobjective/fronts/README.md +68 -68
  131. package/src/neat/multiobjective/metrics/README.md +43 -43
  132. package/src/neat/multiobjective/objectives/README.md +31 -31
  133. package/src/neat/multiobjective/shared/README.md +27 -27
  134. package/src/neat/mutation/README.md +97 -97
  135. package/src/neat/mutation/add-conn/README.md +115 -115
  136. package/src/neat/mutation/add-node/README.md +126 -126
  137. package/src/neat/mutation/flow/README.md +149 -149
  138. package/src/neat/mutation/repair/README.md +185 -185
  139. package/src/neat/mutation/select/README.md +117 -117
  140. package/src/neat/mutation/shared/README.md +32 -32
  141. package/src/neat/objectives/README.md +25 -25
  142. package/src/neat/objectives/core/README.md +67 -67
  143. package/src/neat/pruning/README.md +40 -40
  144. package/src/neat/pruning/core/README.md +171 -171
  145. package/src/neat/pruning/facade/README.md +32 -32
  146. package/src/neat/rng/README.md +104 -104
  147. package/src/neat/rng/core/README.md +137 -137
  148. package/src/neat/rng/facade/README.md +50 -50
  149. package/src/neat/selection/README.md +111 -111
  150. package/src/neat/selection/core/README.md +227 -227
  151. package/src/neat/selection/facade/README.md +61 -61
  152. package/src/neat/shared/README.md +163 -163
  153. package/src/neat/speciation/README.md +31 -31
  154. package/src/neat/speciation/threshold/README.md +35 -35
  155. package/src/neat/species/README.md +25 -25
  156. package/src/neat/species/core/README.md +20 -20
  157. package/src/neat/species/core/shared/README.md +18 -18
  158. package/src/neat/species/history/context/README.md +22 -22
  159. package/src/neat/telemetry/accessors/README.md +58 -58
  160. package/src/neat/telemetry/exports/README.md +233 -233
  161. package/src/neat/telemetry/facade/README.md +252 -252
  162. package/src/neat/telemetry/facade/archive/README.md +57 -57
  163. package/src/neat/telemetry/facade/buffer/README.md +43 -43
  164. package/src/neat/telemetry/facade/lineage/README.md +12 -12
  165. package/src/neat/telemetry/facade/objectives/README.md +44 -44
  166. package/src/neat/telemetry/facade/runtime/README.md +26 -26
  167. package/src/neat/telemetry/facade/species/README.md +27 -27
  168. package/src/neat/telemetry/metrics/README.md +696 -696
  169. package/src/neat/telemetry/recorder/README.md +57 -57
  170. package/src/neat/telemetry/types/README.md +32 -32
  171. package/src/neat/topology-intent/README.md +75 -75
  172. package/src/utils/README.md +193 -193
  173. package/test/examples/asciiMaze/browser-entry/README.md +92 -92
  174. package/test/examples/asciiMaze/dashboardManager/README.md +109 -109
  175. package/test/examples/asciiMaze/dashboardManager/telemetry/README.md +28 -28
  176. package/test/examples/asciiMaze/evolutionEngine/README.md +1527 -1527
  177. package/test/examples/asciiMaze/mazeMovement/README.md +105 -105
  178. package/test/examples/asciiMaze/mazeMovement/finalization/README.md +16 -16
  179. package/test/examples/asciiMaze/mazeMovement/policy/README.md +57 -57
  180. package/test/examples/asciiMaze/mazeMovement/runtime/README.md +52 -52
  181. package/test/examples/asciiMaze/mazeMovement/shaping/README.md +46 -46
  182. package/test/examples/flappy_bird/browser-entry/README.md +508 -508
  183. package/test/examples/flappy_bird/browser-entry/host/README.md +101 -101
  184. package/test/examples/flappy_bird/browser-entry/host/resize/README.md +144 -144
  185. package/test/examples/flappy_bird/browser-entry/network-view/README.md +194 -194
  186. package/test/examples/flappy_bird/browser-entry/playback/README.md +278 -278
  187. package/test/examples/flappy_bird/browser-entry/playback/background/README.md +129 -129
  188. package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/README.md +502 -502
  189. package/test/examples/flappy_bird/browser-entry/playback/frame-render/README.md +139 -139
  190. package/test/examples/flappy_bird/browser-entry/playback/snapshot/README.md +10 -10
  191. package/test/examples/flappy_bird/browser-entry/playback/trail/README.md +43 -43
  192. package/test/examples/flappy_bird/browser-entry/playback/worker-channel/README.md +30 -30
  193. package/test/examples/flappy_bird/browser-entry/runtime/README.md +59 -59
  194. package/test/examples/flappy_bird/browser-entry/visualization/README.md +276 -276
  195. package/test/examples/flappy_bird/browser-entry/worker-channel/README.md +16 -16
  196. package/test/examples/flappy_bird/constants/README.md +1070 -1070
  197. package/test/examples/flappy_bird/environment/README.md +22 -22
  198. package/test/examples/flappy_bird/evaluation/README.md +32 -32
  199. package/test/examples/flappy_bird/evaluation/rollout/README.md +141 -141
  200. package/test/examples/flappy_bird/flappy-evolution-worker/README.md +425 -425
  201. package/test/examples/flappy_bird/simulation-shared/README.md +170 -170
  202. package/test/examples/flappy_bird/simulation-shared/observation/README.md +109 -109
  203. package/test/examples/flappy_bird/trainer/README.md +325 -325
  204. package/test/examples/flappy_bird/trainer/evaluation/README.md +74 -74
  205. package/scripts/analyze-trace.ts +0 -590
  206. package/scripts/copy-examples.mjs +0 -114
  207. package/scripts/export-onnx.mjs +0 -86
  208. package/scripts/generate-bench-tables.mjs +0 -182
  209. package/scripts/generate-docs.ts +0 -2900
  210. package/scripts/write-dist-docs-pkg.mjs +0 -16
@@ -37,46 +37,6 @@ flowchart TD
37
37
 
38
38
  ## neat/pruning/pruning.ts
39
39
 
40
- ### applyEvolutionPruning
41
-
42
- ```ts
43
- applyEvolutionPruning(): void
44
- ```
45
-
46
- Apply evolution-time pruning to the current population.
47
-
48
- Use this path when pruning should follow the generation schedule rather than
49
- a live feedback loop. The evolve orchestration calls into this entrypoint to
50
- ask a simple controller question: "for this generation, should pruning run,
51
- and if so, how sparse should genomes become right now?"
52
-
53
- This function does not maintain long-lived adaptive controller state. Instead
54
- it reads the configured `evolutionPruning` schedule, checks whether the
55
- current generation is inside the active window, computes the ramped target
56
- sparsity for that moment in the run, and forwards the result to the genomes.
57
- The host generation counter is read but not mutated here.
58
-
59
- Choose this entrypoint when you want pruning to be predictable and tied to
60
- generation timing. Use `applyAdaptivePruning()` instead when pruning should
61
- react to observed population size or complexity metrics at runtime.
62
-
63
- Returns: Nothing. Compatible genomes may be pruned in place when the schedule is active, but no adaptive controller fields are updated.
64
-
65
- Example:
66
-
67
- ```ts
68
- host.generation = 40;
69
- host.options.evolutionPruning = {
70
- startGeneration: 20,
71
- interval: 5,
72
- rampGenerations: 10,
73
- targetSparsity: 0.3,
74
- };
75
-
76
- applyEvolutionPruning.call(host);
77
- // Compatible genomes prune themselves using the schedule-derived sparsity.
78
- ```
79
-
80
40
  ### applyAdaptivePruning
81
41
 
82
42
  ```ts
@@ -118,3 +78,43 @@ applyAdaptivePruning.call(host);
118
78
  // The host may initialize its baseline, update _adaptivePruneLevel,
119
79
  // and prune compatible genomes if the metric drift is large enough.
120
80
  ```
81
+
82
+ ### applyEvolutionPruning
83
+
84
+ ```ts
85
+ applyEvolutionPruning(): void
86
+ ```
87
+
88
+ Apply evolution-time pruning to the current population.
89
+
90
+ Use this path when pruning should follow the generation schedule rather than
91
+ a live feedback loop. The evolve orchestration calls into this entrypoint to
92
+ ask a simple controller question: "for this generation, should pruning run,
93
+ and if so, how sparse should genomes become right now?"
94
+
95
+ This function does not maintain long-lived adaptive controller state. Instead
96
+ it reads the configured `evolutionPruning` schedule, checks whether the
97
+ current generation is inside the active window, computes the ramped target
98
+ sparsity for that moment in the run, and forwards the result to the genomes.
99
+ The host generation counter is read but not mutated here.
100
+
101
+ Choose this entrypoint when you want pruning to be predictable and tied to
102
+ generation timing. Use `applyAdaptivePruning()` instead when pruning should
103
+ react to observed population size or complexity metrics at runtime.
104
+
105
+ Returns: Nothing. Compatible genomes may be pruned in place when the schedule is active, but no adaptive controller fields are updated.
106
+
107
+ Example:
108
+
109
+ ```ts
110
+ host.generation = 40;
111
+ host.options.evolutionPruning = {
112
+ startGeneration: 20,
113
+ interval: 5,
114
+ rampGenerations: 10,
115
+ targetSparsity: 0.3,
116
+ };
117
+
118
+ applyEvolutionPruning.call(host);
119
+ // Compatible genomes prune themselves using the schedule-derived sparsity.
120
+ ```
@@ -22,6 +22,22 @@ which configuration knobs belong to scheduled versus adaptive control.
22
22
 
23
23
  ## neat/pruning/core/pruning.types.ts
24
24
 
25
+ ### AdaptivePruningOptions
26
+
27
+ Adaptive pruning options extracted from the NEAT host.
28
+
29
+ These options drive the feedback-controller path: which population metric is
30
+ observed, what sparsity target should remain, how large a drift is tolerated,
31
+ and how quickly the shared prune level is allowed to move.
32
+
33
+ ### EvolutionPruningOptions
34
+
35
+ Evolution pruning options extracted from the NEAT host.
36
+
37
+ These options drive the calendar-like pruning path: when pruning starts, how
38
+ often it repeats, how quickly the target sparsity ramps in, and which pruning
39
+ method is forwarded to compatible genomes.
40
+
25
41
  ### NeatLikeForPruning
26
42
 
27
43
  Minimal NEAT host contract required by pruning helpers.
@@ -44,22 +60,6 @@ Read this chapter before `pruning.core.ts` when you need to know which state
44
60
  the pruning helpers are allowed to read, which state they may write back, and
45
61
  which configuration knobs belong to scheduled versus adaptive control.
46
62
 
47
- ### EvolutionPruningOptions
48
-
49
- Evolution pruning options extracted from the NEAT host.
50
-
51
- These options drive the calendar-like pruning path: when pruning starts, how
52
- often it repeats, how quickly the target sparsity ramps in, and which pruning
53
- method is forwarded to compatible genomes.
54
-
55
- ### AdaptivePruningOptions
56
-
57
- Adaptive pruning options extracted from the NEAT host.
58
-
59
- These options drive the feedback-controller path: which population metric is
60
- observed, what sparsity target should remain, how large a drift is tolerated,
61
- and how quickly the shared prune level is allowed to move.
62
-
63
63
  ### PopulationMetrics
64
64
 
65
65
  Summary of population metrics used by adaptive pruning.
@@ -102,66 +102,26 @@ flowchart TD
102
102
  Hold --> ApplyAdaptive
103
103
  ```
104
104
 
105
- ### resolveActiveEvolutionPruningOptions
106
-
107
- ```ts
108
- resolveActiveEvolutionPruningOptions(
109
- host: NeatLikeForPruning,
110
- ): { startGeneration?: number | undefined; interval?: number | undefined; rampGenerations?: number | undefined; targetSparsity?: number | undefined; method?: string | undefined; } | null
111
- ```
112
-
113
- Resolve scheduled pruning options when they are active for the current generation.
114
-
115
- This helper is the gatekeeper for the calendar-driven pruning path. It keeps
116
- the public pruning wrapper simple by answering one precise question: does the
117
- current generation actually belong to the configured pruning schedule?
118
-
119
- Parameters:
120
- - `host` - - NEAT host exposing generation and pruning options.
121
-
122
- Returns: Evolution pruning options when active, otherwise `null`.
123
-
124
- ### computeTargetSparsityNow
125
-
126
- ```ts
127
- computeTargetSparsityNow(
128
- host: NeatLikeForPruning,
129
- options: { startGeneration?: number | undefined; interval?: number | undefined; rampGenerations?: number | undefined; targetSparsity?: number | undefined; method?: string | undefined; },
130
- ): number
131
- ```
132
-
133
- Compute the target sparsity for the current generation.
134
-
135
- Scheduled pruning ramps toward its configured sparsity target instead of
136
- snapping there immediately. This helper converts the current ramp progress
137
- into the exact target sparsity the active generation should use.
138
-
139
- Parameters:
140
- - `host` - - NEAT host exposing generation state.
141
- - `options` - - Active scheduled pruning options.
142
-
143
- Returns: Target sparsity for the current generation.
144
-
145
- ### computeRampFraction
105
+ ### applyAdaptivePruneLevelToPopulation
146
106
 
147
107
  ```ts
148
- computeRampFraction(
108
+ applyAdaptivePruneLevelToPopulation(
149
109
  host: NeatLikeForPruning,
150
- options: { startGeneration?: number | undefined; interval?: number | undefined; rampGenerations?: number | undefined; targetSparsity?: number | undefined; method?: string | undefined; },
151
- ): number
110
+ pruneLevel: number,
111
+ ): void
152
112
  ```
153
113
 
154
- Compute the ramp completion fraction for scheduled pruning.
114
+ Apply the shared adaptive prune level to every compatible genome.
155
115
 
156
- The ramp fraction is the soft-start mechanism for scheduled pruning. It lets
157
- the controller phase sparsity in gradually over several generations so the
158
- population does not experience one abrupt structural shock.
116
+ This is the final fan-out step for adaptive pruning. The host maintains one
117
+ shared prune level, and this helper applies that single controller decision
118
+ uniformly across genomes that support sparsity pruning.
159
119
 
160
120
  Parameters:
161
- - `host` - - NEAT host exposing generation state.
162
- - `options` - - Active scheduled pruning options.
121
+ - `host` - - NEAT host exposing the population.
122
+ - `pruneLevel` - - Prune level to apply.
163
123
 
164
- Returns: Fraction in `[0, 1]` indicating ramp completion.
124
+ Returns: Nothing. Compatible genomes are pruned in place.
165
125
 
166
126
  ### applyPruningToPopulation
167
127
 
@@ -186,44 +146,69 @@ Parameters:
186
146
 
187
147
  Returns: Nothing. Genomes are pruned in place when supported.
188
148
 
189
- ### resolveActiveAdaptivePruningOptions
149
+ ### computeMeanConnectionCount
190
150
 
191
151
  ```ts
192
- resolveActiveAdaptivePruningOptions(
152
+ computeMeanConnectionCount(
193
153
  host: NeatLikeForPruning,
194
- ): { enabled?: boolean | undefined; metric?: string | undefined; targetSparsity?: number | undefined; learningRate?: number | undefined; tolerance?: number | undefined; adjustRate?: number | undefined; } | null
154
+ ): number
195
155
  ```
196
156
 
197
- Resolve adaptive pruning options when enabled.
157
+ Compute the average connection count per genome.
198
158
 
199
- This is the narrow on-ramp to the feedback-controller branch. It makes the
200
- rest of the adaptive helpers read linearly by collapsing disabled or missing
201
- configuration into one `null` check.
159
+ Connection count is the denser complexity signal commonly used for sparsity
160
+ control. Like node count, it is reduced to a population mean so the adaptive
161
+ controller reacts to trend rather than to one outlier genome.
202
162
 
203
163
  Parameters:
204
- - `host` - - NEAT host exposing adaptive pruning options.
164
+ - `host` - - NEAT host exposing the population.
205
165
 
206
- Returns: Adaptive pruning options when enabled, otherwise `null`.
166
+ Returns: Average number of connections per genome.
207
167
 
208
- ### initializeAdaptivePruningState
168
+ ### computeMeanNodeCount
209
169
 
210
170
  ```ts
211
- initializeAdaptivePruningState(
171
+ computeMeanNodeCount(
212
172
  host: NeatLikeForPruning,
213
- ): void
173
+ ): number
214
174
  ```
215
175
 
216
- Ensure the adaptive pruning state exists on the host.
176
+ Compute the average node count per genome.
217
177
 
218
- Adaptive pruning keeps one shared prune level on the host so the whole
219
- population can react coherently across generations. This helper bootstraps
220
- that state once, rather than making every downstream helper repeat the same
221
- initialization guard.
178
+ Node count is one of the two complexity signals the adaptive controller can
179
+ watch. It is intentionally averaged so population size changes do not by
180
+ themselves distort the pruning signal.
222
181
 
223
182
  Parameters:
224
- - `host` - - NEAT host exposing adaptive pruning state.
183
+ - `host` - - NEAT host exposing the population.
225
184
 
226
- Returns: Nothing. The shared prune level is initialized when missing.
185
+ Returns: Average number of nodes per genome.
186
+
187
+ ### computeNextAdaptivePruneLevel
188
+
189
+ ```ts
190
+ computeNextAdaptivePruneLevel(
191
+ options: { enabled?: boolean | undefined; metric?: string | undefined; targetSparsity?: number | undefined; learningRate?: number | undefined; tolerance?: number | undefined; adjustRate?: number | undefined; },
192
+ currentPruneLevel: number,
193
+ currentMetricValue: number,
194
+ targetRemainingMetric: number,
195
+ ): number
196
+ ```
197
+
198
+ Compute the next adaptive prune level.
199
+
200
+ Once the controller decides that drift is large enough, this helper turns the
201
+ direction of that drift into a bounded update of the shared prune level.
202
+ Higher-than-target complexity tightens pruning; lower-than-target complexity
203
+ relaxes it.
204
+
205
+ Parameters:
206
+ - `options` - - Adaptive pruning options.
207
+ - `currentPruneLevel` - - Current shared prune level.
208
+ - `currentMetricValue` - - Current observed metric value.
209
+ - `targetRemainingMetric` - - Target remaining metric value.
210
+
211
+ Returns: Updated prune level clamped into the valid sparsity range.
227
212
 
228
213
  ### computePopulationMetrics
229
214
 
@@ -245,64 +230,127 @@ Parameters:
245
230
 
246
231
  Returns: Summary of mean node and connection counts.
247
232
 
248
- ### computeMeanNodeCount
233
+ ### computeRampFraction
249
234
 
250
235
  ```ts
251
- computeMeanNodeCount(
236
+ computeRampFraction(
252
237
  host: NeatLikeForPruning,
238
+ options: { startGeneration?: number | undefined; interval?: number | undefined; rampGenerations?: number | undefined; targetSparsity?: number | undefined; method?: string | undefined; },
253
239
  ): number
254
240
  ```
255
241
 
256
- Compute the average node count per genome.
242
+ Compute the ramp completion fraction for scheduled pruning.
257
243
 
258
- Node count is one of the two complexity signals the adaptive controller can
259
- watch. It is intentionally averaged so population size changes do not by
260
- themselves distort the pruning signal.
244
+ The ramp fraction is the soft-start mechanism for scheduled pruning. It lets
245
+ the controller phase sparsity in gradually over several generations so the
246
+ population does not experience one abrupt structural shock.
261
247
 
262
248
  Parameters:
263
- - `host` - - NEAT host exposing the population.
249
+ - `host` - - NEAT host exposing generation state.
250
+ - `options` - - Active scheduled pruning options.
264
251
 
265
- Returns: Average number of nodes per genome.
252
+ Returns: Fraction in `[0, 1]` indicating ramp completion.
266
253
 
267
- ### computeMeanConnectionCount
254
+ ### computeTargetRemainingMetric
268
255
 
269
256
  ```ts
270
- computeMeanConnectionCount(
271
- host: NeatLikeForPruning,
257
+ computeTargetRemainingMetric(
258
+ options: { enabled?: boolean | undefined; metric?: string | undefined; targetSparsity?: number | undefined; learningRate?: number | undefined; tolerance?: number | undefined; adjustRate?: number | undefined; },
259
+ adaptivePruneBaseline: number,
272
260
  ): number
273
261
  ```
274
262
 
275
- Compute the average connection count per genome.
263
+ Compute the target remaining metric implied by the desired sparsity.
276
264
 
277
- Connection count is the denser complexity signal commonly used for sparsity
278
- control. Like node count, it is reduced to a population mean so the adaptive
279
- controller reacts to trend rather than to one outlier genome.
265
+ Adaptive pruning expresses its goal as desired sparsity, but the feedback loop
266
+ compares live complexity metrics. This helper bridges those two views by
267
+ translating the baseline metric into the remaining amount of structure the
268
+ controller wants to keep.
280
269
 
281
270
  Parameters:
282
- - `host` - - NEAT host exposing the population.
271
+ - `options` - - Adaptive pruning options.
272
+ - `adaptivePruneBaseline` - - Baseline metric value.
283
273
 
284
- Returns: Average number of connections per genome.
274
+ Returns: Target remaining metric value.
285
275
 
286
- ### resolveObservedMetricValue
276
+ ### computeTargetSparsityNow
287
277
 
288
278
  ```ts
289
- resolveObservedMetricValue(
290
- options: { enabled?: boolean | undefined; metric?: string | undefined; targetSparsity?: number | undefined; learningRate?: number | undefined; tolerance?: number | undefined; adjustRate?: number | undefined; },
291
- metrics: PopulationMetrics,
279
+ computeTargetSparsityNow(
280
+ host: NeatLikeForPruning,
281
+ options: { startGeneration?: number | undefined; interval?: number | undefined; rampGenerations?: number | undefined; targetSparsity?: number | undefined; method?: string | undefined; },
292
282
  ): number
293
283
  ```
294
284
 
295
- Resolve the currently observed population metric for adaptive pruning.
285
+ Compute the target sparsity for the current generation.
296
286
 
297
- Adaptive pruning can watch either node count or connection count. This helper
298
- turns the configured metric name into the actual observed value that the rest
299
- of the controller math will compare with the target remaining complexity.
287
+ Scheduled pruning ramps toward its configured sparsity target instead of
288
+ snapping there immediately. This helper converts the current ramp progress
289
+ into the exact target sparsity the active generation should use.
300
290
 
301
291
  Parameters:
302
- - `options` - - Adaptive pruning options.
303
- - `metrics` - - Population metric summary.
292
+ - `host` - - NEAT host exposing generation state.
293
+ - `options` - - Active scheduled pruning options.
304
294
 
305
- Returns: Current observed metric value used for adaptation.
295
+ Returns: Target sparsity for the current generation.
296
+
297
+ ### initializeAdaptivePruningState
298
+
299
+ ```ts
300
+ initializeAdaptivePruningState(
301
+ host: NeatLikeForPruning,
302
+ ): void
303
+ ```
304
+
305
+ Ensure the adaptive pruning state exists on the host.
306
+
307
+ Adaptive pruning keeps one shared prune level on the host so the whole
308
+ population can react coherently across generations. This helper bootstraps
309
+ that state once, rather than making every downstream helper repeat the same
310
+ initialization guard.
311
+
312
+ Parameters:
313
+ - `host` - - NEAT host exposing adaptive pruning state.
314
+
315
+ Returns: Nothing. The shared prune level is initialized when missing.
316
+
317
+ ### resolveActiveAdaptivePruningOptions
318
+
319
+ ```ts
320
+ resolveActiveAdaptivePruningOptions(
321
+ host: NeatLikeForPruning,
322
+ ): { enabled?: boolean | undefined; metric?: string | undefined; targetSparsity?: number | undefined; learningRate?: number | undefined; tolerance?: number | undefined; adjustRate?: number | undefined; } | null
323
+ ```
324
+
325
+ Resolve adaptive pruning options when enabled.
326
+
327
+ This is the narrow on-ramp to the feedback-controller branch. It makes the
328
+ rest of the adaptive helpers read linearly by collapsing disabled or missing
329
+ configuration into one `null` check.
330
+
331
+ Parameters:
332
+ - `host` - - NEAT host exposing adaptive pruning options.
333
+
334
+ Returns: Adaptive pruning options when enabled, otherwise `null`.
335
+
336
+ ### resolveActiveEvolutionPruningOptions
337
+
338
+ ```ts
339
+ resolveActiveEvolutionPruningOptions(
340
+ host: NeatLikeForPruning,
341
+ ): { startGeneration?: number | undefined; interval?: number | undefined; rampGenerations?: number | undefined; targetSparsity?: number | undefined; method?: string | undefined; } | null
342
+ ```
343
+
344
+ Resolve scheduled pruning options when they are active for the current generation.
345
+
346
+ This helper is the gatekeeper for the calendar-driven pruning path. It keeps
347
+ the public pruning wrapper simple by answering one precise question: does the
348
+ current generation actually belong to the configured pruning schedule?
349
+
350
+ Parameters:
351
+ - `host` - - NEAT host exposing generation and pruning options.
352
+
353
+ Returns: Evolution pruning options when active, otherwise `null`.
306
354
 
307
355
  ### resolveAdaptivePruneBaseline
308
356
 
@@ -325,27 +373,26 @@ Parameters:
325
373
 
326
374
  Returns: Baseline metric value used for adaptation.
327
375
 
328
- ### computeTargetRemainingMetric
376
+ ### resolveObservedMetricValue
329
377
 
330
378
  ```ts
331
- computeTargetRemainingMetric(
379
+ resolveObservedMetricValue(
332
380
  options: { enabled?: boolean | undefined; metric?: string | undefined; targetSparsity?: number | undefined; learningRate?: number | undefined; tolerance?: number | undefined; adjustRate?: number | undefined; },
333
- adaptivePruneBaseline: number,
381
+ metrics: PopulationMetrics,
334
382
  ): number
335
383
  ```
336
384
 
337
- Compute the target remaining metric implied by the desired sparsity.
385
+ Resolve the currently observed population metric for adaptive pruning.
338
386
 
339
- Adaptive pruning expresses its goal as desired sparsity, but the feedback loop
340
- compares live complexity metrics. This helper bridges those two views by
341
- translating the baseline metric into the remaining amount of structure the
342
- controller wants to keep.
387
+ Adaptive pruning can watch either node count or connection count. This helper
388
+ turns the configured metric name into the actual observed value that the rest
389
+ of the controller math will compare with the target remaining complexity.
343
390
 
344
391
  Parameters:
345
392
  - `options` - - Adaptive pruning options.
346
- - `adaptivePruneBaseline` - - Baseline metric value.
393
+ - `metrics` - - Population metric summary.
347
394
 
348
- Returns: Target remaining metric value.
395
+ Returns: Current observed metric value used for adaptation.
349
396
 
350
397
  ### shouldAdjustAdaptivePruning
351
398
 
@@ -371,50 +418,3 @@ Parameters:
371
418
  - `adaptivePruneBaseline` - - Baseline metric value.
372
419
 
373
420
  Returns: `true` when the normalized drift exceeds the configured tolerance.
374
-
375
- ### computeNextAdaptivePruneLevel
376
-
377
- ```ts
378
- computeNextAdaptivePruneLevel(
379
- options: { enabled?: boolean | undefined; metric?: string | undefined; targetSparsity?: number | undefined; learningRate?: number | undefined; tolerance?: number | undefined; adjustRate?: number | undefined; },
380
- currentPruneLevel: number,
381
- currentMetricValue: number,
382
- targetRemainingMetric: number,
383
- ): number
384
- ```
385
-
386
- Compute the next adaptive prune level.
387
-
388
- Once the controller decides that drift is large enough, this helper turns the
389
- direction of that drift into a bounded update of the shared prune level.
390
- Higher-than-target complexity tightens pruning; lower-than-target complexity
391
- relaxes it.
392
-
393
- Parameters:
394
- - `options` - - Adaptive pruning options.
395
- - `currentPruneLevel` - - Current shared prune level.
396
- - `currentMetricValue` - - Current observed metric value.
397
- - `targetRemainingMetric` - - Target remaining metric value.
398
-
399
- Returns: Updated prune level clamped into the valid sparsity range.
400
-
401
- ### applyAdaptivePruneLevelToPopulation
402
-
403
- ```ts
404
- applyAdaptivePruneLevelToPopulation(
405
- host: NeatLikeForPruning,
406
- pruneLevel: number,
407
- ): void
408
- ```
409
-
410
- Apply the shared adaptive prune level to every compatible genome.
411
-
412
- This is the final fan-out step for adaptive pruning. The host maintains one
413
- shared prune level, and this helper applies that single controller decision
414
- uniformly across genomes that support sparsity pruning.
415
-
416
- Parameters:
417
- - `host` - - NEAT host exposing the population.
418
- - `pruneLevel` - - Prune level to apply.
419
-
420
- Returns: Nothing. Compatible genomes are pruned in place.
@@ -38,72 +38,72 @@ its own.
38
38
 
39
39
  ## neat/pruning/facade/pruning.facade.ts
40
40
 
41
- ### applyEvolutionPruning
41
+ ### applyAdaptivePruning
42
42
 
43
43
  ```ts
44
- applyEvolutionPruning(
44
+ applyAdaptivePruning(
45
45
  host: NeatLikeForPruning,
46
46
  ): Promise<void>
47
47
  ```
48
48
 
49
- Apply evolution-time pruning through the stable public `Neat` facade.
49
+ Run adaptive pruning through the stable public `Neat` facade.
50
50
 
51
- This is the public wrapper for schedule-driven pruning. Use it when the
52
- caller wants the root pruning chapter to inspect generation timing and apply
53
- pruning only when the configured evolution schedule says it is active.
51
+ This is the public wrapper for metric-driven pruning. Use it when pruning
52
+ should react to live population complexity signals rather than a fixed
53
+ generation schedule.
54
54
 
55
- The underlying pruning module is loaded lazily so pruning remains optional,
56
- and the facade preserves the same best-effort behavior as before the pruning
57
- logic was extracted out of the main `Neat` class.
55
+ The facade keeps the same lazy optional-loading behavior so callers can
56
+ continue to treat adaptive pruning as an additive maintenance feature rather
57
+ than a required runtime dependency.
58
58
 
59
- This wrapper is the predictable pruning entrypoint: it says "consult the
60
- generation schedule and prune if the current run state says it is time."
61
- That makes it the better fit for orchestrated evolve loops and deterministic
62
- experiments where pruning should follow a known calendar.
59
+ This wrapper is the reactive pruning entrypoint: it says "inspect the live
60
+ population metrics and adjust the shared prune level only if the drift is big
61
+ enough to matter." That makes it the better fit for maintenance-style runs
62
+ where pruning should respond to observed complexity rather than the calendar.
63
63
 
64
64
  Parameters:
65
- - `host` - - `Neat` instance exposing pruning options, generation state, and population.
65
+ - `host` - - `Neat` instance exposing adaptive pruning state and population metrics.
66
66
 
67
- Returns: Promise that resolves after the best-effort pruning attempt finishes.
67
+ Returns: Promise that resolves after the best-effort adaptive pruning attempt finishes.
68
68
 
69
69
  Example:
70
70
 
71
71
  ```ts
72
- await neat.applyEvolutionPruning();
72
+ await neat.applyAdaptivePruning();
73
73
  ```
74
74
 
75
- ### applyAdaptivePruning
75
+ ### applyEvolutionPruning
76
76
 
77
77
  ```ts
78
- applyAdaptivePruning(
78
+ applyEvolutionPruning(
79
79
  host: NeatLikeForPruning,
80
80
  ): Promise<void>
81
81
  ```
82
82
 
83
- Run adaptive pruning through the stable public `Neat` facade.
83
+ Apply evolution-time pruning through the stable public `Neat` facade.
84
84
 
85
- This is the public wrapper for metric-driven pruning. Use it when pruning
86
- should react to live population complexity signals rather than a fixed
87
- generation schedule.
85
+ This is the public wrapper for schedule-driven pruning. Use it when the
86
+ caller wants the root pruning chapter to inspect generation timing and apply
87
+ pruning only when the configured evolution schedule says it is active.
88
88
 
89
- The facade keeps the same lazy optional-loading behavior so callers can
90
- continue to treat adaptive pruning as an additive maintenance feature rather
91
- than a required runtime dependency.
89
+ The underlying pruning module is loaded lazily so pruning remains optional,
90
+ and the facade preserves the same best-effort behavior as before the pruning
91
+ logic was extracted out of the main `Neat` class.
92
92
 
93
- This wrapper is the reactive pruning entrypoint: it says "inspect the live
94
- population metrics and adjust the shared prune level only if the drift is big
95
- enough to matter." That makes it the better fit for maintenance-style runs
96
- where pruning should respond to observed complexity rather than the calendar.
93
+ This wrapper is the predictable pruning entrypoint: it says "consult the
94
+ generation schedule and prune if the current run state says it is time."
95
+ That makes it the better fit for orchestrated evolve loops and deterministic
96
+ experiments where pruning should follow a known calendar.
97
97
 
98
98
  Parameters:
99
- - `host` - - `Neat` instance exposing adaptive pruning state and population metrics.
99
+ - `host` - - `Neat` instance exposing pruning options, generation state, and population.
100
100
 
101
- Returns: Promise that resolves after the best-effort adaptive pruning attempt finishes.
101
+ Returns: Promise that resolves after the best-effort pruning attempt finishes.
102
102
 
103
103
  Example:
104
104
 
105
105
  ```ts
106
- await neat.applyAdaptivePruning();
106
+ await neat.applyEvolutionPruning();
107
107
  ```
108
108
 
109
109
  ### NeatPruningFacadeHost