@reicek/neataptic-ts 0.1.24 → 0.1.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/copilot-instructions.md +11 -0
- package/.github/skills/trace-analyzer-extension/SKILL.md +3 -3
- package/.github/skills/trace-analyzer-extension/assets/extension-checklist.md +1 -1
- package/.github/skills/trace-analyzer-extension/references/analyzer-extension-workflow.md +1 -1
- package/.github/skills/trace-audit-reporting/SKILL.md +3 -3
- package/.github/skills/trace-audit-reporting/references/trace-analysis-workflow.md +1 -1
- package/.github/workflows/ci.yml +3 -3
- package/.github/workflows/deploy-pages.yml +6 -6
- package/.github/workflows/manual_release_pipeline.yml +3 -3
- package/.github/workflows/publish.yml +18 -19
- package/.github/workflows/release_dispatch.yml +3 -3
- package/package.json +26 -20
- package/plans/Flappy_Bird_Folder_Documentation_Pass.md +4 -4
- package/plans/README.md +24 -0
- package/plans/Roadmap.md +62 -40
- package/plans/analyze-trace-solid-split.plans.md +66 -0
- package/plans/architecture-solid-split.plans.md +9 -15
- package/plans/asciiMaze-typescript-repair.plans.md +1 -1
- package/plans/generate-docs-solid-split.plans.md +87 -0
- package/plans/methods-docs.plans.md +25 -1
- package/plans/methods-solid-split.plans.md +14 -14
- package/plans/neat-docs.plans.md +9 -1
- package/plans/neat-test-surface-repair.plans.md +1 -1
- package/plans/render-docs-html-solid-split.plans.md +68 -0
- package/plans/src-no-explicit-any-cleanup.plans.md +1 -1
- package/plans/utils-docs.plans.md +6 -1
- package/scripts/analyze-trace/analyze-trace.analysis.ts +479 -0
- package/scripts/analyze-trace/analyze-trace.constants.ts +35 -0
- package/scripts/analyze-trace/analyze-trace.io.ts +69 -0
- package/scripts/analyze-trace/analyze-trace.report.ts +100 -0
- package/scripts/analyze-trace/analyze-trace.shared.ts +116 -0
- package/scripts/analyze-trace/analyze-trace.ts +45 -0
- package/scripts/analyze-trace/analyze-trace.types.ts +72 -0
- package/scripts/assets/theme.css +80 -23
- package/scripts/copy-examples.ts +239 -0
- package/scripts/export-onnx.ts +223 -0
- package/scripts/generate-bench-tables.ts +378 -37
- package/scripts/generate-docs/generate-docs.constants.ts +107 -0
- package/scripts/generate-docs/generate-docs.order.ts +355 -0
- package/scripts/generate-docs/generate-docs.state.ts +31 -0
- package/scripts/generate-docs/generate-docs.targets.ts +165 -0
- package/scripts/generate-docs/generate-docs.ts +63 -0
- package/scripts/generate-docs/generate-docs.types.ts +112 -0
- package/scripts/generate-docs/output/generate-docs.output.folder-index.utils.ts +167 -0
- package/scripts/generate-docs/output/generate-docs.output.ordering.utils.ts +353 -0
- package/scripts/generate-docs/output/generate-docs.output.readme.utils.ts +420 -0
- package/scripts/generate-docs/output/generate-docs.output.ts +123 -0
- package/scripts/generate-docs/output/generate-docs.output.warnings.utils.ts +219 -0
- package/scripts/generate-docs/symbols/generate-docs.symbols.collection.utils.ts +365 -0
- package/scripts/generate-docs/symbols/generate-docs.symbols.jsdoc.utils.ts +373 -0
- package/scripts/generate-docs/symbols/generate-docs.symbols.normalize.utils.ts +155 -0
- package/scripts/generate-docs/symbols/generate-docs.symbols.render.utils.ts +149 -0
- package/scripts/generate-docs/symbols/generate-docs.symbols.signature.utils.ts +289 -0
- package/scripts/generate-docs/symbols/generate-docs.symbols.ts +11 -0
- package/scripts/mermaid-cli.mjs +102 -22
- package/scripts/mermaid-cli.ts +736 -0
- package/scripts/render-docs-html/render-docs-html.assets.ts +54 -0
- package/scripts/render-docs-html/render-docs-html.mermaid.ts +245 -0
- package/scripts/{render-docs-html.sidebar.ts → render-docs-html/render-docs-html.navigation.ts} +141 -144
- package/scripts/render-docs-html/render-docs-html.pages.ts +333 -0
- package/scripts/render-docs-html/render-docs-html.shared.ts +333 -0
- package/scripts/render-docs-html/render-docs-html.types.ts +42 -0
- package/scripts/render-docs-html.ts +23 -587
- package/scripts/run-docs.ts +238 -0
- package/scripts/write-dist-docs-pkg.ts +40 -0
- package/src/README.md +75 -75
- package/src/architecture/connection/README.md +5 -5
- package/src/architecture/layer/README.md +508 -508
- package/src/architecture/network/README.md +1458 -1458
- package/src/architecture/network/activate/README.md +694 -694
- package/src/architecture/network/bootstrap/README.md +77 -77
- package/src/architecture/network/connect/README.md +74 -74
- package/src/architecture/network/deterministic/README.md +135 -135
- package/src/architecture/network/evolve/README.md +364 -364
- package/src/architecture/network/gating/README.md +130 -130
- package/src/architecture/network/genetic/README.md +399 -399
- package/src/architecture/network/mutate/README.md +897 -897
- package/src/architecture/network/onnx/README.md +720 -720
- package/src/architecture/network/onnx/export/README.md +728 -728
- package/src/architecture/network/onnx/export/layers/README.md +450 -450
- package/src/architecture/network/onnx/import/README.md +618 -618
- package/src/architecture/network/onnx/schema/README.md +32 -32
- package/src/architecture/network/prune/README.md +245 -245
- package/src/architecture/network/remove/README.md +135 -135
- package/src/architecture/network/runtime/README.md +106 -106
- package/src/architecture/network/serialize/README.md +542 -542
- package/src/architecture/network/slab/README.md +608 -608
- package/src/architecture/network/standalone/README.md +212 -212
- package/src/architecture/network/stats/README.md +84 -84
- package/src/architecture/network/topology/README.md +465 -465
- package/src/architecture/network/training/README.md +200 -200
- package/src/architecture/node/README.md +5 -5
- package/src/architecture/nodePool/README.md +14 -14
- package/src/methods/README.md +99 -99
- package/src/methods/activation/README.md +189 -189
- package/src/methods/cost/README.md +131 -131
- package/src/methods/rate/README.md +86 -86
- package/src/multithreading/README.md +77 -77
- package/src/multithreading/workers/browser/README.md +8 -8
- package/src/multithreading/workers/node/README.md +8 -8
- package/src/neat/README.md +148 -148
- package/src/neat/adaptive/README.md +120 -120
- package/src/neat/adaptive/acceptance/README.md +40 -40
- package/src/neat/adaptive/complexity/README.md +137 -137
- package/src/neat/adaptive/core/README.md +197 -197
- package/src/neat/adaptive/lineage/README.md +90 -90
- package/src/neat/adaptive/mutation/README.md +284 -284
- package/src/neat/compat/README.md +43 -43
- package/src/neat/compat/core/README.md +90 -90
- package/src/neat/diversity/README.md +35 -35
- package/src/neat/diversity/core/README.md +88 -88
- package/src/neat/evaluate/README.md +85 -85
- package/src/neat/evaluate/auto-distance/README.md +75 -75
- package/src/neat/evaluate/entropy-compat/README.md +37 -37
- package/src/neat/evaluate/entropy-sharing/README.md +43 -43
- package/src/neat/evaluate/fitness/README.md +23 -23
- package/src/neat/evaluate/novelty/README.md +120 -120
- package/src/neat/evaluate/objectives/README.md +17 -17
- package/src/neat/evaluate/shared/README.md +94 -94
- package/src/neat/evolve/README.md +96 -96
- package/src/neat/evolve/adaptive/README.md +60 -60
- package/src/neat/evolve/objectives/README.md +63 -63
- package/src/neat/evolve/offspring/README.md +56 -56
- package/src/neat/evolve/population/README.md +171 -171
- package/src/neat/evolve/runtime/README.md +79 -79
- package/src/neat/evolve/speciation/README.md +74 -74
- package/src/neat/evolve/warnings/README.md +10 -10
- package/src/neat/export/README.md +114 -114
- package/src/neat/helpers/README.md +50 -50
- package/src/neat/init/README.md +9 -9
- package/src/neat/lineage/core/README.md +101 -101
- package/src/neat/multiobjective/category/README.md +74 -74
- package/src/neat/multiobjective/crowding/README.md +272 -272
- package/src/neat/multiobjective/dominance/README.md +171 -171
- package/src/neat/multiobjective/fronts/README.md +68 -68
- package/src/neat/multiobjective/metrics/README.md +43 -43
- package/src/neat/multiobjective/objectives/README.md +31 -31
- package/src/neat/multiobjective/shared/README.md +27 -27
- package/src/neat/mutation/README.md +97 -97
- package/src/neat/mutation/add-conn/README.md +115 -115
- package/src/neat/mutation/add-node/README.md +126 -126
- package/src/neat/mutation/flow/README.md +149 -149
- package/src/neat/mutation/repair/README.md +185 -185
- package/src/neat/mutation/select/README.md +117 -117
- package/src/neat/mutation/shared/README.md +32 -32
- package/src/neat/objectives/README.md +25 -25
- package/src/neat/objectives/core/README.md +67 -67
- package/src/neat/pruning/README.md +40 -40
- package/src/neat/pruning/core/README.md +171 -171
- package/src/neat/pruning/facade/README.md +32 -32
- package/src/neat/rng/README.md +104 -104
- package/src/neat/rng/core/README.md +137 -137
- package/src/neat/rng/facade/README.md +50 -50
- package/src/neat/selection/README.md +111 -111
- package/src/neat/selection/core/README.md +227 -227
- package/src/neat/selection/facade/README.md +61 -61
- package/src/neat/shared/README.md +163 -163
- package/src/neat/speciation/README.md +31 -31
- package/src/neat/speciation/threshold/README.md +35 -35
- package/src/neat/species/README.md +25 -25
- package/src/neat/species/core/README.md +20 -20
- package/src/neat/species/core/shared/README.md +18 -18
- package/src/neat/species/history/context/README.md +22 -22
- package/src/neat/telemetry/accessors/README.md +58 -58
- package/src/neat/telemetry/exports/README.md +233 -233
- package/src/neat/telemetry/facade/README.md +252 -252
- package/src/neat/telemetry/facade/archive/README.md +57 -57
- package/src/neat/telemetry/facade/buffer/README.md +43 -43
- package/src/neat/telemetry/facade/lineage/README.md +12 -12
- package/src/neat/telemetry/facade/objectives/README.md +44 -44
- package/src/neat/telemetry/facade/runtime/README.md +26 -26
- package/src/neat/telemetry/facade/species/README.md +27 -27
- package/src/neat/telemetry/metrics/README.md +696 -696
- package/src/neat/telemetry/recorder/README.md +57 -57
- package/src/neat/telemetry/types/README.md +32 -32
- package/src/neat/topology-intent/README.md +75 -75
- package/src/utils/README.md +193 -193
- package/test/examples/asciiMaze/browser-entry/README.md +92 -92
- package/test/examples/asciiMaze/dashboardManager/README.md +109 -109
- package/test/examples/asciiMaze/dashboardManager/telemetry/README.md +28 -28
- package/test/examples/asciiMaze/evolutionEngine/README.md +1527 -1527
- package/test/examples/asciiMaze/mazeMovement/README.md +105 -105
- package/test/examples/asciiMaze/mazeMovement/finalization/README.md +16 -16
- package/test/examples/asciiMaze/mazeMovement/policy/README.md +57 -57
- package/test/examples/asciiMaze/mazeMovement/runtime/README.md +52 -52
- package/test/examples/asciiMaze/mazeMovement/shaping/README.md +46 -46
- package/test/examples/flappy_bird/browser-entry/README.md +508 -508
- package/test/examples/flappy_bird/browser-entry/host/README.md +101 -101
- package/test/examples/flappy_bird/browser-entry/host/resize/README.md +144 -144
- package/test/examples/flappy_bird/browser-entry/network-view/README.md +194 -194
- package/test/examples/flappy_bird/browser-entry/playback/README.md +278 -278
- package/test/examples/flappy_bird/browser-entry/playback/background/README.md +129 -129
- package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/README.md +502 -502
- package/test/examples/flappy_bird/browser-entry/playback/frame-render/README.md +139 -139
- package/test/examples/flappy_bird/browser-entry/playback/snapshot/README.md +10 -10
- package/test/examples/flappy_bird/browser-entry/playback/trail/README.md +43 -43
- package/test/examples/flappy_bird/browser-entry/playback/worker-channel/README.md +30 -30
- package/test/examples/flappy_bird/browser-entry/runtime/README.md +59 -59
- package/test/examples/flappy_bird/browser-entry/visualization/README.md +276 -276
- package/test/examples/flappy_bird/browser-entry/worker-channel/README.md +16 -16
- package/test/examples/flappy_bird/constants/README.md +1070 -1070
- package/test/examples/flappy_bird/environment/README.md +22 -22
- package/test/examples/flappy_bird/evaluation/README.md +32 -32
- package/test/examples/flappy_bird/evaluation/rollout/README.md +141 -141
- package/test/examples/flappy_bird/flappy-evolution-worker/README.md +425 -425
- package/test/examples/flappy_bird/simulation-shared/README.md +170 -170
- package/test/examples/flappy_bird/simulation-shared/observation/README.md +109 -109
- package/test/examples/flappy_bird/trainer/README.md +325 -325
- package/test/examples/flappy_bird/trainer/evaluation/README.md +74 -74
- package/scripts/analyze-trace.ts +0 -590
- package/scripts/copy-examples.mjs +0 -114
- package/scripts/export-onnx.mjs +0 -86
- package/scripts/generate-bench-tables.mjs +0 -182
- package/scripts/generate-docs.ts +0 -2900
- package/scripts/write-dist-docs-pkg.mjs +0 -16
|
@@ -100,6 +100,41 @@ adjustCompatibilityThreshold(
|
|
|
100
100
|
);
|
|
101
101
|
```
|
|
102
102
|
|
|
103
|
+
### clampCompatibilityThreshold
|
|
104
|
+
|
|
105
|
+
```ts
|
|
106
|
+
clampCompatibilityThreshold(
|
|
107
|
+
options: SpeciationOptions,
|
|
108
|
+
minCompatibilityThreshold: number,
|
|
109
|
+
maxCompatibilityThreshold: number,
|
|
110
|
+
): void
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Clamp the compatibility threshold to configured bounds.
|
|
114
|
+
|
|
115
|
+
This is the final safety rail for callers that already have a threshold value
|
|
116
|
+
but need to ensure it remains inside the allowed range. Unlike the PID clamp
|
|
117
|
+
above, this helper only limits the option value itself; it does not interpret
|
|
118
|
+
species-count error or recalculate the integral term.
|
|
119
|
+
|
|
120
|
+
Read this as the small "no surprises" helper at the end of the loop. Once
|
|
121
|
+
the controller has chosen a new threshold candidate, this function makes the
|
|
122
|
+
public option safe to persist into the next generation even if the caller did
|
|
123
|
+
not come through the full PID path.
|
|
124
|
+
|
|
125
|
+
Parameters:
|
|
126
|
+
- `options` - - Speciation options.
|
|
127
|
+
- `minCompatibilityThreshold` - - Lower clamp bound.
|
|
128
|
+
- `maxCompatibilityThreshold` - - Upper clamp bound.
|
|
129
|
+
|
|
130
|
+
Returns: Nothing.
|
|
131
|
+
|
|
132
|
+
Example:
|
|
133
|
+
|
|
134
|
+
```ts
|
|
135
|
+
clampCompatibilityThreshold(neat.options, 1, 10);
|
|
136
|
+
```
|
|
137
|
+
|
|
103
138
|
### computePidThreshold
|
|
104
139
|
|
|
105
140
|
```ts
|
|
@@ -152,38 +187,3 @@ const nextThreshold = computePidThreshold(
|
|
|
152
187
|
10,
|
|
153
188
|
);
|
|
154
189
|
```
|
|
155
|
-
|
|
156
|
-
### clampCompatibilityThreshold
|
|
157
|
-
|
|
158
|
-
```ts
|
|
159
|
-
clampCompatibilityThreshold(
|
|
160
|
-
options: SpeciationOptions,
|
|
161
|
-
minCompatibilityThreshold: number,
|
|
162
|
-
maxCompatibilityThreshold: number,
|
|
163
|
-
): void
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
Clamp the compatibility threshold to configured bounds.
|
|
167
|
-
|
|
168
|
-
This is the final safety rail for callers that already have a threshold value
|
|
169
|
-
but need to ensure it remains inside the allowed range. Unlike the PID clamp
|
|
170
|
-
above, this helper only limits the option value itself; it does not interpret
|
|
171
|
-
species-count error or recalculate the integral term.
|
|
172
|
-
|
|
173
|
-
Read this as the small "no surprises" helper at the end of the loop. Once
|
|
174
|
-
the controller has chosen a new threshold candidate, this function makes the
|
|
175
|
-
public option safe to persist into the next generation even if the caller did
|
|
176
|
-
not come through the full PID path.
|
|
177
|
-
|
|
178
|
-
Parameters:
|
|
179
|
-
- `options` - - Speciation options.
|
|
180
|
-
- `minCompatibilityThreshold` - - Lower clamp bound.
|
|
181
|
-
- `maxCompatibilityThreshold` - - Upper clamp bound.
|
|
182
|
-
|
|
183
|
-
Returns: Nothing.
|
|
184
|
-
|
|
185
|
-
Example:
|
|
186
|
-
|
|
187
|
-
```ts
|
|
188
|
-
clampCompatibilityThreshold(neat.options, 1, 10);
|
|
189
|
-
```
|
|
@@ -53,31 +53,6 @@ const history = neat.getSpeciesHistory();
|
|
|
53
53
|
|
|
54
54
|
## neat/species/species.ts
|
|
55
55
|
|
|
56
|
-
### getSpeciesStats
|
|
57
|
-
|
|
58
|
-
```ts
|
|
59
|
-
getSpeciesStats(): { id: number; size: number; bestScore: number; lastImproved: number; }[]
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
Get lightweight per-species statistics for the current population.
|
|
63
|
-
|
|
64
|
-
This is the shortest read path into the species system. It is useful when a
|
|
65
|
-
caller needs dashboard-friendly snapshots such as current species sizes,
|
|
66
|
-
recent improvement timestamps, or the best score per species without pulling
|
|
67
|
-
the heavier generation-by-generation history buffer.
|
|
68
|
-
|
|
69
|
-
Parameters:
|
|
70
|
-
- `this` - - NEAT host exposing the internal species registry.
|
|
71
|
-
|
|
72
|
-
Returns: Compact per-species summaries suitable for reporting.
|
|
73
|
-
|
|
74
|
-
Example:
|
|
75
|
-
|
|
76
|
-
```ts
|
|
77
|
-
const speciesSummaries = neat.getSpeciesStats();
|
|
78
|
-
console.table(speciesSummaries);
|
|
79
|
-
```
|
|
80
|
-
|
|
81
56
|
### getSpeciesHistory
|
|
82
57
|
|
|
83
58
|
```ts
|
|
@@ -111,3 +86,28 @@ Example:
|
|
|
111
86
|
const speciesHistory = neat.getSpeciesHistory();
|
|
112
87
|
console.log(speciesHistory.at(-1));
|
|
113
88
|
```
|
|
89
|
+
|
|
90
|
+
### getSpeciesStats
|
|
91
|
+
|
|
92
|
+
```ts
|
|
93
|
+
getSpeciesStats(): { id: number; size: number; bestScore: number; lastImproved: number; }[]
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Get lightweight per-species statistics for the current population.
|
|
97
|
+
|
|
98
|
+
This is the shortest read path into the species system. It is useful when a
|
|
99
|
+
caller needs dashboard-friendly snapshots such as current species sizes,
|
|
100
|
+
recent improvement timestamps, or the best score per species without pulling
|
|
101
|
+
the heavier generation-by-generation history buffer.
|
|
102
|
+
|
|
103
|
+
Parameters:
|
|
104
|
+
- `this` - - NEAT host exposing the internal species registry.
|
|
105
|
+
|
|
106
|
+
Returns: Compact per-species summaries suitable for reporting.
|
|
107
|
+
|
|
108
|
+
Example:
|
|
109
|
+
|
|
110
|
+
```ts
|
|
111
|
+
const speciesSummaries = neat.getSpeciesStats();
|
|
112
|
+
console.table(speciesSummaries);
|
|
113
|
+
```
|
|
@@ -36,26 +36,6 @@ flowchart TD
|
|
|
36
36
|
|
|
37
37
|
## neat/species/core/species.core.ts
|
|
38
38
|
|
|
39
|
-
### shouldAugmentExtendedHistory
|
|
40
|
-
|
|
41
|
-
```ts
|
|
42
|
-
shouldAugmentExtendedHistory(
|
|
43
|
-
options: NeatOptions | undefined,
|
|
44
|
-
): boolean
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
Check whether extended species history should be augmented.
|
|
48
|
-
|
|
49
|
-
This is the policy gate for the whole chapter. The read-side species history
|
|
50
|
-
flow uses it to decide whether returning the recorded rows is already enough
|
|
51
|
-
or whether the caller explicitly asked for the richer innovation-range and
|
|
52
|
-
enabled-ratio view.
|
|
53
|
-
|
|
54
|
-
Parameters:
|
|
55
|
-
- `options` - - Current NEAT options.
|
|
56
|
-
|
|
57
|
-
Returns: `true` when extended history is enabled.
|
|
58
|
-
|
|
59
39
|
### backfillExtendedHistory
|
|
60
40
|
|
|
61
41
|
```ts
|
|
@@ -90,3 +70,23 @@ if (shouldAugmentExtendedHistory(neat.options)) {
|
|
|
90
70
|
backfillExtendedHistory(history, neat);
|
|
91
71
|
}
|
|
92
72
|
```
|
|
73
|
+
|
|
74
|
+
### shouldAugmentExtendedHistory
|
|
75
|
+
|
|
76
|
+
```ts
|
|
77
|
+
shouldAugmentExtendedHistory(
|
|
78
|
+
options: NeatOptions | undefined,
|
|
79
|
+
): boolean
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Check whether extended species history should be augmented.
|
|
83
|
+
|
|
84
|
+
This is the policy gate for the whole chapter. The read-side species history
|
|
85
|
+
flow uses it to decide whether returning the recorded rows is already enough
|
|
86
|
+
or whether the caller explicitly asked for the richer innovation-range and
|
|
87
|
+
enabled-ratio view.
|
|
88
|
+
|
|
89
|
+
Parameters:
|
|
90
|
+
- `options` - - Current NEAT options.
|
|
91
|
+
|
|
92
|
+
Returns: `true` when extended history is enabled.
|
|
@@ -33,6 +33,24 @@ flowchart TD
|
|
|
33
33
|
|
|
34
34
|
## neat/species/core/shared/species.core.shared.ts
|
|
35
35
|
|
|
36
|
+
### SpeciesConnectionSummary
|
|
37
|
+
|
|
38
|
+
Aggregated innovation coverage for the genomes currently assigned to one species.
|
|
39
|
+
|
|
40
|
+
The history backfill path uses this compact shape to answer two questions that
|
|
41
|
+
are useful in telemetry dashboards:
|
|
42
|
+
|
|
43
|
+
- how wide the inherited innovation span is across the species members,
|
|
44
|
+
- how many of those structural genes are still enabled.
|
|
45
|
+
|
|
46
|
+
Those two values are enough to make extended history rows much more
|
|
47
|
+
explanatory without forcing the species-reporting surface to retain every
|
|
48
|
+
connection-level detail from every generation.
|
|
49
|
+
|
|
50
|
+
Treat it as a reporting summary, not as a lossless reconstruction format.
|
|
51
|
+
The goal is to explain structural breadth and retention at a glance, not to
|
|
52
|
+
preserve every innovation id for downstream mutation logic.
|
|
53
|
+
|
|
36
54
|
### summarizeSpeciesConnections
|
|
37
55
|
|
|
38
56
|
```ts
|
|
@@ -72,21 +90,3 @@ Example:
|
|
|
72
90
|
const summary = summarizeSpeciesConnections(species.members, neat._fallbackInnov);
|
|
73
91
|
console.log(summary.innovationRange, summary.enabledRatio);
|
|
74
92
|
```
|
|
75
|
-
|
|
76
|
-
### SpeciesConnectionSummary
|
|
77
|
-
|
|
78
|
-
Aggregated innovation coverage for the genomes currently assigned to one species.
|
|
79
|
-
|
|
80
|
-
The history backfill path uses this compact shape to answer two questions that
|
|
81
|
-
are useful in telemetry dashboards:
|
|
82
|
-
|
|
83
|
-
- how wide the inherited innovation span is across the species members,
|
|
84
|
-
- how many of those structural genes are still enabled.
|
|
85
|
-
|
|
86
|
-
Those two values are enough to make extended history rows much more
|
|
87
|
-
explanatory without forcing the species-reporting surface to retain every
|
|
88
|
-
connection-level detail from every generation.
|
|
89
|
-
|
|
90
|
-
Treat it as a reporting summary, not as a lossless reconstruction format.
|
|
91
|
-
The goal is to explain structural breadth and retention at a glance, not to
|
|
92
|
-
preserve every innovation id for downstream mutation logic.
|
|
@@ -23,6 +23,28 @@ Read this chapter in two steps:
|
|
|
23
23
|
|
|
24
24
|
## neat/species/history/context/species.history.context.ts
|
|
25
25
|
|
|
26
|
+
### ResolvedSpeciesHistoryContext
|
|
27
|
+
|
|
28
|
+
Resolved host data needed to serve a species-history read.
|
|
29
|
+
|
|
30
|
+
The public `getSpeciesHistory()` facade should not need to know how the NEAT
|
|
31
|
+
controller stores its history buffer or which internal fields are required to
|
|
32
|
+
support optional extended-history augmentation. This context keeps that
|
|
33
|
+
plumbing in one place.
|
|
34
|
+
|
|
35
|
+
The three fields map to the three setup concerns behind a history read:
|
|
36
|
+
|
|
37
|
+
- `speciesHistory` is the stored generation-by-generation buffer,
|
|
38
|
+
- `backfillContext` carries the internal data needed only when extended
|
|
39
|
+
history enrichment is allowed,
|
|
40
|
+
- `neatOptions` carries the policy switches that decide whether that
|
|
41
|
+
enrichment path should run.
|
|
42
|
+
|
|
43
|
+
Read this type as the boundary between raw controller storage and the richer
|
|
44
|
+
history-read logic. Once this object has been resolved, later helpers can ask
|
|
45
|
+
"should we augment?" and "what data do we already have?" without knowing
|
|
46
|
+
where the controller originally stored each ingredient.
|
|
47
|
+
|
|
26
48
|
### resolveSpeciesHistoryContext
|
|
27
49
|
|
|
28
50
|
```ts
|
|
@@ -62,25 +84,3 @@ if (historyContext.neatOptions?.enableSpeciesAugmentation) {
|
|
|
62
84
|
|
|
63
85
|
console.log(historyContext.speciesHistory.length);
|
|
64
86
|
```
|
|
65
|
-
|
|
66
|
-
### ResolvedSpeciesHistoryContext
|
|
67
|
-
|
|
68
|
-
Resolved host data needed to serve a species-history read.
|
|
69
|
-
|
|
70
|
-
The public `getSpeciesHistory()` facade should not need to know how the NEAT
|
|
71
|
-
controller stores its history buffer or which internal fields are required to
|
|
72
|
-
support optional extended-history augmentation. This context keeps that
|
|
73
|
-
plumbing in one place.
|
|
74
|
-
|
|
75
|
-
The three fields map to the three setup concerns behind a history read:
|
|
76
|
-
|
|
77
|
-
- `speciesHistory` is the stored generation-by-generation buffer,
|
|
78
|
-
- `backfillContext` carries the internal data needed only when extended
|
|
79
|
-
history enrichment is allowed,
|
|
80
|
-
- `neatOptions` carries the policy switches that decide whether that
|
|
81
|
-
enrichment path should run.
|
|
82
|
-
|
|
83
|
-
Read this type as the boundary between raw controller storage and the richer
|
|
84
|
-
history-read logic. Once this object has been resolved, later helpers can ask
|
|
85
|
-
"should we augment?" and "what data do we already have?" without knowing
|
|
86
|
-
where the controller originally stored each ingredient.
|
|
@@ -26,30 +26,32 @@ exposes cached diversity and coarse timing data.
|
|
|
26
26
|
|
|
27
27
|
## neat/telemetry/accessors/telemetry.accessors.ts
|
|
28
28
|
|
|
29
|
-
###
|
|
29
|
+
### buildLineageSnapshot
|
|
30
30
|
|
|
31
31
|
```ts
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
buildLineageSnapshot(
|
|
33
|
+
population: { _id?: number | undefined; _parents?: number[] | undefined; }[],
|
|
34
|
+
limit: number,
|
|
35
|
+
): { id: number; parents: number[]; }[]
|
|
35
36
|
```
|
|
36
37
|
|
|
37
|
-
|
|
38
|
+
Snapshot lineage metadata for the first `limit` genomes.
|
|
38
39
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
The accessor deliberately returns only `{ id, parents }` pairs. That keeps
|
|
41
|
+
lineage snapshots lightweight enough for telemetry entries, tests, and quick
|
|
42
|
+
debugging while still exposing the key teaching signal: which genomes share
|
|
43
|
+
ancestry and how recent offspring connect back to parents.
|
|
42
44
|
|
|
43
45
|
Parameters:
|
|
44
|
-
- `
|
|
46
|
+
- `population` - - Population slice containing optional runtime lineage metadata.
|
|
47
|
+
- `limit` - - Maximum number of genomes to sample from the front of the population.
|
|
45
48
|
|
|
46
|
-
Returns:
|
|
47
|
-
has not been started yet.
|
|
49
|
+
Returns: Compact lineage entries with genome ids and parent ids.
|
|
48
50
|
|
|
49
51
|
Example:
|
|
50
52
|
|
|
51
|
-
const
|
|
52
|
-
console.log(
|
|
53
|
+
const lineage = buildLineageSnapshot(neat.population, 5);
|
|
54
|
+
console.log(lineage.map((entry) => entry.parents));
|
|
53
55
|
|
|
54
56
|
### clearTelemetryBuffer
|
|
55
57
|
|
|
@@ -70,6 +72,25 @@ Parameters:
|
|
|
70
72
|
|
|
71
73
|
Returns: Nothing. The host buffer is replaced with an empty array.
|
|
72
74
|
|
|
75
|
+
### getCachedDiversityStats
|
|
76
|
+
|
|
77
|
+
```ts
|
|
78
|
+
getCachedDiversityStats(
|
|
79
|
+
host: TelemetryAccessorHost,
|
|
80
|
+
): DiversityStats | undefined
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Read cached diversity statistics.
|
|
84
|
+
|
|
85
|
+
This accessor does not compute diversity on demand. Its job is only to expose
|
|
86
|
+
the last cached snapshot so callers can distinguish between "no diversity has
|
|
87
|
+
been computed yet" and "diversity was computed and here is the result."
|
|
88
|
+
|
|
89
|
+
Parameters:
|
|
90
|
+
- `host` - - Telemetry host exposing an optional cached diversity snapshot.
|
|
91
|
+
|
|
92
|
+
Returns: Cached diversity statistics when available, otherwise `undefined`.
|
|
93
|
+
|
|
73
94
|
### getObjectiveEventsSnapshot
|
|
74
95
|
|
|
75
96
|
```ts
|
|
@@ -94,75 +115,54 @@ Example:
|
|
|
94
115
|
const events = getObjectiveEventsSnapshot(neat);
|
|
95
116
|
console.table(events);
|
|
96
117
|
|
|
97
|
-
###
|
|
118
|
+
### getPerformanceStatsSnapshot
|
|
98
119
|
|
|
99
120
|
```ts
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
): { id: number; parents: number[]; }[]
|
|
121
|
+
getPerformanceStatsSnapshot(
|
|
122
|
+
host: TelemetryAccessorHost,
|
|
123
|
+
): { lastEvalMs: number | undefined; lastEvolveMs: number | undefined; }
|
|
104
124
|
```
|
|
105
125
|
|
|
106
|
-
Snapshot
|
|
126
|
+
Snapshot performance timings for evaluation and evolution steps.
|
|
107
127
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
ancestry and how recent offspring connect back to parents.
|
|
128
|
+
These timings are intentionally coarse. They are useful for telemetry reads,
|
|
129
|
+
simple dashboards, and regression tests that need to know which phase was
|
|
130
|
+
recently expensive, but they are not meant to replace a profiler trace.
|
|
112
131
|
|
|
113
132
|
Parameters:
|
|
114
|
-
- `
|
|
115
|
-
- `limit` - - Maximum number of genomes to sample from the front of the population.
|
|
133
|
+
- `host` - - Telemetry host storing the last evaluation and evolution durations.
|
|
116
134
|
|
|
117
|
-
Returns:
|
|
135
|
+
Returns: Object containing the most recent evaluation and evolution timings.
|
|
118
136
|
|
|
119
137
|
Example:
|
|
120
138
|
|
|
121
|
-
const
|
|
122
|
-
console.log(
|
|
123
|
-
|
|
124
|
-
### getCachedDiversityStats
|
|
125
|
-
|
|
126
|
-
```ts
|
|
127
|
-
getCachedDiversityStats(
|
|
128
|
-
host: TelemetryAccessorHost,
|
|
129
|
-
): DiversityStats | undefined
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
Read cached diversity statistics.
|
|
133
|
-
|
|
134
|
-
This accessor does not compute diversity on demand. Its job is only to expose
|
|
135
|
-
the last cached snapshot so callers can distinguish between "no diversity has
|
|
136
|
-
been computed yet" and "diversity was computed and here is the result."
|
|
137
|
-
|
|
138
|
-
Parameters:
|
|
139
|
-
- `host` - - Telemetry host exposing an optional cached diversity snapshot.
|
|
140
|
-
|
|
141
|
-
Returns: Cached diversity statistics when available, otherwise `undefined`.
|
|
139
|
+
const timings = getPerformanceStatsSnapshot(neat);
|
|
140
|
+
console.log(timings.lastEvalMs, timings.lastEvolveMs);
|
|
142
141
|
|
|
143
|
-
###
|
|
142
|
+
### getTelemetryBuffer
|
|
144
143
|
|
|
145
144
|
```ts
|
|
146
|
-
|
|
145
|
+
getTelemetryBuffer(
|
|
147
146
|
host: TelemetryAccessorHost,
|
|
148
|
-
):
|
|
147
|
+
): TelemetryEntry[]
|
|
149
148
|
```
|
|
150
149
|
|
|
151
|
-
|
|
150
|
+
Return the telemetry buffer, defaulting to an empty array when missing.
|
|
152
151
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
152
|
+
This is the lowest-level read for recent telemetry history. It gives callers
|
|
153
|
+
a stable way to inspect the current in-memory buffer without forcing every
|
|
154
|
+
consumer to reimplement null checks.
|
|
156
155
|
|
|
157
156
|
Parameters:
|
|
158
|
-
- `host` - - Telemetry host
|
|
157
|
+
- `host` - - Telemetry host that may or may not have initialized its buffer.
|
|
159
158
|
|
|
160
|
-
Returns:
|
|
159
|
+
Returns: Telemetry entries recorded so far, or an empty array when telemetry
|
|
160
|
+
has not been started yet.
|
|
161
161
|
|
|
162
162
|
Example:
|
|
163
163
|
|
|
164
|
-
const
|
|
165
|
-
console.log(
|
|
164
|
+
const recentEntries = getTelemetryBuffer(neat).slice(-3);
|
|
165
|
+
console.log(recentEntries.length);
|
|
166
166
|
|
|
167
167
|
### LINEAGE_SNAPSHOT_DEFAULT_LIMIT
|
|
168
168
|
|