@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
|
@@ -100,6 +100,30 @@ Parameters:
|
|
|
100
100
|
|
|
101
101
|
Returns: Mutation outcome flags.
|
|
102
102
|
|
|
103
|
+
### applyOperatorDecay
|
|
104
|
+
|
|
105
|
+
```ts
|
|
106
|
+
applyOperatorDecay(
|
|
107
|
+
stats: Map<string, { success: number; attempts: number; }>,
|
|
108
|
+
entries: [string, { success: number; attempts: number; }][],
|
|
109
|
+
decay: number,
|
|
110
|
+
): void
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Apply exponential decay to each operator statistic entry.
|
|
114
|
+
|
|
115
|
+
Operator decay is the controller-level counterpart to per-genome mutation
|
|
116
|
+
tuning. Rather than rewriting genomes directly, it softens stale wins and
|
|
117
|
+
attempts so later operator selection can weight recent performance more
|
|
118
|
+
heavily.
|
|
119
|
+
|
|
120
|
+
Parameters:
|
|
121
|
+
- `stats` - - Operator statistics map.
|
|
122
|
+
- `entries` - - Operator stat entries to update.
|
|
123
|
+
- `decay` - - Decay factor.
|
|
124
|
+
|
|
125
|
+
Returns: Nothing.
|
|
126
|
+
|
|
103
127
|
### applyTwoTierFallback
|
|
104
128
|
|
|
105
129
|
```ts
|
|
@@ -144,6 +168,24 @@ Parameters:
|
|
|
144
168
|
|
|
145
169
|
Returns: Resolved mutation settings.
|
|
146
170
|
|
|
171
|
+
### resolveOperatorDecay
|
|
172
|
+
|
|
173
|
+
```ts
|
|
174
|
+
resolveOperatorDecay(
|
|
175
|
+
config: { enabled?: boolean | undefined; learningRate?: number | undefined; alpha?: number | undefined; decay?: number | undefined; },
|
|
176
|
+
): number
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
Resolve the decay factor for operator statistics.
|
|
180
|
+
|
|
181
|
+
Centralizing the default decay factor keeps the caller focused on the update
|
|
182
|
+
cycle instead of repeatedly restating configuration fallback rules.
|
|
183
|
+
|
|
184
|
+
Parameters:
|
|
185
|
+
- `config` - - Operator adaptation configuration.
|
|
186
|
+
|
|
187
|
+
Returns: Decay factor for exponential smoothing.
|
|
188
|
+
|
|
147
189
|
### shouldAdaptThisGeneration
|
|
148
190
|
|
|
149
191
|
```ts
|
|
@@ -186,48 +228,6 @@ Parameters:
|
|
|
186
228
|
|
|
187
229
|
Returns: True if fallback should run.
|
|
188
230
|
|
|
189
|
-
### applyOperatorDecay
|
|
190
|
-
|
|
191
|
-
```ts
|
|
192
|
-
applyOperatorDecay(
|
|
193
|
-
stats: Map<string, { success: number; attempts: number; }>,
|
|
194
|
-
entries: [string, { success: number; attempts: number; }][],
|
|
195
|
-
decay: number,
|
|
196
|
-
): void
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
Apply exponential decay to each operator statistic entry.
|
|
200
|
-
|
|
201
|
-
Operator decay is the controller-level counterpart to per-genome mutation
|
|
202
|
-
tuning. Rather than rewriting genomes directly, it softens stale wins and
|
|
203
|
-
attempts so later operator selection can weight recent performance more
|
|
204
|
-
heavily.
|
|
205
|
-
|
|
206
|
-
Parameters:
|
|
207
|
-
- `stats` - - Operator statistics map.
|
|
208
|
-
- `entries` - - Operator stat entries to update.
|
|
209
|
-
- `decay` - - Decay factor.
|
|
210
|
-
|
|
211
|
-
Returns: Nothing.
|
|
212
|
-
|
|
213
|
-
### resolveOperatorDecay
|
|
214
|
-
|
|
215
|
-
```ts
|
|
216
|
-
resolveOperatorDecay(
|
|
217
|
-
config: { enabled?: boolean | undefined; learningRate?: number | undefined; alpha?: number | undefined; decay?: number | undefined; },
|
|
218
|
-
): number
|
|
219
|
-
```
|
|
220
|
-
|
|
221
|
-
Resolve the decay factor for operator statistics.
|
|
222
|
-
|
|
223
|
-
Centralizing the default decay factor keeps the caller focused on the update
|
|
224
|
-
cycle instead of repeatedly restating configuration fallback rules.
|
|
225
|
-
|
|
226
|
-
Parameters:
|
|
227
|
-
- `config` - - Operator adaptation configuration.
|
|
228
|
-
|
|
229
|
-
Returns: Decay factor for exponential smoothing.
|
|
230
|
-
|
|
231
231
|
## neat/adaptive/mutation/adaptive.mutation.utils.ts
|
|
232
232
|
|
|
233
233
|
Per-genome adaptive mutation helpers.
|
|
@@ -245,123 +245,77 @@ The helper flow is intentionally compact:
|
|
|
245
245
|
3. resolve strategy-specific deltas,
|
|
246
246
|
4. clamp the updated mutation fields and apply fallback balancing if needed.
|
|
247
247
|
|
|
248
|
-
###
|
|
249
|
-
|
|
250
|
-
```ts
|
|
251
|
-
shouldAdaptThisGeneration(
|
|
252
|
-
generation: number,
|
|
253
|
-
config: { enabled?: boolean | undefined; learningRate?: number | undefined; min?: number | undefined; max?: number | undefined; adaptEvery?: number | undefined; sigma?: number | undefined; minRate?: number | undefined; maxRate?: number | undefined; strategy?: string | undefined; adaptAmount?: boolean | undefined; minAmount?: number | undefined; maxAmount?: number | undefined; initialRate?: number | undefined; amountSigma?: number | undefined; },
|
|
254
|
-
): boolean
|
|
255
|
-
```
|
|
256
|
-
|
|
257
|
-
Check whether mutation adaptation should run this generation.
|
|
258
|
-
|
|
259
|
-
Cadence checks keep adaptive mutation from rewriting per-genome pressure on
|
|
260
|
-
every generation unless the configuration explicitly asks for that. This lets
|
|
261
|
-
runs choose between fast reaction and slower, more stable adjustment cycles.
|
|
262
|
-
|
|
263
|
-
Parameters:
|
|
264
|
-
- `generation` - - Current generation index.
|
|
265
|
-
- `config` - - Adaptive mutation configuration.
|
|
266
|
-
|
|
267
|
-
Returns: True if adaptation should run.
|
|
268
|
-
|
|
269
|
-
### collectScoredGenomes
|
|
270
|
-
|
|
271
|
-
```ts
|
|
272
|
-
collectScoredGenomes(
|
|
273
|
-
population: { [key: string]: unknown; score?: number | undefined; _mutRate?: number | null | undefined; _mutAmount?: number | null | undefined; }[],
|
|
274
|
-
): { [key: string]: unknown; score?: number | undefined; _mutRate?: number | null | undefined; _mutAmount?: number | null | undefined; }[]
|
|
275
|
-
```
|
|
276
|
-
|
|
277
|
-
Collect genomes with numeric scores.
|
|
278
|
-
|
|
279
|
-
The adaptive mutation loop only partitions genomes that have meaningful score
|
|
280
|
-
evidence. Unevaluated genomes stay out of the ranking split so the strategy
|
|
281
|
-
logic only reacts to genomes the run has actually judged.
|
|
282
|
-
|
|
283
|
-
Parameters:
|
|
284
|
-
- `population` - - Population of genomes.
|
|
285
|
-
|
|
286
|
-
Returns: Scored genomes.
|
|
287
|
-
|
|
288
|
-
### sortScoredGenomes
|
|
289
|
-
|
|
290
|
-
```ts
|
|
291
|
-
sortScoredGenomes(
|
|
292
|
-
scoredGenomes: { [key: string]: unknown; score?: number | undefined; _mutRate?: number | null | undefined; _mutAmount?: number | null | undefined; }[],
|
|
293
|
-
): { [key: string]: unknown; score?: number | undefined; _mutRate?: number | null | undefined; _mutAmount?: number | null | undefined; }[]
|
|
294
|
-
```
|
|
295
|
-
|
|
296
|
-
Sort scored genomes in ascending score order.
|
|
297
|
-
|
|
298
|
-
Sorting creates the stable ordering used by the two-tier and explore-low
|
|
299
|
-
strategies. Lower-scoring genomes end up at the front, which makes the later
|
|
300
|
-
top-half and bottom-half split read naturally.
|
|
301
|
-
|
|
302
|
-
Parameters:
|
|
303
|
-
- `scoredGenomes` - - Scored genomes.
|
|
304
|
-
|
|
305
|
-
Returns: Sorted genomes.
|
|
306
|
-
|
|
307
|
-
### splitScoredGenomes
|
|
248
|
+
### applyAnnealDelta
|
|
308
249
|
|
|
309
250
|
```ts
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
251
|
+
applyAnnealDelta(
|
|
252
|
+
baseDelta: number,
|
|
253
|
+
settings: MutationSettings,
|
|
254
|
+
): number
|
|
313
255
|
```
|
|
314
256
|
|
|
315
|
-
|
|
257
|
+
Apply annealing adjustments to a delta.
|
|
316
258
|
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
bottom half or the conservative top half without re-deriving the split.
|
|
259
|
+
Annealing gradually shrinks the effective delta as the run ages, making early
|
|
260
|
+
mutation-pressure updates more aggressive and later ones more conservative.
|
|
320
261
|
|
|
321
262
|
Parameters:
|
|
322
|
-
- `
|
|
263
|
+
- `baseDelta` - - Base random delta.
|
|
264
|
+
- `settings` - - Resolved settings.
|
|
323
265
|
|
|
324
|
-
Returns:
|
|
266
|
+
Returns: Adjusted delta.
|
|
325
267
|
|
|
326
|
-
###
|
|
268
|
+
### applyExploreLowDelta
|
|
327
269
|
|
|
328
270
|
```ts
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
271
|
+
applyExploreLowDelta(
|
|
272
|
+
baseDelta: number,
|
|
273
|
+
genome: { [key: string]: unknown; score?: number | undefined; _mutRate?: number | null | undefined; _mutAmount?: number | null | undefined; },
|
|
274
|
+
bottomHalfSet: Set<{ [key: string]: unknown; score?: number | undefined; _mutRate?: number | null | undefined; _mutAmount?: number | null | undefined; }>,
|
|
275
|
+
): number
|
|
333
276
|
```
|
|
334
277
|
|
|
335
|
-
|
|
278
|
+
Apply explore-low adjustments to a delta.
|
|
336
279
|
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
fallback bookkeeping.
|
|
280
|
+
Explore-low treats weaker genomes as exploration candidates. Bottom-half
|
|
281
|
+
genomes receive larger positive pressure, while the rest are gently pushed
|
|
282
|
+
downward so the search budget does not inflate everywhere at once.
|
|
341
283
|
|
|
342
284
|
Parameters:
|
|
343
|
-
- `
|
|
344
|
-
- `
|
|
285
|
+
- `baseDelta` - - Base random delta.
|
|
286
|
+
- `genome` - - Current genome.
|
|
287
|
+
- `bottomHalfSet` - - Lookup for bottom-half genomes.
|
|
345
288
|
|
|
346
|
-
Returns:
|
|
289
|
+
Returns: Adjusted delta.
|
|
347
290
|
|
|
348
|
-
###
|
|
291
|
+
### applyMutationAmount
|
|
349
292
|
|
|
350
293
|
```ts
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
294
|
+
applyMutationAmount(
|
|
295
|
+
genome: { [key: string]: unknown; score?: number | undefined; _mutRate?: number | null | undefined; _mutAmount?: number | null | undefined; },
|
|
296
|
+
settings: MutationSettings,
|
|
297
|
+
randomSource: () => number,
|
|
298
|
+
genomeIndex: number,
|
|
299
|
+
topHalfSet: Set<{ [key: string]: unknown; score?: number | undefined; _mutRate?: number | null | undefined; _mutAmount?: number | null | undefined; }>,
|
|
300
|
+
bottomHalfSet: Set<{ [key: string]: unknown; score?: number | undefined; _mutRate?: number | null | undefined; _mutAmount?: number | null | undefined; }>,
|
|
301
|
+
): void
|
|
354
302
|
```
|
|
355
303
|
|
|
356
|
-
|
|
304
|
+
Apply mutation-amount adjustments to a genome.
|
|
357
305
|
|
|
358
|
-
|
|
359
|
-
|
|
306
|
+
Rate and amount adaptation share the same high-level strategy vocabulary, but
|
|
307
|
+
amount updates remain optional because some runs only want to tune how often
|
|
308
|
+
mutation fires, not how large each mutation should be.
|
|
360
309
|
|
|
361
310
|
Parameters:
|
|
362
|
-
- `
|
|
311
|
+
- `genome` - - Current genome.
|
|
312
|
+
- `settings` - - Resolved settings.
|
|
313
|
+
- `randomSource` - - Random number provider.
|
|
314
|
+
- `genomeIndex` - - Genome index.
|
|
315
|
+
- `topHalfSet` - - Lookup for top-half genomes.
|
|
316
|
+
- `bottomHalfSet` - - Lookup for bottom-half genomes.
|
|
363
317
|
|
|
364
|
-
Returns:
|
|
318
|
+
Returns: Nothing.
|
|
365
319
|
|
|
366
320
|
### applyMutationsToPopulation
|
|
367
321
|
|
|
@@ -390,12 +344,11 @@ Parameters:
|
|
|
390
344
|
|
|
391
345
|
Returns: Mutation outcome flags.
|
|
392
346
|
|
|
393
|
-
###
|
|
347
|
+
### applyTwoTierAmountDelta
|
|
394
348
|
|
|
395
349
|
```ts
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
randomSource: () => number,
|
|
350
|
+
applyTwoTierAmountDelta(
|
|
351
|
+
baseDelta: number,
|
|
399
352
|
genome: { [key: string]: unknown; score?: number | undefined; _mutRate?: number | null | undefined; _mutAmount?: number | null | undefined; },
|
|
400
353
|
genomeIndex: number,
|
|
401
354
|
topHalfSet: Set<{ [key: string]: unknown; score?: number | undefined; _mutRate?: number | null | undefined; _mutAmount?: number | null | undefined; }>,
|
|
@@ -403,56 +356,34 @@ resolveRateDelta(
|
|
|
403
356
|
): number
|
|
404
357
|
```
|
|
405
358
|
|
|
406
|
-
|
|
359
|
+
Apply two-tier adjustments to amount delta.
|
|
407
360
|
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
annealing toward smaller adjustments over time.
|
|
361
|
+
Amount deltas mirror the high-level two-tier idea from rate adaptation: give
|
|
362
|
+
weaker genomes more room to roam and keep stronger genomes from drifting too
|
|
363
|
+
far in one step.
|
|
412
364
|
|
|
413
365
|
Parameters:
|
|
414
|
-
- `
|
|
415
|
-
- `randomSource` - - Random number provider.
|
|
366
|
+
- `baseDelta` - - Base random delta.
|
|
416
367
|
- `genome` - - Current genome.
|
|
417
368
|
- `genomeIndex` - - Genome index.
|
|
418
369
|
- `topHalfSet` - - Lookup for top-half genomes.
|
|
419
370
|
- `bottomHalfSet` - - Lookup for bottom-half genomes.
|
|
420
371
|
|
|
421
|
-
Returns:
|
|
372
|
+
Returns: Adjusted delta.
|
|
422
373
|
|
|
423
|
-
###
|
|
374
|
+
### applyTwoTierDelta
|
|
424
375
|
|
|
425
376
|
```ts
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
377
|
+
applyTwoTierDelta(
|
|
378
|
+
baseDelta: number,
|
|
379
|
+
genome: { [key: string]: unknown; score?: number | undefined; _mutRate?: number | null | undefined; _mutAmount?: number | null | undefined; },
|
|
380
|
+
genomeIndex: number,
|
|
381
|
+
topHalfSet: Set<{ [key: string]: unknown; score?: number | undefined; _mutRate?: number | null | undefined; _mutAmount?: number | null | undefined; }>,
|
|
382
|
+
bottomHalfSet: Set<{ [key: string]: unknown; score?: number | undefined; _mutRate?: number | null | undefined; _mutAmount?: number | null | undefined; }>,
|
|
429
383
|
): number
|
|
430
384
|
```
|
|
431
385
|
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
This is the small stochastic core shared by rate and amount adaptation.
|
|
435
|
-
Later strategy helpers decide how to reinterpret the sign and magnitude.
|
|
436
|
-
|
|
437
|
-
Parameters:
|
|
438
|
-
- `sigmaBase` - - Sigma scaling factor.
|
|
439
|
-
- `randomSource` - - Random number provider.
|
|
440
|
-
|
|
441
|
-
Returns: Signed delta.
|
|
442
|
-
|
|
443
|
-
### applyTwoTierDelta
|
|
444
|
-
|
|
445
|
-
```ts
|
|
446
|
-
applyTwoTierDelta(
|
|
447
|
-
baseDelta: number,
|
|
448
|
-
genome: { [key: string]: unknown; score?: number | undefined; _mutRate?: number | null | undefined; _mutAmount?: number | null | undefined; },
|
|
449
|
-
genomeIndex: number,
|
|
450
|
-
topHalfSet: Set<{ [key: string]: unknown; score?: number | undefined; _mutRate?: number | null | undefined; _mutAmount?: number | null | undefined; }>,
|
|
451
|
-
bottomHalfSet: Set<{ [key: string]: unknown; score?: number | undefined; _mutRate?: number | null | undefined; _mutAmount?: number | null | undefined; }>,
|
|
452
|
-
): number
|
|
453
|
-
```
|
|
454
|
-
|
|
455
|
-
Apply two-tier adjustments to a delta.
|
|
386
|
+
Apply two-tier adjustments to a delta.
|
|
456
387
|
|
|
457
388
|
Two-tier mode deliberately pushes the two halves in opposite directions so
|
|
458
389
|
one side becomes more exploratory while the other becomes more conservative.
|
|
@@ -468,77 +399,89 @@ Parameters:
|
|
|
468
399
|
|
|
469
400
|
Returns: Adjusted delta.
|
|
470
401
|
|
|
471
|
-
###
|
|
402
|
+
### applyTwoTierFallback
|
|
472
403
|
|
|
473
404
|
```ts
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
): number
|
|
405
|
+
applyTwoTierFallback(
|
|
406
|
+
population: { [key: string]: unknown; score?: number | undefined; _mutRate?: number | null | undefined; _mutAmount?: number | null | undefined; }[],
|
|
407
|
+
settings: MutationSettings,
|
|
408
|
+
): void
|
|
479
409
|
```
|
|
480
410
|
|
|
481
|
-
Apply
|
|
411
|
+
Apply two-tier fallback balancing.
|
|
482
412
|
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
413
|
+
Fallback balancing restores the intended contrast when the stochastic pass
|
|
414
|
+
fails to produce both exploratory and conservative outcomes. It is narrower
|
|
415
|
+
than the main update loop because it only nudges rates, leaving the richer
|
|
416
|
+
strategy-specific reasoning to the first pass.
|
|
486
417
|
|
|
487
418
|
Parameters:
|
|
488
|
-
- `
|
|
489
|
-
- `
|
|
490
|
-
- `bottomHalfSet` - - Lookup for bottom-half genomes.
|
|
419
|
+
- `population` - - Population of genomes.
|
|
420
|
+
- `settings` - - Resolved settings.
|
|
491
421
|
|
|
492
|
-
Returns:
|
|
422
|
+
Returns: Nothing.
|
|
493
423
|
|
|
494
|
-
###
|
|
424
|
+
### clampValue
|
|
495
425
|
|
|
496
426
|
```ts
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
427
|
+
clampValue(
|
|
428
|
+
value: number,
|
|
429
|
+
min: number,
|
|
430
|
+
max: number,
|
|
500
431
|
): number
|
|
501
432
|
```
|
|
502
433
|
|
|
503
|
-
|
|
434
|
+
Clamp a value between min and max bounds.
|
|
504
435
|
|
|
505
|
-
|
|
506
|
-
|
|
436
|
+
Clamping is the final safety guard that keeps adaptive mutation inside the
|
|
437
|
+
configured rate and amount envelopes even when repeated random pressure would
|
|
438
|
+
otherwise drift beyond them.
|
|
507
439
|
|
|
508
440
|
Parameters:
|
|
509
|
-
- `
|
|
510
|
-
- `
|
|
441
|
+
- `value` - - Value to clamp.
|
|
442
|
+
- `min` - - Minimum bound.
|
|
443
|
+
- `max` - - Maximum bound.
|
|
511
444
|
|
|
512
|
-
Returns:
|
|
445
|
+
Returns: Clamped value.
|
|
513
446
|
|
|
514
|
-
###
|
|
447
|
+
### collectScoredGenomes
|
|
515
448
|
|
|
516
449
|
```ts
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
450
|
+
collectScoredGenomes(
|
|
451
|
+
population: { [key: string]: unknown; score?: number | undefined; _mutRate?: number | null | undefined; _mutAmount?: number | null | undefined; }[],
|
|
452
|
+
): { [key: string]: unknown; score?: number | undefined; _mutRate?: number | null | undefined; _mutAmount?: number | null | undefined; }[]
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
Collect genomes with numeric scores.
|
|
456
|
+
|
|
457
|
+
The adaptive mutation loop only partitions genomes that have meaningful score
|
|
458
|
+
evidence. Unevaluated genomes stay out of the ranking split so the strategy
|
|
459
|
+
logic only reacts to genomes the run has actually judged.
|
|
460
|
+
|
|
461
|
+
Parameters:
|
|
462
|
+
- `population` - - Population of genomes.
|
|
463
|
+
|
|
464
|
+
Returns: Scored genomes.
|
|
465
|
+
|
|
466
|
+
### createRandomDelta
|
|
467
|
+
|
|
468
|
+
```ts
|
|
469
|
+
createRandomDelta(
|
|
470
|
+
sigmaBase: number,
|
|
520
471
|
randomSource: () => number,
|
|
521
|
-
|
|
522
|
-
topHalfSet: Set<{ [key: string]: unknown; score?: number | undefined; _mutRate?: number | null | undefined; _mutAmount?: number | null | undefined; }>,
|
|
523
|
-
bottomHalfSet: Set<{ [key: string]: unknown; score?: number | undefined; _mutRate?: number | null | undefined; _mutAmount?: number | null | undefined; }>,
|
|
524
|
-
): void
|
|
472
|
+
): number
|
|
525
473
|
```
|
|
526
474
|
|
|
527
|
-
|
|
475
|
+
Create a signed random delta scaled by sigma.
|
|
528
476
|
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
mutation fires, not how large each mutation should be.
|
|
477
|
+
This is the small stochastic core shared by rate and amount adaptation.
|
|
478
|
+
Later strategy helpers decide how to reinterpret the sign and magnitude.
|
|
532
479
|
|
|
533
480
|
Parameters:
|
|
534
|
-
- `
|
|
535
|
-
- `settings` - - Resolved settings.
|
|
481
|
+
- `sigmaBase` - - Sigma scaling factor.
|
|
536
482
|
- `randomSource` - - Random number provider.
|
|
537
|
-
- `genomeIndex` - - Genome index.
|
|
538
|
-
- `topHalfSet` - - Lookup for top-half genomes.
|
|
539
|
-
- `bottomHalfSet` - - Lookup for bottom-half genomes.
|
|
540
483
|
|
|
541
|
-
Returns:
|
|
484
|
+
Returns: Signed delta.
|
|
542
485
|
|
|
543
486
|
### resolveAmountDelta
|
|
544
487
|
|
|
@@ -569,11 +512,52 @@ Parameters:
|
|
|
569
512
|
|
|
570
513
|
Returns: Signed mutation amount delta.
|
|
571
514
|
|
|
572
|
-
###
|
|
515
|
+
### resolveMutationSettings
|
|
573
516
|
|
|
574
517
|
```ts
|
|
575
|
-
|
|
576
|
-
|
|
518
|
+
resolveMutationSettings(
|
|
519
|
+
engine: NeatLikeWithAdaptive,
|
|
520
|
+
config: { enabled?: boolean | undefined; learningRate?: number | undefined; min?: number | undefined; max?: number | undefined; adaptEvery?: number | undefined; sigma?: number | undefined; minRate?: number | undefined; maxRate?: number | undefined; strategy?: string | undefined; adaptAmount?: boolean | undefined; minAmount?: number | undefined; maxAmount?: number | undefined; initialRate?: number | undefined; amountSigma?: number | undefined; },
|
|
521
|
+
): MutationSettings
|
|
522
|
+
```
|
|
523
|
+
|
|
524
|
+
Resolve mutation settings derived from configuration and engine state.
|
|
525
|
+
|
|
526
|
+
This is the normalization boundary for adaptive mutation. It gathers all
|
|
527
|
+
defaults, runtime counters, and mutation-amount settings into one typed
|
|
528
|
+
object so later helpers can stay focused on strategy logic instead of config
|
|
529
|
+
fallback bookkeeping.
|
|
530
|
+
|
|
531
|
+
Parameters:
|
|
532
|
+
- `engine` - - NEAT engine instance.
|
|
533
|
+
- `config` - - Adaptive mutation configuration.
|
|
534
|
+
|
|
535
|
+
Returns: Resolved mutation settings.
|
|
536
|
+
|
|
537
|
+
### resolveRandomSource
|
|
538
|
+
|
|
539
|
+
```ts
|
|
540
|
+
resolveRandomSource(
|
|
541
|
+
engine: NeatLikeWithAdaptive,
|
|
542
|
+
): () => number
|
|
543
|
+
```
|
|
544
|
+
|
|
545
|
+
Resolve a random source that matches the legacy RNG usage.
|
|
546
|
+
|
|
547
|
+
Adaptive mutation uses the same RNG access pattern as the older runtime so
|
|
548
|
+
the pressure updates remain comparable with existing runs and tests.
|
|
549
|
+
|
|
550
|
+
Parameters:
|
|
551
|
+
- `engine` - - NEAT engine instance.
|
|
552
|
+
|
|
553
|
+
Returns: Random number provider.
|
|
554
|
+
|
|
555
|
+
### resolveRateDelta
|
|
556
|
+
|
|
557
|
+
```ts
|
|
558
|
+
resolveRateDelta(
|
|
559
|
+
settings: MutationSettings,
|
|
560
|
+
randomSource: () => number,
|
|
577
561
|
genome: { [key: string]: unknown; score?: number | undefined; _mutRate?: number | null | undefined; _mutAmount?: number | null | undefined; },
|
|
578
562
|
genomeIndex: number,
|
|
579
563
|
topHalfSet: Set<{ [key: string]: unknown; score?: number | undefined; _mutRate?: number | null | undefined; _mutAmount?: number | null | undefined; }>,
|
|
@@ -581,43 +565,43 @@ applyTwoTierAmountDelta(
|
|
|
581
565
|
): number
|
|
582
566
|
```
|
|
583
567
|
|
|
584
|
-
|
|
568
|
+
Resolve mutation-rate delta based on strategy.
|
|
585
569
|
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
570
|
+
Strategy dispatch keeps the public mutation flow readable. Each strategy gets
|
|
571
|
+
the same base random delta, then reshapes it according to its own policy for
|
|
572
|
+
favoring exploration, rewarding stronger genomes with lower pressure, or
|
|
573
|
+
annealing toward smaller adjustments over time.
|
|
589
574
|
|
|
590
575
|
Parameters:
|
|
591
|
-
- `
|
|
576
|
+
- `settings` - - Resolved settings.
|
|
577
|
+
- `randomSource` - - Random number provider.
|
|
592
578
|
- `genome` - - Current genome.
|
|
593
579
|
- `genomeIndex` - - Genome index.
|
|
594
580
|
- `topHalfSet` - - Lookup for top-half genomes.
|
|
595
581
|
- `bottomHalfSet` - - Lookup for bottom-half genomes.
|
|
596
582
|
|
|
597
|
-
Returns:
|
|
583
|
+
Returns: Signed mutation rate delta.
|
|
598
584
|
|
|
599
|
-
###
|
|
585
|
+
### shouldAdaptThisGeneration
|
|
600
586
|
|
|
601
587
|
```ts
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
): number
|
|
588
|
+
shouldAdaptThisGeneration(
|
|
589
|
+
generation: number,
|
|
590
|
+
config: { enabled?: boolean | undefined; learningRate?: number | undefined; min?: number | undefined; max?: number | undefined; adaptEvery?: number | undefined; sigma?: number | undefined; minRate?: number | undefined; maxRate?: number | undefined; strategy?: string | undefined; adaptAmount?: boolean | undefined; minAmount?: number | undefined; maxAmount?: number | undefined; initialRate?: number | undefined; amountSigma?: number | undefined; },
|
|
591
|
+
): boolean
|
|
607
592
|
```
|
|
608
593
|
|
|
609
|
-
|
|
594
|
+
Check whether mutation adaptation should run this generation.
|
|
610
595
|
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
596
|
+
Cadence checks keep adaptive mutation from rewriting per-genome pressure on
|
|
597
|
+
every generation unless the configuration explicitly asks for that. This lets
|
|
598
|
+
runs choose between fast reaction and slower, more stable adjustment cycles.
|
|
614
599
|
|
|
615
600
|
Parameters:
|
|
616
|
-
- `
|
|
617
|
-
- `
|
|
618
|
-
- `max` - - Maximum bound.
|
|
601
|
+
- `generation` - - Current generation index.
|
|
602
|
+
- `config` - - Adaptive mutation configuration.
|
|
619
603
|
|
|
620
|
-
Returns:
|
|
604
|
+
Returns: True if adaptation should run.
|
|
621
605
|
|
|
622
606
|
### shouldApplyTwoTierFallback
|
|
623
607
|
|
|
@@ -640,27 +624,43 @@ Parameters:
|
|
|
640
624
|
|
|
641
625
|
Returns: True if fallback should run.
|
|
642
626
|
|
|
643
|
-
###
|
|
627
|
+
### sortScoredGenomes
|
|
644
628
|
|
|
645
629
|
```ts
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
): void
|
|
630
|
+
sortScoredGenomes(
|
|
631
|
+
scoredGenomes: { [key: string]: unknown; score?: number | undefined; _mutRate?: number | null | undefined; _mutAmount?: number | null | undefined; }[],
|
|
632
|
+
): { [key: string]: unknown; score?: number | undefined; _mutRate?: number | null | undefined; _mutAmount?: number | null | undefined; }[]
|
|
650
633
|
```
|
|
651
634
|
|
|
652
|
-
|
|
635
|
+
Sort scored genomes in ascending score order.
|
|
653
636
|
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
strategy-specific reasoning to the first pass.
|
|
637
|
+
Sorting creates the stable ordering used by the two-tier and explore-low
|
|
638
|
+
strategies. Lower-scoring genomes end up at the front, which makes the later
|
|
639
|
+
top-half and bottom-half split read naturally.
|
|
658
640
|
|
|
659
641
|
Parameters:
|
|
660
|
-
- `
|
|
661
|
-
- `settings` - - Resolved settings.
|
|
642
|
+
- `scoredGenomes` - - Scored genomes.
|
|
662
643
|
|
|
663
|
-
Returns:
|
|
644
|
+
Returns: Sorted genomes.
|
|
645
|
+
|
|
646
|
+
### splitScoredGenomes
|
|
647
|
+
|
|
648
|
+
```ts
|
|
649
|
+
splitScoredGenomes(
|
|
650
|
+
scoredGenomes: { [key: string]: unknown; score?: number | undefined; _mutRate?: number | null | undefined; _mutAmount?: number | null | undefined; }[],
|
|
651
|
+
): MutationPartitions
|
|
652
|
+
```
|
|
653
|
+
|
|
654
|
+
Split scored genomes into top and bottom halves.
|
|
655
|
+
|
|
656
|
+
The partition step is where population performance becomes strategy-friendly
|
|
657
|
+
structure. Later helpers can ask whether a genome belongs to the exploratory
|
|
658
|
+
bottom half or the conservative top half without re-deriving the split.
|
|
659
|
+
|
|
660
|
+
Parameters:
|
|
661
|
+
- `scoredGenomes` - - Sorted scored genomes.
|
|
662
|
+
|
|
663
|
+
Returns: Partitions used by strategy rules.
|
|
664
664
|
|
|
665
665
|
## neat/adaptive/mutation/adaptive.operator.utils.ts
|
|
666
666
|
|
|
@@ -671,23 +671,29 @@ have succeeded recently. They stay separate from per-genome mutation tuning so
|
|
|
671
671
|
the generated chapter can distinguish genome-local pressure from controller-
|
|
672
672
|
level evidence decay.
|
|
673
673
|
|
|
674
|
-
###
|
|
674
|
+
### applyOperatorDecay
|
|
675
675
|
|
|
676
676
|
```ts
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
677
|
+
applyOperatorDecay(
|
|
678
|
+
stats: Map<string, { success: number; attempts: number; }>,
|
|
679
|
+
entries: [string, { success: number; attempts: number; }][],
|
|
680
|
+
decay: number,
|
|
681
|
+
): void
|
|
680
682
|
```
|
|
681
683
|
|
|
682
|
-
|
|
684
|
+
Apply exponential decay to each operator statistic entry.
|
|
683
685
|
|
|
684
|
-
|
|
685
|
-
|
|
686
|
+
Operator decay is the controller-level counterpart to per-genome mutation
|
|
687
|
+
tuning. Rather than rewriting genomes directly, it softens stale wins and
|
|
688
|
+
attempts so later operator selection can weight recent performance more
|
|
689
|
+
heavily.
|
|
686
690
|
|
|
687
691
|
Parameters:
|
|
688
|
-
- `
|
|
692
|
+
- `stats` - - Operator statistics map.
|
|
693
|
+
- `entries` - - Operator stat entries to update.
|
|
694
|
+
- `decay` - - Decay factor.
|
|
689
695
|
|
|
690
|
-
Returns:
|
|
696
|
+
Returns: Nothing.
|
|
691
697
|
|
|
692
698
|
### collectOperatorStatsEntries
|
|
693
699
|
|
|
@@ -708,30 +714,6 @@ Parameters:
|
|
|
708
714
|
|
|
709
715
|
Returns: Array of operator stat entries.
|
|
710
716
|
|
|
711
|
-
### applyOperatorDecay
|
|
712
|
-
|
|
713
|
-
```ts
|
|
714
|
-
applyOperatorDecay(
|
|
715
|
-
stats: Map<string, { success: number; attempts: number; }>,
|
|
716
|
-
entries: [string, { success: number; attempts: number; }][],
|
|
717
|
-
decay: number,
|
|
718
|
-
): void
|
|
719
|
-
```
|
|
720
|
-
|
|
721
|
-
Apply exponential decay to each operator statistic entry.
|
|
722
|
-
|
|
723
|
-
Operator decay is the controller-level counterpart to per-genome mutation
|
|
724
|
-
tuning. Rather than rewriting genomes directly, it softens stale wins and
|
|
725
|
-
attempts so later operator selection can weight recent performance more
|
|
726
|
-
heavily.
|
|
727
|
-
|
|
728
|
-
Parameters:
|
|
729
|
-
- `stats` - - Operator statistics map.
|
|
730
|
-
- `entries` - - Operator stat entries to update.
|
|
731
|
-
- `decay` - - Decay factor.
|
|
732
|
-
|
|
733
|
-
Returns: Nothing.
|
|
734
|
-
|
|
735
717
|
### decayOperatorStat
|
|
736
718
|
|
|
737
719
|
```ts
|
|
@@ -752,3 +734,21 @@ Parameters:
|
|
|
752
734
|
- `decay` - - Decay factor.
|
|
753
735
|
|
|
754
736
|
Returns: Decayed operator statistic record.
|
|
737
|
+
|
|
738
|
+
### resolveOperatorDecay
|
|
739
|
+
|
|
740
|
+
```ts
|
|
741
|
+
resolveOperatorDecay(
|
|
742
|
+
config: { enabled?: boolean | undefined; learningRate?: number | undefined; alpha?: number | undefined; decay?: number | undefined; },
|
|
743
|
+
): number
|
|
744
|
+
```
|
|
745
|
+
|
|
746
|
+
Resolve the decay factor for operator statistics.
|
|
747
|
+
|
|
748
|
+
Centralizing the default decay factor keeps the caller focused on the update
|
|
749
|
+
cycle instead of repeatedly restating configuration fallback rules.
|
|
750
|
+
|
|
751
|
+
Parameters:
|
|
752
|
+
- `config` - - Operator adaptation configuration.
|
|
753
|
+
|
|
754
|
+
Returns: Decay factor for exponential smoothing.
|