@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
@@ -52,445 +52,484 @@ they reveal about the search?"
52
52
 
53
53
  ## neat/telemetry/metrics/telemetry.metrics.ts
54
54
 
55
- ### getCachedEntropy
55
+ ### applyComplexityStatsMonoObjective
56
56
 
57
57
  ```ts
58
- getCachedEntropy(
59
- generation: number | undefined,
60
- entropyGraph: Record<string, unknown>,
61
- ): number | undefined
58
+ applyComplexityStatsMonoObjective(
59
+ telemetryContext: { _lastMeanNodes?: number | undefined; _lastMeanConns?: number | undefined; },
60
+ telemetryOptions: NeatOptions & TelemetryDiversityOptions,
61
+ populationSnapshot: GenomeDetailed[],
62
+ entry: TelemetryEntryRecord,
63
+ ): void
62
64
  ```
63
65
 
64
- Read a cached entropy value if it exists and belongs to the current
65
- generation.
66
+ Attach complexity stats for mono-objective mode.
66
67
 
67
68
  Parameters:
68
- - `generation` - - Current generation number.
69
- - `entropyGraph` - - Genome-like graph object.
70
-
71
- Returns: Cached entropy number, or undefined when not available.
69
+ - `telemetryContext` - - Neat-like context with population state.
70
+ - `telemetryOptions` - - Options controlling complexity telemetry.
71
+ - `entry` - - Telemetry entry to update.
72
72
 
73
- ### computeDegreeCounts
73
+ ### applyComplexityStatsMultiObjective
74
74
 
75
75
  ```ts
76
- computeDegreeCounts(
77
- entropyGraph: { nodes: { geneId: number; }[]; connections: { from: { geneId: number; }; to: { geneId: number; }; enabled: boolean; }[]; },
78
- ): Record<number, number>
76
+ applyComplexityStatsMultiObjective(
77
+ telemetryContext: { _lastMeanNodes?: number | undefined; _lastMeanConns?: number | undefined; },
78
+ telemetryOptions: NeatOptions & TelemetryDiversityOptions,
79
+ population: GenomeDetailed[],
80
+ entry: TelemetryEntryRecord,
81
+ ): void
79
82
  ```
80
83
 
81
- Compute per-node degree counts for enabled connections.
84
+ Attach complexity stats for multi-objective mode.
82
85
 
83
86
  Parameters:
84
- - `entropyGraph` - - Genome-like graph object.
85
-
86
- Returns: Map geneId -> degree count.
87
+ - `telemetryContext` - - Neat-like context with population state.
88
+ - `telemetryOptions` - - Options controlling complexity telemetry.
89
+ - `population` - - Population snapshot.
90
+ - `entry` - - Telemetry entry to update.
87
91
 
88
- ### buildDegreeHistogram
92
+ ### applyFastModeDefaults
89
93
 
90
94
  ```ts
91
- buildDegreeHistogram(
92
- counts: Record<number, number>,
93
- ): Record<number, number>
95
+ applyFastModeDefaults(
96
+ telemetryContext: { _fastModeTuned?: boolean | undefined; },
97
+ telemetryOptions: NeatOptions & TelemetryDiversityOptions,
98
+ ): void
94
99
  ```
95
100
 
96
- Build a histogram of degree frequencies from a degree-count table.
101
+ Apply fast-mode tuning to diversity sampling and novelty defaults.
97
102
 
98
103
  Parameters:
99
- - `counts` - - Map geneId -> degree count.
100
-
101
- Returns: Map degree -> number of nodes with that degree.
104
+ - `telemetryContext` - - Context object storing fast-mode tuning flag.
105
+ - `telemetryOptions` - - Options with diversity and novelty settings.
102
106
 
103
- ### computeEntropyFromHistogram
107
+ ### applyHypervolumeTelemetry
104
108
 
105
109
  ```ts
106
- computeEntropyFromHistogram(
107
- histogram: Record<number, number>,
108
- totalNodes: number,
109
- ): number
110
+ applyHypervolumeTelemetry(
111
+ telemetryOptions: NeatOptions & TelemetryDiversityOptions,
112
+ hyperVolumeProxy: number,
113
+ entry: TelemetryEntryRecord,
114
+ ): void
110
115
  ```
111
116
 
112
- Compute entropy from a degree-frequency histogram.
117
+ Attach hypervolume scalar when requested.
113
118
 
114
119
  Parameters:
115
- - `histogram` - - Map degree -> number of nodes.
116
- - `totalNodes` - - Total node count used to normalize into probabilities.
117
-
118
- Returns: Entropy value (non-negative).
120
+ - `telemetryOptions` - - Options controlling telemetry fields.
121
+ - `hyperVolumeProxy` - - Hypervolume proxy value.
122
+ - `entry` - - Telemetry entry to update.
119
123
 
120
- ### setCachedEntropy
124
+ ### applyLineageStatsMonoObjective
121
125
 
122
126
  ```ts
123
- setCachedEntropy(
124
- generation: number | undefined,
125
- entropyGraph: Record<string, unknown>,
126
- entropyValue: number,
127
+ applyLineageStatsMonoObjective(
128
+ telemetryContext: { _lineageEnabled?: boolean | undefined; _getRNG?: (() => () => number) | undefined; _lastMeanDepth?: number | undefined; _prevInbreedingCount?: number | undefined; },
129
+ populationSnapshot: GenomeDetailed[],
130
+ entry: TelemetryEntryRecord,
127
131
  ): void
128
132
  ```
129
133
 
130
- Cache an entropy value for the current generation on the graph object.
134
+ Apply lineage stats for mono-objective mode using sampled ancestors.
131
135
 
132
136
  Parameters:
133
- - `generation` - - Current generation number.
134
- - `entropyGraph` - - Genome-like graph object.
135
- - `entropyValue` - - Entropy value to cache.
137
+ - `telemetryContext` - - Neat-like context with lineage settings.
138
+ - `population` - - Population snapshot.
139
+ - `entry` - - Telemetry entry to update.
136
140
 
137
- ### getTelemetryCoreSnapshot
141
+ ### applyLineageStatsMultiObjective
138
142
 
139
143
  ```ts
140
- getTelemetryCoreSnapshot(
141
- sourceEntry: Record<string, unknown>,
142
- fields: TelemetryCoreFields,
143
- ): Partial<Record<string, unknown>>
144
+ applyLineageStatsMultiObjective(
145
+ telemetryContext: { _lineageEnabled?: boolean | undefined; _getRNG?: (() => () => number) | undefined; _lastMeanDepth?: number | undefined; _prevInbreedingCount?: number | undefined; },
146
+ population: GenomeDetailed[],
147
+ entry: TelemetryEntryRecord,
148
+ ): void
144
149
  ```
145
150
 
146
- Build a snapshot of the core telemetry fields present on the entry; does
147
- not mutate the source entry.
151
+ Apply lineage stats for multi-objective mode using ancestor uniqueness.
148
152
 
149
153
  Parameters:
150
- - `sourceEntry` - - Source telemetry object.
151
- - `fields` - - Core telemetry field keys to preserve.
152
-
153
- Returns: Shallow snapshot of core fields that exist on the entry.
154
+ - `telemetryContext` - - Neat-like context with lineage settings.
155
+ - `population` - - Population snapshot.
156
+ - `entry` - - Telemetry entry to update.
154
157
 
155
- ### stripUnselectedTelemetryKeys
158
+ ### applyObjectiveAges
156
159
 
157
160
  ```ts
158
- stripUnselectedTelemetryKeys(
159
- sourceEntry: Record<string, unknown>,
160
- selection: Set<string>,
161
- fields: TelemetryCoreFields,
162
- ): Record<string, unknown>
161
+ applyObjectiveAges(
162
+ telemetryContext: { _objectiveAges?: Map<string, number> | undefined; },
163
+ entry: TelemetryEntryRecord,
164
+ ): void
163
165
  ```
164
166
 
165
- Remove non-core keys that are not whitelisted by the selection set.
166
- Mutates the provided entry in-place for efficiency.
167
+ Apply objective age snapshots to the entry.
167
168
 
168
169
  Parameters:
169
- - `sourceEntry` - - Telemetry entry being filtered.
170
- - `selection` - - Whitelist of additional telemetry keys.
171
- - `fields` - - Core telemetry field keys that must be preserved.
172
-
173
- Returns: The same entry reference after filtering.
170
+ - `telemetryContext` - - Neat-like context with objective ages.
171
+ - `entry` - - Telemetry entry to update.
174
172
 
175
- ### mergeTelemetryCoreFields
173
+ ### applyObjectiveEvents
176
174
 
177
175
  ```ts
178
- mergeTelemetryCoreFields(
179
- sourceEntry: Record<string, unknown>,
180
- coreSnapshot: Partial<Record<string, unknown>>,
181
- ): Record<string, unknown>
176
+ applyObjectiveEvents(
177
+ telemetryContext: { _pendingObjectiveAdds?: string[] | undefined; _pendingObjectiveRemoves?: string[] | undefined; _objectiveEvents?: ObjectiveEvent[] | undefined; },
178
+ entry: TelemetryEntryRecord,
179
+ generation: number,
180
+ ): void
182
181
  ```
183
182
 
184
- Re-attach core fields to the filtered entry.
185
- Mutates the entry so the caller keeps the original reference.
183
+ Apply and flush objective lifecycle events.
186
184
 
187
185
  Parameters:
188
- - `sourceEntry` - - Filtered telemetry entry to update.
189
- - `coreSnapshot` - - Snapshot of core fields to ensure presence.
186
+ - `telemetryContext` - - Neat-like context holding objective events.
187
+ - `entry` - - Telemetry entry to update.
188
+ - `generation` - - Generation index for event records.
190
189
 
191
- Returns: The same entry reference with core fields restored.
190
+ ### applyObjectiveImportance
192
191
 
193
- ### safelyApplyTelemetrySelect
192
+ ```ts
193
+ applyObjectiveImportance(
194
+ telemetryContext: { _lastObjImportance?: ObjImportance | undefined; },
195
+ entry: TelemetryEntryRecord,
196
+ ): void
197
+ ```
198
+
199
+ Apply the most recent objective importance snapshot.
200
+
201
+ Parameters:
202
+ - `telemetryContext` - - Neat-like context with objective importance.
203
+ - `entry` - - Telemetry entry to update.
204
+
205
+ ### applyObjectivesSnapshot
194
206
 
