@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
|
@@ -48,6 +48,49 @@ annotations.
|
|
|
48
48
|
|
|
49
49
|
Returns: Compact metrics aligned with the current population order.
|
|
50
50
|
|
|
51
|
+
### DEFAULT_MAX_PARETO_FRONTS
|
|
52
|
+
|
|
53
|
+
Default number of Pareto fronts returned by accessors.
|
|
54
|
+
|
|
55
|
+
Read helpers stay deliberately bounded by default so inspection callers get a
|
|
56
|
+
useful frontier summary without accidentally materializing every tail front.
|
|
57
|
+
|
|
58
|
+
### DEFAULT_PARETO_ARCHIVE_JSONL_MAX
|
|
59
|
+
|
|
60
|
+
Default slice size when exporting Pareto archive as JSONL.
|
|
61
|
+
|
|
62
|
+
Export uses a slightly larger default window than in-memory reads so offline
|
|
63
|
+
tooling can inspect a broader recent history without requiring the full
|
|
64
|
+
archive.
|
|
65
|
+
|
|
66
|
+
### DEFAULT_PARETO_ARCHIVE_MAX_ENTRIES
|
|
67
|
+
|
|
68
|
+
Default slice size when reading Pareto archive entries.
|
|
69
|
+
|
|
70
|
+
This favors recent history, which is usually the most relevant window for
|
|
71
|
+
telemetry panels or interactive inspection.
|
|
72
|
+
|
|
73
|
+
### exportParetoArchiveJsonl
|
|
74
|
+
|
|
75
|
+
```ts
|
|
76
|
+
exportParetoArchiveJsonl(
|
|
77
|
+
archive: unknown[],
|
|
78
|
+
maxEntries: number,
|
|
79
|
+
): string
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Export a Pareto archive slice as JSON Lines.
|
|
83
|
+
|
|
84
|
+
JSONL keeps each archived snapshot on its own line, which makes the output
|
|
85
|
+
easy to stream, diff, or feed into external tooling without inventing another
|
|
86
|
+
archive-specific export format.
|
|
87
|
+
|
|
88
|
+
Parameters:
|
|
89
|
+
- `archive` - - Archive collection ordered from oldest to newest.
|
|
90
|
+
- `maxEntries` - - Maximum number of recent entries to export.
|
|
91
|
+
|
|
92
|
+
Returns: Newline-delimited JSON for the selected archive window.
|
|
93
|
+
|
|
51
94
|
### reconstructParetoFronts
|
|
52
95
|
|
|
53
96
|
```ts
|
|
@@ -95,46 +138,3 @@ Parameters:
|
|
|
95
138
|
- `maxEntries` - - Maximum number of recent entries to keep.
|
|
96
139
|
|
|
97
140
|
Returns: A trailing slice containing at most `maxEntries` items.
|
|
98
|
-
|
|
99
|
-
### exportParetoArchiveJsonl
|
|
100
|
-
|
|
101
|
-
```ts
|
|
102
|
-
exportParetoArchiveJsonl(
|
|
103
|
-
archive: unknown[],
|
|
104
|
-
maxEntries: number,
|
|
105
|
-
): string
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
Export a Pareto archive slice as JSON Lines.
|
|
109
|
-
|
|
110
|
-
JSONL keeps each archived snapshot on its own line, which makes the output
|
|
111
|
-
easy to stream, diff, or feed into external tooling without inventing another
|
|
112
|
-
archive-specific export format.
|
|
113
|
-
|
|
114
|
-
Parameters:
|
|
115
|
-
- `archive` - - Archive collection ordered from oldest to newest.
|
|
116
|
-
- `maxEntries` - - Maximum number of recent entries to export.
|
|
117
|
-
|
|
118
|
-
Returns: Newline-delimited JSON for the selected archive window.
|
|
119
|
-
|
|
120
|
-
### DEFAULT_MAX_PARETO_FRONTS
|
|
121
|
-
|
|
122
|
-
Default number of Pareto fronts returned by accessors.
|
|
123
|
-
|
|
124
|
-
Read helpers stay deliberately bounded by default so inspection callers get a
|
|
125
|
-
useful frontier summary without accidentally materializing every tail front.
|
|
126
|
-
|
|
127
|
-
### DEFAULT_PARETO_ARCHIVE_MAX_ENTRIES
|
|
128
|
-
|
|
129
|
-
Default slice size when reading Pareto archive entries.
|
|
130
|
-
|
|
131
|
-
This favors recent history, which is usually the most relevant window for
|
|
132
|
-
telemetry panels or interactive inspection.
|
|
133
|
-
|
|
134
|
-
### DEFAULT_PARETO_ARCHIVE_JSONL_MAX
|
|
135
|
-
|
|
136
|
-
Default slice size when exporting Pareto archive as JSONL.
|
|
137
|
-
|
|
138
|
-
Export uses a slightly larger default window than in-memory reads so offline
|
|
139
|
-
tooling can inspect a broader recent history without requiring the full
|
|
140
|
-
archive.
|
|
@@ -33,37 +33,6 @@ flowchart TD
|
|
|
33
33
|
|
|
34
34
|
## neat/multiobjective/objectives/multiobjective.objectives.ts
|
|
35
35
|
|
|
36
|
-
### readObjectiveValue
|
|
37
|
-
|
|
38
|
-
```ts
|
|
39
|
-
readObjectiveValue(
|
|
40
|
-
genomeItem: default,
|
|
41
|
-
descriptor: ObjectiveDescriptor,
|
|
42
|
-
): number
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
Safely reads a single objective value for a given genome.
|
|
46
|
-
|
|
47
|
-
This wraps the descriptor `accessor` in a `try/catch` so that a buggy
|
|
48
|
-
objective function cannot crash multi-objective ranking.
|
|
49
|
-
|
|
50
|
-
Notes:
|
|
51
|
-
- If the accessor throws, this returns `0` (a neutral-ish fallback).
|
|
52
|
-
- Callers should prefer to surface accessor errors during development;
|
|
53
|
-
this helper is intentionally defensive for long-running training loops.
|
|
54
|
-
|
|
55
|
-
Parameters:
|
|
56
|
-
- `genomeItem` - - Genome to evaluate.
|
|
57
|
-
- `descriptor` - - Objective descriptor providing an accessor.
|
|
58
|
-
|
|
59
|
-
Returns: Numeric objective value; `0` if the accessor throws.
|
|
60
|
-
|
|
61
|
-
Example:
|
|
62
|
-
|
|
63
|
-
```ts
|
|
64
|
-
const score = readObjectiveValue(genome, { accessor: (g) => g.score ?? 0 });
|
|
65
|
-
```
|
|
66
|
-
|
|
67
36
|
### buildGenomeValues
|
|
68
37
|
|
|
69
38
|
```ts
|
|
@@ -111,3 +80,34 @@ Parameters:
|
|
|
111
80
|
- `descriptors` - - Objective descriptors (column schema).
|
|
112
81
|
|
|
113
82
|
Returns: Objective values matrix.
|
|
83
|
+
|
|
84
|
+
### readObjectiveValue
|
|
85
|
+
|
|
86
|
+
```ts
|
|
87
|
+
readObjectiveValue(
|
|
88
|
+
genomeItem: default,
|
|
89
|
+
descriptor: ObjectiveDescriptor,
|
|
90
|
+
): number
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Safely reads a single objective value for a given genome.
|
|
94
|
+
|
|
95
|
+
This wraps the descriptor `accessor` in a `try/catch` so that a buggy
|
|
96
|
+
objective function cannot crash multi-objective ranking.
|
|
97
|
+
|
|
98
|
+
Notes:
|
|
99
|
+
- If the accessor throws, this returns `0` (a neutral-ish fallback).
|
|
100
|
+
- Callers should prefer to surface accessor errors during development;
|
|
101
|
+
this helper is intentionally defensive for long-running training loops.
|
|
102
|
+
|
|
103
|
+
Parameters:
|
|
104
|
+
- `genomeItem` - - Genome to evaluate.
|
|
105
|
+
- `descriptor` - - Objective descriptor providing an accessor.
|
|
106
|
+
|
|
107
|
+
Returns: Numeric objective value; `0` if the accessor throws.
|
|
108
|
+
|
|
109
|
+
Example:
|
|
110
|
+
|
|
111
|
+
```ts
|
|
112
|
+
const score = readObjectiveValue(genome, { accessor: (g) => g.score ?? 0 });
|
|
113
|
+
```
|
|
@@ -25,6 +25,33 @@ still run, but they would be reasoning about the wrong objectives or genomes.
|
|
|
25
25
|
|
|
26
26
|
## neat/multiobjective/shared/multiobjective.types.ts
|
|
27
27
|
|
|
28
|
+
### NeatLikeWithMultiObjective
|
|
29
|
+
|
|
30
|
+
Minimal Neat-like interface required by the multi-objective helpers.
|
|
31
|
+
|
|
32
|
+
This host contract stays intentionally small so the multi-objective helpers
|
|
33
|
+
can be reused without depending on the entire `Neat` controller surface.
|
|
34
|
+
The boundary owns only two kinds of state:
|
|
35
|
+
- objective-schema access for the start of the ranking pass,
|
|
36
|
+
- optional Pareto-archive state for the end of the ranking pass.
|
|
37
|
+
|
|
38
|
+
Everything else stays outside this interface on purpose. `objectives/`,
|
|
39
|
+
`dominance/`, `fronts/`, and `crowding/` operate on prepared vectors,
|
|
40
|
+
bookkeeping structures, and annotated genomes rather than reaching back into
|
|
41
|
+
controller internals mid-pass.
|
|
42
|
+
|
|
43
|
+
### NetworkWithMOAnnotations
|
|
44
|
+
|
|
45
|
+
Extends a genome/network with multi-objective annotations.
|
|
46
|
+
|
|
47
|
+
These properties are transient ranking metadata. They are attached after the
|
|
48
|
+
multi-objective helpers compute fronts and crowding distances, then consumed
|
|
49
|
+
by later selection or inspection code as a compact summary of where a genome
|
|
50
|
+
landed on the current Pareto surface.
|
|
51
|
+
|
|
52
|
+
Treat these fields as derived evidence, not durable genome state. A later
|
|
53
|
+
ranking pass is free to recompute or overwrite them.
|
|
54
|
+
|
|
28
55
|
### ObjectiveDescriptor
|
|
29
56
|
|
|
30
57
|
Describes how to evaluate one objective for one genome.
|
|
@@ -56,30 +83,3 @@ const objectives: ObjectiveDescriptor[] = [
|
|
|
56
83
|
{ accessor: (genome) => genome.cost ?? 0, direction: 'min' },
|
|
57
84
|
];
|
|
58
85
|
```
|
|
59
|
-
|
|
60
|
-
### NeatLikeWithMultiObjective
|
|
61
|
-
|
|
62
|
-
Minimal Neat-like interface required by the multi-objective helpers.
|
|
63
|
-
|
|
64
|
-
This host contract stays intentionally small so the multi-objective helpers
|
|
65
|
-
can be reused without depending on the entire `Neat` controller surface.
|
|
66
|
-
The boundary owns only two kinds of state:
|
|
67
|
-
- objective-schema access for the start of the ranking pass,
|
|
68
|
-
- optional Pareto-archive state for the end of the ranking pass.
|
|
69
|
-
|
|
70
|
-
Everything else stays outside this interface on purpose. `objectives/`,
|
|
71
|
-
`dominance/`, `fronts/`, and `crowding/` operate on prepared vectors,
|
|
72
|
-
bookkeeping structures, and annotated genomes rather than reaching back into
|
|
73
|
-
controller internals mid-pass.
|
|
74
|
-
|
|
75
|
-
### NetworkWithMOAnnotations
|
|
76
|
-
|
|
77
|
-
Extends a genome/network with multi-objective annotations.
|
|
78
|
-
|
|
79
|
-
These properties are transient ranking metadata. They are attached after the
|
|
80
|
-
multi-objective helpers compute fronts and crowding distances, then consumed
|
|
81
|
-
by later selection or inspection code as a compact summary of where a genome
|
|
82
|
-
landed on the current Pareto surface.
|
|
83
|
-
|
|
84
|
-
Treat these fields as derived evidence, not durable genome state. A later
|
|
85
|
-
ranking pass is free to recompute or overwrite them.
|
|
@@ -55,6 +55,76 @@ flowchart TD
|
|
|
55
55
|
|
|
56
56
|
## neat/mutation/mutation.ts
|
|
57
57
|
|
|
58
|
+
### DEFAULT_CONNECTION_WEIGHT
|
|
59
|
+
|
|
60
|
+
Default connection weight used when mutation must create a structural edge from scratch.
|
|
61
|
+
|
|
62
|
+
This keeps bootstrap connections and split in-edges deterministic at the
|
|
63
|
+
mutation boundary before later weight mutations or evaluation passes tune the
|
|
64
|
+
value more precisely.
|
|
65
|
+
|
|
66
|
+
### DEFAULT_GENE_ID
|
|
67
|
+
|
|
68
|
+
Default gene id used when mutation needs a stable fallback for node metadata.
|
|
69
|
+
|
|
70
|
+
The value is intentionally simple because it acts as compatibility padding,
|
|
71
|
+
not as a semantic innovation marker.
|
|
72
|
+
|
|
73
|
+
### DEFAULT_INNOVATION_ID
|
|
74
|
+
|
|
75
|
+
Default innovation id used when a connection lacks recorded innovation metadata.
|
|
76
|
+
|
|
77
|
+
This fallback prevents root mutation helpers from depending on missing ids
|
|
78
|
+
while the real innovation-tracking paths decide whether to reuse or allocate
|
|
79
|
+
new structural records.
|
|
80
|
+
|
|
81
|
+
### ensureMinHiddenNodes
|
|
82
|
+
|
|
83
|
+
```ts
|
|
84
|
+
ensureMinHiddenNodes(
|
|
85
|
+
network: GenomeWithMetadata,
|
|
86
|
+
multiplierOverride: number | undefined,
|
|
87
|
+
): Promise<void>
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Ensure the network has a minimum number of hidden nodes and connectivity.
|
|
91
|
+
|
|
92
|
+
This repair helper runs after structural edits when the controller wants to
|
|
93
|
+
keep a mutated genome above a minimum hidden-capacity floor. It is less about
|
|
94
|
+
exploration than about preserving a usable topology budget so later mutation,
|
|
95
|
+
evaluation, and selection steps do not inherit a trivially underbuilt graph.
|
|
96
|
+
|
|
97
|
+
The helper may add hidden nodes, wire missing edges, and rebuild cached
|
|
98
|
+
connection structures, so callers should treat it as a topology-maintenance
|
|
99
|
+
pass rather than a tiny invariant check.
|
|
100
|
+
|
|
101
|
+
Parameters:
|
|
102
|
+
- `network` - Genome whose hidden-node budget and connectivity should be repaired.
|
|
103
|
+
- `multiplierOverride` - Optional override for the configured hidden-node multiplier.
|
|
104
|
+
|
|
105
|
+
Returns: Promise that resolves after hidden-node and connectivity repairs have completed.
|
|
106
|
+
|
|
107
|
+
### ensureNoDeadEnds
|
|
108
|
+
|
|
109
|
+
```ts
|
|
110
|
+
ensureNoDeadEnds(
|
|
111
|
+
network: GenomeWithMetadata,
|
|
112
|
+
): void
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Ensure there are no dead-end nodes (input/output isolation) in the network.
|
|
116
|
+
|
|
117
|
+
Mutation can produce temporarily awkward graphs, especially after structural
|
|
118
|
+
growth or pruning-like simplification. This repair pass reconnects stranded
|
|
119
|
+
input, output, or hidden nodes so the genome remains a sensible candidate for
|
|
120
|
+
later evaluation and does not carry obviously broken topology into the next
|
|
121
|
+
controller stage.
|
|
122
|
+
|
|
123
|
+
Parameters:
|
|
124
|
+
- `network` - Genome whose endpoint and hidden-node connectivity should be repaired.
|
|
125
|
+
|
|
126
|
+
Returns: Nothing. The network may gain repair connections in place.
|
|
127
|
+
|
|
58
128
|
### mutate
|
|
59
129
|
|
|
60
130
|
```ts
|
|
@@ -94,48 +164,6 @@ Example:
|
|
|
94
164
|
neat.mutate();
|
|
95
165
|
```
|
|
96
166
|
|
|
97
|
-
### mutateAddNodeReuse
|
|
98
|
-
|
|
99
|
-
```ts
|
|
100
|
-
mutateAddNodeReuse(
|
|
101
|
-
genome: GenomeWithMetadata,
|
|
102
|
-
): Promise<void>
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
Split a randomly chosen enabled connection and insert a hidden node.
|
|
106
|
-
|
|
107
|
-
This routine attempts to reuse a historical "node split" innovation record
|
|
108
|
-
so that identical splits across different genomes share the same
|
|
109
|
-
innovation ids. This preservation of innovation information is important
|
|
110
|
-
for NEAT-style speciation and genome alignment.
|
|
111
|
-
|
|
112
|
-
Use this helper when the controller wants a structural growth mutation that
|
|
113
|
-
stays compatible with prior history. The important state change is not only
|
|
114
|
-
the new hidden node inside one genome, but also the possible update to the
|
|
115
|
-
controller's split-innovation table when this exact split has never been seen
|
|
116
|
-
before.
|
|
117
|
-
|
|
118
|
-
Method steps (high-level):
|
|
119
|
-
- If the genome has no connections, connect an input to an output to
|
|
120
|
-
bootstrap connectivity.
|
|
121
|
-
- Filter enabled connections and choose one at random.
|
|
122
|
-
- Disconnect the chosen connection and either reuse an existing split
|
|
123
|
-
innovation record or create a new hidden node + two connecting
|
|
124
|
-
connections (in->new, new->out) assigning new innovation ids.
|
|
125
|
-
- Insert the newly created node into the genome's node list at the
|
|
126
|
-
deterministic position to preserve ordering for downstream algorithms.
|
|
127
|
-
|
|
128
|
-
Parameters:
|
|
129
|
-
- `genome` - Genome to modify in place.
|
|
130
|
-
|
|
131
|
-
Returns: Promise that resolves after the split has either reused an existing innovation record or created a new one.
|
|
132
|
-
|
|
133
|
-
Example:
|
|
134
|
-
|
|
135
|
-
```ts
|
|
136
|
-
neat._mutateAddNodeReuse(genome);
|
|
137
|
-
```
|
|
138
|
-
|
|
139
167
|
### mutateAddConnReuse
|
|
140
168
|
|
|
141
169
|
```ts
|
|
@@ -176,53 +204,48 @@ Parameters:
|
|
|
176
204
|
|
|
177
205
|
Returns: Nothing. The genome may gain one new connection and the controller innovation map may be consulted or extended.
|
|
178
206
|
|
|
179
|
-
###
|
|
207
|
+
### mutateAddNodeReuse
|
|
180
208
|
|
|
181
209
|
```ts
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
multiplierOverride: number | undefined,
|
|
210
|
+
mutateAddNodeReuse(
|
|
211
|
+
genome: GenomeWithMetadata,
|
|
185
212
|
): Promise<void>
|
|
186
213
|
```
|
|
187
214
|
|
|
188
|
-
|
|
215
|
+
Split a randomly chosen enabled connection and insert a hidden node.
|
|
189
216
|
|
|
190
|
-
This
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
217
|
+
This routine attempts to reuse a historical "node split" innovation record
|
|
218
|
+
so that identical splits across different genomes share the same
|
|
219
|
+
innovation ids. This preservation of innovation information is important
|
|
220
|
+
for NEAT-style speciation and genome alignment.
|
|
194
221
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
222
|
+
Use this helper when the controller wants a structural growth mutation that
|
|
223
|
+
stays compatible with prior history. The important state change is not only
|
|
224
|
+
the new hidden node inside one genome, but also the possible update to the
|
|
225
|
+
controller's split-innovation table when this exact split has never been seen
|
|
226
|
+
before.
|
|
227
|
+
|
|
228
|
+
Method steps (high-level):
|
|
229
|
+
- If the genome has no connections, connect an input to an output to
|
|
230
|
+
bootstrap connectivity.
|
|
231
|
+
- Filter enabled connections and choose one at random.
|
|
232
|
+
- Disconnect the chosen connection and either reuse an existing split
|
|
233
|
+
innovation record or create a new hidden node + two connecting
|
|
234
|
+
connections (in->new, new->out) assigning new innovation ids.
|
|
235
|
+
- Insert the newly created node into the genome's node list at the
|
|
236
|
+
deterministic position to preserve ordering for downstream algorithms.
|
|
198
237
|
|
|
199
238
|
Parameters:
|
|
200
|
-
- `
|
|
201
|
-
- `multiplierOverride` - Optional override for the configured hidden-node multiplier.
|
|
239
|
+
- `genome` - Genome to modify in place.
|
|
202
240
|
|
|
203
|
-
Returns: Promise that resolves after
|
|
241
|
+
Returns: Promise that resolves after the split has either reused an existing innovation record or created a new one.
|
|
204
242
|
|
|
205
|
-
|
|
243
|
+
Example:
|
|
206
244
|
|
|
207
245
|
```ts
|
|
208
|
-
|
|
209
|
-
network: GenomeWithMetadata,
|
|
210
|
-
): void
|
|
246
|
+
neat._mutateAddNodeReuse(genome);
|
|
211
247
|
```
|
|
212
248
|
|
|
213
|
-
Ensure there are no dead-end nodes (input/output isolation) in the network.
|
|
214
|
-
|
|
215
|
-
Mutation can produce temporarily awkward graphs, especially after structural
|
|
216
|
-
growth or pruning-like simplification. This repair pass reconnects stranded
|
|
217
|
-
input, output, or hidden nodes so the genome remains a sensible candidate for
|
|
218
|
-
later evaluation and does not carry obviously broken topology into the next
|
|
219
|
-
controller stage.
|
|
220
|
-
|
|
221
|
-
Parameters:
|
|
222
|
-
- `network` - Genome whose endpoint and hidden-node connectivity should be repaired.
|
|
223
|
-
|
|
224
|
-
Returns: Nothing. The network may gain repair connections in place.
|
|
225
|
-
|
|
226
249
|
### selectMutationMethod
|
|
227
250
|
|
|
228
251
|
```ts
|
|
@@ -257,26 +280,3 @@ const method = await neat.selectMutationMethod(genome, false);
|
|
|
257
280
|
// The result already reflects policy gates such as phased complexity and
|
|
258
281
|
// structural limits, not just a random sample from the raw configured pool.
|
|
259
282
|
```
|
|
260
|
-
|
|
261
|
-
### DEFAULT_CONNECTION_WEIGHT
|
|
262
|
-
|
|
263
|
-
Default connection weight used when mutation must create a structural edge from scratch.
|
|
264
|
-
|
|
265
|
-
This keeps bootstrap connections and split in-edges deterministic at the
|
|
266
|
-
mutation boundary before later weight mutations or evaluation passes tune the
|
|
267
|
-
value more precisely.
|
|
268
|
-
|
|
269
|
-
### DEFAULT_GENE_ID
|
|
270
|
-
|
|
271
|
-
Default gene id used when mutation needs a stable fallback for node metadata.
|
|
272
|
-
|
|
273
|
-
The value is intentionally simple because it acts as compatibility padding,
|
|
274
|
-
not as a semantic innovation marker.
|
|
275
|
-
|
|
276
|
-
### DEFAULT_INNOVATION_ID
|
|
277
|
-
|
|
278
|
-
Default innovation id used when a connection lacks recorded innovation metadata.
|
|
279
|
-
|
|
280
|
-
This fallback prevents root mutation helpers from depending on missing ids
|
|
281
|
-
while the real innovation-tracking paths decide whether to reuse or allocate
|
|
282
|
-
new structural records.
|