@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
|
@@ -49,6 +49,71 @@ flowchart TD
|
|
|
49
49
|
|
|
50
50
|
## neat/adaptive/adaptive.ts
|
|
51
51
|
|
|
52
|
+
### applyAdaptiveMutation
|
|
53
|
+
|
|
54
|
+
```ts
|
|
55
|
+
applyAdaptiveMutation(): void
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Self-adaptive per-genome mutation tuning.
|
|
59
|
+
|
|
60
|
+
This function implements several strategies to adjust each genome's
|
|
61
|
+
internal mutation rate (`g._mutRate`) and optionally its mutation
|
|
62
|
+
amount (`g._mutAmount`) over time. Strategies include:
|
|
63
|
+
- `twoTier`: push top and bottom halves in opposite directions to
|
|
64
|
+
create exploration/exploitation balance.
|
|
65
|
+
- `exploreLow`: preferentially increase mutation for lower-scoring
|
|
66
|
+
genomes to promote exploration.
|
|
67
|
+
- `anneal`: gradually reduce mutation deltas over time.
|
|
68
|
+
|
|
69
|
+
The method reads `this.options.adaptiveMutation` for configuration
|
|
70
|
+
and mutates genomes in-place.
|
|
71
|
+
|
|
72
|
+
This is the adaptive controller that feeds most directly into the root
|
|
73
|
+
mutation chapter. Rather than choosing one operator itself, it adjusts each
|
|
74
|
+
genome's readiness for later mutation so the next structural-edit pass can be
|
|
75
|
+
more exploratory or more conservative depending on recent success.
|
|
76
|
+
|
|
77
|
+
Returns: Updates per-genome mutation-rate state in place when the current generation satisfies the adaptation cadence.
|
|
78
|
+
|
|
79
|
+
Example:
|
|
80
|
+
|
|
81
|
+
// configuration example:
|
|
82
|
+
// options.adaptiveMutation = { enabled: true, initialRate: 0.5, adaptEvery: 1, strategy: 'twoTier', minRate: 0.01, maxRate: 1 }
|
|
83
|
+
engine.applyAdaptiveMutation();
|
|
84
|
+
|
|
85
|
+
### applyAncestorUniqAdaptive
|
|
86
|
+
|
|
87
|
+
```ts
|
|
88
|
+
applyAncestorUniqAdaptive(): void
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Adaptive adjustments based on ancestor uniqueness telemetry.
|
|
92
|
+
|
|
93
|
+
This helper inspects the most recent telemetry lineage block (if
|
|
94
|
+
available) for an `ancestorUniq` metric indicating how unique
|
|
95
|
+
ancestry is across the population. If ancestry uniqueness drifts
|
|
96
|
+
outside configured thresholds, the method will adjust either the
|
|
97
|
+
multi-objective dominance epsilon (if `mode === 'epsilon'`) or the
|
|
98
|
+
lineage pressure strength (if `mode === 'lineagePressure'`).
|
|
99
|
+
|
|
100
|
+
This makes the lineage controller the feedback bridge between telemetry and
|
|
101
|
+
future search policy. It does not rewrite the current population directly;
|
|
102
|
+
instead it nudges the options that govern how later multi-objective or
|
|
103
|
+
lineage-pressure decisions behave.
|
|
104
|
+
|
|
105
|
+
Typical usage: keep population lineage diversity within a healthy
|
|
106
|
+
band. Low ancestor uniqueness means too many genomes share ancestors
|
|
107
|
+
(risking premature convergence); high uniqueness might indicate
|
|
108
|
+
excessive divergence.
|
|
109
|
+
|
|
110
|
+
Returns: May update lineage-related controller options and record the most recent adjustment generation.
|
|
111
|
+
|
|
112
|
+
Example:
|
|
113
|
+
|
|
114
|
+
// Adjusts `options.multiObjective.dominanceEpsilon` when configured
|
|
115
|
+
engine.applyAncestorUniqAdaptive();
|
|
116
|
+
|
|
52
117
|
### applyComplexityBudget
|
|
53
118
|
|
|
54
119
|
```ts
|
|
@@ -91,33 +156,6 @@ Example:
|
|
|
91
156
|
engine.applyComplexityBudget();
|
|
92
157
|
// engine.options.maxNodes now holds the adjusted complexity cap
|
|
93
158
|
|
|
94
|
-
### applyPhasedComplexity
|
|
95
|
-
|
|
96
|
-
```ts
|
|
97
|
-
applyPhasedComplexity(): void
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
Toggle phased complexity mode between 'complexify' and 'simplify'.
|
|
101
|
-
|
|
102
|
-
Phased complexity supports alternating periods where the algorithm
|
|
103
|
-
is encouraged to grow (complexify) or shrink (simplify) network
|
|
104
|
-
structures. This can help escape local minima or reduce bloat.
|
|
105
|
-
|
|
106
|
-
Use this controller when one static mutation policy is not enough. Instead of
|
|
107
|
-
adjusting caps continuously like `applyComplexityBudget()`, this helper flips
|
|
108
|
-
the controller into a new structural mood and records when that phase began.
|
|
109
|
-
|
|
110
|
-
The current phase and its start generation are stored on `this` as
|
|
111
|
-
`_phase` and `_phaseStartGeneration` so the state persists across
|
|
112
|
-
generations.
|
|
113
|
-
|
|
114
|
-
Returns: Mutates `this._phase` and `this._phaseStartGeneration` so later mutation-selection code knows whether to favor growth or simplification.
|
|
115
|
-
|
|
116
|
-
Example:
|
|
117
|
-
|
|
118
|
-
// Called once per generation to update the phase state
|
|
119
|
-
engine.applyPhasedComplexity();
|
|
120
|
-
|
|
121
159
|
### applyMinimalCriterionAdaptive
|
|
122
160
|
|
|
123
161
|
```ts
|
|
@@ -152,6 +190,61 @@ Example:
|
|
|
152
190
|
// options.minimalCriterionAdaptive = { enabled: true, initialThreshold: 0.1, targetAcceptance: 0.5, adjustRate: 0.1 }
|
|
153
191
|
engine.applyMinimalCriterionAdaptive();
|
|
154
192
|
|
|
193
|
+
### applyOperatorAdaptation
|
|
194
|
+
|
|
195
|
+
```ts
|
|
196
|
+
applyOperatorAdaptation(): void
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
Decay operator adaptation statistics (success/attempt counters).
|
|
200
|
+
|
|
201
|
+
Many adaptive operator-selection schemes keep running tallies of how
|
|
202
|
+
successful each operator has been. This helper applies an exponential
|
|
203
|
+
moving-average style decay to those counters so older outcomes
|
|
204
|
+
progressively matter less.
|
|
205
|
+
|
|
206
|
+
Use this controller when operator adaptation is enabled and you want the
|
|
207
|
+
mutation selector to favor recent evidence over stale wins from much earlier
|
|
208
|
+
generations. It is a policy-maintenance helper, not an operator chooser by
|
|
209
|
+
itself.
|
|
210
|
+
|
|
211
|
+
The `_operatorStats` map on `this` is expected to contain values of
|
|
212
|
+
the shape `{ success: number, attempts: number }` keyed by operator
|
|
213
|
+
id/name.
|
|
214
|
+
|
|
215
|
+
Returns: Decays `_operatorStats` in place so later mutation-method selection reflects more recent operator performance.
|
|
216
|
+
|
|
217
|
+
Example:
|
|
218
|
+
|
|
219
|
+
engine.applyOperatorAdaptation();
|
|
220
|
+
|
|
221
|
+
### applyPhasedComplexity
|
|
222
|
+
|
|
223
|
+
```ts
|
|
224
|
+
applyPhasedComplexity(): void
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
Toggle phased complexity mode between 'complexify' and 'simplify'.
|
|
228
|
+
|
|
229
|
+
Phased complexity supports alternating periods where the algorithm
|
|
230
|
+
is encouraged to grow (complexify) or shrink (simplify) network
|
|
231
|
+
structures. This can help escape local minima or reduce bloat.
|
|
232
|
+
|
|
233
|
+
Use this controller when one static mutation policy is not enough. Instead of
|
|
234
|
+
adjusting caps continuously like `applyComplexityBudget()`, this helper flips
|
|
235
|
+
the controller into a new structural mood and records when that phase began.
|
|
236
|
+
|
|
237
|
+
The current phase and its start generation are stored on `this` as
|
|
238
|
+
`_phase` and `_phaseStartGeneration` so the state persists across
|
|
239
|
+
generations.
|
|
240
|
+
|
|
241
|
+
Returns: Mutates `this._phase` and `this._phaseStartGeneration` so later mutation-selection code knows whether to favor growth or simplification.
|
|
242
|
+
|
|
243
|
+
Example:
|
|
244
|
+
|
|
245
|
+
// Called once per generation to update the phase state
|
|
246
|
+
engine.applyPhasedComplexity();
|
|
247
|
+
|
|
155
248
|
### NeatLikeWithAdaptive
|
|
156
249
|
|
|
157
250
|
Contract map for the adaptive helper boundary.
|
|
@@ -186,96 +279,3 @@ flowchart TD
|
|
|
186
279
|
Options --> Mutation[Mutation and operator adaptation]
|
|
187
280
|
Options --> Lineage[Ancestor uniqueness and lineage pressure]
|
|
188
281
|
```
|
|
189
|
-
|
|
190
|
-
### applyAncestorUniqAdaptive
|
|
191
|
-
|
|
192
|
-
```ts
|
|
193
|
-
applyAncestorUniqAdaptive(): void
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
Adaptive adjustments based on ancestor uniqueness telemetry.
|
|
197
|
-
|
|
198
|
-
This helper inspects the most recent telemetry lineage block (if
|
|
199
|
-
available) for an `ancestorUniq` metric indicating how unique
|
|
200
|
-
ancestry is across the population. If ancestry uniqueness drifts
|
|
201
|
-
outside configured thresholds, the method will adjust either the
|
|
202
|
-
multi-objective dominance epsilon (if `mode === 'epsilon'`) or the
|
|
203
|
-
lineage pressure strength (if `mode === 'lineagePressure'`).
|
|
204
|
-
|
|
205
|
-
This makes the lineage controller the feedback bridge between telemetry and
|
|
206
|
-
future search policy. It does not rewrite the current population directly;
|
|
207
|
-
instead it nudges the options that govern how later multi-objective or
|
|
208
|
-
lineage-pressure decisions behave.
|
|
209
|
-
|
|
210
|
-
Typical usage: keep population lineage diversity within a healthy
|
|
211
|
-
band. Low ancestor uniqueness means too many genomes share ancestors
|
|
212
|
-
(risking premature convergence); high uniqueness might indicate
|
|
213
|
-
excessive divergence.
|
|
214
|
-
|
|
215
|
-
Returns: May update lineage-related controller options and record the most recent adjustment generation.
|
|
216
|
-
|
|
217
|
-
Example:
|
|
218
|
-
|
|
219
|
-
// Adjusts `options.multiObjective.dominanceEpsilon` when configured
|
|
220
|
-
engine.applyAncestorUniqAdaptive();
|
|
221
|
-
|
|
222
|
-
### applyAdaptiveMutation
|
|
223
|
-
|
|
224
|
-
```ts
|
|
225
|
-
applyAdaptiveMutation(): void
|
|
226
|
-
```
|
|
227
|
-
|
|
228
|
-
Self-adaptive per-genome mutation tuning.
|
|
229
|
-
|
|
230
|
-
This function implements several strategies to adjust each genome's
|
|
231
|
-
internal mutation rate (`g._mutRate`) and optionally its mutation
|
|
232
|
-
amount (`g._mutAmount`) over time. Strategies include:
|
|
233
|
-
- `twoTier`: push top and bottom halves in opposite directions to
|
|
234
|
-
create exploration/exploitation balance.
|
|
235
|
-
- `exploreLow`: preferentially increase mutation for lower-scoring
|
|
236
|
-
genomes to promote exploration.
|
|
237
|
-
- `anneal`: gradually reduce mutation deltas over time.
|
|
238
|
-
|
|
239
|
-
The method reads `this.options.adaptiveMutation` for configuration
|
|
240
|
-
and mutates genomes in-place.
|
|
241
|
-
|
|
242
|
-
This is the adaptive controller that feeds most directly into the root
|
|
243
|
-
mutation chapter. Rather than choosing one operator itself, it adjusts each
|
|
244
|
-
genome's readiness for later mutation so the next structural-edit pass can be
|
|
245
|
-
more exploratory or more conservative depending on recent success.
|
|
246
|
-
|
|
247
|
-
Returns: Updates per-genome mutation-rate state in place when the current generation satisfies the adaptation cadence.
|
|
248
|
-
|
|
249
|
-
Example:
|
|
250
|
-
|
|
251
|
-
// configuration example:
|
|
252
|
-
// options.adaptiveMutation = { enabled: true, initialRate: 0.5, adaptEvery: 1, strategy: 'twoTier', minRate: 0.01, maxRate: 1 }
|
|
253
|
-
engine.applyAdaptiveMutation();
|
|
254
|
-
|
|
255
|
-
### applyOperatorAdaptation
|
|
256
|
-
|
|
257
|
-
```ts
|
|
258
|
-
applyOperatorAdaptation(): void
|
|
259
|
-
```
|
|
260
|
-
|
|
261
|
-
Decay operator adaptation statistics (success/attempt counters).
|
|
262
|
-
|
|
263
|
-
Many adaptive operator-selection schemes keep running tallies of how
|
|
264
|
-
successful each operator has been. This helper applies an exponential
|
|
265
|
-
moving-average style decay to those counters so older outcomes
|
|
266
|
-
progressively matter less.
|
|
267
|
-
|
|
268
|
-
Use this controller when operator adaptation is enabled and you want the
|
|
269
|
-
mutation selector to favor recent evidence over stale wins from much earlier
|
|
270
|
-
generations. It is a policy-maintenance helper, not an operator chooser by
|
|
271
|
-
itself.
|
|
272
|
-
|
|
273
|
-
The `_operatorStats` map on `this` is expected to contain values of
|
|
274
|
-
the shape `{ success: number, attempts: number }` keyed by operator
|
|
275
|
-
id/name.
|
|
276
|
-
|
|
277
|
-
Returns: Decays `_operatorStats` in place so later mutation-method selection reflects more recent operator performance.
|
|
278
|
-
|
|
279
|
-
Example:
|
|
280
|
-
|
|
281
|
-
engine.applyOperatorAdaptation();
|
|
@@ -224,25 +224,34 @@ The helper flow is intentionally compact:
|
|
|
224
224
|
3. measure how much of the population clears the bar,
|
|
225
225
|
4. retune the threshold and reject genomes that still miss it.
|
|
226
226
|
|
|
227
|
-
###
|
|
227
|
+
### applyRejection
|
|
228
228
|
|
|
229
229
|
```ts
|
|
230
|
-
|
|
230
|
+
applyRejection(
|
|
231
231
|
engine: NeatLikeWithAdaptive,
|
|
232
|
-
|
|
232
|
+
threshold: number,
|
|
233
233
|
): void
|
|
234
234
|
```
|
|
235
235
|
|
|
236
|
-
|
|
236
|
+
Zero scores below the final threshold.
|
|
237
237
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
238
|
+
Rejection is the acceptance chapter's most direct intervention. Instead of
|
|
239
|
+
queuing a future policy change, it rewrites the current generation's scores so
|
|
240
|
+
the same selection pass immediately treats low-performing genomes as filtered
|
|
241
|
+
out.
|
|
242
|
+
|
|
243
|
+
Example:
|
|
244
|
+
|
|
245
|
+
```ts
|
|
246
|
+
const scores = collectScores(engine);
|
|
247
|
+
const acceptance = computeAcceptance(scores, engine._mcThreshold ?? 0);
|
|
248
|
+
updateThreshold(engine, acceptance, resolveTargetSettings(config));
|
|
249
|
+
applyRejection(engine, engine._mcThreshold ?? 0);
|
|
250
|
+
```
|
|
242
251
|
|
|
243
252
|
Parameters:
|
|
244
253
|
- `engine` - - NEAT engine instance.
|
|
245
|
-
- `
|
|
254
|
+
- `threshold` - - Final MC threshold.
|
|
246
255
|
|
|
247
256
|
Returns: Nothing.
|
|
248
257
|
|
|
@@ -288,6 +297,28 @@ Parameters:
|
|
|
288
297
|
|
|
289
298
|
Returns: Acceptance proportion.
|
|
290
299
|
|
|
300
|
+
### initializeThreshold
|
|
301
|
+
|
|
302
|
+
```ts
|
|
303
|
+
initializeThreshold(
|
|
304
|
+
engine: NeatLikeWithAdaptive,
|
|
305
|
+
config: { enabled?: boolean | undefined; initialThreshold?: number | undefined; targetAcceptance?: number | undefined; adjustRate?: number | undefined; },
|
|
306
|
+
): void
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
Initialize MC threshold if missing.
|
|
310
|
+
|
|
311
|
+
Threshold initialization is lazy because many runs never enable adaptive
|
|
312
|
+
acceptance at all. The first invocation seeds the long-lived threshold, and
|
|
313
|
+
later generations reuse the updated value rather than restarting from the
|
|
314
|
+
original configuration each time.
|
|
315
|
+
|
|
316
|
+
Parameters:
|
|
317
|
+
- `engine` - - NEAT engine instance.
|
|
318
|
+
- `config` - - Minimal-criterion adaptive configuration.
|
|
319
|
+
|
|
320
|
+
Returns: Nothing.
|
|
321
|
+
|
|
291
322
|
### resolveTargetSettings
|
|
292
323
|
|
|
293
324
|
```ts
|
|
@@ -328,34 +359,3 @@ Parameters:
|
|
|
328
359
|
- `tuning` - - Target acceptance and adjustment settings.
|
|
329
360
|
|
|
330
361
|
Returns: Nothing.
|
|
331
|
-
|
|
332
|
-
### applyRejection
|
|
333
|
-
|
|
334
|
-
```ts
|
|
335
|
-
applyRejection(
|
|
336
|
-
engine: NeatLikeWithAdaptive,
|
|
337
|
-
threshold: number,
|
|
338
|
-
): void
|
|
339
|
-
```
|
|
340
|
-
|
|
341
|
-
Zero scores below the final threshold.
|
|
342
|
-
|
|
343
|
-
Rejection is the acceptance chapter's most direct intervention. Instead of
|
|
344
|
-
queuing a future policy change, it rewrites the current generation's scores so
|
|
345
|
-
the same selection pass immediately treats low-performing genomes as filtered
|
|
346
|
-
out.
|
|
347
|
-
|
|
348
|
-
Example:
|
|
349
|
-
|
|
350
|
-
```ts
|
|
351
|
-
const scores = collectScores(engine);
|
|
352
|
-
const acceptance = computeAcceptance(scores, engine._mcThreshold ?? 0);
|
|
353
|
-
updateThreshold(engine, acceptance, resolveTargetSettings(config));
|
|
354
|
-
applyRejection(engine, engine._mcThreshold ?? 0);
|
|
355
|
-
```
|
|
356
|
-
|
|
357
|
-
Parameters:
|
|
358
|
-
- `engine` - - NEAT engine instance.
|
|
359
|
-
- `threshold` - - Final MC threshold.
|
|
360
|
-
|
|
361
|
-
Returns: Nothing.
|