195
207
  ```ts
196
- safelyApplyTelemetrySelect(
197
- telemetryContext: TContext,
198
- telemetryEntry: TelemetryEntry,
199
- applyTelemetrySelectFn: (this: TContext, entry: Record<string, unknown>) => Record<string, unknown>,
208
+ applyObjectivesSnapshot(
209
+ telemetryContext: { _getObjectives?: (() => { key: string; }[]) | undefined; },
210
+ entry: TelemetryEntryRecord,
200
211
  ): void
201
212
  ```
202
213
 
203
- Apply telemetry selection while swallowing selection errors.
214
+ Apply objectives list snapshot (keys only).
204
215
 
205
216
  Parameters:
206
- - `telemetryContext` - - Neat-like context with telemetry selection.
207
- - `telemetryEntry` - - Entry to filter in place.
208
- - `applyTelemetrySelectFn` - - Selection helper to invoke.
217
+ - `telemetryContext` - - Neat-like context with objective provider.
218
+ - `entry` - - Telemetry entry to update.
209
219
 
210
- ### applyFastModeDefaults
220
+ ### applyPerformanceStats
211
221
 
212
222
  ```ts
213
- applyFastModeDefaults(
214
- telemetryContext: { _fastModeTuned?: boolean | undefined; },
223
+ applyPerformanceStats(
224
+ telemetryContext: { _lastEvalDuration?: number | undefined; _lastEvolveDuration?: number | undefined; },
215
225
  telemetryOptions: NeatOptions & TelemetryDiversityOptions,
226
+ entry: TelemetryEntryRecord,
216
227
  ): void
217
228
  ```
218
229
 
219
- Apply fast-mode tuning to diversity sampling and novelty defaults.
230
+ Attach performance stats when configured.
220
231
 
221
232
  Parameters:
222
- - `telemetryContext` - - Context object storing fast-mode tuning flag.
223
- - `telemetryOptions` - - Options with diversity and novelty settings.
233
+ - `telemetryContext` - - Neat-like context with performance data.
234
+ - `telemetryOptions` - - Options controlling performance telemetry.
235
+ - `entry` - - Telemetry entry to update.
224
236
 
225
- ### computeCompatibilityStats
237
+ ### applyRngState
226
238
 
227
239
  ```ts
228
- computeCompatibilityStats(
229
- genomes: TelemetryGenome[],
230
- size: number,
231
- pairSampleCount: number,
232
- rngFactoryFn: () => () => number,
233
- compatibilityDistance: ((a: TelemetryGenome, b: TelemetryGenome) => number) | undefined,
234
- ): { meanCompat: number; varCompat: number; }
240
+ applyRngState(
241
+ telemetryContext: { _rngState?: unknown; },
242
+ telemetryOptions: NeatOptions & TelemetryDiversityOptions,
243
+ entry: TelemetryEntryRecord,
244
+ ): void
235
245
  ```
236
246
 
237
- Compute pairwise compatibility statistics via sampling.
247
+ Attach RNG state when configured.
238
248
 
239
249
  Parameters:
240
- - `genomes` - - Population snapshot.
241
- - `size` - - Population size.
242
- - `pairSampleCount` - - Number of pairs to sample.
243
- - `rngFactoryFn` - - RNG factory returning a uniform random function.
244
- - `compatibilityDistance` - - Optional compatibility distance function.
250
+ - `telemetryContext` - - Neat-like context with RNG state.
251
+ - `telemetryOptions` - - Options controlling RNG telemetry.
252
+ - `entry` - - Telemetry entry to update.
245
253
 
246
- Returns: Mean and variance of sampled compatibilities.
254
+ ### applySpeciesAllocation
247
255
 
248
- ### computeEntropyStats
256
+ ```ts
257
+ applySpeciesAllocation(
258
+ telemetryContext: { _lastOffspringAlloc?: SpeciesAlloc[] | undefined; },
259
+ entry: TelemetryEntryRecord,
260
+ ): void
261
+ ```
262
+
263
+ Apply per-species offspring allocation snapshot.
264
+
265
+ Parameters:
266
+ - `telemetryContext` - - Neat-like context with allocation snapshot.
267
+ - `entry` - - Telemetry entry to update.
268
+
269
+ ### buildComplexityEntry
249
270
 
250
271
  ```ts
251
- computeEntropyStats(
252
- genomes: TelemetryGenome[],
253
- structuralEntropyFn: (genome: TelemetryGenome) => number,
254
- ): { meanEntropy: number; varEntropy: number; }
272
+ buildComplexityEntry(
273
+ telemetryOptions: NeatOptions & TelemetryDiversityOptions,
274
+ meanCounts: { meanNodes: number; meanConns: number; },
275
+ maxCounts: { maxNodes: number; maxConns: number; },
276
+ meanEnabledRatio: number,
277
+ growthValues: { growthNodes: number; growthConns: number; },
278
+ ): { meanNodes: number; meanConns: number; maxNodes: number; maxConns: number; meanEnabledRatio: number; growthNodes: number; growthConns: number; budgetMaxNodes: number; budgetMaxConns: number; }
255
279
  ```
256
280
 
257
- Compute structural entropy mean and variance across the population.
281
+ Build the complexity entry payload for multi-objective mode.
258
282
 
259
283
  Parameters:
260
- - `genomes` - - Population snapshot.
261
- - `structuralEntropyFn` - - Function to compute entropy for a genome.
284
+ - `telemetryOptions` - - Options controlling complexity telemetry.
285
+ - `meanCounts` - - Mean node/connection counts.
286
+ - `maxCounts` - - Max node/connection counts.
287
+ - `meanEnabledRatio` - - Mean enabled ratio.
288
+ - `growthValues` - - Growth deltas.
262
289
 
263
- Returns: Mean and variance of entropy values.
290
+ Returns: Complexity entry payload.
264
291
 
265
- ### computeGraphletEntropy
292
+ ### buildDegreeHistogram
266
293
 
267
294
  ```ts
268
- computeGraphletEntropy(
269
- genomes: TelemetryGenome[],
270
- size: number,
271
- graphletSampleCount: number,
272
- rngFactoryFn: () => () => number,
273
- ): number
295
+ buildDegreeHistogram(
296
+ counts: Record<number, number>,
297
+ ): Record<number, number>
274
298
  ```
275
299
 
276
- Sample graphlet motifs and compute entropy over their edge counts.
300
+ Build a histogram of degree frequencies from a degree-count table.
277
301
 
278
302
  Parameters:
279
- - `genomes` - - Population snapshot.
280
- - `size` - - Population size.
281
- - `graphletSampleCount` - - Number of graphlets to sample.
282
- - `rngFactoryFn` - - RNG factory returning a uniform random function.
303
+ - `counts` - - Map geneId -> degree count.
283
304
 
284
- Returns: Graphlet entropy value.
305
+ Returns: Map degree -> number of nodes with that degree.
285
306
 
286
- ### pickDistinctIndices
307
+ ### buildLineageContext
287
308
 
288
309
  ```ts
289
- pickDistinctIndices(
290
- upperBound: number,
291
- count: number,
292
- rng: () => number,
293
- ): number[]
310
+ buildLineageContext(
311
+ context: { _getRNG?: (() => () => number) | undefined; },
312
+ populationSnapshot: GenomeDetailed[],
313
+ ): NeatLineageContext
294
314
  ```
295
315
 
296
- Pick a fixed number of distinct random indices.
316
+ Build a lineage helper context for ancestor operations.
297
317
 
298
318
  Parameters:
299
- - `upperBound` - - Exclusive upper bound for random indices.
300
- - `count` - - Number of distinct indices to pick.
301
- - `rng` - - RNG function returning values in [0,1).
319
+ - `context` - - Neat-like context with RNG helpers.
320
+ - `populationSnapshot` - - Population snapshot.
302
321
 
303
- Returns: Array of distinct indices.
322
+ Returns: Lineage helper context.
304
323
 
305
- ### countEnabledEdges
324
+ ### buildLineageEntry
306
325
 
307
326
  ```ts
308
- countEnabledEdges(
309
- genome: TelemetryGenome,
310
- selectedNodes: NodeLike[],
311
- ): number
327
+ buildLineageEntry(
328
+ context: { _prevInbreedingCount?: number | undefined; },
329
+ bestGenomeSnapshot: GenomeDetailed,
330
+ meanDepthValue: number,
331
+ ancestorUniquenessScore: number,
332
+ ): { parents: number[]; depthBest: number; meanDepth: number; inbreeding: number; ancestorUniq: number; }
312
333
  ```
313
334
 
314
- Count enabled edges between the selected nodes in a genome.
335
+ Build the lineage entry payload.
315
336
 
316
337
  Parameters:
317
- - `genome` - - Genome with connections to inspect.
318
- - `selectedNodes` - - Nodes forming the graphlet sample.
338
+ - `context` - - Neat-like context with lineage info.
339
+ - `bestGenomeSnapshot` - - Best genome snapshot.
340
+ - `meanDepthValue` - - Mean lineage depth.
341
+ - `ancestorUniquenessScore` - - Ancestor uniqueness score.
319
342
 
320
- Returns: Edge count capped at 3.
343
+ Returns: Lineage entry payload.
321
344
 
322
- ### computeOperatorStatsSnapshot
345
+ ### collectDepths
323
346
 
324
347
  ```ts
325
- computeOperatorStatsSnapshot(
326
- operatorStats: OperatorStatsMap | undefined,
327
- ): { op: string; succ: number; att: number; }[]
348
+ collectDepths(
349
+ populationSnapshot: GenomeDetailed[],
350
+ ): number[]
328
351
  ```
329
352
 
330
- Snapshot operator statistics into a telemetry-friendly array.
353
+ Collect depth values for the current population.
331
354
 
332
355
  Parameters:
333
- - `operatorStats` - - Operator stats map (opName -> success/attempts).
356
+ - `populationSnapshot` - - Population snapshot.
334
357
 
335
- Returns: Operator stats snapshot array.
358
+ Returns: Array of depth values (defaults to 0).
336
359
 
337
- ### readOperatorStats
360
+ ### collectPopulationCounts
338
361
 
339
362
  ```ts
340
- readOperatorStats(
341
- operatorStats: OperatorStatsMap | undefined,
342
- ): { name: string; success: number; attempts: number; }[]
363
+ collectPopulationCounts(
364
+ populationSnapshot: GenomeDetailed[],
365
+ ): { nodeCounts: number[]; connectionCounts: number[]; }
343
366
  ```
344
367
 
345
- Convert operator stats map into the public accessor shape.
368
+ Collect node and connection counts for the population.
346
369
 
347
370
  Parameters:
348
- - `operatorStats` - - Operator stats map stored on the host.
371
+ - `populationSnapshot` - - Population snapshot.
349
372
 
350
- Returns: Public operator summaries for dashboards and tests.
373
+ Returns: Node and connection counts arrays.
351
374
 
