@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
|
@@ -35,6 +35,22 @@ flowchart TD
|
|
|
35
35
|
|
|
36
36
|
## neat/lineage/core/lineage.types.ts
|
|
37
37
|
|
|
38
|
+
### AncestorQueueEntry
|
|
39
|
+
|
|
40
|
+
Queue entry used during breadth-first ancestor traversal.
|
|
41
|
+
|
|
42
|
+
Each entry records which ancestor id is being explored, how deep that
|
|
43
|
+
ancestor sits relative to the original genome, and an optional cached genome
|
|
44
|
+
reference so later traversal steps can enqueue that ancestor's parents.
|
|
45
|
+
|
|
46
|
+
### GenomeIndexPair
|
|
47
|
+
|
|
48
|
+
Index pair representing one sampled genome comparison.
|
|
49
|
+
|
|
50
|
+
The lineage uniqueness metric does not compare every possible pair in large
|
|
51
|
+
populations. Instead it samples a bounded set of pairs, then asks how much
|
|
52
|
+
recent ancestry overlaps inside each comparison.
|
|
53
|
+
|
|
38
54
|
### GenomeLike
|
|
39
55
|
|
|
40
56
|
Minimal genome shape used by lineage helpers.
|
|
@@ -62,22 +78,6 @@ The population supplies the ancestry graph to inspect. The RNG provider keeps
|
|
|
62
78
|
sampled uniqueness deterministic so the same run can replay the same sampled
|
|
63
79
|
comparisons during tests or exported-state debugging.
|
|
64
80
|
|
|
65
|
-
### GenomeIndexPair
|
|
66
|
-
|
|
67
|
-
Index pair representing one sampled genome comparison.
|
|
68
|
-
|
|
69
|
-
The lineage uniqueness metric does not compare every possible pair in large
|
|
70
|
-
populations. Instead it samples a bounded set of pairs, then asks how much
|
|
71
|
-
recent ancestry overlaps inside each comparison.
|
|
72
|
-
|
|
73
|
-
### AncestorQueueEntry
|
|
74
|
-
|
|
75
|
-
Queue entry used during breadth-first ancestor traversal.
|
|
76
|
-
|
|
77
|
-
Each entry records which ancestor id is being explored, how deep that
|
|
78
|
-
ancestor sits relative to the original genome, and an optional cached genome
|
|
79
|
-
reference so later traversal steps can enqueue that ancestor's parents.
|
|
80
|
-
|
|
81
81
|
## neat/lineage/core/lineage.core.ts
|
|
82
82
|
|
|
83
83
|
Lineage-analysis mechanics used by NEAT ancestry helpers.
|
|
@@ -119,46 +119,24 @@ flowchart TD
|
|
|
119
119
|
compare --> mean[Mean ancestor uniqueness]:::accent
|
|
120
120
|
```
|
|
121
121
|
|
|
122
|
-
###
|
|
123
|
-
|
|
124
|
-
```ts
|
|
125
|
-
normalizeParentIds(
|
|
126
|
-
value: GenomeLike,
|
|
127
|
-
): number[]
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
Normalize the parent ID list for a genome.
|
|
131
|
-
|
|
132
|
-
This helper is the first seam in the pipeline: it turns "maybe has lineage
|
|
133
|
-
metadata" into a guaranteed array shape so the traversal code never needs to
|
|
134
|
-
branch on missing parent storage.
|
|
135
|
-
|
|
136
|
-
Parameters:
|
|
137
|
-
- `value` - - Genome to read parents from.
|
|
138
|
-
|
|
139
|
-
Returns: Parent ID list, or an empty array when absent.
|
|
140
|
-
|
|
141
|
-
### createInitialQueue
|
|
122
|
+
### calculateMaxSamplePairs
|
|
142
123
|
|
|
143
124
|
```ts
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
): AncestorQueueEntry[]
|
|
125
|
+
calculateMaxSamplePairs(
|
|
126
|
+
size: number,
|
|
127
|
+
): number
|
|
148
128
|
```
|
|
149
129
|
|
|
150
|
-
|
|
130
|
+
Compute the upper bound on sampled genome pairs.
|
|
151
131
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
still respecting the bounded depth window.
|
|
132
|
+
The uniqueness metric is intentionally sampled rather than exhaustive. This
|
|
133
|
+
helper keeps that budget honest by capping the requested sample count to both
|
|
134
|
+
the true combinatorial maximum and the chapter's global runtime limit.
|
|
156
135
|
|
|
157
136
|
Parameters:
|
|
158
|
-
- `
|
|
159
|
-
- `population` - - Current population for ID lookups.
|
|
137
|
+
- `size` - - Population size.
|
|
160
138
|
|
|
161
|
-
Returns:
|
|
139
|
+
Returns: Sample cap respecting both the combinatorial count and the global limit.
|
|
162
140
|
|
|
163
141
|
### collectAncestorIds
|
|
164
142
|
|
|
@@ -186,6 +164,71 @@ Parameters:
|
|
|
186
164
|
|
|
187
165
|
Returns: Unique ancestor IDs encountered within the depth window.
|
|
188
166
|
|
|
167
|
+
### computeAverageDistance
|
|
168
|
+
|
|
169
|
+
```ts
|
|
170
|
+
computeAverageDistance(
|
|
171
|
+
distances: number[],
|
|
172
|
+
): number
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
Compute the mean ancestor distance across sampled pairs.
|
|
176
|
+
|
|
177
|
+
This is the final fold from many local comparisons into one controller-facing
|
|
178
|
+
scalar. Rounding is intentional: the value is meant to be a stable telemetry
|
|
179
|
+
and adaptive-policy signal rather than a high-precision scientific output.
|
|
180
|
+
|
|
181
|
+
Parameters:
|
|
182
|
+
- `distances` - - Pairwise Jaccard distances.
|
|
183
|
+
|
|
184
|
+
Returns: Mean distance rounded to the configured decimal precision.
|
|
185
|
+
|
|
186
|
+
### computePairDistances
|
|
187
|
+
|
|
188
|
+
```ts
|
|
189
|
+
computePairDistances(
|
|
190
|
+
pairs: GenomeIndexPair[],
|
|
191
|
+
population: GenomeLike[],
|
|
192
|
+
buildAncestorSet: (genome: GenomeLike) => Set<number>,
|
|
193
|
+
): number[]
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
Compute Jaccard distances for sampled genome pairs.
|
|
197
|
+
|
|
198
|
+
This stage turns sampled pair indices into actual lineage evidence. Each pair
|
|
199
|
+
is resolved to two genomes, each genome is expanded into a shallow ancestor
|
|
200
|
+
set, and those sets are compared using Jaccard distance so the final metric
|
|
201
|
+
reflects overlap rather than raw ancestor counts.
|
|
202
|
+
|
|
203
|
+
Parameters:
|
|
204
|
+
- `pairs` - - Sampled index pairs.
|
|
205
|
+
- `population` - - Current population.
|
|
206
|
+
- `buildAncestorSet` - - Helper that builds ancestor sets for genomes.
|
|
207
|
+
|
|
208
|
+
Returns: Jaccard distances for valid pairs.
|
|
209
|
+
|
|
210
|
+
### createInitialQueue
|
|
211
|
+
|
|
212
|
+
```ts
|
|
213
|
+
createInitialQueue(
|
|
214
|
+
parentIds: number[],
|
|
215
|
+
population: GenomeLike[],
|
|
216
|
+
): AncestorQueueEntry[]
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
Create the initial breadth-first queue from direct parent IDs.
|
|
220
|
+
|
|
221
|
+
This queue is the bridge between stored lineage metadata and the traversal
|
|
222
|
+
loop. Depth starts at the direct-parent layer because lineage uniqueness is a
|
|
223
|
+
recent-family metric first; later queue expansion can then walk outward while
|
|
224
|
+
still respecting the bounded depth window.
|
|
225
|
+
|
|
226
|
+
Parameters:
|
|
227
|
+
- `parentIds` - - Direct parent IDs to seed the queue.
|
|
228
|
+
- `population` - - Current population for ID lookups.
|
|
229
|
+
|
|
230
|
+
Returns: Queue entries at depth 1.
|
|
231
|
+
|
|
189
232
|
### hasMinimumPopulation
|
|
190
233
|
|
|
191
234
|
```ts
|
|
@@ -205,24 +248,24 @@ Parameters:
|
|
|
205
248
|
|
|
206
249
|
Returns: `true` when at least two genomes exist.
|
|
207
250
|
|
|
208
|
-
###
|
|
251
|
+
### normalizeParentIds
|
|
209
252
|
|
|
210
253
|
```ts
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
): number
|
|
254
|
+
normalizeParentIds(
|
|
255
|
+
value: GenomeLike,
|
|
256
|
+
): number[]
|
|
214
257
|
```
|
|
215
258
|
|
|
216
|
-
|
|
259
|
+
Normalize the parent ID list for a genome.
|
|
217
260
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
261
|
+
This helper is the first seam in the pipeline: it turns "maybe has lineage
|
|
262
|
+
metadata" into a guaranteed array shape so the traversal code never needs to
|
|
263
|
+
branch on missing parent storage.
|
|
221
264
|
|
|
222
265
|
Parameters:
|
|
223
|
-
- `
|
|
266
|
+
- `value` - - Genome to read parents from.
|
|
224
267
|
|
|
225
|
-
Returns:
|
|
268
|
+
Returns: Parent ID list, or an empty array when absent.
|
|
226
269
|
|
|
227
270
|
### sampleGenomePairs
|
|
228
271
|
|
|
@@ -247,46 +290,3 @@ Parameters:
|
|
|
247
290
|
- `rngFactory` - - RNG provider used to obtain a random function.
|
|
248
291
|
|
|
249
292
|
Returns: Array of sampled index pairs.
|
|
250
|
-
|
|
251
|
-
### computePairDistances
|
|
252
|
-
|
|
253
|
-
```ts
|
|
254
|
-
computePairDistances(
|
|
255
|
-
pairs: GenomeIndexPair[],
|
|
256
|
-
population: GenomeLike[],
|
|
257
|
-
buildAncestorSet: (genome: GenomeLike) => Set<number>,
|
|
258
|
-
): number[]
|
|
259
|
-
```
|
|
260
|
-
|
|
261
|
-
Compute Jaccard distances for sampled genome pairs.
|
|
262
|
-
|
|
263
|
-
This stage turns sampled pair indices into actual lineage evidence. Each pair
|
|
264
|
-
is resolved to two genomes, each genome is expanded into a shallow ancestor
|
|
265
|
-
set, and those sets are compared using Jaccard distance so the final metric
|
|
266
|
-
reflects overlap rather than raw ancestor counts.
|
|
267
|
-
|
|
268
|
-
Parameters:
|
|
269
|
-
- `pairs` - - Sampled index pairs.
|
|
270
|
-
- `population` - - Current population.
|
|
271
|
-
- `buildAncestorSet` - - Helper that builds ancestor sets for genomes.
|
|
272
|
-
|
|
273
|
-
Returns: Jaccard distances for valid pairs.
|
|
274
|
-
|
|
275
|
-
### computeAverageDistance
|
|
276
|
-
|
|
277
|
-
```ts
|
|
278
|
-
computeAverageDistance(
|
|
279
|
-
distances: number[],
|
|
280
|
-
): number
|
|
281
|
-
```
|
|
282
|
-
|
|
283
|
-
Compute the mean ancestor distance across sampled pairs.
|
|
284
|
-
|
|
285
|
-
This is the final fold from many local comparisons into one controller-facing
|
|
286
|
-
scalar. Rounding is intentional: the value is meant to be a stable telemetry
|
|
287
|
-
and adaptive-policy signal rather than a high-precision scientific output.
|
|
288
|
-
|
|
289
|
-
Parameters:
|
|
290
|
-
- `distances` - - Pairwise Jaccard distances.
|
|
291
|
-
|
|
292
|
-
Returns: Mean distance rounded to the configured decimal precision.
|
|
@@ -33,38 +33,33 @@ flowchart TD
|
|
|
33
33
|
|
|
34
34
|
## neat/multiobjective/category/multiobjective.category.ts
|
|
35
35
|
|
|
36
|
-
###
|
|
36
|
+
### adaptDominanceEpsilon
|
|
37
37
|
|
|
38
38
|
```ts
|
|
39
|
-
|
|
39
|
+
adaptDominanceEpsilon(
|
|
40
40
|
internal: NeatControllerForEvolution,
|
|
41
|
-
|
|
41
|
+
paretoFronts: GenomeWithMetadata[][],
|
|
42
|
+
config: { targetFrontMin: number; targetFrontUpperRatio: number; targetFrontLowerRatio: number; defaultEpsilonAdjust: number; defaultEpsilonMin: number; defaultEpsilonMax: number; defaultEpsilonCooldown: number; },
|
|
42
43
|
): void
|
|
43
44
|
```
|
|
44
45
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
This is the bridge between the generic Pareto-ranking helpers and the larger
|
|
48
|
-
evolve loop. It runs the ranking pass, reorders the live population by
|
|
49
|
-
`(rank, crowding)`, snapshots the best fronts for telemetry, optionally
|
|
50
|
-
adjusts dominance epsilon to keep the frontier size useful, and prunes
|
|
51
|
-
objectives that have gone flat for long enough to stop influencing search.
|
|
46
|
+
Adapt dominance epsilon based on Pareto front size.
|
|
52
47
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
4. tune or prune long-lived multi-objective policy state.
|
|
48
|
+
This is the controller's feedback loop for keeping the leading front in a
|
|
49
|
+
useful size band. If too many genomes land on the first front, epsilon grows
|
|
50
|
+
so future dominance becomes stricter. If too few survive, epsilon shrinks so
|
|
51
|
+
the controller relaxes back toward a broader competitive set.
|
|
58
52
|
|
|
59
|
-
The
|
|
60
|
-
|
|
61
|
-
the
|
|
53
|
+
The cooldown gate matters because the frontier can oscillate from one
|
|
54
|
+
generation to the next. Waiting a few generations between adjustments keeps
|
|
55
|
+
the threshold from chattering.
|
|
62
56
|
|
|
63
57
|
Parameters:
|
|
64
58
|
- `internal` - - NEAT controller instance.
|
|
65
|
-
- `
|
|
59
|
+
- `paretoFronts` - - Non-dominated fronts.
|
|
60
|
+
- `config` - - Epsilon tuning constants.
|
|
66
61
|
|
|
67
|
-
Returns:
|
|
62
|
+
Returns: void.
|
|
68
63
|
|
|
69
64
|
### computeCrowdingDistances
|
|
70
65
|
|
|
@@ -97,27 +92,64 @@ Parameters:
|
|
|
97
92
|
|
|
98
93
|
Returns: crowding distances aligned with population order.
|
|
99
94
|
|
|
100
|
-
###
|
|
95
|
+
### processMultiObjective
|
|
101
96
|
|
|
102
97
|
```ts
|
|
103
|
-
|
|
98
|
+
processMultiObjective(
|
|
104
99
|
internal: NeatControllerForEvolution,
|
|
105
|
-
|
|
106
|
-
crowdingDistances: number[],
|
|
100
|
+
config: { paretoArchiveMax: number; targetFrontMin: number; targetFrontUpperRatio: number; targetFrontLowerRatio: number; defaultEpsilonAdjust: number; defaultEpsilonMin: number; defaultEpsilonMax: number; defaultEpsilonCooldown: number; pruneWindowDefault: number; pruneRangeEpsDefault: number; },
|
|
107
101
|
): void
|
|
108
102
|
```
|
|
109
103
|
|
|
110
|
-
|
|
104
|
+
Apply the multi-objective evolution policy for the current generation.
|
|
111
105
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
106
|
+
This is the bridge between the generic Pareto-ranking helpers and the larger
|
|
107
|
+
evolve loop. It runs the ranking pass, reorders the live population by
|
|
108
|
+
`(rank, crowding)`, snapshots the best fronts for telemetry, optionally
|
|
109
|
+
adjusts dominance epsilon to keep the frontier size useful, and prunes
|
|
110
|
+
objectives that have gone flat for long enough to stop influencing search.
|
|
111
|
+
|
|
112
|
+
Conceptually, this helper owns the post-ranking reaction layer:
|
|
113
|
+
1. compute fresh fronts and crowding evidence,
|
|
114
|
+
2. convert that evidence into stable population order,
|
|
115
|
+
3. persist compact history for later reads,
|
|
116
|
+
4. tune or prune long-lived multi-objective policy state.
|
|
117
|
+
|
|
118
|
+
The function updates the controller in place because evolve needs the new
|
|
119
|
+
ordering, archive state, and adaptive settings immediately for the rest of
|
|
120
|
+
the generation loop.
|
|
116
121
|
|
|
117
122
|
Parameters:
|
|
118
123
|
- `internal` - - NEAT controller instance.
|
|
119
|
-
- `
|
|
120
|
-
|
|
124
|
+
- `config` - - Multi-objective tuning constants.
|
|
125
|
+
|
|
126
|
+
Returns: Nothing. The controller is updated in place.
|
|
127
|
+
|
|
128
|
+
### pruneInactiveObjectives
|
|
129
|
+
|
|
130
|
+
```ts
|
|
131
|
+
pruneInactiveObjectives(
|
|
132
|
+
internal: NeatControllerForEvolution,
|
|
133
|
+
config: { pruneWindowDefault: number; pruneRangeEpsDefault: number; },
|
|
134
|
+
): void
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Prune objectives that have collapsed ranges over a window.
|
|
138
|
+
|
|
139
|
+
This helper removes objectives that are no longer contributing meaningful
|
|
140
|
+
discrimination across the current population. An objective is considered
|
|
141
|
+
structurally inactive when its observed range stays below the configured
|
|
142
|
+
epsilon for enough consecutive generations.
|
|
143
|
+
|
|
144
|
+
The pruning pass is intentionally conservative:
|
|
145
|
+
- protected objectives such as `fitness` and `complexity` are never removed,
|
|
146
|
+
- stale counters must persist for a full window before removal,
|
|
147
|
+
- objective-cache invalidation happens only after an actual removal so later
|
|
148
|
+
reads rebuild the descriptor list from the surviving objective set.
|
|
149
|
+
|
|
150
|
+
Parameters:
|
|
151
|
+
- `internal` - - NEAT controller instance.
|
|
152
|
+
- `config` - - Pruning constants.
|
|
121
153
|
|
|
122
154
|
Returns: void.
|
|
123
155
|
|
|
@@ -151,58 +183,26 @@ Parameters:
|
|
|
151
183
|
|
|
152
184
|
Returns: void.
|
|
153
185
|
|
|
154
|
-
###
|
|
155
|
-
|
|
156
|
-
```ts
|
|
157
|
-
adaptDominanceEpsilon(
|
|
158
|
-
internal: NeatControllerForEvolution,
|
|
159
|
-
paretoFronts: GenomeWithMetadata[][],
|
|
160
|
-
config: { targetFrontMin: number; targetFrontUpperRatio: number; targetFrontLowerRatio: number; defaultEpsilonAdjust: number; defaultEpsilonMin: number; defaultEpsilonMax: number; defaultEpsilonCooldown: number; },
|
|
161
|
-
): void
|
|
162
|
-
```
|
|
163
|
-
|
|
164
|
-
Adapt dominance epsilon based on Pareto front size.
|
|
165
|
-
|
|
166
|
-
This is the controller's feedback loop for keeping the leading front in a
|
|
167
|
-
useful size band. If too many genomes land on the first front, epsilon grows
|
|
168
|
-
so future dominance becomes stricter. If too few survive, epsilon shrinks so
|
|
169
|
-
the controller relaxes back toward a broader competitive set.
|
|
170
|
-
|
|
171
|
-
The cooldown gate matters because the frontier can oscillate from one
|
|
172
|
-
generation to the next. Waiting a few generations between adjustments keeps
|
|
173
|
-
the threshold from chattering.
|
|
174
|
-
|
|
175
|
-
Parameters:
|
|
176
|
-
- `internal` - - NEAT controller instance.
|
|
177
|
-
- `paretoFronts` - - Non-dominated fronts.
|
|
178
|
-
- `config` - - Epsilon tuning constants.
|
|
179
|
-
|
|
180
|
-
Returns: void.
|
|
181
|
-
|
|
182
|
-
### pruneInactiveObjectives
|
|
186
|
+
### sortPopulationByPareto
|
|
183
187
|
|
|
184
188
|
```ts
|
|
185
|
-
|
|
189
|
+
sortPopulationByPareto(
|
|
186
190
|
internal: NeatControllerForEvolution,
|
|
187
|
-
|
|
191
|
+
populationSnapshot: GenomeWithMetadata[],
|
|
192
|
+
crowdingDistances: number[],
|
|
188
193
|
): void
|
|
189
194
|
```
|
|
190
195
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
This helper removes objectives that are no longer contributing meaningful
|
|
194
|
-
discrimination across the current population. An objective is considered
|
|
195
|
-
structurally inactive when its observed range stays below the configured
|
|
196
|
-
epsilon for enough consecutive generations.
|
|
196
|
+
Sort population by Pareto rank and crowding distance.
|
|
197
197
|
|
|
198
|
-
The
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
reads rebuild the descriptor list from the surviving objective set.
|
|
198
|
+
The ordering rule is lexicographic: lower `_moRank` wins first, then higher
|
|
199
|
+
crowding distance wins within the same front. This keeps the live population
|
|
200
|
+
aligned with NSGA-II style selection pressure while preserving one stable
|
|
201
|
+
index map from the pre-sort snapshot to the later crowding write-back.
|
|
203
202
|
|
|
204
203
|
Parameters:
|
|
205
204
|
- `internal` - - NEAT controller instance.
|
|
206
|
-
- `
|
|
205
|
+
- `populationSnapshot` - - Current population reference.
|
|
206
|
+
- `crowdingDistances` - - Crowding distances aligned with population order.
|
|
207
207
|
|
|
208
208
|
Returns: void.
|