@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
|
@@ -4,26 +4,26 @@ Canonical threshold used for random binary parent/gene choice.
|
|
|
4
4
|
|
|
5
5
|
## architecture/network/genetic/network.genetic.utils.types.ts
|
|
6
6
|
|
|
7
|
-
### RANDOM_BINARY_SELECTION_THRESHOLD
|
|
8
|
-
|
|
9
|
-
Canonical threshold used for random binary parent/gene choice.
|
|
10
|
-
|
|
11
7
|
### DEFAULT_REENABLE_PROBABILITY
|
|
12
8
|
|
|
13
9
|
Default probability for re-enabling disabled genes during crossover.
|
|
14
10
|
|
|
15
|
-
### NO_GATER_INDEX
|
|
16
|
-
|
|
17
|
-
Sentinel index representing that no gater node is assigned.
|
|
18
|
-
|
|
19
11
|
### FIRST_INDEX
|
|
20
12
|
|
|
21
13
|
First element index used when reading newly created connections.
|
|
22
14
|
|
|
15
|
+
### NO_GATER_INDEX
|
|
16
|
+
|
|
17
|
+
Sentinel index representing that no gater node is assigned.
|
|
18
|
+
|
|
23
19
|
### PARENT_COMPATIBILITY_ERROR_MESSAGE
|
|
24
20
|
|
|
25
21
|
Shared compatibility error message for crossover parent validation.
|
|
26
22
|
|
|
23
|
+
### RANDOM_BINARY_SELECTION_THRESHOLD
|
|
24
|
+
|
|
25
|
+
Canonical threshold used for random binary parent/gene choice.
|
|
26
|
+
|
|
27
27
|
### RandomGenerator
|
|
28
28
|
|
|
29
29
|
```ts
|
|
@@ -116,39 +116,35 @@ offspring.mutate();
|
|
|
116
116
|
|
|
117
117
|
## architecture/network/genetic/network.genetic.setup.utils.ts
|
|
118
118
|
|
|
119
|
-
###
|
|
119
|
+
### asGeneticNetwork
|
|
120
120
|
|
|
121
121
|
```ts
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
equal: boolean,
|
|
126
|
-
): CrossoverContext
|
|
122
|
+
asGeneticNetwork(
|
|
123
|
+
network: default,
|
|
124
|
+
): GeneticNetwork
|
|
127
125
|
```
|
|
128
126
|
|
|
129
|
-
|
|
127
|
+
Coerces a network to the internal genetic runtime shape.
|
|
130
128
|
|
|
131
129
|
Parameters:
|
|
132
|
-
- `
|
|
133
|
-
- `parentNetwork2` - - Second parent network.
|
|
134
|
-
- `equal` - - Equal-treatment mode flag.
|
|
130
|
+
- `network` - - Source network.
|
|
135
131
|
|
|
136
|
-
Returns:
|
|
132
|
+
Returns: Network with runtime genetic properties.
|
|
137
133
|
|
|
138
|
-
###
|
|
134
|
+
### assignNodeIndexes
|
|
139
135
|
|
|
140
136
|
```ts
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
):
|
|
137
|
+
assignNodeIndexes(
|
|
138
|
+
nodes: default[],
|
|
139
|
+
): void
|
|
144
140
|
```
|
|
145
141
|
|
|
146
|
-
|
|
142
|
+
Assigns contiguous indices to a node list.
|
|
147
143
|
|
|
148
144
|
Parameters:
|
|
149
|
-
- `
|
|
145
|
+
- `nodes` - - Nodes to reindex.
|
|
150
146
|
|
|
151
|
-
Returns:
|
|
147
|
+
Returns: Nothing.
|
|
152
148
|
|
|
153
149
|
### assignOffspringNodes
|
|
154
150
|
|
|
@@ -165,6 +161,31 @@ Parameters:
|
|
|
165
161
|
|
|
166
162
|
Returns: Nothing.
|
|
167
163
|
|
|
164
|
+
### buildOffspringNodes
|
|
165
|
+
|
|
166
|
+
```ts
|
|
167
|
+
buildOffspringNodes(
|
|
168
|
+
parent1: GeneticNetwork,
|
|
169
|
+
parent2: GeneticNetwork,
|
|
170
|
+
parentMetrics: ParentMetrics,
|
|
171
|
+
offspringNodeCount: number,
|
|
172
|
+
equal: boolean,
|
|
173
|
+
randomGenerator: RandomGenerator,
|
|
174
|
+
): default[]
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
Builds the offspring node list by selecting genes per slot.
|
|
178
|
+
|
|
179
|
+
Parameters:
|
|
180
|
+
- `parent1` - - First parent.
|
|
181
|
+
- `parent2` - - Second parent.
|
|
182
|
+
- `parentMetrics` - - Parent metrics.
|
|
183
|
+
- `offspringNodeCount` - - Target offspring size.
|
|
184
|
+
- `equal` - - Equal-treatment mode.
|
|
185
|
+
- `randomGenerator` - - Random generator.
|
|
186
|
+
|
|
187
|
+
Returns: Cloned offspring node genes.
|
|
188
|
+
|
|
168
189
|
### chooseOffspringConnectionGenes
|
|
169
190
|
|
|
170
191
|
```ts
|
|
@@ -180,37 +201,54 @@ Parameters:
|
|
|
180
201
|
|
|
181
202
|
Returns: Chosen connection genes.
|
|
182
203
|
|
|
183
|
-
###
|
|
204
|
+
### cloneNodeGene
|
|
184
205
|
|
|
185
206
|
```ts
|
|
186
|
-
|
|
207
|
+
cloneNodeGene(
|
|
208
|
+
sourceNode: default,
|
|
209
|
+
): default
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
Clones node structural gene attributes.
|
|
213
|
+
|
|
214
|
+
Parameters:
|
|
215
|
+
- `sourceNode` - - Source node gene.
|
|
216
|
+
|
|
217
|
+
Returns: Cloned node.
|
|
218
|
+
|
|
219
|
+
### createCrossoverContext
|
|
220
|
+
|
|
221
|
+
```ts
|
|
222
|
+
createCrossoverContext(
|
|
187
223
|
parentNetwork1: default,
|
|
188
224
|
parentNetwork2: default,
|
|
189
|
-
|
|
225
|
+
equal: boolean,
|
|
226
|
+
): CrossoverContext
|
|
190
227
|
```
|
|
191
228
|
|
|
192
|
-
|
|
229
|
+
Creates the immutable crossover baseline context.
|
|
193
230
|
|
|
194
231
|
Parameters:
|
|
195
|
-
- `parentNetwork1` - - First parent
|
|
196
|
-
- `parentNetwork2` - - Second parent
|
|
232
|
+
- `parentNetwork1` - - First parent network.
|
|
233
|
+
- `parentNetwork2` - - Second parent network.
|
|
234
|
+
- `equal` - - Equal-treatment mode flag.
|
|
197
235
|
|
|
198
|
-
Returns:
|
|
236
|
+
Returns: Initialized crossover context.
|
|
199
237
|
|
|
200
|
-
###
|
|
238
|
+
### createNodeBuildContext
|
|
201
239
|
|
|
202
240
|
```ts
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
):
|
|
241
|
+
createNodeBuildContext(
|
|
242
|
+
context: CrossoverContext,
|
|
243
|
+
): CrossoverNodeBuildContext
|
|
206
244
|
```
|
|
207
245
|
|
|
208
|
-
|
|
246
|
+
Creates the node-build context for offspring node selection.
|
|
209
247
|
|
|
210
248
|
Parameters:
|
|
211
|
-
- `
|
|
249
|
+
- `context` - - Crossover baseline context.
|
|
212
250
|
|
|
213
|
-
Returns:
|
|
251
|
+
Returns: Node-build context.
|
|
214
252
|
|
|
215
253
|
### createOffspringScaffold
|
|
216
254
|
|
|
@@ -229,40 +267,6 @@ Parameters:
|
|
|
229
267
|
|
|
230
268
|
Returns: Initialized offspring runtime object.
|
|
231
269
|
|
|
232
|
-
### resolveParentMetrics
|
|
233
|
-
|
|
234
|
-
```ts
|
|
235
|
-
resolveParentMetrics(
|
|
236
|
-
parent1: GeneticNetwork,
|
|
237
|
-
parent2: GeneticNetwork,
|
|
238
|
-
outputSize: number,
|
|
239
|
-
): ParentMetrics
|
|
240
|
-
```
|
|
241
|
-
|
|
242
|
-
Computes common parent metrics reused across helper functions.
|
|
243
|
-
|
|
244
|
-
Parameters:
|
|
245
|
-
- `parent1` - - First parent network.
|
|
246
|
-
- `parent2` - - Second parent network.
|
|
247
|
-
- `outputSize` - - Shared output size.
|
|
248
|
-
|
|
249
|
-
Returns: Parent metrics.
|
|
250
|
-
|
|
251
|
-
### getRandomGenerator
|
|
252
|
-
|
|
253
|
-
```ts
|
|
254
|
-
getRandomGenerator(
|
|
255
|
-
parentNetwork: default,
|
|
256
|
-
): RandomGenerator
|
|
257
|
-
```
|
|
258
|
-
|
|
259
|
-
Resolves the random generator used by crossover decisions.
|
|
260
|
-
|
|
261
|
-
Parameters:
|
|
262
|
-
- `parentNetwork` - - Parent network that may provide a deterministic `_rand` source.
|
|
263
|
-
|
|
264
|
-
Returns: Random function.
|
|
265
|
-
|
|
266
270
|
### determineOffspringNodeCount
|
|
267
271
|
|
|
268
272
|
```ts
|
|
@@ -282,52 +286,62 @@ Parameters:
|
|
|
282
286
|
|
|
283
287
|
Returns: Offspring node count.
|
|
284
288
|
|
|
285
|
-
###
|
|
289
|
+
### getAlignedOutputNode
|
|
286
290
|
|
|
287
291
|
```ts
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
292
|
+
getAlignedOutputNode(
|
|
293
|
+
parent: GeneticNetwork,
|
|
294
|
+
alignedIndex: number,
|
|
295
|
+
): default | undefined
|
|
291
296
|
```
|
|
292
297
|
|
|
293
|
-
|
|
298
|
+
Reads an aligned output candidate node if index is in the valid non-input range.
|
|
294
299
|
|
|
295
300
|
Parameters:
|
|
296
|
-
- `
|
|
301
|
+
- `parent` - - Parent network.
|
|
302
|
+
- `alignedIndex` - - Tail-aligned index.
|
|
297
303
|
|
|
298
|
-
Returns:
|
|
304
|
+
Returns: Output candidate node.
|
|
299
305
|
|
|
300
|
-
###
|
|
306
|
+
### getRandomGenerator
|
|
301
307
|
|
|
302
308
|
```ts
|
|
303
|
-
|
|
309
|
+
getRandomGenerator(
|
|
310
|
+
parentNetwork: default,
|
|
311
|
+
): RandomGenerator
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
Resolves the random generator used by crossover decisions.
|
|
315
|
+
|
|
316
|
+
Parameters:
|
|
317
|
+
- `parentNetwork` - - Parent network that may provide a deterministic `_rand` source.
|
|
318
|
+
|
|
319
|
+
Returns: Random function.
|
|
320
|
+
|
|
321
|
+
### resolveParentMetrics
|
|
322
|
+
|
|
323
|
+
```ts
|
|
324
|
+
resolveParentMetrics(
|
|
304
325
|
parent1: GeneticNetwork,
|
|
305
326
|
parent2: GeneticNetwork,
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
equal: boolean,
|
|
309
|
-
randomGenerator: RandomGenerator,
|
|
310
|
-
): default[]
|
|
327
|
+
outputSize: number,
|
|
328
|
+
): ParentMetrics
|
|
311
329
|
```
|
|
312
330
|
|
|
313
|
-
|
|
331
|
+
Computes common parent metrics reused across helper functions.
|
|
314
332
|
|
|
315
333
|
Parameters:
|
|
316
|
-
- `parent1` - - First parent.
|
|
317
|
-
- `parent2` - - Second parent.
|
|
318
|
-
- `
|
|
319
|
-
- `offspringNodeCount` - - Target offspring size.
|
|
320
|
-
- `equal` - - Equal-treatment mode.
|
|
321
|
-
- `randomGenerator` - - Random generator.
|
|
334
|
+
- `parent1` - - First parent network.
|
|
335
|
+
- `parent2` - - Second parent network.
|
|
336
|
+
- `outputSize` - - Shared output size.
|
|
322
337
|
|
|
323
|
-
Returns:
|
|
338
|
+
Returns: Parent metrics.
|
|
324
339
|
|
|
325
|
-
###
|
|
340
|
+
### selectHiddenNodeGene
|
|
326
341
|
|
|
327
342
|
```ts
|
|
328
|
-
|
|
343
|
+
selectHiddenNodeGene(
|
|
329
344
|
nodeIndex: number,
|
|
330
|
-
offspringNodeCount: number,
|
|
331
345
|
parent1: GeneticNetwork,
|
|
332
346
|
parent2: GeneticNetwork,
|
|
333
347
|
parentMetrics: ParentMetrics,
|
|
@@ -336,18 +350,17 @@ selectNodeGeneAtIndex(
|
|
|
336
350
|
): default | undefined
|
|
337
351
|
```
|
|
338
352
|
|
|
339
|
-
Selects a node gene
|
|
353
|
+
Selects a hidden-region node gene.
|
|
340
354
|
|
|
341
355
|
Parameters:
|
|
342
356
|
- `nodeIndex` - - Slot index.
|
|
343
|
-
- `offspringNodeCount` - - Total offspring slots.
|
|
344
357
|
- `parent1` - - First parent.
|
|
345
358
|
- `parent2` - - Second parent.
|
|
346
359
|
- `parentMetrics` - - Parent metrics.
|
|
347
360
|
- `equal` - - Equal-treatment mode.
|
|
348
361
|
- `randomGenerator` - - Random generator.
|
|
349
362
|
|
|
350
|
-
Returns: Selected
|
|
363
|
+
Returns: Selected hidden node gene.
|
|
351
364
|
|
|
352
365
|
### selectInputNodeGene
|
|
353
366
|
|
|
@@ -366,104 +379,121 @@ Parameters:
|
|
|
366
379
|
|
|
367
380
|
Returns: Parent 1 input node gene.
|
|
368
381
|
|
|
369
|
-
###
|
|
382
|
+
### selectNodeGeneAtIndex
|
|
370
383
|
|
|
371
384
|
```ts
|
|
372
|
-
|
|
385
|
+
selectNodeGeneAtIndex(
|
|
373
386
|
nodeIndex: number,
|
|
374
387
|
offspringNodeCount: number,
|
|
375
388
|
parent1: GeneticNetwork,
|
|
376
389
|
parent2: GeneticNetwork,
|
|
377
390
|
parentMetrics: ParentMetrics,
|
|
391
|
+
equal: boolean,
|
|
378
392
|
randomGenerator: RandomGenerator,
|
|
379
393
|
): default | undefined
|
|
380
394
|
```
|
|
381
395
|
|
|
382
|
-
Selects
|
|
396
|
+
Selects a node gene for a specific offspring slot.
|
|
383
397
|
|
|
384
398
|
Parameters:
|
|
385
399
|
- `nodeIndex` - - Slot index.
|
|
386
|
-
- `offspringNodeCount` - -
|
|
400
|
+
- `offspringNodeCount` - - Total offspring slots.
|
|
387
401
|
- `parent1` - - First parent.
|
|
388
402
|
- `parent2` - - Second parent.
|
|
389
403
|
- `parentMetrics` - - Parent metrics.
|
|
404
|
+
- `equal` - - Equal-treatment mode.
|
|
390
405
|
- `randomGenerator` - - Random generator.
|
|
391
406
|
|
|
392
|
-
Returns: Selected
|
|
393
|
-
|
|
394
|
-
### getAlignedOutputNode
|
|
395
|
-
|
|
396
|
-
```ts
|
|
397
|
-
getAlignedOutputNode(
|
|
398
|
-
parent: GeneticNetwork,
|
|
399
|
-
alignedIndex: number,
|
|
400
|
-
): default | undefined
|
|
401
|
-
```
|
|
402
|
-
|
|
403
|
-
Reads an aligned output candidate node if index is in the valid non-input range.
|
|
404
|
-
|
|
405
|
-
Parameters:
|
|
406
|
-
- `parent` - - Parent network.
|
|
407
|
-
- `alignedIndex` - - Tail-aligned index.
|
|
408
|
-
|
|
409
|
-
Returns: Output candidate node.
|
|
407
|
+
Returns: Selected parent node gene, when present.
|
|
410
408
|
|
|
411
|
-
###
|
|
409
|
+
### selectOutputNodeGene
|
|
412
410
|
|
|
413
411
|
```ts
|
|
414
|
-
|
|
412
|
+
selectOutputNodeGene(
|
|
415
413
|
nodeIndex: number,
|
|
414
|
+
offspringNodeCount: number,
|
|
416
415
|
parent1: GeneticNetwork,
|
|
417
416
|
parent2: GeneticNetwork,
|
|
418
417
|
parentMetrics: ParentMetrics,
|
|
419
|
-
equal: boolean,
|
|
420
418
|
randomGenerator: RandomGenerator,
|
|
421
419
|
): default | undefined
|
|
422
420
|
```
|
|
423
421
|
|
|
424
|
-
Selects
|
|
422
|
+
Selects an output-region node gene using tail alignment.
|
|
425
423
|
|
|
426
424
|
Parameters:
|
|
427
425
|
- `nodeIndex` - - Slot index.
|
|
426
|
+
- `offspringNodeCount` - - Target offspring size.
|
|
428
427
|
- `parent1` - - First parent.
|
|
429
428
|
- `parent2` - - Second parent.
|
|
430
429
|
- `parentMetrics` - - Parent metrics.
|
|
431
|
-
- `equal` - - Equal-treatment mode.
|
|
432
430
|
- `randomGenerator` - - Random generator.
|
|
433
431
|
|
|
434
|
-
Returns: Selected
|
|
432
|
+
Returns: Selected output node gene.
|
|
435
433
|
|
|
436
|
-
###
|
|
434
|
+
### validateParentCompatibility
|
|
437
435
|
|
|
438
436
|
```ts
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
437
|
+
validateParentCompatibility(
|
|
438
|
+
parentNetwork1: default,
|
|
439
|
+
parentNetwork2: default,
|
|
440
|
+
): void
|
|
442
441
|
```
|
|
443
442
|
|
|
444
|
-
|
|
443
|
+
Validates parent compatibility for crossover.
|
|
445
444
|
|
|
446
445
|
Parameters:
|
|
447
|
-
- `
|
|
446
|
+
- `parentNetwork1` - - First parent candidate.
|
|
447
|
+
- `parentNetwork2` - - Second parent candidate.
|
|
448
448
|
|
|
449
|
-
Returns:
|
|
449
|
+
Returns: Nothing.
|
|
450
450
|
|
|
451
451
|
## architecture/network/genetic/network.genetic.selection.utils.ts
|
|
452
452
|
|
|
453
|
-
###
|
|
453
|
+
### buildConnectionGene
|
|
454
454
|
|
|
455
455
|
```ts
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
):
|
|
456
|
+
buildConnectionGene(
|
|
457
|
+
connection: default,
|
|
458
|
+
): ConnectionGene | undefined
|
|
459
459
|
```
|
|
460
460
|
|
|
461
|
-
|
|
461
|
+
Builds a connection gene from a concrete connection instance.
|
|
462
462
|
|
|
463
463
|
Parameters:
|
|
464
|
-
- `
|
|
464
|
+
- `connection` - - Runtime connection.
|
|
465
465
|
|
|
466
|
-
Returns:
|
|
466
|
+
Returns: Gene descriptor, or undefined when endpoints lack valid indices.
|
|
467
|
+
|
|
468
|
+
### canInheritParent1DisjointGenes
|
|
469
|
+
|
|
470
|
+
```ts
|
|
471
|
+
canInheritParent1DisjointGenes(
|
|
472
|
+
context: ConnectionGeneSelectionContext,
|
|
473
|
+
): boolean
|
|
474
|
+
```
|
|
475
|
+
|
|
476
|
+
Determines if parent-1 disjoint/excess genes are inheritable.
|
|
477
|
+
|
|
478
|
+
Parameters:
|
|
479
|
+
- `context` - - Selection context.
|
|
480
|
+
|
|
481
|
+
Returns: True when parent-1 disjoint genes can be selected.
|
|
482
|
+
|
|
483
|
+
### canInheritParent2DisjointGenes
|
|
484
|
+
|
|
485
|
+
```ts
|
|
486
|
+
canInheritParent2DisjointGenes(
|
|
487
|
+
context: ConnectionGeneSelectionContext,
|
|
488
|
+
): boolean
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
Determines if parent-2 disjoint/excess genes are inheritable.
|
|
492
|
+
|
|
493
|
+
Parameters:
|
|
494
|
+
- `context` - - Selection context.
|
|
495
|
+
|
|
496
|
+
Returns: True when parent-2 disjoint genes can be selected.
|
|
467
497
|
|
|
468
498
|
### chooseConnectionGenes
|
|
469
499
|
|
|
@@ -492,62 +522,92 @@ Parameters:
|
|
|
492
522
|
|
|
493
523
|
Returns: Chosen genes for offspring materialization.
|
|
494
524
|
|
|
495
|
-
###
|
|
525
|
+
### chooseDisjointGeneFromParent
|
|
496
526
|
|
|
497
527
|
```ts
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
528
|
+
chooseDisjointGeneFromParent(
|
|
529
|
+
parent: GeneticNetwork,
|
|
530
|
+
sourceGene: ConnectionGene,
|
|
531
|
+
): ConnectionGene
|
|
501
532
|
```
|
|
502
533
|
|
|
503
|
-
|
|
534
|
+
Chooses a disjoint/excess gene from a single parent.
|
|
504
535
|
|
|
505
536
|
Parameters:
|
|
506
|
-
- `
|
|
537
|
+
- `parent` - - Source parent.
|
|
538
|
+
- `sourceGene` - - Source gene.
|
|
507
539
|
|
|
508
|
-
Returns:
|
|
540
|
+
Returns: Selected disjoint gene.
|
|
509
541
|
|
|
510
|
-
###
|
|
542
|
+
### chooseMatchingGene
|
|
511
543
|
|
|
512
544
|
```ts
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
sourceRandomGenerator: RandomGenerator,
|
|
521
|
-
): ConnectionGeneSelectionContext
|
|
545
|
+
chooseMatchingGene(
|
|
546
|
+
parent1: GeneticNetwork,
|
|
547
|
+
parent2: GeneticNetwork,
|
|
548
|
+
parent1Gene: ConnectionGene,
|
|
549
|
+
parent2Gene: ConnectionGene,
|
|
550
|
+
randomGenerator: RandomGenerator,
|
|
551
|
+
): ConnectionGene
|
|
522
552
|
```
|
|
523
553
|
|
|
524
|
-
|
|
554
|
+
Chooses a gene for matching innovation IDs.
|
|
525
555
|
|
|
526
556
|
Parameters:
|
|
527
|
-
- `
|
|
528
|
-
- `
|
|
529
|
-
- `
|
|
530
|
-
- `
|
|
531
|
-
- `
|
|
532
|
-
- `sourceEqual` - - Equal-treatment flag.
|
|
533
|
-
- `sourceRandomGenerator` - - Random source.
|
|
557
|
+
- `parent1` - - First parent.
|
|
558
|
+
- `parent2` - - Second parent.
|
|
559
|
+
- `parent1Gene` - - Parent 1 matching gene.
|
|
560
|
+
- `parent2Gene` - - Parent 2 matching gene.
|
|
561
|
+
- `randomGenerator` - - Random generator.
|
|
534
562
|
|
|
535
|
-
Returns:
|
|
563
|
+
Returns: Selected gene.
|
|
536
564
|
|
|
537
|
-
###
|
|
565
|
+
### cloneConnectionGene
|
|
538
566
|
|
|
539
567
|
```ts
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
):
|
|
568
|
+
cloneConnectionGene(
|
|
569
|
+
sourceGene: ConnectionGene,
|
|
570
|
+
): ConnectionGene
|
|
543
571
|
```
|
|
544
572
|
|
|
545
|
-
|
|
573
|
+
Clones a connection gene.
|
|
546
574
|
|
|
547
575
|
Parameters:
|
|
548
|
-
- `
|
|
576
|
+
- `sourceGene` - - Source gene.
|
|
549
577
|
|
|
550
|
-
Returns:
|
|
578
|
+
Returns: Independent clone.
|
|
579
|
+
|
|
580
|
+
### collectConnectionGenes
|
|
581
|
+
|
|
582
|
+
```ts
|
|
583
|
+
collectConnectionGenes(
|
|
584
|
+
parent: GeneticNetwork,
|
|
585
|
+
): Record<string, ConnectionGene>
|
|
586
|
+
```
|
|
587
|
+
|
|
588
|
+
Collects all connection genes (standard + self) keyed by innovation ID.
|
|
589
|
+
|
|
590
|
+
Parameters:
|
|
591
|
+
- `parent` - - Parent network.
|
|
592
|
+
|
|
593
|
+
Returns: Innovation-keyed connection gene map.
|
|
594
|
+
|
|
595
|
+
### combineChosenGenes
|
|
596
|
+
|
|
597
|
+
```ts
|
|
598
|
+
combineChosenGenes(
|
|
599
|
+
parent1TraversalGenes: ConnectionGene[],
|
|
600
|
+
parent2OnlyGenesToAppend: ConnectionGene[],
|
|
601
|
+
): ConnectionGene[]
|
|
602
|
+
```
|
|
603
|
+
|
|
604
|
+
Combines selected gene partitions into one ordered list.
|
|
605
|
+
|
|
606
|
+
Parameters:
|
|
607
|
+
- `parent1TraversalGenes` - - Genes selected from parent-1 traversal.
|
|
608
|
+
- `parent2OnlyGenesToAppend` - - Parent-2-only genes.
|
|
609
|
+
|
|
610
|
+
Returns: Combined chosen genes.
|
|
551
611
|
|
|
552
612
|
### createParent1TraversalContexts
|
|
553
613
|
|
|
@@ -564,6 +624,33 @@ Parameters:
|
|
|
564
624
|
|
|
565
625
|
Returns: Parent-1 traversal contexts.
|
|
566
626
|
|
|
627
|
+
### createSelectionContext
|
|
628
|
+
|
|
629
|
+
```ts
|
|
630
|
+
createSelectionContext(
|
|
631
|
+
sourceParent1: GeneticNetwork,
|
|
632
|
+
sourceParent2: GeneticNetwork,
|
|
633
|
+
sourceParentMetrics: ParentMetrics,
|
|
634
|
+
sourceParent1Genes: Record<string, ConnectionGene>,
|
|
635
|
+
sourceParent2Genes: Record<string, ConnectionGene>,
|
|
636
|
+
sourceEqual: boolean,
|
|
637
|
+
sourceRandomGenerator: RandomGenerator,
|
|
638
|
+
): ConnectionGeneSelectionContext
|
|
639
|
+
```
|
|
640
|
+
|
|
641
|
+
Creates the immutable context for this selection pass.
|
|
642
|
+
|
|
643
|
+
Parameters:
|
|
644
|
+
- `sourceParent1` - - First parent.
|
|
645
|
+
- `sourceParent2` - - Second parent.
|
|
646
|
+
- `sourceParentMetrics` - - Shared parent metrics.
|
|
647
|
+
- `sourceParent1Genes` - - Parent-1 genes.
|
|
648
|
+
- `sourceParent2Genes` - - Parent-2 genes.
|
|
649
|
+
- `sourceEqual` - - Equal-treatment flag.
|
|
650
|
+
- `sourceRandomGenerator` - - Random source.
|
|
651
|
+
|
|
652
|
+
Returns: Selection context.
|
|
653
|
+
|
|
567
654
|
### foldParent1TraversalContexts
|
|
568
655
|
|
|
569
656
|
```ts
|
|
@@ -579,6 +666,23 @@ Parameters:
|
|
|
579
666
|
|
|
580
667
|
Returns: Parent-1 selection result.
|
|
581
668
|
|
|
669
|
+
### resolveReenableProbability
|
|
670
|
+
|
|
671
|
+
```ts
|
|
672
|
+
resolveReenableProbability(
|
|
673
|
+
preferredProbability: number | undefined,
|
|
674
|
+
fallbackProbability: number | undefined,
|
|
675
|
+
): number
|
|
676
|
+
```
|
|
677
|
+
|
|
678
|
+
Resolves re-enable probability with fallback to default value.
|
|
679
|
+
|
|
680
|
+
Parameters:
|
|
681
|
+
- `preferredProbability` - - Preferred parent probability.
|
|
682
|
+
- `fallbackProbability` - - Secondary parent probability.
|
|
683
|
+
|
|
684
|
+
Returns: Probability in [0, 1].
|
|
685
|
+
|
|
582
686
|
### selectGeneForParent1TraversalContext
|
|
583
687
|
|
|
584
688
|
```ts
|
|
@@ -594,22 +698,20 @@ Parameters:
|
|
|
594
698
|
|
|
595
699
|
Returns: Selected gene or undefined.
|
|
596
700
|
|
|
597
|
-
###
|
|
701
|
+
### selectParent1TraversalGenes
|
|
598
702
|
|
|
599
703
|
```ts
|
|
600
|
-
|
|
704
|
+
selectParent1TraversalGenes(
|
|
601
705
|
context: ConnectionGeneSelectionContext,
|
|
602
|
-
|
|
603
|
-
): Record<string, ConnectionGene>
|
|
706
|
+
): Parent1TraversalSelectionResult
|
|
604
707
|
```
|
|
605
708
|
|
|
606
|
-
|
|
709
|
+
Selects genes reachable from parent-1 innovation traversal.
|
|
607
710
|
|
|
608
711
|
Parameters:
|
|
609
712
|
- `context` - - Selection context.
|
|
610
|
-
- `consumedInnovationIds` - - Innovation IDs already consumed via matching genes.
|
|
611
713
|
|
|
612
|
-
Returns:
|
|
714
|
+
Returns: Parent-1 traversal result.
|
|
613
715
|
|
|
614
716
|
### selectParent2OnlyGenes
|
|
615
717
|
|
|
@@ -628,143 +730,92 @@ Parameters:
|
|
|
628
730
|
|
|
629
731
|
Returns: Selected parent-2-only genes.
|
|
630
732
|
|
|
631
|
-
###
|
|
733
|
+
### selectRemainingParent2Genes
|
|
632
734
|
|
|
633
735
|
```ts
|
|
634
|
-
|
|
736
|
+
selectRemainingParent2Genes(
|
|
635
737
|
context: ConnectionGeneSelectionContext,
|
|
636
|
-
|
|
738
|
+
consumedInnovationIds: string[],
|
|
739
|
+
): Record<string, ConnectionGene>
|
|
637
740
|
```
|
|
638
741
|
|
|
639
|
-
|
|
742
|
+
Builds parent-2 gene map after removing consumed matching innovations.
|
|
640
743
|
|
|
641
744
|
Parameters:
|
|
642
745
|
- `context` - - Selection context.
|
|
746
|
+
- `consumedInnovationIds` - - Innovation IDs already consumed via matching genes.
|
|
643
747
|
|
|
644
|
-
Returns:
|
|
748
|
+
Returns: Remaining parent-2 genes.
|
|
645
749
|
|
|
646
|
-
|
|
750
|
+
## architecture/network/genetic/network.genetic.materialize.utils.ts
|
|
751
|
+
|
|
752
|
+
### applyConnectionGeneToConnection
|
|
647
753
|
|
|
648
754
|
```ts
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
755
|
+
applyConnectionGeneToConnection(
|
|
756
|
+
connection: default,
|
|
757
|
+
connectionGene: ConnectionGene,
|
|
758
|
+
): void
|
|
652
759
|
```
|
|
653
760
|
|
|
654
|
-
|
|
761
|
+
Applies gene properties to a runtime connection.
|
|
655
762
|
|
|
656
763
|
Parameters:
|
|
657
|
-
- `
|
|
764
|
+
- `connection` - - Runtime connection.
|
|
765
|
+
- `connectionGene` - - Gene source.
|
|
658
766
|
|
|
659
|
-
Returns:
|
|
767
|
+
Returns: Nothing.
|
|
660
768
|
|
|
661
|
-
###
|
|
769
|
+
### attachGaterIfAvailable
|
|
662
770
|
|
|
663
771
|
```ts
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
772
|
+
attachGaterIfAvailable(
|
|
773
|
+
offspring: GeneticNetwork,
|
|
774
|
+
connection: default,
|
|
775
|
+
gaterIndex: number,
|
|
776
|
+
): void
|
|
668
777
|
```
|
|
669
778
|
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
Parameters:
|
|
673
|
-
- `parent1TraversalGenes` - - Genes selected from parent-1 traversal.
|
|
674
|
-
- `parent2OnlyGenesToAppend` - - Parent-2-only genes.
|
|
675
|
-
|
|
676
|
-
Returns: Combined chosen genes.
|
|
677
|
-
|
|
678
|
-
### chooseMatchingGene
|
|
679
|
-
|
|
680
|
-
```ts
|
|
681
|
-
chooseMatchingGene(
|
|
682
|
-
parent1: GeneticNetwork,
|
|
683
|
-
parent2: GeneticNetwork,
|
|
684
|
-
parent1Gene: ConnectionGene,
|
|
685
|
-
parent2Gene: ConnectionGene,
|
|
686
|
-
randomGenerator: RandomGenerator,
|
|
687
|
-
): ConnectionGene
|
|
688
|
-
```
|
|
689
|
-
|
|
690
|
-
Chooses a gene for matching innovation IDs.
|
|
691
|
-
|
|
692
|
-
Parameters:
|
|
693
|
-
- `parent1` - - First parent.
|
|
694
|
-
- `parent2` - - Second parent.
|
|
695
|
-
- `parent1Gene` - - Parent 1 matching gene.
|
|
696
|
-
- `parent2Gene` - - Parent 2 matching gene.
|
|
697
|
-
- `randomGenerator` - - Random generator.
|
|
698
|
-
|
|
699
|
-
Returns: Selected gene.
|
|
700
|
-
|
|
701
|
-
### chooseDisjointGeneFromParent
|
|
702
|
-
|
|
703
|
-
```ts
|
|
704
|
-
chooseDisjointGeneFromParent(
|
|
705
|
-
parent: GeneticNetwork,
|
|
706
|
-
sourceGene: ConnectionGene,
|
|
707
|
-
): ConnectionGene
|
|
708
|
-
```
|
|
709
|
-
|
|
710
|
-
Chooses a disjoint/excess gene from a single parent.
|
|
711
|
-
|
|
712
|
-
Parameters:
|
|
713
|
-
- `parent` - - Source parent.
|
|
714
|
-
- `sourceGene` - - Source gene.
|
|
715
|
-
|
|
716
|
-
Returns: Selected disjoint gene.
|
|
717
|
-
|
|
718
|
-
### cloneConnectionGene
|
|
719
|
-
|
|
720
|
-
```ts
|
|
721
|
-
cloneConnectionGene(
|
|
722
|
-
sourceGene: ConnectionGene,
|
|
723
|
-
): ConnectionGene
|
|
724
|
-
```
|
|
725
|
-
|
|
726
|
-
Clones a connection gene.
|
|
779
|
+
Attaches a gater node when the target index is valid.
|
|
727
780
|
|
|
728
781
|
Parameters:
|
|
729
|
-
- `
|
|
782
|
+
- `offspring` - - Offspring network.
|
|
783
|
+
- `connection` - - Connection to gate.
|
|
784
|
+
- `gaterIndex` - - Candidate gater node index.
|
|
730
785
|
|
|
731
|
-
Returns:
|
|
786
|
+
Returns: Nothing.
|
|
732
787
|
|
|
733
|
-
###
|
|
788
|
+
### collectEligibleTraversalContexts
|
|
734
789
|
|
|
735
790
|
```ts
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
):
|
|
791
|
+
collectEligibleTraversalContexts(
|
|
792
|
+
context: OffspringMaterializationContext,
|
|
793
|
+
genes: ConnectionGene[],
|
|
794
|
+
): GeneTraversalContext[]
|
|
740
795
|
```
|
|
741
796
|
|
|
742
|
-
|
|
797
|
+
Collects traversal contexts that satisfy all structural eligibility checks.
|
|
743
798
|
|
|
744
799
|
Parameters:
|
|
745
|
-
- `
|
|
746
|
-
- `
|
|
747
|
-
|
|
748
|
-
Returns: Probability in [0, 1].
|
|
800
|
+
- `context` - - Top-level materialization context.
|
|
801
|
+
- `genes` - - Candidate genes.
|
|
749
802
|
|
|
750
|
-
|
|
803
|
+
Returns: Eligible traversal contexts.
|
|
751
804
|
|
|
752
|
-
###
|
|
805
|
+
### createConnectionForEndpoints
|
|
753
806
|
|
|
754
807
|
```ts
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
): void
|
|
808
|
+
createConnectionForEndpoints(
|
|
809
|
+
endpointsContext: GeneEndpointsContext,
|
|
810
|
+
): default | undefined
|
|
759
811
|
```
|
|
760
812
|
|
|
761
|
-
|
|
813
|
+
Creates a runtime connection for endpoint nodes.
|
|
762
814
|
|
|
763
815
|
Parameters:
|
|
764
|
-
- `
|
|
765
|
-
- `chosenGenes` - - Chosen connection genes.
|
|
816
|
+
- `endpointsContext` - - Endpoint context.
|
|
766
817
|
|
|
767
|
-
Returns:
|
|
818
|
+
Returns: Created connection or undefined.
|
|
768
819
|
|
|
769
820
|
### createMaterializationContext
|
|
770
821
|
|
|
@@ -781,22 +832,24 @@ Parameters:
|
|
|
781
832
|
|
|
782
833
|
Returns: Materialization context.
|
|
783
834
|
|
|
784
|
-
###
|
|
835
|
+
### createOffspringConnection
|
|
785
836
|
|
|
786
837
|
```ts
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
838
|
+
createOffspringConnection(
|
|
839
|
+
offspring: GeneticNetwork,
|
|
840
|
+
fromNode: default,
|
|
841
|
+
toNode: default,
|
|
842
|
+
): default | undefined
|
|
791
843
|
```
|
|
792
844
|
|
|
793
|
-
|
|
845
|
+
Creates a single offspring connection edge.
|
|
794
846
|
|
|
795
847
|
Parameters:
|
|
796
|
-
- `
|
|
797
|
-
- `
|
|
848
|
+
- `offspring` - - Offspring network.
|
|
849
|
+
- `fromNode` - - Source node.
|
|
850
|
+
- `toNode` - - Destination node.
|
|
798
851
|
|
|
799
|
-
Returns:
|
|
852
|
+
Returns: Created connection or undefined.
|
|
800
853
|
|
|
801
854
|
### createTraversalContexts
|
|
802
855
|
|
|
@@ -815,192 +868,139 @@ Parameters:
|
|
|
815
868
|
|
|
816
869
|
Returns: Traversal contexts.
|
|
817
870
|
|
|
818
|
-
###
|
|
819
|
-
|
|
820
|
-
```ts
|
|
821
|
-
keepTraversalContextsWithinNodeBounds(
|
|
822
|
-
traversalContexts: GeneTraversalContext[],
|
|
823
|
-
): GeneTraversalContext[]
|
|
824
|
-
```
|
|
825
|
-
|
|
826
|
-
Keeps traversal contexts whose endpoints are inside offspring bounds.
|
|
827
|
-
|
|
828
|
-
Parameters:
|
|
829
|
-
- `traversalContexts` - - Candidate traversal contexts.
|
|
830
|
-
|
|
831
|
-
Returns: Node-bounded contexts.
|
|
832
|
-
|
|
833
|
-
### keepFeedForwardTraversalContexts
|
|
834
|
-
|
|
835
|
-
```ts
|
|
836
|
-
keepFeedForwardTraversalContexts(
|
|
837
|
-
traversalContexts: GeneTraversalContext[],
|
|
838
|
-
): GeneTraversalContext[]
|
|
839
|
-
```
|
|
840
|
-
|
|
841
|
-
Keeps traversal contexts that preserve feed-forward edge direction.
|
|
842
|
-
|
|
843
|
-
Parameters:
|
|
844
|
-
- `traversalContexts` - - Node-bounded traversal contexts.
|
|
845
|
-
|
|
846
|
-
Returns: Feed-forward contexts.
|
|
847
|
-
|
|
848
|
-
### materializeTraversalContexts
|
|
871
|
+
### hasExistingProjection
|
|
849
872
|
|
|
850
873
|
```ts
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
):
|
|
874
|
+
hasExistingProjection(
|
|
875
|
+
endpointsContext: GeneEndpointsContext,
|
|
876
|
+
): boolean
|
|
854
877
|
```
|
|
855
878
|
|
|
856
|
-
|
|
879
|
+
Checks whether the source endpoint already projects to the target endpoint.
|
|
857
880
|
|
|
858
881
|
Parameters:
|
|
859
|
-
- `
|
|
882
|
+
- `endpointsContext` - - Endpoint context.
|
|
860
883
|
|
|
861
|
-
Returns:
|
|
884
|
+
Returns: True when projection already exists.
|
|
862
885
|
|
|
863
|
-
###
|
|
886
|
+
### isTraversalContextFeedForward
|
|
864
887
|
|
|
865
888
|
```ts
|
|
866
|
-
|
|
889
|
+
isTraversalContextFeedForward(
|
|
867
890
|
traversalContext: GeneTraversalContext,
|
|
868
|
-
):
|
|
891
|
+
): boolean
|
|
869
892
|
```
|
|
870
893
|
|
|
871
|
-
|
|
894
|
+
Validates that a traversal context follows feed-forward ordering.
|
|
872
895
|
|
|
873
896
|
Parameters:
|
|
874
897
|
- `traversalContext` - - Traversal context.
|
|
875
898
|
|
|
876
|
-
Returns:
|
|
899
|
+
Returns: True when the gene is strictly forward.
|
|
877
900
|
|
|
878
|
-
###
|
|
901
|
+
### isTraversalContextWithinNodeBounds
|
|
879
902
|
|
|
880
903
|
```ts
|
|
881
|
-
|
|
904
|
+
isTraversalContextWithinNodeBounds(
|
|
882
905
|
traversalContext: GeneTraversalContext,
|
|
883
|
-
):
|
|
906
|
+
): boolean
|
|
884
907
|
```
|
|
885
908
|
|
|
886
|
-
|
|
909
|
+
Validates that a traversal context endpoints are inside offspring bounds.
|
|
887
910
|
|
|
888
911
|
Parameters:
|
|
889
912
|
- `traversalContext` - - Traversal context.
|
|
890
913
|
|
|
891
|
-
Returns:
|
|
914
|
+
Returns: True when both indices are bounded.
|
|
892
915
|
|
|
893
|
-
###
|
|
916
|
+
### keepFeedForwardTraversalContexts
|
|
894
917
|
|
|
895
918
|
```ts
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
):
|
|
919
|
+
keepFeedForwardTraversalContexts(
|
|
920
|
+
traversalContexts: GeneTraversalContext[],
|
|
921
|
+
): GeneTraversalContext[]
|
|
899
922
|
```
|
|
900
923
|
|
|
901
|
-
|
|
924
|
+
Keeps traversal contexts that preserve feed-forward edge direction.
|
|
902
925
|
|
|
903
926
|
Parameters:
|
|
904
|
-
- `
|
|
927
|
+
- `traversalContexts` - - Node-bounded traversal contexts.
|
|
905
928
|
|
|
906
|
-
Returns:
|
|
929
|
+
Returns: Feed-forward contexts.
|
|
907
930
|
|
|
908
|
-
###
|
|
931
|
+
### keepTraversalContextsWithinNodeBounds
|
|
909
932
|
|
|
910
933
|
```ts
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
):
|
|
934
|
+
keepTraversalContextsWithinNodeBounds(
|
|
935
|
+
traversalContexts: GeneTraversalContext[],
|
|
936
|
+
): GeneTraversalContext[]
|
|
914
937
|
```
|
|
915
938
|
|
|
916
|
-
|
|
939
|
+
Keeps traversal contexts whose endpoints are inside offspring bounds.
|
|
917
940
|
|
|
918
941
|
Parameters:
|
|
919
|
-
- `
|
|
942
|
+
- `traversalContexts` - - Candidate traversal contexts.
|
|
920
943
|
|
|
921
|
-
Returns:
|
|
944
|
+
Returns: Node-bounded contexts.
|
|
922
945
|
|
|
923
|
-
###
|
|
946
|
+
### materializeOffspringConnections
|
|
924
947
|
|
|
925
948
|
```ts
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
949
|
+
materializeOffspringConnections(
|
|
950
|
+
offspring: GeneticNetwork,
|
|
951
|
+
chosenGenes: ConnectionGene[],
|
|
952
|
+
): void
|
|
929
953
|
```
|
|
930
954
|
|
|
931
|
-
|
|
955
|
+
Materializes selected connection genes in the offspring network.
|
|
932
956
|
|
|
933
957
|
Parameters:
|
|
934
|
-
- `
|
|
958
|
+
- `offspring` - - Offspring network.
|
|
959
|
+
- `chosenGenes` - - Chosen connection genes.
|
|
935
960
|
|
|
936
|
-
Returns:
|
|
961
|
+
Returns: Nothing.
|
|
937
962
|
|
|
938
|
-
###
|
|
963
|
+
### materializeSingleTraversalContext
|
|
939
964
|
|
|
940
965
|
```ts
|
|
941
|
-
|
|
966
|
+
materializeSingleTraversalContext(
|
|
942
967
|
traversalContext: GeneTraversalContext,
|
|
943
|
-
):
|
|
968
|
+
): void
|
|
944
969
|
```
|
|
945
970
|
|
|
946
|
-
|
|
971
|
+
Materializes one eligible traversal context when no duplicate projection exists.
|
|
947
972
|
|
|
948
973
|
Parameters:
|
|
949
974
|
- `traversalContext` - - Traversal context.
|
|
950
975
|
|
|
951
|
-
Returns:
|
|
952
|
-
|
|
953
|
-
### createOffspringConnection
|
|
954
|
-
|
|
955
|
-
```ts
|
|
956
|
-
createOffspringConnection(
|
|
957
|
-
offspring: GeneticNetwork,
|
|
958
|
-
fromNode: default,
|
|
959
|
-
toNode: default,
|
|
960
|
-
): default | undefined
|
|
961
|
-
```
|
|
962
|
-
|
|
963
|
-
Creates a single offspring connection edge.
|
|
964
|
-
|
|
965
|
-
Parameters:
|
|
966
|
-
- `offspring` - - Offspring network.
|
|
967
|
-
- `fromNode` - - Source node.
|
|
968
|
-
- `toNode` - - Destination node.
|
|
969
|
-
|
|
970
|
-
Returns: Created connection or undefined.
|
|
976
|
+
Returns: Nothing.
|
|
971
977
|
|
|
972
|
-
###
|
|
978
|
+
### materializeTraversalContexts
|
|
973
979
|
|
|
974
980
|
```ts
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
connectionGene: ConnectionGene,
|
|
981
|
+
materializeTraversalContexts(
|
|
982
|
+
traversalContexts: GeneTraversalContext[],
|
|
978
983
|
): void
|
|
979
984
|
```
|
|
980
985
|
|
|
981
|
-
|
|
986
|
+
Materializes each eligible traversal context independently.
|
|
982
987
|
|
|
983
988
|
Parameters:
|
|
984
|
-
- `
|
|
985
|
-
- `connectionGene` - - Gene source.
|
|
989
|
+
- `traversalContexts` - - Eligible traversal contexts.
|
|
986
990
|
|
|
987
991
|
Returns: Nothing.
|
|
988
992
|
|
|
989
|
-
###
|
|
993
|
+
### resolveGeneEndpointsContext
|
|
990
994
|
|
|
991
995
|
```ts
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
gaterIndex: number,
|
|
996
|
-
): void
|
|
996
|
+
resolveGeneEndpointsContext(
|
|
997
|
+
traversalContext: GeneTraversalContext,
|
|
998
|
+
): GeneEndpointsContext | undefined
|
|
997
999
|
```
|
|
998
1000
|
|
|
999
|
-
|
|
1001
|
+
Resolves concrete endpoint nodes for a traversal context.
|
|
1000
1002
|
|
|
1001
1003
|
Parameters:
|
|
1002
|
-
- `
|
|
1003
|
-
- `connection` - - Connection to gate.
|
|
1004
|
-
- `gaterIndex` - - Candidate gater node index.
|
|
1004
|
+
- `traversalContext` - - Traversal context.
|
|
1005
1005
|
|
|
1006
|
-
Returns:
|
|
1006
|
+
Returns: Endpoint context or undefined.
|