352
- ### computeHyperVolumeProxy
375
+ ### computeAncestorUniquenessSampled
353
376
 
354
377
  ```ts
355
- computeHyperVolumeProxy(
356
- telemetryOptions: NeatOptions & TelemetryDiversityOptions,
357
- population: GenomeDetailed[],
378
+ computeAncestorUniquenessSampled(
379
+ context: { _getRNG?: (() => () => number) | undefined; },
380
+ populationSnapshot: GenomeDetailed[],
358
381
  ): number
359
382
  ```
360
383
 
361
- Compute a hypervolume-like proxy for the Pareto front.
384
+ Compute ancestor uniqueness using sampled Jaccard distance.
362
385
 
363
386
  Parameters:
364
- - `telemetryOptions` - - Options controlling complexity metric.
365
- - `population` - - Population snapshot.
387
+ - `context` - - Neat-like context with RNG helpers.
388
+ - `populationSnapshot` - - Population snapshot.
366
389
 
367
- Returns: Hypervolume proxy value.
390
+ Returns: Rounded ancestor uniqueness score.
368
391
 
369
- ### computeParetoFrontSizes
392
+ ### computeAndStoreGrowthValues
370
393
 
371
394
  ```ts
372
- computeParetoFrontSizes(
373
- population: GenomeDetailed[],
374
- ): number[]
395
+ computeAndStoreGrowthValues(
396
+ context: { _lastMeanNodes?: number | undefined; _lastMeanConns?: number | undefined; },
397
+ meanCounts: { meanNodes: number; meanConns: number; },
398
+ ): { growthNodes: number; growthConns: number; }
375
399
  ```
376
400
 
377
- Compute sizes of early Pareto fronts.
401
+ Compute growth values and store the latest means on the context.
378
402
 
379
403
  Parameters:
380
- - `population` - - Population snapshot.
404
+ - `context` - - Neat-like context with previous mean values.
405
+ - `meanCounts` - - Current mean node/connection counts.
381
406
 
382
- Returns: Array of front sizes (rank 0..4).
407
+ Returns: Growth values for nodes and connections.
383
408
 
384
- ### applyObjectiveImportance
409
+ ### computeCompatibilityStats
385
410
 
386
411
  ```ts
387
- applyObjectiveImportance(
388
- telemetryContext: { _lastObjImportance?: ObjImportance | undefined; },
389
- entry: TelemetryEntryRecord,
390
- ): void
412
+ computeCompatibilityStats(
413
+ genomes: TelemetryGenome[],
414
+ size: number,
415
+ pairSampleCount: number,
416
+ rngFactoryFn: () => () => number,
417
+ compatibilityDistance: ((a: TelemetryGenome, b: TelemetryGenome) => number) | undefined,
418
+ ): { meanCompat: number; varCompat: number; }
391
419
  ```
392
420
 
393
- Apply the most recent objective importance snapshot.
421
+ Compute pairwise compatibility statistics via sampling.
394
422
 
395
423
  Parameters:
396
- - `telemetryContext` - - Neat-like context with objective importance.
397
- - `entry` - - Telemetry entry to update.
424
+ - `genomes` - - Population snapshot.
425
+ - `size` - - Population size.
426
+ - `pairSampleCount` - - Number of pairs to sample.
427
+ - `rngFactoryFn` - - RNG factory returning a uniform random function.
428
+ - `compatibilityDistance` - - Optional compatibility distance function.
398
429
 
399
- ### applyObjectiveAges
430
+ Returns: Mean and variance of sampled compatibilities.
431
+
432
+ ### computeDegreeCounts
400
433
 
401
434
  ```ts
402
- applyObjectiveAges(
403
- telemetryContext: { _objectiveAges?: Map<string, number> | undefined; },
404
- entry: TelemetryEntryRecord,
405
- ): void
435
+ computeDegreeCounts(
436
+ entropyGraph: { nodes: { geneId: number; }[]; connections: { from: { geneId: number; }; to: { geneId: number; }; enabled: boolean; }[]; },
437
+ ): Record<number, number>
406
438
  ```
407
439
 
408
- Apply objective age snapshots to the entry.
440
+ Compute per-node degree counts for enabled connections.
409
441
 
410
442
  Parameters:
411
- - `telemetryContext` - - Neat-like context with objective ages.
412
- - `entry` - - Telemetry entry to update.
443
+ - `entropyGraph` - - Genome-like graph object.
413
444
 
414
- ### applyObjectiveEvents
445
+ Returns: Map geneId -> degree count.
446
+
447
+ ### computeEnabledRatios
415
448
 
416
449
  ```ts
417
- applyObjectiveEvents(
418
- telemetryContext: { _pendingObjectiveAdds?: string[] | undefined; _pendingObjectiveRemoves?: string[] | undefined; _objectiveEvents?: ObjectiveEvent[] | undefined; },
419
- entry: TelemetryEntryRecord,
420
- generation: number,
421
- ): void
450
+ computeEnabledRatios(
451
+ populationSnapshot: GenomeDetailed[],
452
+ ): number[]
422
453
  ```
423
454
 
424
- Apply and flush objective lifecycle events.
455
+ Compute enabled ratios per genome.
425
456
 
426
457
  Parameters:
427
- - `telemetryContext` - - Neat-like context holding objective events.
428
- - `entry` - - Telemetry entry to update.
429
- - `generation` - - Generation index for event records.
458
+ - `populationSnapshot` - - Population snapshot.
430
459
 
431
- ### applySpeciesAllocation
460
+ Returns: Array of enabled ratios.
461
+
462
+ ### computeEntropyFromHistogram
432
463
 
433
464
  ```ts
434
- applySpeciesAllocation(
435
- telemetryContext: { _lastOffspringAlloc?: SpeciesAlloc[] | undefined; },
436
- entry: TelemetryEntryRecord,
437
- ): void
465
+ computeEntropyFromHistogram(
466
+ histogram: Record<number, number>,
467
+ totalNodes: number,
468
+ ): number
438
469
  ```
439
470
 
440
- Apply per-species offspring allocation snapshot.
471
+ Compute entropy from a degree-frequency histogram.
441
472
 
442
473
  Parameters:
443
- - `telemetryContext` - - Neat-like context with allocation snapshot.
444
- - `entry` - - Telemetry entry to update.
474
+ - `histogram` - - Map degree -> number of nodes.
475
+ - `totalNodes` - - Total node count used to normalize into probabilities.
445
476
 
446
- ### applyObjectivesSnapshot
477
+ Returns: Entropy value (non-negative).
478
+
479
+ ### computeEntropyStats
447
480
 
448
481
  ```ts
449
- applyObjectivesSnapshot(
450
- telemetryContext: { _getObjectives?: (() => { key: string; }[]) | undefined; },
451
- entry: TelemetryEntryRecord,
452
- ): void
482
+ computeEntropyStats(
483
+ genomes: TelemetryGenome[],
484
+ structuralEntropyFn: (genome: TelemetryGenome) => number,
485
+ ): { meanEntropy: number; varEntropy: number; }
453
486
  ```
454
487
 
455
- Apply objectives list snapshot (keys only).
488
+ Compute structural entropy mean and variance across the population.
456
489
 
457
490
  Parameters:
458
- - `telemetryContext` - - Neat-like context with objective provider.
459
- - `entry` - - Telemetry entry to update.
491
+ - `genomes` - - Population snapshot.
492
+ - `structuralEntropyFn` - - Function to compute entropy for a genome.
460
493
 
461
- ### applyHypervolumeTelemetry
494
+ Returns: Mean and variance of entropy values.
495
+
496
+ ### computeGraphletEntropy
462
497
 
463
498
  ```ts
464
- applyHypervolumeTelemetry(
465
- telemetryOptions: NeatOptions & TelemetryDiversityOptions,
466
- hyperVolumeProxy: number,
467
- entry: TelemetryEntryRecord,
468
- ): void
499
+ computeGraphletEntropy(
500
+ genomes: TelemetryGenome[],
501
+ size: number,
502
+ graphletSampleCount: number,
503
+ rngFactoryFn: () => () => number,
504
+ ): number
469
505
  ```
470
506
 
471
- Attach hypervolume scalar when requested.
507
+ Sample graphlet motifs and compute entropy over their edge counts.
472
508
 
473
509
  Parameters:
474
- - `telemetryOptions` - - Options controlling telemetry fields.
475
- - `hyperVolumeProxy` - - Hypervolume proxy value.
476
- - `entry` - - Telemetry entry to update.
510
+ - `genomes` - - Population snapshot.
511
+ - `size` - - Population size.
512
+ - `graphletSampleCount` - - Number of graphlets to sample.
513
+ - `rngFactoryFn` - - RNG factory returning a uniform random function.
477
514
 
478
- ### applyRngState
515
+ Returns: Graphlet entropy value.
516
+
517
+ ### computeHyperVolumeProxy
479
518
 
480
519
  ```ts
481
- applyRngState(
482
- telemetryContext: { _rngState?: unknown; },
520
+ computeHyperVolumeProxy(
483
521
  telemetryOptions: NeatOptions & TelemetryDiversityOptions,
484
- entry: TelemetryEntryRecord,
485
- ): void
522
+ population: GenomeDetailed[],
523
+ ): number
486
524
  ```
487
525
 
488
- Attach RNG state when configured.
526
+ Compute a hypervolume-like proxy for the Pareto front.
489
527
 
490
528
  Parameters:
491
- - `telemetryContext` - - Neat-like context with RNG state.
492
- - `telemetryOptions` - - Options controlling RNG telemetry.
493
- - `entry` - - Telemetry entry to update.
529
+ - `telemetryOptions` - - Options controlling complexity metric.
530
+ - `population` - - Population snapshot.
531
+
532
+ Returns: Hypervolume proxy value.
494
533
 
495
534
  ### computeLineageStats
496
535
 
@@ -515,71 +554,35 @@ Parameters:
515
554
 
516
555
  Returns: Lineage mean depth and pairwise distance.
517
556
 
