@reicek/neataptic-ts 0.1.25 → 0.1.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/copilot-instructions.md +11 -0
- package/.github/skills/trace-analyzer-extension/SKILL.md +3 -3
- package/.github/skills/trace-analyzer-extension/assets/extension-checklist.md +1 -1
- package/.github/skills/trace-analyzer-extension/references/analyzer-extension-workflow.md +1 -1
- package/.github/skills/trace-audit-reporting/SKILL.md +3 -3
- package/.github/skills/trace-audit-reporting/references/trace-analysis-workflow.md +1 -1
- package/package.json +19 -13
- package/plans/Flappy_Bird_Folder_Documentation_Pass.md +4 -4
- package/plans/README.md +24 -0
- package/plans/Roadmap.md +62 -40
- package/plans/analyze-trace-solid-split.plans.md +66 -0
- package/plans/architecture-solid-split.plans.md +9 -15
- package/plans/asciiMaze-typescript-repair.plans.md +1 -1
- package/plans/generate-docs-solid-split.plans.md +87 -0
- package/plans/methods-docs.plans.md +25 -1
- package/plans/methods-solid-split.plans.md +14 -14
- package/plans/neat-docs.plans.md +9 -1
- package/plans/neat-test-surface-repair.plans.md +1 -1
- package/plans/render-docs-html-solid-split.plans.md +68 -0
- package/plans/src-no-explicit-any-cleanup.plans.md +1 -1
- package/plans/utils-docs.plans.md +6 -1
- package/scripts/analyze-trace/analyze-trace.analysis.ts +479 -0
- package/scripts/analyze-trace/analyze-trace.constants.ts +35 -0
- package/scripts/analyze-trace/analyze-trace.io.ts +69 -0
- package/scripts/analyze-trace/analyze-trace.report.ts +100 -0
- package/scripts/analyze-trace/analyze-trace.shared.ts +116 -0
- package/scripts/analyze-trace/analyze-trace.ts +45 -0
- package/scripts/analyze-trace/analyze-trace.types.ts +72 -0
- package/scripts/assets/theme.css +80 -23
- package/scripts/copy-examples.ts +239 -0
- package/scripts/export-onnx.ts +223 -0
- package/scripts/generate-bench-tables.ts +378 -37
- package/scripts/generate-docs/generate-docs.constants.ts +107 -0
- package/scripts/generate-docs/generate-docs.order.ts +355 -0
- package/scripts/generate-docs/generate-docs.state.ts +31 -0
- package/scripts/generate-docs/generate-docs.targets.ts +165 -0
- package/scripts/generate-docs/generate-docs.ts +63 -0
- package/scripts/generate-docs/generate-docs.types.ts +112 -0
- package/scripts/generate-docs/output/generate-docs.output.folder-index.utils.ts +167 -0
- package/scripts/generate-docs/output/generate-docs.output.ordering.utils.ts +353 -0
- package/scripts/generate-docs/output/generate-docs.output.readme.utils.ts +420 -0
- package/scripts/generate-docs/output/generate-docs.output.ts +123 -0
- package/scripts/generate-docs/output/generate-docs.output.warnings.utils.ts +219 -0
- package/scripts/generate-docs/symbols/generate-docs.symbols.collection.utils.ts +365 -0
- package/scripts/generate-docs/symbols/generate-docs.symbols.jsdoc.utils.ts +373 -0
- package/scripts/generate-docs/symbols/generate-docs.symbols.normalize.utils.ts +155 -0
- package/scripts/generate-docs/symbols/generate-docs.symbols.render.utils.ts +149 -0
- package/scripts/generate-docs/symbols/generate-docs.symbols.signature.utils.ts +289 -0
- package/scripts/generate-docs/symbols/generate-docs.symbols.ts +11 -0
- package/scripts/mermaid-cli.mjs +102 -22
- package/scripts/mermaid-cli.ts +736 -0
- package/scripts/render-docs-html/render-docs-html.assets.ts +54 -0
- package/scripts/render-docs-html/render-docs-html.mermaid.ts +245 -0
- package/scripts/{render-docs-html.sidebar.ts → render-docs-html/render-docs-html.navigation.ts} +141 -144
- package/scripts/render-docs-html/render-docs-html.pages.ts +333 -0
- package/scripts/render-docs-html/render-docs-html.shared.ts +333 -0
- package/scripts/render-docs-html/render-docs-html.types.ts +42 -0
- package/scripts/render-docs-html.ts +23 -587
- package/scripts/run-docs.ts +238 -0
- package/scripts/write-dist-docs-pkg.ts +40 -0
- package/src/README.md +75 -75
- package/src/architecture/connection/README.md +5 -5
- package/src/architecture/layer/README.md +508 -508
- package/src/architecture/network/README.md +1458 -1458
- package/src/architecture/network/activate/README.md +694 -694
- package/src/architecture/network/bootstrap/README.md +77 -77
- package/src/architecture/network/connect/README.md +74 -74
- package/src/architecture/network/deterministic/README.md +135 -135
- package/src/architecture/network/evolve/README.md +364 -364
- package/src/architecture/network/gating/README.md +130 -130
- package/src/architecture/network/genetic/README.md +399 -399
- package/src/architecture/network/mutate/README.md +897 -897
- package/src/architecture/network/onnx/README.md +720 -720
- package/src/architecture/network/onnx/export/README.md +728 -728
- package/src/architecture/network/onnx/export/layers/README.md +450 -450
- package/src/architecture/network/onnx/import/README.md +618 -618
- package/src/architecture/network/onnx/schema/README.md +32 -32
- package/src/architecture/network/prune/README.md +245 -245
- package/src/architecture/network/remove/README.md +135 -135
- package/src/architecture/network/runtime/README.md +106 -106
- package/src/architecture/network/serialize/README.md +542 -542
- package/src/architecture/network/slab/README.md +608 -608
- package/src/architecture/network/standalone/README.md +212 -212
- package/src/architecture/network/stats/README.md +84 -84
- package/src/architecture/network/topology/README.md +465 -465
- package/src/architecture/network/training/README.md +200 -200
- package/src/architecture/node/README.md +5 -5
- package/src/architecture/nodePool/README.md +14 -14
- package/src/methods/README.md +99 -99
- package/src/methods/activation/README.md +189 -189
- package/src/methods/cost/README.md +131 -131
- package/src/methods/rate/README.md +86 -86
- package/src/multithreading/README.md +77 -77
- package/src/multithreading/workers/browser/README.md +8 -8
- package/src/multithreading/workers/node/README.md +8 -8
- package/src/neat/README.md +148 -148
- package/src/neat/adaptive/README.md +120 -120
- package/src/neat/adaptive/acceptance/README.md +40 -40
- package/src/neat/adaptive/complexity/README.md +137 -137
- package/src/neat/adaptive/core/README.md +197 -197
- package/src/neat/adaptive/lineage/README.md +90 -90
- package/src/neat/adaptive/mutation/README.md +284 -284
- package/src/neat/compat/README.md +43 -43
- package/src/neat/compat/core/README.md +90 -90
- package/src/neat/diversity/README.md +35 -35
- package/src/neat/diversity/core/README.md +88 -88
- package/src/neat/evaluate/README.md +85 -85
- package/src/neat/evaluate/auto-distance/README.md +75 -75
- package/src/neat/evaluate/entropy-compat/README.md +37 -37
- package/src/neat/evaluate/entropy-sharing/README.md +43 -43
- package/src/neat/evaluate/fitness/README.md +23 -23
- package/src/neat/evaluate/novelty/README.md +120 -120
- package/src/neat/evaluate/objectives/README.md +17 -17
- package/src/neat/evaluate/shared/README.md +94 -94
- package/src/neat/evolve/README.md +96 -96
- package/src/neat/evolve/adaptive/README.md +60 -60
- package/src/neat/evolve/objectives/README.md +63 -63
- package/src/neat/evolve/offspring/README.md +56 -56
- package/src/neat/evolve/population/README.md +171 -171
- package/src/neat/evolve/runtime/README.md +79 -79
- package/src/neat/evolve/speciation/README.md +74 -74
- package/src/neat/evolve/warnings/README.md +10 -10
- package/src/neat/export/README.md +114 -114
- package/src/neat/helpers/README.md +50 -50
- package/src/neat/init/README.md +9 -9
- package/src/neat/lineage/core/README.md +101 -101
- package/src/neat/multiobjective/category/README.md +74 -74
- package/src/neat/multiobjective/crowding/README.md +272 -272
- package/src/neat/multiobjective/dominance/README.md +171 -171
- package/src/neat/multiobjective/fronts/README.md +68 -68
- package/src/neat/multiobjective/metrics/README.md +43 -43
- package/src/neat/multiobjective/objectives/README.md +31 -31
- package/src/neat/multiobjective/shared/README.md +27 -27
- package/src/neat/mutation/README.md +97 -97
- package/src/neat/mutation/add-conn/README.md +115 -115
- package/src/neat/mutation/add-node/README.md +126 -126
- package/src/neat/mutation/flow/README.md +149 -149
- package/src/neat/mutation/repair/README.md +185 -185
- package/src/neat/mutation/select/README.md +117 -117
- package/src/neat/mutation/shared/README.md +32 -32
- package/src/neat/objectives/README.md +25 -25
- package/src/neat/objectives/core/README.md +67 -67
- package/src/neat/pruning/README.md +40 -40
- package/src/neat/pruning/core/README.md +171 -171
- package/src/neat/pruning/facade/README.md +32 -32
- package/src/neat/rng/README.md +104 -104
- package/src/neat/rng/core/README.md +137 -137
- package/src/neat/rng/facade/README.md +50 -50
- package/src/neat/selection/README.md +111 -111
- package/src/neat/selection/core/README.md +227 -227
- package/src/neat/selection/facade/README.md +61 -61
- package/src/neat/shared/README.md +163 -163
- package/src/neat/speciation/README.md +31 -31
- package/src/neat/speciation/threshold/README.md +35 -35
- package/src/neat/species/README.md +25 -25
- package/src/neat/species/core/README.md +20 -20
- package/src/neat/species/core/shared/README.md +18 -18
- package/src/neat/species/history/context/README.md +22 -22
- package/src/neat/telemetry/accessors/README.md +58 -58
- package/src/neat/telemetry/exports/README.md +233 -233
- package/src/neat/telemetry/facade/README.md +252 -252
- package/src/neat/telemetry/facade/archive/README.md +57 -57
- package/src/neat/telemetry/facade/buffer/README.md +43 -43
- package/src/neat/telemetry/facade/lineage/README.md +12 -12
- package/src/neat/telemetry/facade/objectives/README.md +44 -44
- package/src/neat/telemetry/facade/runtime/README.md +26 -26
- package/src/neat/telemetry/facade/species/README.md +27 -27
- package/src/neat/telemetry/metrics/README.md +696 -696
- package/src/neat/telemetry/recorder/README.md +57 -57
- package/src/neat/telemetry/types/README.md +32 -32
- package/src/neat/topology-intent/README.md +75 -75
- package/src/utils/README.md +193 -193
- package/test/examples/asciiMaze/browser-entry/README.md +92 -92
- package/test/examples/asciiMaze/dashboardManager/README.md +109 -109
- package/test/examples/asciiMaze/dashboardManager/telemetry/README.md +28 -28
- package/test/examples/asciiMaze/evolutionEngine/README.md +1527 -1527
- package/test/examples/asciiMaze/mazeMovement/README.md +105 -105
- package/test/examples/asciiMaze/mazeMovement/finalization/README.md +16 -16
- package/test/examples/asciiMaze/mazeMovement/policy/README.md +57 -57
- package/test/examples/asciiMaze/mazeMovement/runtime/README.md +52 -52
- package/test/examples/asciiMaze/mazeMovement/shaping/README.md +46 -46
- package/test/examples/flappy_bird/browser-entry/README.md +508 -508
- package/test/examples/flappy_bird/browser-entry/host/README.md +101 -101
- package/test/examples/flappy_bird/browser-entry/host/resize/README.md +144 -144
- package/test/examples/flappy_bird/browser-entry/network-view/README.md +194 -194
- package/test/examples/flappy_bird/browser-entry/playback/README.md +278 -278
- package/test/examples/flappy_bird/browser-entry/playback/background/README.md +129 -129
- package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/README.md +502 -502
- package/test/examples/flappy_bird/browser-entry/playback/frame-render/README.md +139 -139
- package/test/examples/flappy_bird/browser-entry/playback/snapshot/README.md +10 -10
- package/test/examples/flappy_bird/browser-entry/playback/trail/README.md +43 -43
- package/test/examples/flappy_bird/browser-entry/playback/worker-channel/README.md +30 -30
- package/test/examples/flappy_bird/browser-entry/runtime/README.md +59 -59
- package/test/examples/flappy_bird/browser-entry/visualization/README.md +276 -276
- package/test/examples/flappy_bird/browser-entry/worker-channel/README.md +16 -16
- package/test/examples/flappy_bird/constants/README.md +1070 -1070
- package/test/examples/flappy_bird/environment/README.md +22 -22
- package/test/examples/flappy_bird/evaluation/README.md +32 -32
- package/test/examples/flappy_bird/evaluation/rollout/README.md +141 -141
- package/test/examples/flappy_bird/flappy-evolution-worker/README.md +425 -425
- package/test/examples/flappy_bird/simulation-shared/README.md +170 -170
- package/test/examples/flappy_bird/simulation-shared/observation/README.md +109 -109
- package/test/examples/flappy_bird/trainer/README.md +325 -325
- package/test/examples/flappy_bird/trainer/evaluation/README.md +74 -74
- package/scripts/analyze-trace.ts +0 -590
- package/scripts/copy-examples.mjs +0 -114
- package/scripts/export-onnx.mjs +0 -86
- package/scripts/generate-bench-tables.mjs +0 -182
- package/scripts/generate-docs.ts +0 -2900
- package/scripts/write-dist-docs-pkg.mjs +0 -16
|
@@ -47,38 +47,52 @@ behavior.
|
|
|
47
47
|
|
|
48
48
|
## neat/selection/facade/selection.facade.ts
|
|
49
49
|
|
|
50
|
-
###
|
|
50
|
+
### FittestNetwork
|
|
51
|
+
|
|
52
|
+
Champion-shaped network returned by the public `getFittest()` facade.
|
|
53
|
+
|
|
54
|
+
The facade intentionally returns the real network instance from the current
|
|
55
|
+
population rather than a detached summary object. That keeps the stable
|
|
56
|
+
`Neat` contract aligned with long-standing usage patterns where callers read
|
|
57
|
+
the champion's score and then continue inspecting the network itself.
|
|
58
|
+
|
|
59
|
+
The extra `score` field is called out here so the generated README can name
|
|
60
|
+
the returned shape explicitly instead of falling back to a rough imported
|
|
61
|
+
default-type rendering.
|
|
62
|
+
|
|
63
|
+
### getAverage
|
|
51
64
|
|
|
52
65
|
```ts
|
|
53
|
-
|
|
66
|
+
getAverage(
|
|
54
67
|
host: NeatPopulationSummaryFacadeHost,
|
|
55
|
-
):
|
|
68
|
+
): number
|
|
56
69
|
```
|
|
57
70
|
|
|
58
|
-
|
|
71
|
+
Compute the average score across the current population.
|
|
59
72
|
|
|
60
|
-
This
|
|
61
|
-
|
|
73
|
+
This is a compact inspection helper for telemetry, tests, and quick
|
|
74
|
+
debugging where the caller only needs the current mean fitness.
|
|
62
75
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
76
|
+
Read it as the companion to {@link getFittest}: the champion tells you how
|
|
77
|
+
high the best genome has climbed, while the average tells you whether that
|
|
78
|
+
progress is representative of the wider generation or still concentrated in
|
|
79
|
+
a small leading group. Because this wrapper stays at the summary layer, it
|
|
80
|
+
reports on population state without drifting into parent-choice or breeding
|
|
81
|
+
policy.
|
|
68
82
|
|
|
69
|
-
|
|
70
|
-
the
|
|
83
|
+
Together, `getFittest()` and `getAverage()` are the facade's public promise:
|
|
84
|
+
one read for the leader and one read for the generation as a whole.
|
|
71
85
|
|
|
72
86
|
Parameters:
|
|
73
|
-
- `host` - - `Neat` instance exposing population
|
|
87
|
+
- `host` - - `Neat` instance exposing population and evaluation state.
|
|
74
88
|
|
|
75
|
-
Returns:
|
|
89
|
+
Returns: Mean score across the current population.
|
|
76
90
|
|
|
77
91
|
Example:
|
|
78
92
|
|
|
79
93
|
```ts
|
|
80
|
-
neat.
|
|
81
|
-
console.log(
|
|
94
|
+
const meanScore = neat.getAverage();
|
|
95
|
+
console.log(`Average score: ${meanScore}`);
|
|
82
96
|
```
|
|
83
97
|
|
|
84
98
|
### getFittest
|
|
@@ -116,41 +130,6 @@ const champion = neat.getFittest();
|
|
|
116
130
|
console.log(champion.score);
|
|
117
131
|
```
|
|
118
132
|
|
|
119
|
-
### getAverage
|
|
120
|
-
|
|
121
|
-
```ts
|
|
122
|
-
getAverage(
|
|
123
|
-
host: NeatPopulationSummaryFacadeHost,
|
|
124
|
-
): number
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
Compute the average score across the current population.
|
|
128
|
-
|
|
129
|
-
This is a compact inspection helper for telemetry, tests, and quick
|
|
130
|
-
debugging where the caller only needs the current mean fitness.
|
|
131
|
-
|
|
132
|
-
Read it as the companion to {@link getFittest}: the champion tells you how
|
|
133
|
-
high the best genome has climbed, while the average tells you whether that
|
|
134
|
-
progress is representative of the wider generation or still concentrated in
|
|
135
|
-
a small leading group. Because this wrapper stays at the summary layer, it
|
|
136
|
-
reports on population state without drifting into parent-choice or breeding
|
|
137
|
-
policy.
|
|
138
|
-
|
|
139
|
-
Together, `getFittest()` and `getAverage()` are the facade's public promise:
|
|
140
|
-
one read for the leader and one read for the generation as a whole.
|
|
141
|
-
|
|
142
|
-
Parameters:
|
|
143
|
-
- `host` - - `Neat` instance exposing population and evaluation state.
|
|
144
|
-
|
|
145
|
-
Returns: Mean score across the current population.
|
|
146
|
-
|
|
147
|
-
Example:
|
|
148
|
-
|
|
149
|
-
```ts
|
|
150
|
-
const meanScore = neat.getAverage();
|
|
151
|
-
console.log(`Average score: ${meanScore}`);
|
|
152
|
-
```
|
|
153
|
-
|
|
154
133
|
### NeatPopulationSummaryFacadeHost
|
|
155
134
|
|
|
156
135
|
Narrow `Neat` host surface required by the public population-summary facade.
|
|
@@ -166,15 +145,36 @@ and lower-level selection policy stay in the root selection boundary and its
|
|
|
166
145
|
need to preserve long-standing `neat.sort()`, `neat.getFittest()`, and
|
|
167
146
|
`neat.getAverage()` behavior.
|
|
168
147
|
|
|
169
|
-
###
|
|
148
|
+
### sort
|
|
170
149
|
|
|
171
|
-
|
|
150
|
+
```ts
|
|
151
|
+
sort(
|
|
152
|
+
host: NeatPopulationSummaryFacadeHost,
|
|
153
|
+
): void
|
|
154
|
+
```
|
|
172
155
|
|
|
173
|
-
|
|
174
|
-
population rather than a detached summary object. That keeps the stable
|
|
175
|
-
`Neat` contract aligned with long-standing usage patterns where callers read
|
|
176
|
-
the champion's score and then continue inspecting the network itself.
|
|
156
|
+
Sort the population in descending fitness order.
|
|
177
157
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
158
|
+
This preserves the historical `neat.sort()` behavior while keeping the
|
|
159
|
+
top-level class free of inline ordering details.
|
|
160
|
+
|
|
161
|
+
Use this wrapper when later reads should see the current population in an
|
|
162
|
+
explicit best-first order, such as before manual inspection, debugging, or a
|
|
163
|
+
deterministic test assertion. The wrapper deliberately stays narrow: it only
|
|
164
|
+
forwards to the shared selection ordering helper and keeps the familiar class
|
|
165
|
+
method available at the stable `Neat` surface.
|
|
166
|
+
|
|
167
|
+
This is the facade's one explicit reordering primitive. Everything else in
|
|
168
|
+
the chapter is read-only population inspection.
|
|
169
|
+
|
|
170
|
+
Parameters:
|
|
171
|
+
- `host` - - `Neat` instance exposing population sorting state.
|
|
172
|
+
|
|
173
|
+
Returns: Nothing. The population array is reordered in place.
|
|
174
|
+
|
|
175
|
+
Example:
|
|
176
|
+
|
|
177
|
+
```ts
|
|
178
|
+
neat.sort();
|
|
179
|
+
console.log(neat.population[0].score);
|
|
180
|
+
```
|
|
@@ -64,44 +64,84 @@ Practical reading order:
|
|
|
64
64
|
|
|
65
65
|
## neat/shared/neat.shared.types.ts
|
|
66
66
|
|
|
67
|
-
###
|
|
67
|
+
### AnyObj
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
Generic map type used as a stop‑gap where the precise shape is still in flux.
|
|
70
|
+
Prefer a specific interface once the surface stabilises.
|
|
70
71
|
|
|
71
|
-
|
|
72
|
-
- Compatibility-threshold based species assignment
|
|
73
|
-
- Adaptive threshold controllers (PID-like)
|
|
74
|
-
- Species allocation telemetry (history snapshots)
|
|
72
|
+
### ComplexityMetrics
|
|
75
73
|
|
|
76
|
-
|
|
77
|
-
typed without importing the full controller configuration object. Read it as
|
|
78
|
-
the option family that shapes how species are formed, protected, and recorded
|
|
79
|
-
over time.
|
|
74
|
+
Aggregate structural complexity metrics capturing size & growth pressure.
|
|
80
75
|
|
|
81
|
-
###
|
|
76
|
+
### ConnectionLike
|
|
82
77
|
|
|
83
|
-
|
|
84
|
-
These values inform stagnation heuristics and adaptive controllers.
|
|
78
|
+
Lightweight connection representation used by telemetry and structural helpers.
|
|
85
79
|
|
|
86
|
-
|
|
87
|
-
They exist so live speciation logic can remember recent behavior before the
|
|
88
|
-
`species/` chapter later projects that state into user-facing summaries.
|
|
80
|
+
### DiversityStats
|
|
89
81
|
|
|
90
|
-
|
|
82
|
+
Diversity statistics captured each generation. Individual fields may be
|
|
83
|
+
omitted in telemetry output if diversity tracking is partially disabled to
|
|
84
|
+
reduce runtime cost.
|
|
91
85
|
|
|
92
|
-
|
|
93
|
-
|
|
86
|
+
This contract is the compact summary that lets telemetry, diagnostics, and
|
|
87
|
+
dashboards talk about population spread without rerunning the heavier
|
|
88
|
+
compatibility, entropy, and lineage calculations. The fields are aggregated
|
|
89
|
+
on purpose: they are meant for trend reading, not for reconstructing every
|
|
90
|
+
pairwise comparison after the fact.
|
|
94
91
|
|
|
95
|
-
This
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
public `Neat` facade.
|
|
92
|
+
This is one half of the chapter's evidence language. Diversity tells the
|
|
93
|
+
controller how structurally spread out the population currently looks, which
|
|
94
|
+
is useful for dashboards, adaptive policies, and regression checks even when
|
|
95
|
+
the full pairwise evidence would be too expensive to keep around.
|
|
100
96
|
|
|
101
|
-
###
|
|
97
|
+
### GenomeDetailed
|
|
102
98
|
|
|
103
|
-
|
|
104
|
-
|
|
99
|
+
More concrete genome surface used by telemetry and lineage helpers.
|
|
100
|
+
Extends the minimal `GenomeLike` with node/connection shapes and a few
|
|
101
|
+
internal bookkeeping fields used by telemetry.
|
|
102
|
+
|
|
103
|
+
Use this contract when a helper needs more than anonymous structure. The
|
|
104
|
+
extra fields here are the ones that repeatedly matter to the read-side NEAT
|
|
105
|
+
chapters: stable genome identity, parent tracking, lineage depth, and the
|
|
106
|
+
richer node and connection shapes needed for telemetry, history, and
|
|
107
|
+
compatibility-adjacent reporting.
|
|
108
|
+
|
|
109
|
+
In chapter terms, `GenomeDetailed` is the point where the shared vocabulary
|
|
110
|
+
stops being merely structural and becomes historically meaningful. Once a
|
|
111
|
+
helper needs `_id`, `_parents`, or `_depth`, it is no longer talking about a
|
|
112
|
+
generic network shape; it is talking about a genome with an evolutionary
|
|
113
|
+
past that later reporting chapters may want to inspect.
|
|
114
|
+
|
|
115
|
+
### GenomeLike
|
|
116
|
+
|
|
117
|
+
Minimal genome structural surface used by several helpers (incrementally expanded).
|
|
118
|
+
|
|
119
|
+
NOTE: `nodes` and `connections` remain intentionally structural/opaque
|
|
120
|
+
until a stable public abstraction is finalised.
|
|
121
|
+
|
|
122
|
+
Read this as the portable genome contract. It is enough for helpers that
|
|
123
|
+
need counts, loose structural access, or a primary score, but not enough to
|
|
124
|
+
encode every network behavior. More specialized chapters should extend this
|
|
125
|
+
shape only when they truly need richer node, connection, or lineage detail.
|
|
126
|
+
|
|
127
|
+
That restraint matters because this contract sits near the base of the shared
|
|
128
|
+
vocabulary. If it grows too eager, every downstream chapter inherits more of
|
|
129
|
+
the runtime than it actually needs.
|
|
130
|
+
|
|
131
|
+
### LineageSnapshot
|
|
132
|
+
|
|
133
|
+
Snapshot of lineage & ancestry statistics for the current generation.
|
|
134
|
+
|
|
135
|
+
This is the ancestry companion to `DiversityStats`. Diversity answers how far
|
|
136
|
+
apart genomes currently look; lineage answers how much recent family overlap
|
|
137
|
+
still exists beneath those structures. Telemetry and adaptive controllers use
|
|
138
|
+
both because structural spread and family spread are related but not
|
|
139
|
+
interchangeable signals.
|
|
140
|
+
|
|
141
|
+
Read `LineageSnapshot` and `DiversityStats` together. One describes present
|
|
142
|
+
structural variety, the other describes how independent that variety really
|
|
143
|
+
is. NEAT benefits from both views because a population can look diverse while
|
|
144
|
+
still clustering around a narrow recent ancestry.
|
|
105
145
|
|
|
106
146
|
### NeatLike
|
|
107
147
|
|
|
@@ -119,6 +159,30 @@ Pedagogically, this is the chapter's "start here" host contract. It tells a
|
|
|
119
159
|
reader that the shared layer values portability over completeness, and that a
|
|
120
160
|
richer local host contract should only appear when a chapter can justify why.
|
|
121
161
|
|
|
162
|
+
### NeatOptions
|
|
163
|
+
|
|
164
|
+
Options subset used by telemetry helpers. Kept narrow to avoid leaking
|
|
165
|
+
full runtime options into the helper type surface.
|
|
166
|
+
|
|
167
|
+
The purpose of this contract is not to model every `Neat` option. It is to
|
|
168
|
+
capture the policy knobs that recur across extracted helper chapters:
|
|
169
|
+
telemetry flags, diversity sampling, compatibility tuning, species history,
|
|
170
|
+
novelty, and a few structural budget fields. If a helper needs more than
|
|
171
|
+
this, that is usually a sign it wants a chapter-local host contract instead
|
|
172
|
+
of a wider shared type.
|
|
173
|
+
|
|
174
|
+
Read this as the shared policy slice, not the complete public options model.
|
|
175
|
+
It exists so extracted chapters can agree on recurring controller settings
|
|
176
|
+
without smuggling the full `Neat` facade through every helper signature.
|
|
177
|
+
|
|
178
|
+
### NodeLike
|
|
179
|
+
|
|
180
|
+
Lightweight node representation used by telemetry and structural helpers.
|
|
181
|
+
|
|
182
|
+
### ObjAges
|
|
183
|
+
|
|
184
|
+
Map of objective key to age in generations since introduction.
|
|
185
|
+
|
|
122
186
|
### ObjectiveDescriptor
|
|
123
187
|
|
|
124
188
|
Descriptor for a single optimisation objective (single or multi‑objective runs).
|
|
@@ -149,90 +213,24 @@ const complexityObj: ObjectiveDescriptor = {
|
|
|
149
213
|
};
|
|
150
214
|
```
|
|
151
215
|
|
|
152
|
-
###
|
|
153
|
-
|
|
154
|
-
Minimal genome structural surface used by several helpers (incrementally expanded).
|
|
155
|
-
|
|
156
|
-
NOTE: `nodes` and `connections` remain intentionally structural/opaque
|
|
157
|
-
until a stable public abstraction is finalised.
|
|
158
|
-
|
|
159
|
-
Read this as the portable genome contract. It is enough for helpers that
|
|
160
|
-
need counts, loose structural access, or a primary score, but not enough to
|
|
161
|
-
encode every network behavior. More specialized chapters should extend this
|
|
162
|
-
shape only when they truly need richer node, connection, or lineage detail.
|
|
163
|
-
|
|
164
|
-
That restraint matters because this contract sits near the base of the shared
|
|
165
|
-
vocabulary. If it grows too eager, every downstream chapter inherits more of
|
|
166
|
-
the runtime than it actually needs.
|
|
167
|
-
|
|
168
|
-
### NodeLike
|
|
169
|
-
|
|
170
|
-
Lightweight node representation used by telemetry and structural helpers.
|
|
171
|
-
|
|
172
|
-
### ConnectionLike
|
|
173
|
-
|
|
174
|
-
Lightweight connection representation used by telemetry and structural helpers.
|
|
175
|
-
|
|
176
|
-
### GenomeDetailed
|
|
177
|
-
|
|
178
|
-
More concrete genome surface used by telemetry and lineage helpers.
|
|
179
|
-
Extends the minimal `GenomeLike` with node/connection shapes and a few
|
|
180
|
-
internal bookkeeping fields used by telemetry.
|
|
181
|
-
|
|
182
|
-
Use this contract when a helper needs more than anonymous structure. The
|
|
183
|
-
extra fields here are the ones that repeatedly matter to the read-side NEAT
|
|
184
|
-
chapters: stable genome identity, parent tracking, lineage depth, and the
|
|
185
|
-
richer node and connection shapes needed for telemetry, history, and
|
|
186
|
-
compatibility-adjacent reporting.
|
|
187
|
-
|
|
188
|
-
In chapter terms, `GenomeDetailed` is the point where the shared vocabulary
|
|
189
|
-
stops being merely structural and becomes historically meaningful. Once a
|
|
190
|
-
helper needs `_id`, `_parents`, or `_depth`, it is no longer talking about a
|
|
191
|
-
generic network shape; it is talking about a genome with an evolutionary
|
|
192
|
-
past that later reporting chapters may want to inspect.
|
|
193
|
-
|
|
194
|
-
### SpeciesLike
|
|
195
|
-
|
|
196
|
-
Internal species representation used by helpers. Kept minimal and structural.
|
|
197
|
-
|
|
198
|
-
This is the live registry shape behind the stronger `speciation/` and
|
|
199
|
-
`species/` chapters. It is intentionally not a polished reporting format;
|
|
200
|
-
instead it holds the small amount of state those chapters repeatedly need to
|
|
201
|
-
maintain or summarize: membership, best score, improvement timing, and room
|
|
202
|
-
for implementation-specific bookkeeping.
|
|
216
|
+
### ObjectiveEvent
|
|
203
217
|
|
|
204
|
-
|
|
218
|
+
Objective add/remove lifecycle event for telemetry and auditing.
|
|
205
219
|
|
|
206
|
-
|
|
207
|
-
full runtime options into the helper type surface.
|
|
220
|
+
### ObjEvent
|
|
208
221
|
|
|
209
|
-
|
|
210
|
-
capture the policy knobs that recur across extracted helper chapters:
|
|
211
|
-
telemetry flags, diversity sampling, compatibility tuning, species history,
|
|
212
|
-
novelty, and a few structural budget fields. If a helper needs more than
|
|
213
|
-
this, that is usually a sign it wants a chapter-local host contract instead
|
|
214
|
-
of a wider shared type.
|
|
222
|
+
Dynamic objective lifecycle event (addition or removal).
|
|
215
223
|
|
|
216
|
-
|
|
217
|
-
It exists so extracted chapters can agree on recurring controller settings
|
|
218
|
-
without smuggling the full `Neat` facade through every helper signature.
|
|
224
|
+
**Deprecated:** Use `ObjectiveEvent` instead.
|
|
219
225
|
|
|
220
|
-
###
|
|
226
|
+
### ObjImportance
|
|
221
227
|
|
|
222
|
-
|
|
223
|
-
omitted in telemetry output if diversity tracking is partially disabled to
|
|
224
|
-
reduce runtime cost.
|
|
228
|
+
Map of objective key to its importance metrics (range / variance).
|
|
225
229
|
|
|
226
|
-
|
|
227
|
-
dashboards talk about population spread without rerunning the heavier
|
|
228
|
-
compatibility, entropy, and lineage calculations. The fields are aggregated
|
|
229
|
-
on purpose: they are meant for trend reading, not for reconstructing every
|
|
230
|
-
pairwise comparison after the fact.
|
|
230
|
+
### ObjImportanceEntry
|
|
231
231
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
is useful for dashboards, adaptive policies, and regression checks even when
|
|
235
|
-
the full pairwise evidence would be too expensive to keep around.
|
|
232
|
+
Contribution / dispersion metrics for an objective over a recent window.
|
|
233
|
+
Used to gauge whether an objective meaningfully influences selection.
|
|
236
234
|
|
|
237
235
|
### OperatorStat
|
|
238
236
|
|
|
@@ -246,57 +244,89 @@ A high attempt count with low success can indicate constraints becoming tight
|
|
|
246
244
|
|
|
247
245
|
Aggregated success / attempt counters over a window or entire run.
|
|
248
246
|
|
|
249
|
-
###
|
|
247
|
+
### ParetoArchiveEntry
|
|
250
248
|
|
|
251
|
-
|
|
252
|
-
Used to gauge whether an objective meaningfully influences selection.
|
|
249
|
+
Pareto archive entry capturing a genome plus its objective values.
|
|
253
250
|
|
|
254
|
-
|
|
251
|
+
This contract is intentionally sparse because the archive is primarily a
|
|
252
|
+
preservation boundary. The stored genome captures the candidate itself, while
|
|
253
|
+
`objectives` preserves the exact multi-objective evidence that justified its
|
|
254
|
+
place on the frontier at the time it was archived.
|
|
255
255
|
|
|
256
|
-
|
|
256
|
+
### PerformanceMetrics
|
|
257
257
|
|
|
258
|
-
|
|
258
|
+
Timing metrics for coarse evolutionary phases (milliseconds).
|
|
259
259
|
|
|
260
|
-
|
|
260
|
+
These timings are intentionally coarse. They exist to reveal where a run is
|
|
261
|
+
spending time at the chapter level, not to replace a profiler. That makes
|
|
262
|
+
them useful inside telemetry exports and regression-oriented dashboards where
|
|
263
|
+
simple evaluation-versus-evolution trends are more valuable than exhaustive
|
|
264
|
+
trace detail.
|
|
261
265
|
|
|
262
|
-
###
|
|
266
|
+
### SpeciationHarnessContext
|
|
263
267
|
|
|
264
|
-
|
|
268
|
+
Minimal runtime surface required by speciation helpers.
|
|
269
|
+
Tests and harnesses can narrow the options type via the generic parameter.
|
|
265
270
|
|
|
266
|
-
|
|
271
|
+
This host contract is intentionally more specific than `NeatLike` because
|
|
272
|
+
speciation is one of the most stateful controller phases. The helpers need
|
|
273
|
+
the live population, the species registry, threshold-tuning accumulators,
|
|
274
|
+
and the compatibility read itself, but they still do not need the entire
|
|
275
|
+
public `Neat` facade.
|
|
276
|
+
|
|
277
|
+
### SpeciationOptions
|
|
278
|
+
|
|
279
|
+
Speciation options for the NEAT speciation controller.
|
|
280
|
+
|
|
281
|
+
Extends {@link NeatOptions} with speciation-specific configuration used by:
|
|
282
|
+
- Compatibility-threshold based species assignment
|
|
283
|
+
- Adaptive threshold controllers (PID-like)
|
|
284
|
+
- Species allocation telemetry (history snapshots)
|
|
285
|
+
|
|
286
|
+
This is the shared policy slice that lets speciation helpers stay narrowly
|
|
287
|
+
typed without importing the full controller configuration object. Read it as
|
|
288
|
+
the option family that shapes how species are formed, protected, and recorded
|
|
289
|
+
over time.
|
|
267
290
|
|
|
268
291
|
### SpeciesAlloc
|
|
269
292
|
|
|
270
293
|
Offspring allocation for a species during reproduction.
|
|
271
294
|
|
|
272
|
-
###
|
|
295
|
+
### SpeciesHistoryEntry
|
|
273
296
|
|
|
274
|
-
|
|
297
|
+
Species statistics captured for a particular generation.
|
|
275
298
|
|
|
276
|
-
This is the
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
both because structural spread and family spread are related but not
|
|
280
|
-
interchangeable signals.
|
|
299
|
+
This is the history-buffer unit used by the `species/` chapter. One entry
|
|
300
|
+
answers "what did the species table look like at this generation boundary?"
|
|
301
|
+
without requiring callers to inspect the live registry directly.
|
|
281
302
|
|
|
282
|
-
|
|
283
|
-
structural variety, the other describes how independent that variety really
|
|
284
|
-
is. NEAT benefits from both views because a population can look diverse while
|
|
285
|
-
still clustering around a narrow recent ancestry.
|
|
303
|
+
### SpeciesHistoryStat
|
|
286
304
|
|
|
287
|
-
|
|
305
|
+
Species statistics at a single historical snapshot (generation boundary).
|
|
288
306
|
|
|
289
|
-
|
|
307
|
+
### SpeciesHistoryStatExtended
|
|
290
308
|
|
|
291
|
-
|
|
309
|
+
Extended per-species historical snapshot with optional backfilled metrics
|
|
310
|
+
that may be computed lazily (innovationRange, enabledRatio).
|
|
292
311
|
|
|
293
|
-
|
|
312
|
+
### SpeciesLastStats
|
|
294
313
|
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
314
|
+
Rolling statistics tracked for each species between generations.
|
|
315
|
+
These values inform stagnation heuristics and adaptive controllers.
|
|
316
|
+
|
|
317
|
+
These are controller-maintenance values rather than polished reporting rows.
|
|
318
|
+
They exist so live speciation logic can remember recent behavior before the
|
|
319
|
+
`species/` chapter later projects that state into user-facing summaries.
|
|
320
|
+
|
|
321
|
+
### SpeciesLike
|
|
322
|
+
|
|
323
|
+
Internal species representation used by helpers. Kept minimal and structural.
|
|
324
|
+
|
|
325
|
+
This is the live registry shape behind the stronger `speciation/` and
|
|
326
|
+
`species/` chapters. It is intentionally not a polished reporting format;
|
|
327
|
+
instead it holds the small amount of state those chapters repeatedly need to
|
|
328
|
+
maintain or summarize: membership, best score, improvement timing, and room
|
|
329
|
+
for implementation-specific bookkeeping.
|
|
300
330
|
|
|
301
331
|
### TelemetryEntry
|
|
302
332
|
|
|
@@ -329,33 +359,3 @@ function logSummary(t: TelemetryEntry) {
|
|
|
329
359
|
if (t.diversity) console.log('Mean compat', t.diversity.meanCompat);
|
|
330
360
|
}
|
|
331
361
|
```
|
|
332
|
-
|
|
333
|
-
### SpeciesHistoryStat
|
|
334
|
-
|
|
335
|
-
Species statistics at a single historical snapshot (generation boundary).
|
|
336
|
-
|
|
337
|
-
### SpeciesHistoryEntry
|
|
338
|
-
|
|
339
|
-
Species statistics captured for a particular generation.
|
|
340
|
-
|
|
341
|
-
This is the history-buffer unit used by the `species/` chapter. One entry
|
|
342
|
-
answers "what did the species table look like at this generation boundary?"
|
|
343
|
-
without requiring callers to inspect the live registry directly.
|
|
344
|
-
|
|
345
|
-
### SpeciesHistoryStatExtended
|
|
346
|
-
|
|
347
|
-
Extended per-species historical snapshot with optional backfilled metrics
|
|
348
|
-
that may be computed lazily (innovationRange, enabledRatio).
|
|
349
|
-
|
|
350
|
-
### ParetoArchiveEntry
|
|
351
|
-
|
|
352
|
-
Pareto archive entry capturing a genome plus its objective values.
|
|
353
|
-
|
|
354
|
-
This contract is intentionally sparse because the archive is primarily a
|
|
355
|
-
preservation boundary. The stored genome captures the candidate itself, while
|
|
356
|
-
`objectives` preserves the exact multi-objective evidence that justified its
|
|
357
|
-
place on the frontier at the time it was archived.
|
|
358
|
-
|
|
359
|
-
### ObjectiveEvent
|
|
360
|
-
|
|
361
|
-
Objective add/remove lifecycle event for telemetry and auditing.
|
|
@@ -57,37 +57,6 @@ neat._updateSpeciesStagnation();
|
|
|
57
57
|
|
|
58
58
|
## neat/speciation/speciation.ts
|
|
59
59
|
|
|
60
|
-
### _speciate
|
|
61
|
-
|
|
62
|
-
```ts
|
|
63
|
-
_speciate(): void
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
Assign genomes into species based on compatibility distance.
|
|
67
|
-
|
|
68
|
-
This is the main controller-facing speciation pass. It preserves the previous
|
|
69
|
-
species snapshot for telemetry and history, rebuilds memberships against the
|
|
70
|
-
current representatives, adjusts the compatibility threshold, refreshes the
|
|
71
|
-
live representatives, applies optional age-based protection, records a new
|
|
72
|
-
history row, and trims the history buffer.
|
|
73
|
-
|
|
74
|
-
In other words, this helper does not merely "cluster genomes." It keeps the
|
|
75
|
-
long-lived species registry coherent across generations so later phases such
|
|
76
|
-
as selection, pruning, telemetry, and archive inspection can reason about a
|
|
77
|
-
stable notion of species identity.
|
|
78
|
-
|
|
79
|
-
Parameters:
|
|
80
|
-
- `this` - - Speciation harness context.
|
|
81
|
-
|
|
82
|
-
Returns: Nothing.
|
|
83
|
-
|
|
84
|
-
Example:
|
|
85
|
-
|
|
86
|
-
```ts
|
|
87
|
-
neat._speciate();
|
|
88
|
-
console.log(neat._species.length);
|
|
89
|
-
```
|
|
90
|
-
|
|
91
60
|
### _applyFitnessSharing
|
|
92
61
|
|
|
93
62
|
```ts
|
|
@@ -142,6 +111,37 @@ Example:
|
|
|
142
111
|
neat._sortSpeciesMembers(neat._species[0]);
|
|
143
112
|
```
|
|
144
113
|
|
|
114
|
+
### _speciate
|
|
115
|
+
|
|
116
|
+
```ts
|
|
117
|
+
_speciate(): void
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Assign genomes into species based on compatibility distance.
|
|
121
|
+
|
|
122
|
+
This is the main controller-facing speciation pass. It preserves the previous
|
|
123
|
+
species snapshot for telemetry and history, rebuilds memberships against the
|
|
124
|
+
current representatives, adjusts the compatibility threshold, refreshes the
|
|
125
|
+
live representatives, applies optional age-based protection, records a new
|
|
126
|
+
history row, and trims the history buffer.
|
|
127
|
+
|
|
128
|
+
In other words, this helper does not merely "cluster genomes." It keeps the
|
|
129
|
+
long-lived species registry coherent across generations so later phases such
|
|
130
|
+
as selection, pruning, telemetry, and archive inspection can reason about a
|
|
131
|
+
stable notion of species identity.
|
|
132
|
+
|
|
133
|
+
Parameters:
|
|
134
|
+
- `this` - - Speciation harness context.
|
|
135
|
+
|
|
136
|
+
Returns: Nothing.
|
|
137
|
+
|
|
138
|
+
Example:
|
|
139
|
+
|
|
140
|
+
```ts
|
|
141
|
+
neat._speciate();
|
|
142
|
+
console.log(neat._species.length);
|
|
143
|
+
```
|
|
144
|
+
|
|
145
145
|
### _updateSpeciesStagnation
|
|
146
146
|
|
|
147
147
|
```ts
|