@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
|
@@ -34,6 +34,28 @@ flowchart TD
|
|
|
34
34
|
|
|
35
35
|
## neat/mutation/repair/mutation.dead-ends.ts
|
|
36
36
|
|
|
37
|
+
### chooseRandomNodeForDeadEnds
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
chooseRandomNodeForDeadEnds(
|
|
41
|
+
candidates: NodeWithMetadata[],
|
|
42
|
+
internal: NeatControllerForMutation,
|
|
43
|
+
): NodeWithMetadata | null
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Choose a random node from candidates for dead-end repair.
|
|
47
|
+
|
|
48
|
+
Repair deliberately stays lightweight and non-optimizing. Once a helper has
|
|
49
|
+
found a legal candidate pool, this selector uses the controller RNG to pick
|
|
50
|
+
one reconnection target or source without imposing another ranking policy on
|
|
51
|
+
the maintenance path.
|
|
52
|
+
|
|
53
|
+
Parameters:
|
|
54
|
+
- `candidates` - - candidate nodes
|
|
55
|
+
- `internal` - - neat controller context
|
|
56
|
+
|
|
57
|
+
Returns: selected node or null
|
|
58
|
+
|
|
37
59
|
### collectNodeGroupsForDeadEnds
|
|
38
60
|
|
|
39
61
|
```ts
|
|
@@ -53,46 +75,50 @@ Parameters:
|
|
|
53
75
|
|
|
54
76
|
Returns: grouped node arrays
|
|
55
77
|
|
|
56
|
-
###
|
|
78
|
+
### connectIfCandidatesExistForDeadEnds
|
|
57
79
|
|
|
58
80
|
```ts
|
|
59
|
-
|
|
81
|
+
connectIfCandidatesExistForDeadEnds(
|
|
60
82
|
networkToEdit: GenomeWithMetadata,
|
|
61
|
-
|
|
83
|
+
anchorNode: NodeWithMetadata,
|
|
84
|
+
candidates: NodeWithMetadata[],
|
|
85
|
+
reverse: boolean,
|
|
62
86
|
internal: NeatControllerForMutation,
|
|
63
87
|
): void
|
|
64
88
|
```
|
|
65
89
|
|
|
66
|
-
|
|
90
|
+
Connect a node to a random candidate if candidates exist.
|
|
67
91
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
92
|
+
This is the chapter's small best-effort wiring primitive. It does not decide
|
|
93
|
+
whether repair should happen; it only applies one candidate connection in the
|
|
94
|
+
requested direction and tolerates incompatible node pairs without turning a
|
|
95
|
+
maintenance pass into a fatal error.
|
|
72
96
|
|
|
73
97
|
Parameters:
|
|
74
98
|
- `networkToEdit` - - network to edit
|
|
75
|
-
- `
|
|
99
|
+
- `anchorNode` - - node to connect from/to
|
|
100
|
+
- `candidates` - - candidate nodes for connection
|
|
101
|
+
- `reverse` - - whether to connect candidate -> anchor
|
|
76
102
|
- `internal` - - neat controller context
|
|
77
103
|
|
|
78
104
|
Returns: void
|
|
79
105
|
|
|
80
|
-
###
|
|
106
|
+
### ensureHiddenConnectivityForDeadEnds
|
|
81
107
|
|
|
82
108
|
```ts
|
|
83
|
-
|
|
109
|
+
ensureHiddenConnectivityForDeadEnds(
|
|
84
110
|
networkToEdit: GenomeWithMetadata,
|
|
85
111
|
nodeGroupsToUse: { inputNodes: NodeWithMetadata[]; outputNodes: NodeWithMetadata[]; hiddenNodes: NodeWithMetadata[]; },
|
|
86
112
|
internal: NeatControllerForMutation,
|
|
87
113
|
): void
|
|
88
114
|
```
|
|
89
115
|
|
|
90
|
-
Ensure
|
|
116
|
+
Ensure hidden nodes have both incoming and outgoing connections.
|
|
91
117
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
118
|
+
Hidden nodes are the most delicate repair family because they must stay on a
|
|
119
|
+
usable path through the network. A hidden node with only one side connected
|
|
120
|
+
is structural dead weight, so this helper repairs the missing side without
|
|
121
|
+
disturbing hidden nodes that are already participating in a path.
|
|
96
122
|
|
|
97
123
|
Parameters:
|
|
98
124
|
- `networkToEdit` - - network to edit
|
|
@@ -101,22 +127,22 @@ Parameters:
|
|
|
101
127
|
|
|
102
128
|
Returns: void
|
|
103
129
|
|
|
104
|
-
###
|
|
130
|
+
### ensureInputConnectivityForDeadEnds
|
|
105
131
|
|
|
106
132
|
```ts
|
|
107
|
-
|
|
133
|
+
ensureInputConnectivityForDeadEnds(
|
|
108
134
|
networkToEdit: GenomeWithMetadata,
|
|
109
135
|
nodeGroupsToUse: { inputNodes: NodeWithMetadata[]; outputNodes: NodeWithMetadata[]; hiddenNodes: NodeWithMetadata[]; },
|
|
110
136
|
internal: NeatControllerForMutation,
|
|
111
137
|
): void
|
|
112
138
|
```
|
|
113
139
|
|
|
114
|
-
Ensure
|
|
140
|
+
Ensure all input nodes have at least one outgoing connection.
|
|
115
141
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
142
|
+
Inputs are the first dead-end family because an input with no outgoing edge
|
|
143
|
+
cannot influence the rest of the network at all. The helper prefers routing
|
|
144
|
+
into hidden nodes when they exist and falls back to direct output links when
|
|
145
|
+
the network has no hidden layer yet.
|
|
120
146
|
|
|
121
147
|
Parameters:
|
|
122
148
|
- `networkToEdit` - - network to edit
|
|
@@ -125,52 +151,30 @@ Parameters:
|
|
|
125
151
|
|
|
126
152
|
Returns: void
|
|
127
153
|
|
|
128
|
-
###
|
|
154
|
+
### ensureOutputConnectivityForDeadEnds
|
|
129
155
|
|
|
130
156
|
```ts
|
|
131
|
-
|
|
157
|
+
ensureOutputConnectivityForDeadEnds(
|
|
132
158
|
networkToEdit: GenomeWithMetadata,
|
|
133
|
-
|
|
134
|
-
candidates: NodeWithMetadata[],
|
|
135
|
-
reverse: boolean,
|
|
159
|
+
nodeGroupsToUse: { inputNodes: NodeWithMetadata[]; outputNodes: NodeWithMetadata[]; hiddenNodes: NodeWithMetadata[]; },
|
|
136
160
|
internal: NeatControllerForMutation,
|
|
137
161
|
): void
|
|
138
162
|
```
|
|
139
163
|
|
|
140
|
-
|
|
164
|
+
Ensure all output nodes have at least one incoming connection.
|
|
141
165
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
166
|
+
Outputs are the second dead-end family. An output with no inbound edge can be
|
|
167
|
+
observed by later scoring code, but it carries no meaningful signal. The
|
|
168
|
+
helper therefore reconnects it from hidden nodes first and from inputs when
|
|
169
|
+
no hidden layer exists.
|
|
146
170
|
|
|
147
171
|
Parameters:
|
|
148
172
|
- `networkToEdit` - - network to edit
|
|
149
|
-
- `
|
|
150
|
-
- `candidates` - - candidate nodes for connection
|
|
151
|
-
- `reverse` - - whether to connect candidate -> anchor
|
|
173
|
+
- `nodeGroupsToUse` - - grouped node arrays
|
|
152
174
|
- `internal` - - neat controller context
|
|
153
175
|
|
|
154
176
|
Returns: void
|
|
155
177
|
|
|
156
|
-
### hasOutgoingForDeadEnds
|
|
157
|
-
|
|
158
|
-
```ts
|
|
159
|
-
hasOutgoingForDeadEnds(
|
|
160
|
-
node: NodeWithMetadata,
|
|
161
|
-
): boolean
|
|
162
|
-
```
|
|
163
|
-
|
|
164
|
-
Check whether a node has outgoing connections.
|
|
165
|
-
|
|
166
|
-
Dead-end repair uses this as the smallest possible structural predicate: if
|
|
167
|
-
the outgoing list is empty, the node cannot currently send signal forward.
|
|
168
|
-
|
|
169
|
-
Parameters:
|
|
170
|
-
- `node` - - node to inspect
|
|
171
|
-
|
|
172
|
-
Returns: true when outgoing connections exist
|
|
173
|
-
|
|
174
178
|
### hasIncomingForDeadEnds
|
|
175
179
|
|
|
176
180
|
```ts
|
|
@@ -190,27 +194,23 @@ Parameters:
|
|
|
190
194
|
|
|
191
195
|
Returns: true when incoming connections exist
|
|
192
196
|
|
|
193
|
-
###
|
|
197
|
+
### hasOutgoingForDeadEnds
|
|
194
198
|
|
|
195
199
|
```ts
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
): NodeWithMetadata | null
|
|
200
|
+
hasOutgoingForDeadEnds(
|
|
201
|
+
node: NodeWithMetadata,
|
|
202
|
+
): boolean
|
|
200
203
|
```
|
|
201
204
|
|
|
202
|
-
|
|
205
|
+
Check whether a node has outgoing connections.
|
|
203
206
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
one reconnection target or source without imposing another ranking policy on
|
|
207
|
-
the maintenance path.
|
|
207
|
+
Dead-end repair uses this as the smallest possible structural predicate: if
|
|
208
|
+
the outgoing list is empty, the node cannot currently send signal forward.
|
|
208
209
|
|
|
209
210
|
Parameters:
|
|
210
|
-
- `
|
|
211
|
-
- `internal` - - neat controller context
|
|
211
|
+
- `node` - - node to inspect
|
|
212
212
|
|
|
213
|
-
Returns:
|
|
213
|
+
Returns: true when outgoing connections exist
|
|
214
214
|
|
|
215
215
|
## neat/mutation/repair/mutation.min-hidden.ts
|
|
216
216
|
|
|
@@ -232,6 +232,27 @@ policy. The helpers here turn policy into concrete edits:
|
|
|
232
232
|
3. wire those hidden nodes into usable inbound and outbound paths,
|
|
233
233
|
4. rebuild connection caches after the structural edits.
|
|
234
234
|
|
|
235
|
+
### chooseRandomNodeForMinHidden
|
|
236
|
+
|
|
237
|
+
```ts
|
|
238
|
+
chooseRandomNodeForMinHidden(
|
|
239
|
+
candidates: NodeWithMetadata[],
|
|
240
|
+
internal: NeatControllerForMutation,
|
|
241
|
+
): NodeWithMetadata | null
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
Choose a random node from a candidate list.
|
|
245
|
+
|
|
246
|
+
Like the dead-end repair selector, this helper keeps minimum-hidden
|
|
247
|
+
enforcement policy-light: once a legal candidate pool exists, choose one
|
|
248
|
+
using the controller RNG and keep the maintenance pass moving.
|
|
249
|
+
|
|
250
|
+
Parameters:
|
|
251
|
+
- `candidates` - - candidate nodes
|
|
252
|
+
- `internal` - - neat controller context
|
|
253
|
+
|
|
254
|
+
Returns: selected node or null
|
|
255
|
+
|
|
235
256
|
### collectNodeGroupsForMinHidden
|
|
236
257
|
|
|
237
258
|
```ts
|
|
@@ -251,81 +272,53 @@ Parameters:
|
|
|
251
272
|
|
|
252
273
|
Returns: grouped node arrays
|
|
253
274
|
|
|
254
|
-
###
|
|
275
|
+
### computeMinimumHiddenSize
|
|
255
276
|
|
|
256
277
|
```ts
|
|
257
|
-
|
|
258
|
-
|
|
278
|
+
computeMinimumHiddenSize(
|
|
279
|
+
inputCount: number,
|
|
280
|
+
outputCount: number,
|
|
281
|
+
explicitMinimumHidden: number | undefined,
|
|
282
|
+
hiddenMultiplier: number | undefined,
|
|
259
283
|
): number
|
|
260
284
|
```
|
|
261
285
|
|
|
262
|
-
|
|
286
|
+
Compute the minimum hidden node count using explicit or multiplier-based settings.
|
|
263
287
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
288
|
+
This is the policy-resolution helper for the file. An explicit minimum wins
|
|
289
|
+
immediately; otherwise the helper derives a hidden target from the visible
|
|
290
|
+
endpoint count and the configured multiplier.
|
|
267
291
|
|
|
268
292
|
Parameters:
|
|
269
|
-
- `
|
|
293
|
+
- `inputCount` - - Number of input nodes in the network.
|
|
294
|
+
- `outputCount` - - Number of output nodes in the network.
|
|
295
|
+
- `explicitMinimumHidden` - - Optional explicit minimum hidden count.
|
|
296
|
+
- `hiddenMultiplier` - - Optional multiplier used when explicit minimum is absent.
|
|
270
297
|
|
|
271
|
-
Returns:
|
|
298
|
+
Returns: Minimum hidden node requirement.
|
|
272
299
|
|
|
273
|
-
###
|
|
300
|
+
### ensureHiddenConnectivityForMinHidden
|
|
274
301
|
|
|
275
302
|
```ts
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
multiplier: number | undefined,
|
|
303
|
+
ensureHiddenConnectivityForMinHidden(
|
|
304
|
+
networkToEdit: GenomeWithMetadata,
|
|
305
|
+
nodeGroupsToUse: { inputNodes: NodeWithMetadata[]; outputNodes: NodeWithMetadata[]; hiddenNodes: NodeWithMetadata[]; },
|
|
280
306
|
internal: NeatControllerForMutation,
|
|
281
|
-
):
|
|
307
|
+
): void
|
|
282
308
|
```
|
|
283
309
|
|
|
284
|
-
|
|
310
|
+
Ensure hidden nodes have both incoming and outgoing connections.
|
|
285
311
|
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
312
|
+
New hidden nodes are not useful until they sit on an actual path through the
|
|
313
|
+
network. This helper treats the whole hidden set as a post-creation repair
|
|
314
|
+
pass so newly added nodes and previously under-connected nodes both leave the
|
|
315
|
+
function with usable inbound and outbound links.
|
|
289
316
|
|
|
290
317
|
Parameters:
|
|
291
|
-
- `
|
|
292
|
-
- `
|
|
293
|
-
- `multiplier` - - optional size multiplier
|
|
318
|
+
- `networkToEdit` - - network to edit
|
|
319
|
+
- `nodeGroupsToUse` - - grouped node arrays
|
|
294
320
|
- `internal` - - neat controller context
|
|
295
321
|
|
|
296
|
-
Returns: minimum hidden node count
|
|
297
|
-
|
|
298
|
-
### hasRequiredEndpointsForMinHidden
|
|
299
|
-
|
|
300
|
-
```ts
|
|
301
|
-
hasRequiredEndpointsForMinHidden(
|
|
302
|
-
nodeGroupsToCheck: { inputNodes: NodeWithMetadata[]; outputNodes: NodeWithMetadata[]; },
|
|
303
|
-
): boolean
|
|
304
|
-
```
|
|
305
|
-
|
|
306
|
-
Check whether the network has at least one input and output node.
|
|
307
|
-
|
|
308
|
-
Minimum-hidden enforcement only makes sense when there is an actual endpoint
|
|
309
|
-
path to support. If either side is missing, the helper chapter stops before
|
|
310
|
-
creating hidden nodes that would have nowhere useful to connect.
|
|
311
|
-
|
|
312
|
-
Parameters:
|
|
313
|
-
- `nodeGroupsToCheck` - - grouped node arrays
|
|
314
|
-
|
|
315
|
-
Returns: true when inputs and outputs are present
|
|
316
|
-
|
|
317
|
-
### warnMissingEndpointsForMinHidden
|
|
318
|
-
|
|
319
|
-
```ts
|
|
320
|
-
warnMissingEndpointsForMinHidden(): void
|
|
321
|
-
```
|
|
322
|
-
|
|
323
|
-
Emit a warning when the network lacks input or output nodes.
|
|
324
|
-
|
|
325
|
-
This preserves the chapter's best-effort maintenance contract: endpoint-free
|
|
326
|
-
networks are notable enough to warn about, but not severe enough to justify a
|
|
327
|
-
hard failure during repair.
|
|
328
|
-
|
|
329
322
|
Returns: void
|
|
330
323
|
|
|
331
324
|
### ensureHiddenNodeCountForMinHidden
|
|
@@ -353,55 +346,6 @@ Parameters:
|
|
|
353
346
|
|
|
354
347
|
Returns: Promise resolving when nodes are created
|
|
355
348
|
|
|
356
|
-
### ensureHiddenConnectivityForMinHidden
|
|
357
|
-
|
|
358
|
-
```ts
|
|
359
|
-
ensureHiddenConnectivityForMinHidden(
|
|
360
|
-
networkToEdit: GenomeWithMetadata,
|
|
361
|
-
nodeGroupsToUse: { inputNodes: NodeWithMetadata[]; outputNodes: NodeWithMetadata[]; hiddenNodes: NodeWithMetadata[]; },
|
|
362
|
-
internal: NeatControllerForMutation,
|
|
363
|
-
): void
|
|
364
|
-
```
|
|
365
|
-
|
|
366
|
-
Ensure hidden nodes have both incoming and outgoing connections.
|
|
367
|
-
|
|
368
|
-
New hidden nodes are not useful until they sit on an actual path through the
|
|
369
|
-
network. This helper treats the whole hidden set as a post-creation repair
|
|
370
|
-
pass so newly added nodes and previously under-connected nodes both leave the
|
|
371
|
-
function with usable inbound and outbound links.
|
|
372
|
-
|
|
373
|
-
Parameters:
|
|
374
|
-
- `networkToEdit` - - network to edit
|
|
375
|
-
- `nodeGroupsToUse` - - grouped node arrays
|
|
376
|
-
- `internal` - - neat controller context
|
|
377
|
-
|
|
378
|
-
Returns: void
|
|
379
|
-
|
|
380
|
-
### computeMinimumHiddenSize
|
|
381
|
-
|
|
382
|
-
```ts
|
|
383
|
-
computeMinimumHiddenSize(
|
|
384
|
-
inputCount: number,
|
|
385
|
-
outputCount: number,
|
|
386
|
-
explicitMinimumHidden: number | undefined,
|
|
387
|
-
hiddenMultiplier: number | undefined,
|
|
388
|
-
): number
|
|
389
|
-
```
|
|
390
|
-
|
|
391
|
-
Compute the minimum hidden node count using explicit or multiplier-based settings.
|
|
392
|
-
|
|
393
|
-
This is the policy-resolution helper for the file. An explicit minimum wins
|
|
394
|
-
immediately; otherwise the helper derives a hidden target from the visible
|
|
395
|
-
endpoint count and the configured multiplier.
|
|
396
|
-
|
|
397
|
-
Parameters:
|
|
398
|
-
- `inputCount` - - Number of input nodes in the network.
|
|
399
|
-
- `outputCount` - - Number of output nodes in the network.
|
|
400
|
-
- `explicitMinimumHidden` - - Optional explicit minimum hidden count.
|
|
401
|
-
- `hiddenMultiplier` - - Optional multiplier used when explicit minimum is absent.
|
|
402
|
-
|
|
403
|
-
Returns: Minimum hidden node requirement.
|
|
404
|
-
|
|
405
349
|
### ensureIncomingConnectionForMinHidden
|
|
406
350
|
|
|
407
351
|
```ts
|
|
@@ -452,26 +396,28 @@ Parameters:
|
|
|
452
396
|
|
|
453
397
|
Returns: void
|
|
454
398
|
|
|
455
|
-
###
|
|
399
|
+
### hasRequiredEndpointsForMinHidden
|
|
456
400
|
|
|
457
401
|
```ts
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
): NodeWithMetadata | null
|
|
402
|
+
hasRequiredEndpointsForMinHidden(
|
|
403
|
+
nodeGroupsToCheck: { inputNodes: NodeWithMetadata[]; outputNodes: NodeWithMetadata[]; },
|
|
404
|
+
): boolean
|
|
462
405
|
```
|
|
463
406
|
|
|
464
|
-
|
|
407
|
+
Check whether the network has at least one input and output node.
|
|
465
408
|
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
409
|
+
Minimum-hidden enforcement only makes sense when there is an actual endpoint
|
|
410
|
+
path to support. If either side is missing, the helper chapter stops before
|
|
411
|
+
creating hidden nodes that would have nowhere useful to connect.
|
|
469
412
|
|
|
470
413
|
Parameters:
|
|
471
|
-
- `
|
|
472
|
-
- `internal` - - neat controller context
|
|
414
|
+
- `nodeGroupsToCheck` - - grouped node arrays
|
|
473
415
|
|
|
474
|
-
Returns:
|
|
416
|
+
Returns: true when inputs and outputs are present
|
|
417
|
+
|
|
418
|
+
### MINIMUM_HIDDEN_BASELINE
|
|
419
|
+
|
|
420
|
+
Baseline minimum hidden nodes when no configuration is provided.
|
|
475
421
|
|
|
476
422
|
### rebuildNetworkConnectionsForMinHidden
|
|
477
423
|
|
|
@@ -492,6 +438,60 @@ Parameters:
|
|
|
492
438
|
|
|
493
439
|
Returns: Promise resolving after rebuild completes
|
|
494
440
|
|
|
495
|
-
###
|
|
441
|
+
### resolveMaxNodesForMinHidden
|
|
496
442
|
|
|
497
|
-
|
|
443
|
+
```ts
|
|
444
|
+
resolveMaxNodesForMinHidden(
|
|
445
|
+
internal: NeatControllerForMutation,
|
|
446
|
+
): number
|
|
447
|
+
```
|
|
448
|
+
|
|
449
|
+
Resolve the maximum node limit for the network.
|
|
450
|
+
|
|
451
|
+
The hidden-floor policy must stay inside the broader controller cap. This
|
|
452
|
+
helper centralizes that read so later creation logic can treat "unbounded"
|
|
453
|
+
and "explicitly capped" networks with one consistent limit value.
|
|
454
|
+
|
|
455
|
+
Parameters:
|
|
456
|
+
- `internal` - - neat controller context
|
|
457
|
+
|
|
458
|
+
Returns: maximum node limit
|
|
459
|
+
|
|
460
|
+
### resolveMinHiddenForMinHidden
|
|
461
|
+
|
|
462
|
+
```ts
|
|
463
|
+
resolveMinHiddenForMinHidden(
|
|
464
|
+
networkToInspect: GenomeWithMetadata,
|
|
465
|
+
maxNodesLimit: number,
|
|
466
|
+
multiplier: number | undefined,
|
|
467
|
+
internal: NeatControllerForMutation,
|
|
468
|
+
): number
|
|
469
|
+
```
|
|
470
|
+
|
|
471
|
+
Resolve the minimum hidden node requirement for the network.
|
|
472
|
+
|
|
473
|
+
This converts controller policy into one concrete hidden-node target for the
|
|
474
|
+
current network. The result respects both the configured minimum-hidden rule
|
|
475
|
+
and the remaining room beneath the maximum-node limit.
|
|
476
|
+
|
|
477
|
+
Parameters:
|
|
478
|
+
- `networkToInspect` - - network to inspect
|
|
479
|
+
- `maxNodesLimit` - - maximum allowed nodes
|
|
480
|
+
- `multiplier` - - optional size multiplier
|
|
481
|
+
- `internal` - - neat controller context
|
|
482
|
+
|
|
483
|
+
Returns: minimum hidden node count
|
|
484
|
+
|
|
485
|
+
### warnMissingEndpointsForMinHidden
|
|
486
|
+
|
|
487
|
+
```ts
|
|
488
|
+
warnMissingEndpointsForMinHidden(): void
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
Emit a warning when the network lacks input or output nodes.
|
|
492
|
+
|
|
493
|
+
This preserves the chapter's best-effort maintenance contract: endpoint-free
|
|
494
|
+
networks are notable enough to warn about, but not severe enough to justify a
|
|
495
|
+
hard failure during repair.
|
|
496
|
+
|
|
497
|
+
Returns: void
|