518
- ### applyLineageStatsMultiObjective
519
-
520
- ```ts
521
- applyLineageStatsMultiObjective(
522
- telemetryContext: { _lineageEnabled?: boolean | undefined; _getRNG?: (() => () => number) | undefined; _lastMeanDepth?: number | undefined; _prevInbreedingCount?: number | undefined; },
523
- population: GenomeDetailed[],
524
- entry: TelemetryEntryRecord,
525
- ): void
526
- ```
527
-
528
- Apply lineage stats for multi-objective mode using ancestor uniqueness.
529
-
530
- Parameters:
531
- - `telemetryContext` - - Neat-like context with lineage settings.
532
- - `population` - - Population snapshot.
533
- - `entry` - - Telemetry entry to update.
534
-
535
- ### applyLineageStatsMonoObjective
536
-
537
- ```ts
538
- applyLineageStatsMonoObjective(
539
- telemetryContext: { _lineageEnabled?: boolean | undefined; _getRNG?: (() => () => number) | undefined; _lastMeanDepth?: number | undefined; _prevInbreedingCount?: number | undefined; },
540
- populationSnapshot: GenomeDetailed[],
541
- entry: TelemetryEntryRecord,
542
- ): void
543
- ```
544
-
545
- Apply lineage stats for mono-objective mode using sampled ancestors.
546
-
547
- Parameters:
548
- - `telemetryContext` - - Neat-like context with lineage settings.
549
- - `population` - - Population snapshot.
550
- - `entry` - - Telemetry entry to update.
551
-
552
- ### isLineageEligible
557
+ ### computeMaxCounts
553
558
 
554
559
  ```ts
555
- isLineageEligible(
556
- context: { _lineageEnabled?: boolean | undefined; },
557
- populationSnapshot: GenomeDetailed[],
558
- ): boolean
560
+ computeMaxCounts(
561
+ counts: { nodeCounts: number[]; connectionCounts: number[]; },
562
+ ): { maxNodes: number; maxConns: number; }
559
563
  ```
560
564
 
561
- Check whether lineage metrics should be computed.
565
+ Compute max node and connection counts.
562
566
 
563
567
  Parameters:
564
- - `context` - - Neat-like context with lineage flag.
565
- - `populationSnapshot` - - Population snapshot to validate.
568
+ - `counts` - - Node and connection counts arrays.
566
569
 
567
- Returns: True when lineage stats should be computed.
570
+ Returns: Max node and connection counts.
568
571
 
569
- ### collectDepths
572
+ ### computeMeanCounts
570
573
 
571
574
  ```ts
572
- collectDepths(
573
- populationSnapshot: GenomeDetailed[],
574
- ): number[]
575
+ computeMeanCounts(
576
+ counts: { nodeCounts: number[]; connectionCounts: number[]; },
577
+ ): { meanNodes: number; meanConns: number; }
575
578
  ```
576
579
 
577
- Collect depth values for the current population.
580
+ Compute mean node and connection counts.
578
581
 
579
582
  Parameters:
580
- - `populationSnapshot` - - Population snapshot.
583
+ - `counts` - - Node and connection counts arrays.
581
584
 
582
- Returns: Array of depth values (defaults to 0).
585
+ Returns: Mean node and connection counts.
583
586
 
584
587
  ### computeMeanDepth
585
588
 
@@ -596,39 +599,35 @@ Parameters:
596
599
 
597
600
  Returns: Mean depth value.
598
601
 
599
- ### computeAncestorUniquenessSampled
602
+ ### computeMeanEnabledRatio
600
603
 
601
604
  ```ts
602
- computeAncestorUniquenessSampled(
603
- context: { _getRNG?: (() => () => number) | undefined; },
604
- populationSnapshot: GenomeDetailed[],
605
+ computeMeanEnabledRatio(
606
+ enabledRatios: number[],
605
607
  ): number
606
608
  ```
607
609
 
608
- Compute ancestor uniqueness using sampled Jaccard distance.
610
+ Compute mean of enabled ratios.
609
611
 
610
612
  Parameters:
611
- - `context` - - Neat-like context with RNG helpers.
612
- - `populationSnapshot` - - Population snapshot.
613
+ - `enabledRatios` - - Enabled ratios per genome.
613
614
 
614
- Returns: Rounded ancestor uniqueness score.
615
+ Returns: Mean enabled ratio.
615
616
 
616
- ### pickDistinctPairIndices
617
+ ### computeOperatorStatsSnapshot
617
618
 
618
619
  ```ts
619
- pickDistinctPairIndices(
620
- context: { _getRNG?: (() => () => number) | undefined; },
621
- populationSize: number,
622
- ): { firstIndex: number; secondIndex: number; }
620
+ computeOperatorStatsSnapshot(
621
+ operatorStats: OperatorStatsMap | undefined,
622
+ ): { op: string; succ: number; att: number; }[]
623
623
  ```
624
624
 
625
- Pick two distinct indices using the context RNG.
625
+ Snapshot operator statistics into a telemetry-friendly array.
626
626
 
627
627
  Parameters:
628
- - `context` - - Neat-like context with RNG factory.
629
- - `populationSize` - - Population size for index bounds.
628
+ - `operatorStats` - - Operator stats map (opName -> success/attempts).
630
629
 
631
- Returns: Pair of distinct indices.
630
+ Returns: Operator stats snapshot array.
632
631
 
633
632
  ### computePairJaccardDistance
634
633
 
@@ -651,22 +650,20 @@ Parameters:
651
650
 
652
651
  Returns: Jaccard distance or undefined when both sets are empty.
653
652
 
654
- ### buildLineageContext
655
-
656
- ```ts
657
- buildLineageContext(
658
- context: { _getRNG?: (() => () => number) | undefined; },
659
- populationSnapshot: GenomeDetailed[],
660
- ): NeatLineageContext
653
+ ### computeParetoFrontSizes
654
+
655
+ ```ts
656
+ computeParetoFrontSizes(
657
+ population: GenomeDetailed[],
658
+ ): number[]
661
659
  ```
662
660
 
663
- Build a lineage helper context for ancestor operations.
661
+ Compute sizes of early Pareto fronts.
664
662
 
665
663
  Parameters:
666
- - `context` - - Neat-like context with RNG helpers.
667
- - `populationSnapshot` - - Population snapshot.
664
+ - `population` - - Population snapshot.
668
665
 
669
- Returns: Lineage helper context.
666
+ Returns: Array of front sizes (rank 0..4).
670
667
 
671
668
  ### countAncestorIntersection
672
669
 
@@ -685,195 +682,198 @@ Parameters:
685
682
 
686
683
  Returns: Intersection count.
687
684
 
688
- ### buildLineageEntry
685
+ ### countEnabledEdges
689
686
 
690
687
  ```ts
691
- buildLineageEntry(
692
- context: { _prevInbreedingCount?: number | undefined; },
693
- bestGenomeSnapshot: GenomeDetailed,
694
- meanDepthValue: number,
695
- ancestorUniquenessScore: number,
696
- ): { parents: number[]; depthBest: number; meanDepth: number; inbreeding: number; ancestorUniq: number; }
688
+ countEnabledEdges(
689
+ genome: TelemetryGenome,
690
+ selectedNodes: NodeLike[],
691
+ ): number
697
692
  ```
698
693
 
699
- Build the lineage entry payload.
694
+ Count enabled edges between the selected nodes in a genome.
700
695
 
701
696
  Parameters:
702
- - `context` - - Neat-like context with lineage info.
703
- - `bestGenomeSnapshot` - - Best genome snapshot.
704
- - `meanDepthValue` - - Mean lineage depth.
705
- - `ancestorUniquenessScore` - - Ancestor uniqueness score.
697
+ - `genome` - - Genome with connections to inspect.
698
+ - `selectedNodes` - - Nodes forming the graphlet sample.
706
699
 
707
- Returns: Lineage entry payload.
700
+ Returns: Edge count capped at 3.
708
701
 
709
- ### collectPopulationCounts
702
+ ### getCachedEntropy
710
703
 
711
704
  ```ts
712
- collectPopulationCounts(
713
- populationSnapshot: GenomeDetailed[],
714
- ): { nodeCounts: number[]; connectionCounts: number[]; }
705
+ getCachedEntropy(
706
+ generation: number | undefined,
707
+ entropyGraph: Record<string, unknown>,
708
+ ): number | undefined
715
709
  ```
716
710
 
717
- Collect node and connection counts for the population.
711
+ Read a cached entropy value if it exists and belongs to the current
712
+ generation.
718
713
 
719
714
  Parameters:
720
- - `populationSnapshot` - - Population snapshot.
715
+ - `generation` - - Current generation number.
716
+ - `entropyGraph` - - Genome-like graph object.
721
717
 
722
- Returns: Node and connection counts arrays.
718
+ Returns: Cached entropy number, or undefined when not available.
723
719
 
724
- ### computeMeanCounts
720
+ ### getTelemetryCoreSnapshot
725
721
 
726
722
  ```ts
727
- computeMeanCounts(
728
- counts: { nodeCounts: number[]; connectionCounts: number[]; },
729
- ): { meanNodes: number; meanConns: number; }
723
+ getTelemetryCoreSnapshot(
724
+ sourceEntry: Record<string, unknown>,
725
+ fields: TelemetryCoreFields,
726
+ ): Partial<Record<string, unknown>>
730
727
  ```
731
728
 
732
- Compute mean node and connection counts.
729
+ Build a snapshot of the core telemetry fields present on the entry; does
730
+ not mutate the source entry.
733
731
 
734
732
  Parameters:
735
- - `counts` - - Node and connection counts arrays.
733
+ - `sourceEntry` - - Source telemetry object.
734
+ - `fields` - - Core telemetry field keys to preserve.
736
735
 
737
- Returns: Mean node and connection counts.
736
+ Returns: Shallow snapshot of core fields that exist on the entry.
738
737
 
739
- ### computeMaxCounts
738
+ ### isLineageEligible
740
739
 
741
740
  ```ts
742
- computeMaxCounts(
743
- counts: { nodeCounts: number[]; connectionCounts: number[]; },
744
- ): { maxNodes: number; maxConns: number; }
741
+ isLineageEligible(
742
+ context: { _lineageEnabled?: boolean | undefined; },
743
+ populationSnapshot: GenomeDetailed[],
744
+ ): boolean
745
745
  ```
746
746
 
747
- Compute max node and connection counts.
747
+ Check whether lineage metrics should be computed.
748
748
 
749
749
  Parameters:
750
- - `counts` - - Node and connection counts arrays.
750
+ - `context` - - Neat-like context with lineage flag.
751
+ - `populationSnapshot` - - Population snapshot to validate.
751
752
 
752
- Returns: Max node and connection counts.
753
+ Returns: True when lineage stats should be computed.
753
754
 
754
- ### computeEnabledRatios
755
+ ### mergeTelemetryCoreFields
755
756
 
756
757
  ```ts
