@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
|
@@ -8,26 +8,22 @@ Shared dataset compatibility error message.
|
|
|
8
8
|
|
|
9
9
|
Shared dataset compatibility error message.
|
|
10
10
|
|
|
11
|
-
###
|
|
12
|
-
|
|
13
|
-
Shared evolve stopping-condition validation error.
|
|
14
|
-
|
|
15
|
-
### DEFAULT_TARGET_ERROR
|
|
11
|
+
### DEFAULT_EVALUATION_AMOUNT
|
|
16
12
|
|
|
17
|
-
Default
|
|
13
|
+
Default repeated evaluation amount.
|
|
18
14
|
|
|
19
15
|
### DEFAULT_GROWTH
|
|
20
16
|
|
|
21
17
|
Default complexity growth penalty.
|
|
22
18
|
|
|
23
|
-
### DEFAULT_EVALUATION_AMOUNT
|
|
24
|
-
|
|
25
|
-
Default repeated evaluation amount.
|
|
26
|
-
|
|
27
19
|
### DEFAULT_LOG_INTERVAL
|
|
28
20
|
|
|
29
21
|
Default logging frequency value.
|
|
30
22
|
|
|
23
|
+
### DEFAULT_TARGET_ERROR
|
|
24
|
+
|
|
25
|
+
Default target error used when omitted.
|
|
26
|
+
|
|
31
27
|
### DEFAULT_THREAD_COUNT
|
|
32
28
|
|
|
33
29
|
Default single-thread worker count.
|
|
@@ -36,33 +32,37 @@ Default single-thread worker count.
|
|
|
36
32
|
|
|
37
33
|
Sentinel target error indicating that error-based stopping is disabled.
|
|
38
34
|
|
|
39
|
-
###
|
|
35
|
+
### EvolutionSummary
|
|
40
36
|
|
|
41
|
-
|
|
37
|
+
Shared evolution summary payload.
|
|
42
38
|
|
|
43
|
-
###
|
|
39
|
+
### GenomeStructureCounts
|
|
44
40
|
|
|
45
|
-
|
|
41
|
+
Structural counts used by complexity heuristics.
|
|
46
42
|
|
|
47
|
-
###
|
|
43
|
+
### MAX_CONSECUTIVE_INVALID_ERRORS
|
|
48
44
|
|
|
49
|
-
|
|
45
|
+
Maximum consecutive invalid errors tolerated before loop abort.
|
|
50
46
|
|
|
51
47
|
### SMALL_POPULATION_MUTATION_AMOUNT
|
|
52
48
|
|
|
53
49
|
Mutation amount fallback used for very small populations.
|
|
54
50
|
|
|
55
|
-
###
|
|
51
|
+
### SMALL_POPULATION_MUTATION_RATE
|
|
56
52
|
|
|
57
|
-
|
|
53
|
+
Mutation rate fallback used for very small populations.
|
|
58
54
|
|
|
59
|
-
###
|
|
55
|
+
### SMALL_POPULATION_THRESHOLD
|
|
60
56
|
|
|
61
|
-
|
|
57
|
+
Population threshold considered "small" for mutation heuristics.
|
|
62
58
|
|
|
63
|
-
###
|
|
59
|
+
### STOPPING_CONDITION_REQUIRED_ERROR_MESSAGE
|
|
64
60
|
|
|
65
|
-
|
|
61
|
+
Shared evolve stopping-condition validation error.
|
|
62
|
+
|
|
63
|
+
### ZERO_ITERATIONS
|
|
64
|
+
|
|
65
|
+
Explicit zero-iteration value.
|
|
66
66
|
|
|
67
67
|
## architecture/network/evolve/network.evolve.utils.ts
|
|
68
68
|
|
|
@@ -109,76 +109,93 @@ console.log(summary.error, summary.iterations, summary.time);
|
|
|
109
109
|
|
|
110
110
|
## architecture/network/evolve/network.evolve.loop.utils.ts
|
|
111
111
|
|
|
112
|
-
###
|
|
112
|
+
### applyEvolutionStep
|
|
113
113
|
|
|
114
114
|
```ts
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
): Promise<{ error: number; bestGenome: default | undefined; }>
|
|
115
|
+
applyEvolutionStep(
|
|
116
|
+
state: EvolutionLoopState,
|
|
117
|
+
evolvedGenome: default,
|
|
118
|
+
growth: number,
|
|
119
|
+
): void
|
|
121
120
|
```
|
|
122
121
|
|
|
123
|
-
|
|
122
|
+
Applies one evolve() result to loop state.
|
|
124
123
|
|
|
125
124
|
Parameters:
|
|
126
|
-
- `
|
|
127
|
-
- `
|
|
128
|
-
- `
|
|
129
|
-
- `iterations` - - Optional max iteration count.
|
|
125
|
+
- `state` - - Mutable loop state.
|
|
126
|
+
- `evolvedGenome` - - Genome returned by NEAT evolve step.
|
|
127
|
+
- `growth` - - Complexity growth scalar.
|
|
130
128
|
|
|
131
|
-
Returns:
|
|
129
|
+
Returns: Nothing.
|
|
132
130
|
|
|
133
|
-
###
|
|
131
|
+
### createInitialLoopState
|
|
134
132
|
|
|
135
133
|
```ts
|
|
136
|
-
|
|
137
|
-
currentError: number,
|
|
138
|
-
targetError: number,
|
|
139
|
-
iterationsSpecified: boolean,
|
|
140
|
-
currentGeneration: number,
|
|
141
|
-
maxIterations: number | undefined,
|
|
142
|
-
): boolean
|
|
134
|
+
createInitialLoopState(): EvolutionLoopState
|
|
143
135
|
```
|
|
144
136
|
|
|
145
|
-
|
|
137
|
+
Creates initial loop state snapshot.
|
|
138
|
+
|
|
139
|
+
Returns: Initial loop state.
|
|
140
|
+
|
|
141
|
+
### deriveErrorFromFitness
|
|
142
|
+
|
|
143
|
+
```ts
|
|
144
|
+
deriveErrorFromFitness(
|
|
145
|
+
fitness: number,
|
|
146
|
+
genome: default,
|
|
147
|
+
growth: number,
|
|
148
|
+
): number
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
Derive error from fitness by inverting score composition.
|
|
146
152
|
|
|
147
153
|
Parameters:
|
|
148
|
-
- `
|
|
149
|
-
- `
|
|
150
|
-
- `
|
|
151
|
-
- `currentGeneration` - - Current NEAT generation index.
|
|
152
|
-
- `maxIterations` - - Maximum iteration limit.
|
|
154
|
+
- `fitness` - - Fitness value from fittest genome.
|
|
155
|
+
- `genome` - - Fittest genome.
|
|
156
|
+
- `growth` - - Complexity growth scalar.
|
|
153
157
|
|
|
154
|
-
Returns:
|
|
158
|
+
Returns: Derived error value.
|
|
155
159
|
|
|
156
|
-
###
|
|
160
|
+
### runEvolutionLoop
|
|
157
161
|
|
|
158
162
|
```ts
|
|
159
|
-
|
|
163
|
+
runEvolutionLoop(
|
|
164
|
+
neatInstance: NeatRuntime,
|
|
165
|
+
resolvedSettings: EvolutionSettings,
|
|
166
|
+
targetError: number,
|
|
167
|
+
iterations: number | undefined,
|
|
168
|
+
): Promise<{ error: number; bestGenome: default | undefined; }>
|
|
160
169
|
```
|
|
161
170
|
|
|
162
|
-
|
|
171
|
+
Run core evolution loop until stop condition is met.
|
|
163
172
|
|
|
164
|
-
|
|
173
|
+
Parameters:
|
|
174
|
+
- `neatInstance` - - Active NEAT instance.
|
|
175
|
+
- `resolvedSettings` - - Scalar evolution settings.
|
|
176
|
+
- `targetError` - - Effective target error (-1 means disabled).
|
|
177
|
+
- `iterations` - - Optional max iteration count.
|
|
165
178
|
|
|
166
|
-
|
|
179
|
+
Returns: Loop result snapshot.
|
|
180
|
+
|
|
181
|
+
### runScheduleCallbackSafely
|
|
167
182
|
|
|
168
183
|
```ts
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
184
|
+
runScheduleCallbackSafely(
|
|
185
|
+
scheduleConfig: { iterations: number; function: (stats: { fitness: number; error: number; iteration: number; }) => void; } | undefined,
|
|
186
|
+
generation: number,
|
|
187
|
+
bestFitness: number,
|
|
188
|
+
error: number,
|
|
173
189
|
): void
|
|
174
190
|
```
|
|
175
191
|
|
|
176
|
-
|
|
192
|
+
Run schedule callback if schedule trigger is reached.
|
|
177
193
|
|
|
178
194
|
Parameters:
|
|
179
|
-
- `
|
|
180
|
-
- `
|
|
181
|
-
- `
|
|
195
|
+
- `scheduleConfig` - - Optional schedule configuration.
|
|
196
|
+
- `generation` - - Current generation.
|
|
197
|
+
- `bestFitness` - - Current best fitness.
|
|
198
|
+
- `error` - - Current error.
|
|
182
199
|
|
|
183
200
|
Returns: Nothing.
|
|
184
201
|
|
|
@@ -197,24 +214,28 @@ Parameters:
|
|
|
197
214
|
|
|
198
215
|
Returns: True when invalid-error threshold is reached.
|
|
199
216
|
|
|
200
|
-
###
|
|
217
|
+
### shouldContinueEvolution
|
|
201
218
|
|
|
202
219
|
```ts
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
220
|
+
shouldContinueEvolution(
|
|
221
|
+
currentError: number,
|
|
222
|
+
targetError: number,
|
|
223
|
+
iterationsSpecified: boolean,
|
|
224
|
+
currentGeneration: number,
|
|
225
|
+
maxIterations: number | undefined,
|
|
226
|
+
): boolean
|
|
208
227
|
```
|
|
209
228
|
|
|
210
|
-
|
|
229
|
+
Determine whether evolution loop should continue.
|
|
211
230
|
|
|
212
231
|
Parameters:
|
|
213
|
-
- `
|
|
214
|
-
- `
|
|
215
|
-
- `
|
|
232
|
+
- `currentError` - - Current derived error value.
|
|
233
|
+
- `targetError` - - Effective target error (-1 means disabled).
|
|
234
|
+
- `iterationsSpecified` - - Whether iterations limit is active.
|
|
235
|
+
- `currentGeneration` - - Current NEAT generation index.
|
|
236
|
+
- `maxIterations` - - Maximum iteration limit.
|
|
216
237
|
|
|
217
|
-
Returns:
|
|
238
|
+
Returns: True when loop should continue.
|
|
218
239
|
|
|
219
240
|
### updateBestGenomeIfImproved
|
|
220
241
|
|
|
@@ -254,29 +275,25 @@ Parameters:
|
|
|
254
275
|
|
|
255
276
|
Returns: Updated guard state.
|
|
256
277
|
|
|
257
|
-
|
|
278
|
+
## architecture/network/evolve/network.evolve.setup.utils.ts
|
|
279
|
+
|
|
280
|
+
### applySmallPopulationHeuristics
|
|
258
281
|
|
|
259
282
|
```ts
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
bestFitness: number,
|
|
264
|
-
error: number,
|
|
283
|
+
applySmallPopulationHeuristics(
|
|
284
|
+
neatInstance: NeatRuntime,
|
|
285
|
+
evolveOptions: EvolveOptions,
|
|
265
286
|
): void
|
|
266
287
|
```
|
|
267
288
|
|
|
268
|
-
|
|
289
|
+
Increase mutation aggressiveness for tiny populations.
|
|
269
290
|
|
|
270
291
|
Parameters:
|
|
271
|
-
- `
|
|
272
|
-
- `
|
|
273
|
-
- `bestFitness` - - Current best fitness.
|
|
274
|
-
- `error` - - Current error.
|
|
292
|
+
- `neatInstance` - - Active NEAT instance.
|
|
293
|
+
- `evolveOptions` - - Evolve options object.
|
|
275
294
|
|
|
276
295
|
Returns: Nothing.
|
|
277
296
|
|
|
278
|
-
## architecture/network/evolve/network.evolve.setup.utils.ts
|
|
279
|
-
|
|
280
297
|
### assertEvolutionDatasetCompatibility
|
|
281
298
|
|
|
282
299
|
```ts
|
|
@@ -294,67 +311,71 @@ Parameters:
|
|
|
294
311
|
|
|
295
312
|
Returns: Nothing.
|
|
296
313
|
|
|
297
|
-
###
|
|
314
|
+
### configureNeatOptions
|
|
298
315
|
|
|
299
316
|
```ts
|
|
300
|
-
|
|
317
|
+
configureNeatOptions(
|
|
318
|
+
network: default,
|
|
301
319
|
evolveOptions: EvolveOptions,
|
|
302
|
-
):
|
|
320
|
+
): void
|
|
303
321
|
```
|
|
304
322
|
|
|
305
|
-
|
|
323
|
+
Normalize options used by NEAT constructor.
|
|
306
324
|
|
|
307
325
|
Parameters:
|
|
308
|
-
- `
|
|
326
|
+
- `network` - - Network instance being evolved.
|
|
327
|
+
- `evolveOptions` - - Evolve options object.
|
|
309
328
|
|
|
310
|
-
Returns:
|
|
329
|
+
Returns: Nothing.
|
|
311
330
|
|
|
312
|
-
###
|
|
331
|
+
### createEvolutionConfig
|
|
313
332
|
|
|
314
333
|
```ts
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
):
|
|
334
|
+
createEvolutionConfig(
|
|
335
|
+
settingsToSummarize: EvolutionSettings,
|
|
336
|
+
): EvolutionConfig | undefined
|
|
318
337
|
```
|
|
319
338
|
|
|
320
|
-
|
|
339
|
+
Build optional structured evolution config summary.
|
|
321
340
|
|
|
322
341
|
Parameters:
|
|
323
|
-
- `
|
|
342
|
+
- `settingsToSummarize` - - Scalar evolution settings.
|
|
324
343
|
|
|
325
|
-
Returns:
|
|
344
|
+
Returns: Optional summary config.
|
|
326
345
|
|
|
327
|
-
###
|
|
346
|
+
### createNeatInstance
|
|
328
347
|
|
|
329
348
|
```ts
|
|
330
|
-
|
|
349
|
+
createNeatInstance(
|
|
350
|
+
network: default,
|
|
351
|
+
fitnessFunction: EvolutionFitnessFunction,
|
|
331
352
|
evolveOptions: EvolveOptions,
|
|
332
|
-
|
|
333
|
-
): EvolutionStopConditions
|
|
353
|
+
): Promise<NeatRuntime>
|
|
334
354
|
```
|
|
335
355
|
|
|
336
|
-
|
|
356
|
+
Lazy-load and create NEAT instance.
|
|
337
357
|
|
|
338
358
|
Parameters:
|
|
359
|
+
- `network` - - Network instance being evolved.
|
|
360
|
+
- `fitnessFunction` - - Prepared fitness evaluator.
|
|
339
361
|
- `evolveOptions` - - Evolve options object.
|
|
340
|
-
- `initialTargetError` - - Target error resolved from options.
|
|
341
362
|
|
|
342
|
-
Returns:
|
|
363
|
+
Returns: Constructed NEAT instance.
|
|
343
364
|
|
|
344
|
-
###
|
|
365
|
+
### getNormalizedOptions
|
|
345
366
|
|
|
346
367
|
```ts
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
):
|
|
368
|
+
getNormalizedOptions(
|
|
369
|
+
evolveOptions: EvolveOptions,
|
|
370
|
+
): EvolveOptions
|
|
350
371
|
```
|
|
351
372
|
|
|
352
|
-
|
|
373
|
+
Ensure options object exists.
|
|
353
374
|
|
|
354
375
|
Parameters:
|
|
355
|
-
- `
|
|
376
|
+
- `evolveOptions` - - Incoming evolve options.
|
|
356
377
|
|
|
357
|
-
Returns:
|
|
378
|
+
Returns: Safe options object.
|
|
358
379
|
|
|
359
380
|
### prepareFitnessFunction
|
|
360
381
|
|
|
@@ -375,41 +396,37 @@ Parameters:
|
|
|
375
396
|
|
|
376
397
|
Returns: Fitness function and resolved thread count.
|
|
377
398
|
|
|
378
|
-
###
|
|
399
|
+
### resolveEvolutionSettings
|
|
379
400
|
|
|
380
401
|
```ts
|
|
381
|
-
|
|
382
|
-
network: default,
|
|
402
|
+
resolveEvolutionSettings(
|
|
383
403
|
evolveOptions: EvolveOptions,
|
|
384
|
-
):
|
|
404
|
+
): EvolutionSettings
|
|
385
405
|
```
|
|
386
406
|
|
|
387
|
-
|
|
407
|
+
Resolve normalized scalar settings with defaults.
|
|
388
408
|
|
|
389
409
|
Parameters:
|
|
390
|
-
- `network` - - Network instance being evolved.
|
|
391
410
|
- `evolveOptions` - - Evolve options object.
|
|
392
411
|
|
|
393
|
-
Returns:
|
|
412
|
+
Returns: Normalized scalar settings.
|
|
394
413
|
|
|
395
|
-
###
|
|
414
|
+
### resolveStopConditions
|
|
396
415
|
|
|
397
416
|
```ts
|
|
398
|
-
|
|
399
|
-
network: default,
|
|
400
|
-
fitnessFunction: EvolutionFitnessFunction,
|
|
417
|
+
resolveStopConditions(
|
|
401
418
|
evolveOptions: EvolveOptions,
|
|
402
|
-
|
|
419
|
+
initialTargetError: number,
|
|
420
|
+
): EvolutionStopConditions
|
|
403
421
|
```
|
|
404
422
|
|
|
405
|
-
|
|
423
|
+
Resolve stopping-condition semantics while preserving legacy behavior.
|
|
406
424
|
|
|
407
425
|
Parameters:
|
|
408
|
-
- `network` - - Network instance being evolved.
|
|
409
|
-
- `fitnessFunction` - - Prepared fitness evaluator.
|
|
410
426
|
- `evolveOptions` - - Evolve options object.
|
|
427
|
+
- `initialTargetError` - - Target error resolved from options.
|
|
411
428
|
|
|
412
|
-
Returns:
|
|
429
|
+
Returns: Final stop conditions.
|
|
413
430
|
|
|
414
431
|
### warnIfNoBestGenomeMayOccur
|
|
415
432
|
|
|
@@ -428,41 +445,49 @@ Parameters:
|
|
|
428
445
|
|
|
429
446
|
Returns: Nothing.
|
|
430
447
|
|
|
431
|
-
|
|
448
|
+
## architecture/network/evolve/network.evolve.fitness.utils.ts
|
|
449
|
+
|
|
450
|
+
### buildMultiThreadFitness
|
|
432
451
|
|
|
433
452
|
```ts
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
453
|
+
buildMultiThreadFitness(
|
|
454
|
+
set: TrainingSample[],
|
|
455
|
+
cost: CostFunctionOrRef,
|
|
456
|
+
amount: number,
|
|
457
|
+
growth: number,
|
|
458
|
+
threads: number,
|
|
459
|
+
options: Record<string, unknown>,
|
|
460
|
+
): Promise<FitnessSetup>
|
|
438
461
|
```
|
|
439
462
|
|
|
440
|
-
|
|
463
|
+
Build worker-based population fitness setup.
|
|
441
464
|
|
|
442
465
|
Parameters:
|
|
443
|
-
- `
|
|
444
|
-
- `
|
|
445
|
-
|
|
446
|
-
|
|
466
|
+
- `set` - - Dataset.
|
|
467
|
+
- `cost` - - Cost function or reference.
|
|
468
|
+
- `amount` - - Repetition count.
|
|
469
|
+
- `growth` - - Complexity penalty scalar.
|
|
470
|
+
- `threads` - - Desired worker count.
|
|
471
|
+
- `options` - - Evolution options object.
|
|
447
472
|
|
|
448
|
-
|
|
473
|
+
Returns: Population fitness setup.
|
|
449
474
|
|
|
450
|
-
###
|
|
475
|
+
### buildPopulationWorkerFitnessFunction
|
|
451
476
|
|
|
452
477
|
```ts
|
|
453
|
-
|
|
454
|
-
|
|
478
|
+
buildPopulationWorkerFitnessFunction(
|
|
479
|
+
workers: TestWorkerInstance[],
|
|
455
480
|
growth: number,
|
|
456
|
-
):
|
|
481
|
+
): PopulationFitnessFunction
|
|
457
482
|
```
|
|
458
483
|
|
|
459
|
-
|
|
484
|
+
Build population-level fitness function powered by worker queue.
|
|
460
485
|
|
|
461
486
|
Parameters:
|
|
462
|
-
- `
|
|
463
|
-
- `growth` - -
|
|
487
|
+
- `workers` - - Spawned worker instances.
|
|
488
|
+
- `growth` - - Complexity penalty scalar.
|
|
464
489
|
|
|
465
|
-
Returns:
|
|
490
|
+
Returns: Population-level fitness function.
|
|
466
491
|
|
|
467
492
|
### buildSingleThreadFitness
|
|
468
493
|
|
|
@@ -485,131 +510,94 @@ Parameters:
|
|
|
485
510
|
|
|
486
511
|
Returns: Single-genome fitness function.
|
|
487
512
|
|
|
488
|
-
###
|
|
489
|
-
|
|
490
|
-
```ts
|
|
491
|
-
buildMultiThreadFitness(
|
|
492
|
-
set: TrainingSample[],
|
|
493
|
-
cost: CostFunctionOrRef,
|
|
494
|
-
amount: number,
|
|
495
|
-
growth: number,
|
|
496
|
-
threads: number,
|
|
497
|
-
options: Record<string, unknown>,
|
|
498
|
-
): Promise<FitnessSetup>
|
|
499
|
-
```
|
|
500
|
-
|
|
501
|
-
Build worker-based population fitness setup.
|
|
502
|
-
|
|
503
|
-
Parameters:
|
|
504
|
-
- `set` - - Dataset.
|
|
505
|
-
- `cost` - - Cost function or reference.
|
|
506
|
-
- `amount` - - Repetition count.
|
|
507
|
-
- `growth` - - Complexity penalty scalar.
|
|
508
|
-
- `threads` - - Desired worker count.
|
|
509
|
-
- `options` - - Evolution options object.
|
|
510
|
-
|
|
511
|
-
Returns: Population fitness setup.
|
|
512
|
-
|
|
513
|
-
### evaluateGenomeWithWorker
|
|
513
|
+
### cacheComplexityBase
|
|
514
514
|
|
|
515
515
|
```ts
|
|
516
|
-
|
|
517
|
-
worker: TestWorkerInstance,
|
|
516
|
+
cacheComplexityBase(
|
|
518
517
|
genome: default,
|
|
519
|
-
|
|
520
|
-
|
|
518
|
+
structureCounts: GenomeStructureCounts,
|
|
519
|
+
complexityBase: number,
|
|
520
|
+
): void
|
|
521
521
|
```
|
|
522
522
|
|
|
523
|
-
|
|
523
|
+
Store complexity base cache entry for future reuse.
|
|
524
524
|
|
|
525
525
|
Parameters:
|
|
526
|
-
- `
|
|
527
|
-
- `
|
|
528
|
-
- `
|
|
526
|
+
- `genome` - - Candidate network used as cache key.
|
|
527
|
+
- `structureCounts` - - Current structural counts.
|
|
528
|
+
- `complexityBase` - - Computed base complexity value.
|
|
529
529
|
|
|
530
|
-
Returns:
|
|
530
|
+
Returns: Nothing.
|
|
531
531
|
|
|
532
|
-
###
|
|
532
|
+
### claimNextGenome
|
|
533
533
|
|
|
534
534
|
```ts
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
): void
|
|
535
|
+
claimNextGenome(
|
|
536
|
+
context: PopulationWorkerEvaluationContext,
|
|
537
|
+
): default | undefined
|
|
539
538
|
```
|
|
540
539
|
|
|
541
|
-
|
|
540
|
+
Claims the next genome index from shared queue state.
|
|
542
541
|
|
|
543
542
|
Parameters:
|
|
544
|
-
- `
|
|
545
|
-
- `workers` - - Spawned worker instances.
|
|
543
|
+
- `context` - - Population evaluation context.
|
|
546
544
|
|
|
547
|
-
Returns:
|
|
545
|
+
Returns: Next genome, or undefined when queue is exhausted.
|
|
548
546
|
|
|
549
|
-
###
|
|
547
|
+
### computeComplexityBase
|
|
550
548
|
|
|
551
549
|
```ts
|
|
552
|
-
|
|
550
|
+
computeComplexityBase(
|
|
553
551
|
genome: default,
|
|
554
|
-
|
|
555
|
-
cost: EvolveCostFunction,
|
|
556
|
-
amount: number,
|
|
552
|
+
structureCounts: GenomeStructureCounts,
|
|
557
553
|
): number
|
|
558
554
|
```
|
|
559
555
|
|
|
560
|
-
|
|
556
|
+
Compute non-scaled complexity base from structural counts.
|
|
561
557
|
|
|
562
558
|
Parameters:
|
|
563
|
-
- `genome` - -
|
|
564
|
-
- `
|
|
565
|
-
- `cost` - - Cost function reference.
|
|
566
|
-
- `amount` - - Number of repeated evaluations.
|
|
559
|
+
- `genome` - - Candidate network whose complexity to compute.
|
|
560
|
+
- `structureCounts` - - Current structural counts.
|
|
567
561
|
|
|
568
|
-
Returns:
|
|
562
|
+
Returns: Base complexity value before growth scaling.
|
|
569
563
|
|
|
570
|
-
###
|
|
564
|
+
### computeComplexityPenalty
|
|
571
565
|
|
|
572
566
|
```ts
|
|
573
|
-
|
|
567
|
+
computeComplexityPenalty(
|
|
574
568
|
genome: default,
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
): number | null
|
|
569
|
+
growth: number,
|
|
570
|
+
): number
|
|
578
571
|
```
|
|
579
572
|
|
|
580
|
-
|
|
573
|
+
Compute structural complexity penalty scaled by growth.
|
|
581
574
|
|
|
582
575
|
Parameters:
|
|
583
|
-
- `genome` - -
|
|
584
|
-
- `
|
|
585
|
-
- `cost` - - Cost function reference.
|
|
576
|
+
- `genome` - - Candidate network whose complexity to measure.
|
|
577
|
+
- `growth` - - Positive scalar controlling parsimony pressure.
|
|
586
578
|
|
|
587
|
-
Returns:
|
|
579
|
+
Returns: Complexity penalty.
|
|
588
580
|
|
|
589
|
-
###
|
|
581
|
+
### createPopulationWorkerEvaluationContext
|
|
590
582
|
|
|
591
583
|
```ts
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
584
|
+
createPopulationWorkerEvaluationContext(
|
|
585
|
+
sourceWorkers: TestWorkerInstance[],
|
|
586
|
+
sourcePopulation: default[],
|
|
587
|
+
sourceGrowth: number,
|
|
588
|
+
sourceResolve: () => void,
|
|
589
|
+
): PopulationWorkerEvaluationContext
|
|
595
590
|
```
|
|
596
591
|
|
|
597
|
-
|
|
592
|
+
Creates the shared evaluation context for one population run.
|
|
598
593
|
|
|
599
594
|
Parameters:
|
|
600
|
-
- `
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
### resolveTestWorkerConstructor
|
|
605
|
-
|
|
606
|
-
```ts
|
|
607
|
-
resolveTestWorkerConstructor(): Promise<TestWorkerConstructor | null>
|
|
608
|
-
```
|
|
609
|
-
|
|
610
|
-
Resolve worker constructor for current runtime environment.
|
|
595
|
+
- `sourceWorkers` - - Worker pool.
|
|
596
|
+
- `sourcePopulation` - - Population to evaluate.
|
|
597
|
+
- `sourceGrowth` - - Complexity penalty scalar.
|
|
598
|
+
- `sourceResolve` - - Promise resolver.
|
|
611
599
|
|
|
612
|
-
Returns:
|
|
600
|
+
Returns: Population evaluation context.
|
|
613
601
|
|
|
614
602
|
### createSingleThreadFallbackFitness
|
|
615
603
|
|
|
@@ -632,171 +620,175 @@ Parameters:
|
|
|
632
620
|
|
|
633
621
|
Returns: Single-thread fitness setup.
|
|
634
622
|
|
|
635
|
-
###
|
|
623
|
+
### createWorkerTraversalContext
|
|
636
624
|
|
|
637
625
|
```ts
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
threads: number,
|
|
643
|
-
): TestWorkerInstance[]
|
|
626
|
+
createWorkerTraversalContext(
|
|
627
|
+
context: PopulationWorkerEvaluationContext,
|
|
628
|
+
worker: TestWorkerInstance,
|
|
629
|
+
): WorkerTraversalContext
|
|
644
630
|
```
|
|
645
631
|
|
|
646
|
-
|
|
632
|
+
Creates traversal context for one worker.
|
|
647
633
|
|
|
648
634
|
Parameters:
|
|
649
|
-
- `
|
|
650
|
-
- `
|
|
651
|
-
- `cost` - - Cost function or cost reference.
|
|
652
|
-
- `threads` - - Requested worker count.
|
|
635
|
+
- `context` - - Population evaluation context.
|
|
636
|
+
- `worker` - - Worker instance.
|
|
653
637
|
|
|
654
|
-
Returns:
|
|
638
|
+
Returns: Worker traversal context.
|
|
655
639
|
|
|
656
|
-
###
|
|
640
|
+
### evaluateGenomeAmountTimes
|
|
657
641
|
|
|
658
642
|
```ts
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
643
|
+
evaluateGenomeAmountTimes(
|
|
644
|
+
genome: default,
|
|
645
|
+
set: TrainingSample[],
|
|
646
|
+
cost: EvolveCostFunction,
|
|
647
|
+
amount: number,
|
|
648
|
+
): number
|
|
662
649
|
```
|
|
663
650
|
|
|
664
|
-
|
|
651
|
+
Evaluate one genome repeatedly and accumulate negative error.
|
|
665
652
|
|
|
666
653
|
Parameters:
|
|
667
|
-
- `
|
|
654
|
+
- `genome` - - Genome under evaluation.
|
|
655
|
+
- `set` - - Dataset used for evaluation.
|
|
656
|
+
- `cost` - - Cost function reference.
|
|
657
|
+
- `amount` - - Number of repeated evaluations.
|
|
668
658
|
|
|
669
|
-
Returns:
|
|
659
|
+
Returns: Accumulated negative error or -Infinity on failure.
|
|
670
660
|
|
|
671
|
-
###
|
|
661
|
+
### evaluateGenomeErrorSafely
|
|
672
662
|
|
|
673
663
|
```ts
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
664
|
+
evaluateGenomeErrorSafely(
|
|
665
|
+
genome: default,
|
|
666
|
+
set: TrainingSample[],
|
|
667
|
+
cost: EvolveCostFunction,
|
|
668
|
+
): number | null
|
|
678
669
|
```
|
|
679
670
|
|
|
680
|
-
|
|
671
|
+
Evaluate one genome and return error, with warning-protected failure handling.
|
|
681
672
|
|
|
682
673
|
Parameters:
|
|
683
|
-
- `
|
|
684
|
-
- `
|
|
674
|
+
- `genome` - - Genome under evaluation.
|
|
675
|
+
- `set` - - Dataset used for evaluation.
|
|
676
|
+
- `cost` - - Cost function reference.
|
|
685
677
|
|
|
686
|
-
Returns:
|
|
678
|
+
Returns: Error value, or null when evaluation fails.
|
|
687
679
|
|
|
688
|
-
###
|
|
680
|
+
### evaluateGenomeWithWorker
|
|
689
681
|
|
|
690
682
|
```ts
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
): PopulationWorkerEvaluationContext
|
|
683
|
+
evaluateGenomeWithWorker(
|
|
684
|
+
worker: TestWorkerInstance,
|
|
685
|
+
genome: default,
|
|
686
|
+
growth: number,
|
|
687
|
+
): Promise<void>
|
|
697
688
|
```
|
|
698
689
|
|
|
699
|
-
|
|
690
|
+
Evaluate one genome with a worker and assign penalized score.
|
|
700
691
|
|
|
701
692
|
Parameters:
|
|
702
|
-
- `
|
|
703
|
-
- `
|
|
704
|
-
- `
|
|
705
|
-
- `sourceResolve` - - Promise resolver.
|
|
693
|
+
- `worker` - - Worker instance.
|
|
694
|
+
- `genome` - - Genome under evaluation.
|
|
695
|
+
- `growth` - - Complexity penalty scalar.
|
|
706
696
|
|
|
707
|
-
Returns:
|
|
697
|
+
Returns: Promise resolving when score assignment completes.
|
|
708
698
|
|
|
709
|
-
###
|
|
699
|
+
### finalizeWorker
|
|
710
700
|
|
|
711
701
|
```ts
|
|
712
|
-
|
|
702
|
+
finalizeWorker(
|
|
713
703
|
context: PopulationWorkerEvaluationContext,
|
|
714
|
-
):
|
|
704
|
+
): void
|
|
715
705
|
```
|
|
716
706
|
|
|
717
|
-
|
|
707
|
+
Marks one worker as completed and resolves when all workers finish.
|
|
718
708
|
|
|
719
709
|
Parameters:
|
|
720
710
|
- `context` - - Population evaluation context.
|
|
721
711
|
|
|
722
|
-
Returns:
|
|
712
|
+
Returns: Nothing.
|
|
723
713
|
|
|
724
|
-
###
|
|
714
|
+
### getCachedComplexityBase
|
|
725
715
|
|
|
726
716
|
```ts
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
717
|
+
getCachedComplexityBase(
|
|
718
|
+
genome: default,
|
|
719
|
+
structureCounts: GenomeStructureCounts,
|
|
720
|
+
): number | null
|
|
730
721
|
```
|
|
731
722
|
|
|
732
|
-
|
|
723
|
+
Retrieve cached complexity base if cached structure counts still match.
|
|
733
724
|
|
|
734
725
|
Parameters:
|
|
735
|
-
- `
|
|
726
|
+
- `genome` - - Candidate network whose cached complexity is queried.
|
|
727
|
+
- `structureCounts` - - Current structural counts.
|
|
736
728
|
|
|
737
|
-
Returns:
|
|
729
|
+
Returns: Cached complexity base or null when cache miss occurs.
|
|
738
730
|
|
|
739
|
-
###
|
|
731
|
+
### getGenomeStructureCounts
|
|
740
732
|
|
|
741
733
|
```ts
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
): WorkerTraversalContext
|
|
734
|
+
getGenomeStructureCounts(
|
|
735
|
+
genome: default,
|
|
736
|
+
): GenomeStructureCounts
|
|
746
737
|
```
|
|
747
738
|
|
|
748
|
-
|
|
739
|
+
Get structural counts used by complexity heuristic.
|
|
749
740
|
|
|
750
741
|
Parameters:
|
|
751
|
-
- `
|
|
752
|
-
- `worker` - - Worker instance.
|
|
742
|
+
- `genome` - - Candidate network whose structure is being measured.
|
|
753
743
|
|
|
754
|
-
Returns:
|
|
744
|
+
Returns: Structural counts used for complexity computation.
|
|
755
745
|
|
|
756
|
-
###
|
|
746
|
+
### hasNoWorkers
|
|
757
747
|
|
|
758
748
|
```ts
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
):
|
|
749
|
+
hasNoWorkers(
|
|
750
|
+
context: PopulationWorkerEvaluationContext,
|
|
751
|
+
): boolean
|
|
762
752
|
```
|
|
763
753
|
|
|
764
|
-
|
|
754
|
+
Checks whether there are workers available to process genomes.
|
|
765
755
|
|
|
766
756
|
Parameters:
|
|
767
|
-
- `
|
|
757
|
+
- `context` - - Population evaluation context.
|
|
768
758
|
|
|
769
|
-
Returns:
|
|
759
|
+
Returns: True when worker pool is empty.
|
|
770
760
|
|
|
771
|
-
###
|
|
761
|
+
### installWorkerTerminationHook
|
|
772
762
|
|
|
773
763
|
```ts
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
764
|
+
installWorkerTerminationHook(
|
|
765
|
+
options: Record<string, unknown>,
|
|
766
|
+
workers: TestWorkerInstance[],
|
|
767
|
+
): void
|
|
777
768
|
```
|
|
778
769
|
|
|
779
|
-
|
|
770
|
+
Register worker termination hook onto options object.
|
|
780
771
|
|
|
781
772
|
Parameters:
|
|
782
|
-
- `
|
|
773
|
+
- `options` - - Evolve options object.
|
|
774
|
+
- `workers` - - Spawned worker instances.
|
|
783
775
|
|
|
784
|
-
Returns:
|
|
776
|
+
Returns: Nothing.
|
|
785
777
|
|
|
786
|
-
###
|
|
778
|
+
### resolveCostName
|
|
787
779
|
|
|
788
780
|
```ts
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
):
|
|
781
|
+
resolveCostName(
|
|
782
|
+
cost: CostFunctionOrRef,
|
|
783
|
+
): string
|
|
792
784
|
```
|
|
793
785
|
|
|
794
|
-
|
|
786
|
+
Resolve serializable cost name for worker payload.
|
|
795
787
|
|
|
796
788
|
Parameters:
|
|
797
|
-
- `
|
|
789
|
+
- `cost` - - Cost function or cost reference.
|
|
798
790
|
|
|
799
|
-
Returns:
|
|
791
|
+
Returns: Cost name string.
|
|
800
792
|
|
|
801
793
|
### resolveEvaluation
|
|
802
794
|
|
|
@@ -813,71 +805,79 @@ Parameters:
|
|
|
813
805
|
|
|
814
806
|
Returns: Nothing.
|
|
815
807
|
|
|
816
|
-
###
|
|
808
|
+
### resolveTestWorkerConstructor
|
|
817
809
|
|
|
818
810
|
```ts
|
|
819
|
-
|
|
820
|
-
genome: default,
|
|
821
|
-
): GenomeStructureCounts
|
|
811
|
+
resolveTestWorkerConstructor(): Promise<TestWorkerConstructor | null>
|
|
822
812
|
```
|
|
823
813
|
|
|
824
|
-
|
|
814
|
+
Resolve worker constructor for current runtime environment.
|
|
815
|
+
|
|
816
|
+
Returns: Worker constructor or null when unavailable.
|
|
817
|
+
|
|
818
|
+
### runWorkerTraversalStep
|
|
819
|
+
|
|
820
|
+
```ts
|
|
821
|
+
runWorkerTraversalStep(
|
|
822
|
+
traversalContext: WorkerTraversalContext,
|
|
823
|
+
): void
|
|
824
|
+
```
|
|
825
|
+
|
|
826
|
+
Runs one asynchronous traversal step for a worker.
|
|
825
827
|
|
|
826
828
|
Parameters:
|
|
827
|
-
- `
|
|
829
|
+
- `traversalContext` - - Worker traversal context.
|
|
828
830
|
|
|
829
|
-
Returns:
|
|
831
|
+
Returns: Nothing.
|
|
830
832
|
|
|
831
|
-
###
|
|
833
|
+
### spawnTestWorkers
|
|
832
834
|
|
|
833
835
|
```ts
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
836
|
+
spawnTestWorkers(
|
|
837
|
+
workerConstructor: TestWorkerConstructor,
|
|
838
|
+
serializedSet: number[],
|
|
839
|
+
cost: CostFunctionOrRef,
|
|
840
|
+
threads: number,
|
|
841
|
+
): TestWorkerInstance[]
|
|
838
842
|
```
|
|
839
843
|
|
|
840
|
-
|
|
844
|
+
Spawn worker instances up to requested thread count.
|
|
841
845
|
|
|
842
846
|
Parameters:
|
|
843
|
-
- `
|
|
844
|
-
- `
|
|
847
|
+
- `workerConstructor` - - Worker constructor resolved for runtime.
|
|
848
|
+
- `serializedSet` - - Serialized dataset shared with workers.
|
|
849
|
+
- `cost` - - Cost function or cost reference.
|
|
850
|
+
- `threads` - - Requested worker count.
|
|
845
851
|
|
|
846
|
-
Returns:
|
|
852
|
+
Returns: Spawned worker instances.
|
|
847
853
|
|
|
848
|
-
###
|
|
854
|
+
### startWorkerTraversal
|
|
849
855
|
|
|
850
856
|
```ts
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
): number
|
|
857
|
+
startWorkerTraversal(
|
|
858
|
+
context: PopulationWorkerEvaluationContext,
|
|
859
|
+
): void
|
|
855
860
|
```
|
|
856
861
|
|
|
857
|
-
|
|
862
|
+
Starts traversal loops for all workers.
|
|
858
863
|
|
|
859
864
|
Parameters:
|
|
860
|
-
- `
|
|
861
|
-
- `structureCounts` - - Current structural counts.
|
|
865
|
+
- `context` - - Population evaluation context.
|
|
862
866
|
|
|
863
|
-
Returns:
|
|
867
|
+
Returns: Nothing.
|
|
864
868
|
|
|
865
|
-
###
|
|
869
|
+
### warnGenomeEvaluationFailure
|
|
866
870
|
|
|
867
871
|
```ts
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
structureCounts: GenomeStructureCounts,
|
|
871
|
-
complexityBase: number,
|
|
872
|
+
warnGenomeEvaluationFailure(
|
|
873
|
+
error: unknown,
|
|
872
874
|
): void
|
|
873
875
|
```
|
|
874
876
|
|
|
875
|
-
|
|
877
|
+
Emit warning when genome evaluation fails.
|
|
876
878
|
|
|
877
879
|
Parameters:
|
|
878
|
-
- `
|
|
879
|
-
- `structureCounts` - - Current structural counts.
|
|
880
|
-
- `complexityBase` - - Computed base complexity value.
|
|
880
|
+
- `error` - - Unknown evaluation error.
|
|
881
881
|
|
|
882
882
|
Returns: Nothing.
|
|
883
883
|
|
|
@@ -904,21 +904,6 @@ Parameters:
|
|
|
904
904
|
|
|
905
905
|
Returns: Nothing.
|
|
906
906
|
|
|
907
|
-
### terminateWorkersSafely
|
|
908
|
-
|
|
909
|
-
```ts
|
|
910
|
-
terminateWorkersSafely(
|
|
911
|
-
evolveOptions: EvolveOptions,
|
|
912
|
-
): void
|
|
913
|
-
```
|
|
914
|
-
|
|
915
|
-
Terminate worker resources registered in options.
|
|
916
|
-
|
|
917
|
-
Parameters:
|
|
918
|
-
- `evolveOptions` - - Evolve options object.
|
|
919
|
-
|
|
920
|
-
Returns: Nothing.
|
|
921
|
-
|
|
922
907
|
### buildEvolutionSummary
|
|
923
908
|
|
|
924
909
|
```ts
|
|
@@ -937,3 +922,18 @@ Parameters:
|
|
|
937
922
|
- `loopStartTime` - - Loop start timestamp.
|
|
938
923
|
|
|
939
924
|
Returns: Evolution summary object.
|
|
925
|
+
|
|
926
|
+
### terminateWorkersSafely
|
|
927
|
+
|
|
928
|
+
```ts
|
|
929
|
+
terminateWorkersSafely(
|
|
930
|
+
evolveOptions: EvolveOptions,
|
|
931
|
+
): void
|
|
932
|
+
```
|
|
933
|
+
|
|
934
|
+
Terminate worker resources registered in options.
|
|
935
|
+
|
|
936
|
+
Parameters:
|
|
937
|
+
- `evolveOptions` - - Evolve options object.
|
|
938
|
+
|
|
939
|
+
Returns: Nothing.
|