757
- computeEnabledRatios(
758
- populationSnapshot: GenomeDetailed[],
759
- ): number[]
758
+ mergeTelemetryCoreFields(
759
+ sourceEntry: Record<string, unknown>,
760
+ coreSnapshot: Partial<Record<string, unknown>>,
761
+ ): Record<string, unknown>
760
762
  ```
761
763
 
762
- Compute enabled ratios per genome.
764
+ Re-attach core fields to the filtered entry.
765
+ Mutates the entry so the caller keeps the original reference.
763
766
 
764
767
  Parameters:
765
- - `populationSnapshot` - - Population snapshot.
768
+ - `sourceEntry` - - Filtered telemetry entry to update.
769
+ - `coreSnapshot` - - Snapshot of core fields to ensure presence.
766
770
 
767
- Returns: Array of enabled ratios.
771
+ Returns: The same entry reference with core fields restored.
768
772
 
769
- ### computeMeanEnabledRatio
773
+ ### pickDistinctIndices
770
774
 
771
775
  ```ts
772
- computeMeanEnabledRatio(
773
- enabledRatios: number[],
774
- ): number
776
+ pickDistinctIndices(
777
+ upperBound: number,
778
+ count: number,
779
+ rng: () => number,
780
+ ): number[]
775
781
  ```
776
782
 
777
- Compute mean of enabled ratios.
783
+ Pick a fixed number of distinct random indices.
778
784
 
779
785
  Parameters:
780
- - `enabledRatios` - - Enabled ratios per genome.
786
+ - `upperBound` - - Exclusive upper bound for random indices.
787
+ - `count` - - Number of distinct indices to pick.
788
+ - `rng` - - RNG function returning values in [0,1).
781
789
 
782
- Returns: Mean enabled ratio.
790
+ Returns: Array of distinct indices.
783
791
 
784
- ### computeAndStoreGrowthValues
792
+ ### pickDistinctPairIndices
785
793
 
786
794
  ```ts
787
- computeAndStoreGrowthValues(
788
- context: { _lastMeanNodes?: number | undefined; _lastMeanConns?: number | undefined; },
789
- meanCounts: { meanNodes: number; meanConns: number; },
790
- ): { growthNodes: number; growthConns: number; }
795
+ pickDistinctPairIndices(
796
+ context: { _getRNG?: (() => () => number) | undefined; },
797
+ populationSize: number,
798
+ ): { firstIndex: number; secondIndex: number; }
791
799
  ```
792
800
 
793
- Compute growth values and store the latest means on the context.
801
+ Pick two distinct indices using the context RNG.
794
802
 
795
803
  Parameters:
796
- - `context` - - Neat-like context with previous mean values.
797
- - `meanCounts` - - Current mean node/connection counts.
804
+ - `context` - - Neat-like context with RNG factory.
805
+ - `populationSize` - - Population size for index bounds.
798
806
 
799
- Returns: Growth values for nodes and connections.
807
+ Returns: Pair of distinct indices.
800
808
 
801
- ### buildComplexityEntry
809
+ ### readOperatorStats
802
810
 
803
811
  ```ts
804
- buildComplexityEntry(
805
- telemetryOptions: NeatOptions & TelemetryDiversityOptions,
806
- meanCounts: { meanNodes: number; meanConns: number; },
807
- maxCounts: { maxNodes: number; maxConns: number; },
808
- meanEnabledRatio: number,
809
- growthValues: { growthNodes: number; growthConns: number; },
810
- ): { meanNodes: number; meanConns: number; maxNodes: number; maxConns: number; meanEnabledRatio: number; growthNodes: number; growthConns: number; budgetMaxNodes: number; budgetMaxConns: number; }
812
+ readOperatorStats(
813
+ operatorStats: OperatorStatsMap | undefined,
814
+ ): { name: string; success: number; attempts: number; }[]
811
815
  ```
812
816
 
813
- Build the complexity entry payload for multi-objective mode.
817
+ Convert operator stats map into the public accessor shape.
814
818
 
815
819
  Parameters:
816
- - `telemetryOptions` - - Options controlling complexity telemetry.
817
- - `meanCounts` - - Mean node/connection counts.
818
- - `maxCounts` - - Max node/connection counts.
819
- - `meanEnabledRatio` - - Mean enabled ratio.
820
- - `growthValues` - - Growth deltas.
820
+ - `operatorStats` - - Operator stats map stored on the host.
821
821
 
822
- Returns: Complexity entry payload.
822
+ Returns: Public operator summaries for dashboards and tests.
823
823
 
824
- ### applyComplexityStatsMultiObjective
824
+ ### safelyApplyTelemetrySelect
825
825
 
826
826
  ```ts
827
- applyComplexityStatsMultiObjective(
828
- telemetryContext: { _lastMeanNodes?: number | undefined; _lastMeanConns?: number | undefined; },
829
- telemetryOptions: NeatOptions & TelemetryDiversityOptions,
830
- population: GenomeDetailed[],
831
- entry: TelemetryEntryRecord,
827
+ safelyApplyTelemetrySelect(
828
+ telemetryContext: TContext,
829
+ telemetryEntry: TelemetryEntry,
830
+ applyTelemetrySelectFn: (this: TContext, entry: Record<string, unknown>) => Record<string, unknown>,
832
831
  ): void
833
832
  ```
834
833
 
835
- Attach complexity stats for multi-objective mode.
834
+ Apply telemetry selection while swallowing selection errors.
836
835
 
837
836
  Parameters:
838
- - `telemetryContext` - - Neat-like context with population state.
839
- - `telemetryOptions` - - Options controlling complexity telemetry.
840
- - `population` - - Population snapshot.
841
- - `entry` - - Telemetry entry to update.
837
+ - `telemetryContext` - - Neat-like context with telemetry selection.
838
+ - `telemetryEntry` - - Entry to filter in place.
839
+ - `applyTelemetrySelectFn` - - Selection helper to invoke.
842
840
 
843
- ### applyComplexityStatsMonoObjective
841
+ ### setCachedEntropy
844
842
 
845
843
  ```ts
846
- applyComplexityStatsMonoObjective(
847
- telemetryContext: { _lastMeanNodes?: number | undefined; _lastMeanConns?: number | undefined; },
848
- telemetryOptions: NeatOptions & TelemetryDiversityOptions,
849
- populationSnapshot: GenomeDetailed[],
850
- entry: TelemetryEntryRecord,
844
+ setCachedEntropy(
845
+ generation: number | undefined,
846
+ entropyGraph: Record<string, unknown>,
847
+ entropyValue: number,
851
848
  ): void
852
849
  ```
853
850
 
854
- Attach complexity stats for mono-objective mode.
851
+ Cache an entropy value for the current generation on the graph object.
855
852
 
856
853
  Parameters:
857
- - `telemetryContext` - - Neat-like context with population state.
858
- - `telemetryOptions` - - Options controlling complexity telemetry.
859
- - `entry` - - Telemetry entry to update.
854
+ - `generation` - - Current generation number.
855
+ - `entropyGraph` - - Genome-like graph object.
856
+ - `entropyValue` - - Entropy value to cache.
860
857
 
861
- ### applyPerformanceStats
858
+ ### stripUnselectedTelemetryKeys
862
859
 
863
860
  ```ts
864
- applyPerformanceStats(
865
- telemetryContext: { _lastEvalDuration?: number | undefined; _lastEvolveDuration?: number | undefined; },
866
- telemetryOptions: NeatOptions & TelemetryDiversityOptions,
867
- entry: TelemetryEntryRecord,
868
- ): void
861
+ stripUnselectedTelemetryKeys(
862
+ sourceEntry: Record<string, unknown>,
863
+ selection: Set<string>,
864
+ fields: TelemetryCoreFields,
865
+ ): Record<string, unknown>
869
866
  ```
870
867
 
871
- Attach performance stats when configured.
868
+ Remove non-core keys that are not whitelisted by the selection set.
869
+ Mutates the provided entry in-place for efficiency.
872
870
 
873
871
  Parameters:
874
- - `telemetryContext` - - Neat-like context with performance data.
875
- - `telemetryOptions` - - Options controlling performance telemetry.
876
- - `entry` - - Telemetry entry to update.
872
+ - `sourceEntry` - - Telemetry entry being filtered.
873
+ - `selection` - - Whitelist of additional telemetry keys.
874
+ - `fields` - - Core telemetry field keys that must be preserved.
875
+
876
+ Returns: The same entry reference after filtering.
877
877
 
878
878
  ## neat/telemetry/metrics/telemetry.metrics.rng.ts
879
879
 
@@ -896,53 +896,35 @@ Parameters:
896
896
 
897
897
  ## neat/telemetry/metrics/telemetry.metrics.entropy.ts
898
898
 
899
- ### getCachedEntropy
900
-
901
- ```ts
902
- getCachedEntropy(
903
- generation: number | undefined,
904
- entropyGraph: Record<string, unknown>,
905
- ): number | undefined
906
- ```
907
-
908
- Read a cached entropy value if it exists and belongs to the current
909
- generation.
910
-
911
- Parameters:
912
- - `generation` - - Current generation number.
913
- - `entropyGraph` - - Genome-like graph object.
914
-
915
- Returns: Cached entropy number, or undefined when not available.
916
-
917
- ### computeDegreeCounts
899
+ ### buildDegreeHistogram
918
900
 
919
901
  ```ts
920
- computeDegreeCounts(
921
- entropyGraph: { nodes: { geneId: number; }[]; connections: { from: { geneId: number; }; to: { geneId: number; }; enabled: boolean; }[]; },
902
+ buildDegreeHistogram(
903
+ counts: Record<number, number>,
922
904
  ): Record<number, number>
923
905
  ```
924
906
 
925
- Compute per-node degree counts for enabled connections.
907
+ Build a histogram of degree frequencies from a degree-count table.
926
908
 
927
909
  Parameters:
928
- - `entropyGraph` - - Genome-like graph object.
910
+ - `counts` - - Map geneId -> degree count.
929
911
 
930
- Returns: Map geneId -> degree count.
912
+ Returns: Map degree -> number of nodes with that degree.
931
913
 
932
- ### buildDegreeHistogram
914
+ ### computeDegreeCounts
933
915
 
934
916
  ```ts
935
- buildDegreeHistogram(
936
- counts: Record<number, number>,
917
+ computeDegreeCounts(
918
+ entropyGraph: { nodes: { geneId: number; }[]; connections: { from: { geneId: number; }; to: { geneId: number; }; enabled: boolean; }[]; },
937
919
  ): Record<number, number>
938
920
  ```
939
921
 
940
- Build a histogram of degree frequencies from a degree-count table.
922
+ Compute per-node degree counts for enabled connections.
941
923
 
942
924
  Parameters:
943
- - `counts` - - Map geneId -> degree count.
925
+ - `entropyGraph` - - Genome-like graph object.
944
926
 
945
- Returns: Map degree -> number of nodes with that degree.
927
+ Returns: Map geneId -> degree count.
946
928
 
947
929
  ### computeEntropyFromHistogram
948
930
 
@@ -961,6 +943,24 @@ Parameters:
961
943
 
962
944
  Returns: Entropy value (non-negative).
963
945
 
946
+ ### getCachedEntropy
947
+
948
+ ```ts
949
+ getCachedEntropy(
950
+ generation: number | undefined,
951
+ entropyGraph: Record<string, unknown>,
952
+ ): number | undefined
953
+ ```
954
+
955
+ Read a cached entropy value if it exists and belongs to the current
956
+ generation.
957
+
958
+ Parameters:
959
+ - `generation` - - Current generation number.
960
+ - `entropyGraph` - - Genome-like graph object.
961
+
962
+ Returns: Cached entropy number, or undefined when not available.
963
+
964
964
  ### setCachedEntropy
965
965
 
966
966
  ```ts
@@ -980,28 +980,22 @@ Parameters:
980
980
 
981
981
  ## neat/telemetry/metrics/telemetry.metrics.lineage.ts
982
982
 
983
- ### computeLineageStats
983
+ ### applyLineageStatsMonoObjective
984
984
 
985
985
  ```ts
986
- computeLineageStats(
987
- lineageEnabled: boolean,
988
- genomes: TelemetryGenome[],
989
- size: number,
990
- pairSampleCount: number,
991
- rngFactoryFn: () => () => number,
992
- ): { lineageMeanDepth: number; lineageMeanPairDist: number; }
986
+ applyLineageStatsMonoObjective(
987
+ telemetryContext: { _lineageEnabled?: boolean | undefined; _getRNG?: (() => () => number) | undefined; _lastMeanDepth?: number | undefined; _prevInbreedingCount?: number | undefined; },
988
+ populationSnapshot: GenomeDetailed[],
989
+ entry: TelemetryEntryRecord,
990
+ ): void
993
991
  ```
994
992
 
995
- Compute lineage depth and pairwise depth-distance statistics.
993
+ Apply lineage stats for mono-objective mode using sampled ancestors.
996
994
 
997
995
  Parameters:
998
- - `lineageEnabled` - - Whether lineage metrics are enabled.
999
- - `genomes` - - Population snapshot.
1000
- - `size` - - Population size.
1001
- - `pairSampleCount` - - Number of pairs to sample.
1002
- - `rngFactoryFn` - - RNG factory returning a uniform random function.
1003
-
1004
- Returns: Lineage mean depth and pairwise distance.
996
+ - `telemetryContext` - - Neat-like context with lineage settings.
997
+ - `population` - - Population snapshot.
998
+ - `entry` - - Telemetry entry to update.
1005
999
 
1006
1000
  ### applyLineageStatsMultiObjective
1007
1001
 
@@ -1020,39 +1014,43 @@ Parameters:
1020
1014
  - `population` - - Population snapshot.
1021
1015
  - `entry` - - Telemetry entry to update.
1022
1016
 
1023
- ### applyLineageStatsMonoObjective
1017
+ ### buildLineageContext
1024
1018
 
1025
1019
  ```ts
1026
- applyLineageStatsMonoObjective(
1027
- telemetryContext: { _lineageEnabled?: boolean | undefined; _getRNG?: (() => () => number) | undefined; _lastMeanDepth?: number | undefined; _prevInbreedingCount?: number | undefined; },
1020
+ buildLineageContext(
1021
+ context: { _getRNG?: (() => () => number) | undefined; },
1028
1022
  populationSnapshot: GenomeDetailed[],
1029
- entry: TelemetryEntryRecord,
1030
- ): void
1023
+ ): NeatLineageContext
1031
1024
  ```
1032
1025
 
1033
- Apply lineage stats for mono-objective mode using sampled ancestors.
1026
+ Build a lineage helper context for ancestor operations.
1034
1027
 
1035
1028
  Parameters:
1036
- - `telemetryContext` - - Neat-like context with lineage settings.
1037
- - `population` - - Population snapshot.
1038
- - `entry` - - Telemetry entry to update.
1029
+ - `context` - - Neat-like context with RNG helpers.
1030
+ - `populationSnapshot` - - Population snapshot.
1039
1031
 
1040
- ### isLineageEligible
1032
+ Returns: Lineage helper context.
1033
+
1034
+ ### buildLineageEntry
1041
1035
 
1042
1036
  ```ts
1043
- isLineageEligible(
1044
- context: { _lineageEnabled?: boolean | undefined; },
1045
- populationSnapshot: GenomeDetailed[],
1046
- ): boolean
1037
+ buildLineageEntry(
1038
+ context: { _prevInbreedingCount?: number | undefined; },
1039
+ bestGenomeSnapshot: GenomeDetailed,
1040
+ meanDepthValue: number,
1041
+ ancestorUniquenessScore: number,
1042
+ ): { parents: number[]; depthBest: number; meanDepth: number; inbreeding: number; ancestorUniq: number; }
1047
1043
  ```
1048
1044
 
1049
- Check whether lineage metrics should be computed.
1045
+ Build the lineage entry payload.
1050
1046
 
1051
1047
  Parameters:
1052
- - `context` - - Neat-like context with lineage flag.
1053
- - `populationSnapshot` - - Population snapshot to validate.
1048
+ - `context` - - Neat-like context with lineage info.
1049
+ - `bestGenomeSnapshot` - - Best genome snapshot.
1050
+ - `meanDepthValue` - - Mean lineage depth.
1051
+ - `ancestorUniquenessScore` - - Ancestor uniqueness score.
1054
1052
 
1055
- Returns: True when lineage stats should be computed.
1053
+ Returns: Lineage entry payload.
1056
1054
 
1057
1055
  ### collectDepths
1058
1056
 
@@ -1069,21 +1067,6 @@ Parameters:
1069
1067
 
1070
1068
  Returns: Array of depth values (defaults to 0).
1071
1069
 
1072
- ### computeMeanDepth
1073
-
1074
- ```ts
1075
- computeMeanDepth(
1076
- depthValues: number[],
1077
- ): number
1078
- ```
1079
-
1080
- Compute the mean depth from a depth list.
1081
-
1082
- Parameters:
1083
- - `depthValues` - - Depth values to average.
1084
-
1085
- Returns: Mean depth value.
1086
-
1087
1070
  ### computeAncestorUniquenessSampled
1088
1071
 
1089
1072
  ```ts
@@ -1101,22 +1084,43 @@ Parameters:
1101
1084
 
1102
1085
  Returns: Rounded ancestor uniqueness score.
1103
1086
 
1104
- ### pickDistinctPairIndices
1087
+ ### computeLineageStats
1105
1088
 
1106
1089
  ```ts
1107
- pickDistinctPairIndices(
1108
- context: { _getRNG?: (() => () => number) | undefined; },
1109
- populationSize: number,
1110
- ): { firstIndex: number; secondIndex: number; }
1090
+ computeLineageStats(
1091
+ lineageEnabled: boolean,
1092
+ genomes: TelemetryGenome[],
1093
+ size: number,
1094
+ pairSampleCount: number,
1095
+ rngFactoryFn: () => () => number,
1096
+ ): { lineageMeanDepth: number; lineageMeanPairDist: number; }
1111
1097
  ```
1112
1098
 
1113
- Pick two distinct indices using the context RNG.
1099
+ Compute lineage depth and pairwise depth-distance statistics.
1114
1100
 
1115
1101
  Parameters:
1116
- - `context` - - Neat-like context with RNG factory.
1117
- - `populationSize` - - Population size for index bounds.
1102
+ - `lineageEnabled` - - Whether lineage metrics are enabled.
1103
+ - `genomes` - - Population snapshot.
1104
+ - `size` - - Population size.
1105
+ - `pairSampleCount` - - Number of pairs to sample.
1106
+ - `rngFactoryFn` - - RNG factory returning a uniform random function.
1118
1107
 
1119
- Returns: Pair of distinct indices.
1108
+ Returns: Lineage mean depth and pairwise distance.
1109
+
1110
+ ### computeMeanDepth
1111
+
1112
+ ```ts
1113
+ computeMeanDepth(
1114
+ depthValues: number[],
1115
+ ): number
1116
+ ```
1117
+
1118
+ Compute the mean depth from a depth list.
1119
+
1120
+ Parameters:
1121
+ - `depthValues` - - Depth values to average.
1122
+
1123
+ Returns: Mean depth value.
1120
1124
 
1121
1125
  ### computePairJaccardDistance
1122
1126
 
@@ -1139,23 +1143,6 @@ Parameters:
1139
1143
 
1140
1144
  Returns: Jaccard distance or undefined when both sets are empty.
1141
1145
 
1142
- ### buildLineageContext
1143
-
1144
- ```ts
1145
- buildLineageContext(
1146
- context: { _getRNG?: (() => () => number) | undefined; },
1147
- populationSnapshot: GenomeDetailed[],
1148
- ): NeatLineageContext
1149
- ```
1150
-
1151
- Build a lineage helper context for ancestor operations.
1152
-
1153
- Parameters:
1154
- - `context` - - Neat-like context with RNG helpers.
1155
- - `populationSnapshot` - - Population snapshot.
1156
-
1157
- Returns: Lineage helper context.
1158
-
1159
1146
  ### countAncestorIntersection
1160
1147
 
1161
1148
  ```ts
@@ -1173,26 +1160,39 @@ Parameters:
1173
1160
 
1174
1161
  Returns: Intersection count.
1175
1162
 
1176
- ### buildLineageEntry
1163
+ ### isLineageEligible
1177
1164
 
1178
1165
  ```ts
1179
- buildLineageEntry(
1180
- context: { _prevInbreedingCount?: number | undefined; },
1181
- bestGenomeSnapshot: GenomeDetailed,
1182
- meanDepthValue: number,
1183
- ancestorUniquenessScore: number,
1184
- ): { parents: number[]; depthBest: number; meanDepth: number; inbreeding: number; ancestorUniq: number; }
1166
+ isLineageEligible(
1167
+ context: { _lineageEnabled?: boolean | undefined; },
1168
+ populationSnapshot: GenomeDetailed[],
1169
+ ): boolean
1185
1170
  ```
1186
1171
 
1187
- Build the lineage entry payload.
1172
+ Check whether lineage metrics should be computed.
1188
1173
 
1189
1174
  Parameters:
1190
- - `context` - - Neat-like context with lineage info.
1191
- - `bestGenomeSnapshot` - - Best genome snapshot.
1192
- - `meanDepthValue` - - Mean lineage depth.
1193
- - `ancestorUniquenessScore` - - Ancestor uniqueness score.
1175
+ - `context` - - Neat-like context with lineage flag.
1176
+ - `populationSnapshot` - - Population snapshot to validate.
1194
1177
 
1195
- Returns: Lineage entry payload.
1178
+ Returns: True when lineage stats should be computed.
1179
+
1180
+ ### pickDistinctPairIndices
1181
+
1182
+ ```ts
1183
+ pickDistinctPairIndices(
1184
+ context: { _getRNG?: (() => () => number) | undefined; },
1185
+ populationSize: number,
1186
+ ): { firstIndex: number; secondIndex: number; }
1187
+ ```
1188
+
1189
+ Pick two distinct indices using the context RNG.
1190
+
1191
+ Parameters:
1192
+ - `context` - - Neat-like context with RNG factory.
1193
+ - `populationSize` - - Population size for index bounds.
1194
+
1195
+ Returns: Pair of distinct indices.
1196
1196
 
1197
1197
  ## neat/telemetry/metrics/telemetry.metrics.operator.ts
1198
1198
 
@@ -1304,6 +1304,23 @@ Parameters:
1304
1304
 
1305
1305
  Returns: Graphlet entropy value.
1306
1306
 
1307
+ ### countEnabledEdges
1308
+
1309
+ ```ts
1310
+ countEnabledEdges(
1311
+ genome: TelemetryGenome,
1312
+ selectedNodes: NodeLike[],
1313
+ ): number
1314
+ ```
1315
+
1316
+ Count enabled edges between the selected nodes in a genome.
1317
+
1318
+ Parameters:
1319
+ - `genome` - - Genome with connections to inspect.
1320
+ - `selectedNodes` - - Nodes forming the graphlet sample.
1321
+
1322
+ Returns: Edge count capped at 3.
1323
+
1307
1324
  ### pickDistinctIndices
1308
1325
 
1309
1326
  ```ts
@@ -1323,23 +1340,6 @@ Parameters:
1323
1340
 
1324
1341
  Returns: Array of distinct indices.
1325
1342
 
1326
- ### countEnabledEdges
1327
-
1328
- ```ts
1329
- countEnabledEdges(
1330
- genome: TelemetryGenome,
1331
- selectedNodes: NodeLike[],
1332
- ): number
1333
- ```
1334
-
1335
- Count enabled edges between the selected nodes in a genome.
1336
-
1337
- Parameters:
1338
- - `genome` - - Genome with connections to inspect.
1339
- - `selectedNodes` - - Nodes forming the graphlet sample.
1340
-
1341
- Returns: Edge count capped at 3.
1342
-
1343
1343
  ## neat/telemetry/metrics/telemetry.metrics.selection.ts
1344
1344
 
1345
1345
  ### getTelemetryCoreSnapshot
@@ -1358,27 +1358,7 @@ Parameters:
1358
1358
  - `sourceEntry` - - Source telemetry object.
1359
1359
  - `fields` - - Core telemetry field keys to preserve.
1360
1360
 
1361
- Returns: Shallow snapshot of core fields that exist on the entry.
1362
-
1363
- ### stripUnselectedTelemetryKeys
1364
-
1365
- ```ts
1366
- stripUnselectedTelemetryKeys(
1367
- sourceEntry: Record<string, unknown>,
1368
- selection: Set<string>,
1369
- fields: TelemetryCoreFields,
1370
- ): Record<string, unknown>
1371
- ```
1372
-
1373
- Remove non-core keys that are not whitelisted by the selection set.
1374
- Mutates the provided entry in-place for efficiency.
1375
-
1376
- Parameters:
1377
- - `sourceEntry` - - Telemetry entry being filtered.
1378
- - `selection` - - Whitelist of additional telemetry keys.
1379
- - `fields` - - Core telemetry field keys that must be preserved.
1380
-
1381
- Returns: The same entry reference after filtering.
1361
+ Returns: Shallow snapshot of core fields that exist on the entry.
1382
1362
 
1383
1363
  ### mergeTelemetryCoreFields
1384
1364
 
@@ -1415,82 +1395,102 @@ Parameters:
1415
1395
  - `telemetryEntry` - - Entry to filter in place.
1416
1396
  - `applyTelemetrySelectFn` - - Selection helper to invoke.
1417
1397
 
1418
- ## neat/telemetry/metrics/telemetry.metrics.complexity.ts
1419
-
1420
- ### collectPopulationCounts
1398
+ ### stripUnselectedTelemetryKeys
1421
1399
 
1422
1400
  ```ts
1423
- collectPopulationCounts(
1424
- populationSnapshot: GenomeDetailed[],
1425
- ): { nodeCounts: number[]; connectionCounts: number[]; }
1401
+ stripUnselectedTelemetryKeys(
1402
+ sourceEntry: Record<string, unknown>,
1403
+ selection: Set<string>,
1404
+ fields: TelemetryCoreFields,
1405
+ ): Record<string, unknown>
1426
1406
  ```
1427
1407
 
1428
- Collect node and connection counts for the population.
1408
+ Remove non-core keys that are not whitelisted by the selection set.
1409
+ Mutates the provided entry in-place for efficiency.
1429
1410
 
1430
1411
  Parameters:
1431
- - `populationSnapshot` - - Population snapshot.
1412
+ - `sourceEntry` - - Telemetry entry being filtered.
1413
+ - `selection` - - Whitelist of additional telemetry keys.
1414
+ - `fields` - - Core telemetry field keys that must be preserved.
1432
1415
 
1433
- Returns: Node and connection counts arrays.
1416
+ Returns: The same entry reference after filtering.
1434
1417
 
1435
- ### computeMeanCounts
1418
+ ## neat/telemetry/metrics/telemetry.metrics.complexity.ts
1419
+
1420
+ ### applyComplexityStatsMonoObjective
1436
1421
 
1437
1422
  ```ts
1438
- computeMeanCounts(
1439
- counts: { nodeCounts: number[]; connectionCounts: number[]; },
1440
- ): { meanNodes: number; meanConns: number; }
1423
+ applyComplexityStatsMonoObjective(
1424
+ telemetryContext: { _lastMeanNodes?: number | undefined; _lastMeanConns?: number | undefined; },
1425
+ telemetryOptions: NeatOptions & TelemetryDiversityOptions,
1426
+ populationSnapshot: GenomeDetailed[],
1427
+ entry: TelemetryEntryRecord,
1428
+ ): void
1441
1429
  ```
1442
1430
 
1443
- Compute mean node and connection counts.
1431
+ Attach complexity stats for mono-objective mode.
1444
1432
 
1445
1433
  Parameters:
1446
- - `counts` - - Node and connection counts arrays.
1447
-
1448
- Returns: Mean node and connection counts.
1434
+ - `telemetryContext` - - Neat-like context with population state.
1435
+ - `telemetryOptions` - - Options controlling complexity telemetry.
1436
+ - `entry` - - Telemetry entry to update.
1449
1437
 
1450
- ### computeMaxCounts
1438
+ ### applyComplexityStatsMultiObjective
1451
1439
 
1452
1440
  ```ts
1453
- computeMaxCounts(
1454
- counts: { nodeCounts: number[]; connectionCounts: number[]; },
1455
- ): { maxNodes: number; maxConns: number; }
1441
+ applyComplexityStatsMultiObjective(
1442
+ telemetryContext: { _lastMeanNodes?: number | undefined; _lastMeanConns?: number | undefined; },
1443
+ telemetryOptions: NeatOptions & TelemetryDiversityOptions,
1444
+ population: GenomeDetailed[],
1445
+ entry: TelemetryEntryRecord,
1446
+ ): void
1456
1447
  ```
1457
1448
 
1458
- Compute max node and connection counts.
1449
+ Attach complexity stats for multi-objective mode.
1459
1450
 
1460
1451
  Parameters:
1461
- - `counts` - - Node and connection counts arrays.
1462
-
1463
- Returns: Max node and connection counts.
1452
+ - `telemetryContext` - - Neat-like context with population state.
1453
+ - `telemetryOptions` - - Options controlling complexity telemetry.
1454
+ - `population` - - Population snapshot.
1455
+ - `entry` - - Telemetry entry to update.
1464
1456
 
1465
- ### computeEnabledRatios
1457
+ ### buildComplexityEntry
1466
1458
 
1467
1459
  ```ts
1468
- computeEnabledRatios(
1469
- populationSnapshot: GenomeDetailed[],
1470
- ): number[]
1460
+ buildComplexityEntry(
1461
+ telemetryOptions: NeatOptions & TelemetryDiversityOptions,
1462
+ meanCounts: { meanNodes: number; meanConns: number; },
1463
+ maxCounts: { maxNodes: number; maxConns: number; },
1464
+ meanEnabledRatio: number,
1465
+ growthValues: { growthNodes: number; growthConns: number; },
1466
+ ): { meanNodes: number; meanConns: number; maxNodes: number; maxConns: number; meanEnabledRatio: number; growthNodes: number; growthConns: number; budgetMaxNodes: number; budgetMaxConns: number; }
1471
1467
  ```
1472
1468
 
1473
- Compute enabled ratios per genome.
1469
+ Build the complexity entry payload for multi-objective mode.
1474
1470
 
1475
1471
  Parameters:
1476
- - `populationSnapshot` - - Population snapshot.
1472
+ - `telemetryOptions` - - Options controlling complexity telemetry.
1473
+ - `meanCounts` - - Mean node/connection counts.
1474
+ - `maxCounts` - - Max node/connection counts.
1475
+ - `meanEnabledRatio` - - Mean enabled ratio.
1476
+ - `growthValues` - - Growth deltas.
1477
1477
 
1478
- Returns: Array of enabled ratios.
1478
+ Returns: Complexity entry payload.
1479
1479
 
1480
- ### computeMeanEnabledRatio
1480
+ ### collectPopulationCounts
1481
1481
 
1482
1482
  ```ts
1483
- computeMeanEnabledRatio(
1484
- enabledRatios: number[],
1485
- ): number
1483
+ collectPopulationCounts(
1484
+ populationSnapshot: GenomeDetailed[],
1485
+ ): { nodeCounts: number[]; connectionCounts: number[]; }
1486
1486
  ```
1487
1487
 
1488
- Compute mean of enabled ratios.
1488
+ Collect node and connection counts for the population.
1489
1489
 
1490
1490
  Parameters:
1491
- - `enabledRatios` - - Enabled ratios per genome.
1491
+ - `populationSnapshot` - - Population snapshot.
1492
1492
 
1493
- Returns: Mean enabled ratio.
1493
+ Returns: Node and connection counts arrays.
1494
1494
 
1495
1495
  ### computeAndStoreGrowthValues
1496
1496
 
@@ -1509,113 +1509,83 @@ Parameters:
1509
1509
 
1510
1510
  Returns: Growth values for nodes and connections.
1511
1511
 
1512
- ### buildComplexityEntry
1512
+ ### computeEnabledRatios
1513
1513
 
1514
1514
  ```ts
1515
- buildComplexityEntry(
1516
- telemetryOptions: NeatOptions & TelemetryDiversityOptions,
1517
- meanCounts: { meanNodes: number; meanConns: number; },
1518
- maxCounts: { maxNodes: number; maxConns: number; },
1519
- meanEnabledRatio: number,
1520
- growthValues: { growthNodes: number; growthConns: number; },
1521
- ): { meanNodes: number; meanConns: number; maxNodes: number; maxConns: number; meanEnabledRatio: number; growthNodes: number; growthConns: number; budgetMaxNodes: number; budgetMaxConns: number; }
1515
+ computeEnabledRatios(
1516
+ populationSnapshot: GenomeDetailed[],
1517
+ ): number[]
1522
1518
  ```
1523
1519
 
1524
- Build the complexity entry payload for multi-objective mode.
1520
+ Compute enabled ratios per genome.
1525
1521
 
1526
1522
  Parameters:
1527
- - `telemetryOptions` - - Options controlling complexity telemetry.
1528
- - `meanCounts` - - Mean node/connection counts.
1529
- - `maxCounts` - - Max node/connection counts.
1530
- - `meanEnabledRatio` - - Mean enabled ratio.
1531
- - `growthValues` - - Growth deltas.
1523
+ - `populationSnapshot` - - Population snapshot.
1532
1524
 
1533
- Returns: Complexity entry payload.
1525
+ Returns: Array of enabled ratios.
1534
1526
 
1535
- ### applyComplexityStatsMultiObjective
1527
+ ### computeMaxCounts
1536
1528
 
1537
1529
  ```ts
1538
- applyComplexityStatsMultiObjective(
1539
- telemetryContext: { _lastMeanNodes?: number | undefined; _lastMeanConns?: number | undefined; },
1540
- telemetryOptions: NeatOptions & TelemetryDiversityOptions,
1541
- population: GenomeDetailed[],
1542
- entry: TelemetryEntryRecord,
1543
- ): void
1530
+ computeMaxCounts(
1531
+ counts: { nodeCounts: number[]; connectionCounts: number[]; },
1532
+ ): { maxNodes: number; maxConns: number; }
1544
1533
  ```
1545
1534
 
1546
- Attach complexity stats for multi-objective mode.
1535
+ Compute max node and connection counts.
1547
1536
 
1548
1537
  Parameters:
1549
- - `telemetryContext` - - Neat-like context with population state.
1550
- - `telemetryOptions` - - Options controlling complexity telemetry.
1551
- - `population` - - Population snapshot.
1552
- - `entry` - - Telemetry entry to update.
1538
+ - `counts` - - Node and connection counts arrays.
1553
1539
 
1554
- ### applyComplexityStatsMonoObjective
1540
+ Returns: Max node and connection counts.
1541
+
1542
+ ### computeMeanCounts
1555
1543
 
1556
1544
  ```ts
1557
- applyComplexityStatsMonoObjective(
1558
- telemetryContext: { _lastMeanNodes?: number | undefined; _lastMeanConns?: number | undefined; },
1559
- telemetryOptions: NeatOptions & TelemetryDiversityOptions,
1560
- populationSnapshot: GenomeDetailed[],
1561
- entry: TelemetryEntryRecord,
1562
- ): void
1545
+ computeMeanCounts(
1546
+ counts: { nodeCounts: number[]; connectionCounts: number[]; },
1547
+ ): { meanNodes: number; meanConns: number; }
1563
1548
  ```
1564
1549
 
1565
- Attach complexity stats for mono-objective mode.
1550
+ Compute mean node and connection counts.
1566
1551
 
1567
1552
  Parameters:
1568
- - `telemetryContext` - - Neat-like context with population state.
1569
- - `telemetryOptions` - - Options controlling complexity telemetry.
1570
- - `entry` - - Telemetry entry to update.
1553
+ - `counts` - - Node and connection counts arrays.
1571
1554
 
1572
- ## neat/telemetry/metrics/telemetry.metrics.objectives.ts
1555
+ Returns: Mean node and connection counts.
1573
1556
 
1574
- ### computeHyperVolumeProxy
1557
+ ### computeMeanEnabledRatio
1575
1558
 
1576
1559
  ```ts
1577
- computeHyperVolumeProxy(
1578
- telemetryOptions: NeatOptions & TelemetryDiversityOptions,
1579
- population: GenomeDetailed[],
1560
+ computeMeanEnabledRatio(
1561
+ enabledRatios: number[],
1580
1562
  ): number
1581
1563
  ```
1582
1564
 
1583
- Compute a hypervolume-like proxy for the Pareto front.
1565
+ Compute mean of enabled ratios.
1584
1566
 
1585
1567
  Parameters:
1586
- - `telemetryOptions` - - Options controlling complexity metric.
1587
- - `population` - - Population snapshot.
1588
-
1589
- Returns: Hypervolume proxy value.
1590
-
1591
- ### computeParetoFrontSizes
1592
-
1593
- ```ts
1594
- computeParetoFrontSizes(
1595
- population: GenomeDetailed[],
1596
- ): number[]
1597
- ```
1598
-
1599
- Compute sizes of early Pareto fronts.
1568
+ - `enabledRatios` - - Enabled ratios per genome.
1600
1569
 
1601
- Parameters:
1602
- - `population` - - Population snapshot.
1570
+ Returns: Mean enabled ratio.
1603
1571
 
1604
- Returns: Array of front sizes (rank 0..4).
1572
+ ## neat/telemetry/metrics/telemetry.metrics.objectives.ts
1605
1573
 
1606
- ### applyObjectiveImportance
1574
+ ### applyHypervolumeTelemetry
1607
1575
 
1608
1576
  ```ts
1609
- applyObjectiveImportance(
1610
- telemetryContext: { _lastObjImportance?: ObjImportance | undefined; },
1577
+ applyHypervolumeTelemetry(
1578
+ telemetryOptions: NeatOptions & TelemetryDiversityOptions,
1579
+ hyperVolumeProxy: number,
1611
1580
  entry: TelemetryEntryRecord,
1612
1581
  ): void
1613
1582
  ```
1614
1583
 
1615
- Apply the most recent objective importance snapshot.
1584
+ Attach hypervolume scalar when requested.
1616
1585
 
1617
1586
  Parameters:
1618
- - `telemetryContext` - - Neat-like context with objective importance.
1587
+ - `telemetryOptions` - - Options controlling telemetry fields.
1588
+ - `hyperVolumeProxy` - - Hypervolume proxy value.
1619
1589
  - `entry` - - Telemetry entry to update.
1620
1590
 
1621
1591
  ### applyObjectiveAges
@@ -1650,19 +1620,19 @@ Parameters:
1650
1620
  - `entry` - - Telemetry entry to update.
1651
1621
  - `generation` - - Generation index for event records.
1652
1622
 
1653
- ### applySpeciesAllocation
1623
+ ### applyObjectiveImportance
1654
1624
 
1655
1625
  ```ts
1656
- applySpeciesAllocation(
1657
- telemetryContext: { _lastOffspringAlloc?: SpeciesAlloc[] | undefined; },
1626
+ applyObjectiveImportance(
1627
+ telemetryContext: { _lastObjImportance?: ObjImportance | undefined; },
1658
1628
  entry: TelemetryEntryRecord,
1659
1629
  ): void
1660
1630
  ```
1661
1631
 
1662
- Apply per-species offspring allocation snapshot.
1632
+ Apply the most recent objective importance snapshot.
1663
1633
 
1664
1634
  Parameters:
1665
- - `telemetryContext` - - Neat-like context with allocation snapshot.
1635
+ - `telemetryContext` - - Neat-like context with objective importance.
1666
1636
  - `entry` - - Telemetry entry to update.
1667
1637
 
1668
1638
  ### applyObjectivesSnapshot
@@ -1680,23 +1650,53 @@ Parameters:
1680
1650
  - `telemetryContext` - - Neat-like context with objective provider.
1681
1651
  - `entry` - - Telemetry entry to update.
1682
1652
 
1683
- ### applyHypervolumeTelemetry
1653
+ ### applySpeciesAllocation
1684
1654
 
1685
1655
  ```ts
1686
- applyHypervolumeTelemetry(
1687
- telemetryOptions: NeatOptions & TelemetryDiversityOptions,
1688
- hyperVolumeProxy: number,
1656
+ applySpeciesAllocation(
1657
+ telemetryContext: { _lastOffspringAlloc?: SpeciesAlloc[] | undefined; },
1689
1658
  entry: TelemetryEntryRecord,
1690
1659
  ): void
1691
1660
  ```
1692
1661
 
1693
- Attach hypervolume scalar when requested.
1662
+ Apply per-species offspring allocation snapshot.
1694
1663
 
1695
1664
  Parameters:
1696
- - `telemetryOptions` - - Options controlling telemetry fields.
1697
- - `hyperVolumeProxy` - - Hypervolume proxy value.
1665
+ - `telemetryContext` - - Neat-like context with allocation snapshot.
1698
1666
  - `entry` - - Telemetry entry to update.
1699
1667
 
1668
+ ### computeHyperVolumeProxy
1669
+
1670
+ ```ts
1671
+ computeHyperVolumeProxy(
1672
+ telemetryOptions: NeatOptions & TelemetryDiversityOptions,
1673
+ population: GenomeDetailed[],
1674
+ ): number
1675
+ ```
1676
+
1677
+ Compute a hypervolume-like proxy for the Pareto front.
1678
+
1679
+ Parameters:
1680
+ - `telemetryOptions` - - Options controlling complexity metric.
1681
+ - `population` - - Population snapshot.
1682
+
1683
+ Returns: Hypervolume proxy value.
1684
+
1685
+ ### computeParetoFrontSizes
1686
+
1687
+ ```ts
1688
+ computeParetoFrontSizes(
1689
+ population: GenomeDetailed[],
1690
+ ): number[]
1691
+ ```
1692
+
1693
+ Compute sizes of early Pareto fronts.
1694
+
1695
+ Parameters:
1696
+ - `population` - - Population snapshot.
1697
+
1698
+ Returns: Array of front sizes (rank 0..4).
1699
+
1700
1700
  ## neat/telemetry/metrics/telemetry.metrics.performance.ts
1701
1701
 
1702
1702
  ### applyPerformanceStats