@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
|
@@ -17,16 +17,6 @@ contract is what makes deterministic stepping and reward debugging practical.
|
|
|
17
17
|
|
|
18
18
|
## environment/environment.types.ts
|
|
19
19
|
|
|
20
|
-
### FlappyPipe
|
|
21
|
-
|
|
22
|
-
Pipe obstacle definition.
|
|
23
|
-
|
|
24
|
-
Pipes move from right to left. The bird scores once per pipe when the pipe
|
|
25
|
-
completely crosses the bird x-position.
|
|
26
|
-
|
|
27
|
-
This is the environment-owned pipe state, distinct from the packed snapshot
|
|
28
|
-
transport shapes used by the browser worker.
|
|
29
|
-
|
|
30
20
|
### FlappyBird
|
|
31
21
|
|
|
32
22
|
Bird kinematic state for one simulation frame.
|
|
@@ -34,6 +24,16 @@ Bird kinematic state for one simulation frame.
|
|
|
34
24
|
The environment keeps only the minimum physics state needed to advance the
|
|
35
25
|
episode: vertical position and vertical velocity.
|
|
36
26
|
|
|
27
|
+
### FlappyDifficultyScale
|
|
28
|
+
|
|
29
|
+
Difficulty scale used by the curriculum scheduler.
|
|
30
|
+
|
|
31
|
+
- `0` means easiest profile (wide gaps, slower pipes).
|
|
32
|
+
- `1` means fully adaptive profile based on passed pipes.
|
|
33
|
+
|
|
34
|
+
Values between `0` and `1` interpolate between those extremes, which lets the
|
|
35
|
+
trainer or environment caller dial curriculum strength continuously.
|
|
36
|
+
|
|
37
37
|
### FlappyGameState
|
|
38
38
|
|
|
39
39
|
Full simulation state for one Flappy episode.
|
|
@@ -50,24 +50,18 @@ Structured observation features used to build the neural-network input vector.
|
|
|
50
50
|
Re-exported from shared simulation utilities so trainer and browser paths
|
|
51
51
|
stay synchronized as the observation schema evolves.
|
|
52
52
|
|
|
53
|
-
###
|
|
53
|
+
### FlappyPipe
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
Pipe obstacle definition.
|
|
56
56
|
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
Pipes move from right to left. The bird scores once per pipe when the pipe
|
|
58
|
+
completely crosses the bird x-position.
|
|
59
59
|
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
This is the environment-owned pipe state, distinct from the packed snapshot
|
|
61
|
+
transport shapes used by the browser worker.
|
|
62
62
|
|
|
63
63
|
## environment/environment.constants.ts
|
|
64
64
|
|
|
65
|
-
### FLAPPY_ENVIRONMENT_DEFAULT_DIFFICULTY_SCALE
|
|
66
|
-
|
|
67
|
-
Default curriculum difficulty scale used by environment stepping.
|
|
68
|
-
|
|
69
|
-
A value of `1` means the environment uses the full adaptive difficulty ramp.
|
|
70
|
-
|
|
71
65
|
### FLAPPY_ENVIRONMENT_DEFAULT_CONTROL_SUBSTEPS_PER_FRAME
|
|
72
66
|
|
|
73
67
|
Default number of control/physics substeps executed per simulation frame.
|
|
@@ -75,6 +69,12 @@ Default number of control/physics substeps executed per simulation frame.
|
|
|
75
69
|
Reusing the shared control-substep count keeps the environment and browser
|
|
76
70
|
playback aligned on the same stepping granularity.
|
|
77
71
|
|
|
72
|
+
### FLAPPY_ENVIRONMENT_DEFAULT_DIFFICULTY_SCALE
|
|
73
|
+
|
|
74
|
+
Default curriculum difficulty scale used by environment stepping.
|
|
75
|
+
|
|
76
|
+
A value of `1` means the environment uses the full adaptive difficulty ramp.
|
|
77
|
+
|
|
78
78
|
### FLAPPY_ENVIRONMENT_MAX_FRAMES_PER_EPISODE
|
|
79
79
|
|
|
80
80
|
Maximum frame budget before the environment forces timeout termination.
|
|
@@ -20,6 +20,13 @@ Read the exports in that order:
|
|
|
20
20
|
|
|
21
21
|
## evaluation/evaluation.types.ts
|
|
22
22
|
|
|
23
|
+
### FlappyEpisodeResult
|
|
24
|
+
|
|
25
|
+
Summary metrics for a single Flappy episode rollout.
|
|
26
|
+
|
|
27
|
+
The result intentionally keeps both a single scalar `fitness` and the channel
|
|
28
|
+
breakdown that produced it, which makes reward debugging much easier.
|
|
29
|
+
|
|
23
30
|
### FlappyNetworkLike
|
|
24
31
|
|
|
25
32
|
Minimal network contract required by Flappy evaluation.
|
|
@@ -34,13 +41,6 @@ Runtime controls for one rollout evaluation.
|
|
|
34
41
|
This is the public control surface for evaluation callers. The rollout layer
|
|
35
42
|
later normalizes these options into execution-safe context values.
|
|
36
43
|
|
|
37
|
-
### FlappyEpisodeResult
|
|
38
|
-
|
|
39
|
-
Summary metrics for a single Flappy episode rollout.
|
|
40
|
-
|
|
41
|
-
The result intentionally keeps both a single scalar `fitness` and the channel
|
|
42
|
-
breakdown that produced it, which makes reward debugging much easier.
|
|
43
|
-
|
|
44
44
|
### FlappySeedBatchEvaluation
|
|
45
45
|
|
|
46
46
|
Aggregate statistics from evaluating one network across shared seeds.
|
|
@@ -60,14 +60,14 @@ Default difficulty scale for rollouts when caller does not provide one.
|
|
|
60
60
|
|
|
61
61
|
A value of `1` means full adaptive difficulty is enabled during evaluation.
|
|
62
62
|
|
|
63
|
-
### FLAPPY_EVALUATION_DEFAULT_EARLY_TERMINATION_GRACE_FRAMES
|
|
64
|
-
|
|
65
|
-
Default grace period (frames) before early termination checks begin.
|
|
66
|
-
|
|
67
63
|
### FLAPPY_EVALUATION_DEFAULT_EARLY_TERMINATION_CONSECUTIVE_FRAMES
|
|
68
64
|
|
|
69
65
|
Default consecutive unrecoverable frames required for early termination.
|
|
70
66
|
|
|
67
|
+
### FLAPPY_EVALUATION_DEFAULT_EARLY_TERMINATION_GRACE_FRAMES
|
|
68
|
+
|
|
69
|
+
Default grace period (frames) before early termination checks begin.
|
|
70
|
+
|
|
71
71
|
### FLAPPY_EVALUATION_DEFAULT_PIPE_PROGRESS_TARGET
|
|
72
72
|
|
|
73
73
|
Default pipe-progress target used when normalizing rollout fitness.
|
|
@@ -79,17 +79,17 @@ even when individual episodes vary widely in difficulty and duration.
|
|
|
79
79
|
|
|
80
80
|
Dense shaping normalization factor per survived frame.
|
|
81
81
|
|
|
82
|
-
###
|
|
82
|
+
### FLAPPY_EVALUATION_NORMALIZED_DENSE_WEIGHT
|
|
83
83
|
|
|
84
|
-
|
|
84
|
+
Dense-shaping channel weight in normalized fitness composition.
|
|
85
85
|
|
|
86
86
|
### FLAPPY_EVALUATION_NORMALIZED_PROGRESS_WEIGHT
|
|
87
87
|
|
|
88
88
|
Pipe-progress channel weight in normalized fitness composition.
|
|
89
89
|
|
|
90
|
-
###
|
|
90
|
+
### FLAPPY_EVALUATION_NORMALIZED_SURVIVAL_WEIGHT
|
|
91
91
|
|
|
92
|
-
|
|
92
|
+
Survival channel weight in normalized fitness composition.
|
|
93
93
|
|
|
94
94
|
### FLAPPY_EVALUATION_NORMALIZED_TERMINAL_WEIGHT
|
|
95
95
|
|
|
@@ -102,40 +102,40 @@ Robust fitness penalty multiplier applied to standard deviation.
|
|
|
102
102
|
A higher value penalizes instability more strongly when computing robust
|
|
103
103
|
fitness from a shared-seed batch.
|
|
104
104
|
|
|
105
|
-
###
|
|
105
|
+
### FLAPPY_EVALUATION_SEED_MIX_MULTIPLIER_A
|
|
106
106
|
|
|
107
|
-
|
|
107
|
+
Seed-mix first multiplicative avalanche constant.
|
|
108
108
|
|
|
109
|
-
###
|
|
109
|
+
### FLAPPY_EVALUATION_SEED_MIX_MULTIPLIER_B
|
|
110
110
|
|
|
111
|
-
|
|
111
|
+
Seed-mix second multiplicative avalanche constant.
|
|
112
112
|
|
|
113
|
-
###
|
|
113
|
+
### FLAPPY_EVALUATION_SEED_MIX_XOR_SALT
|
|
114
114
|
|
|
115
|
-
|
|
115
|
+
Seed-mix additive constant used to decorrelate nearby genome ids.
|
|
116
|
+
|
|
117
|
+
Together with the multiplicative constants below, this creates a small
|
|
118
|
+
avalanche-style mixing pipeline for deterministic seed derivation.
|
|
116
119
|
|
|
117
120
|
### FLAPPY_EVALUATION_UNRECOVERABLE_ABOVE_GAP_DELTA
|
|
118
121
|
|
|
119
122
|
Upper-gap delta threshold used by early termination heuristic.
|
|
120
123
|
|
|
121
|
-
###
|
|
122
|
-
|
|
123
|
-
Rising-speed threshold used by early termination heuristic.
|
|
124
|
+
### FLAPPY_EVALUATION_UNRECOVERABLE_BELOW_GAP_DELTA
|
|
124
125
|
|
|
125
|
-
|
|
126
|
+
Lower-gap delta threshold used by early termination heuristic.
|
|
126
127
|
|
|
127
|
-
|
|
128
|
+
### FLAPPY_EVALUATION_UNRECOVERABLE_CLEARANCE_THRESHOLD
|
|
128
129
|
|
|
129
|
-
|
|
130
|
-
avalanche-style mixing pipeline for deterministic seed derivation.
|
|
130
|
+
Unrecoverable clearance threshold used by early termination heuristic.
|
|
131
131
|
|
|
132
|
-
###
|
|
132
|
+
### FLAPPY_EVALUATION_UNRECOVERABLE_FALLING_VELOCITY
|
|
133
133
|
|
|
134
|
-
|
|
134
|
+
Falling-speed threshold used by early termination heuristic.
|
|
135
135
|
|
|
136
|
-
###
|
|
136
|
+
### FLAPPY_EVALUATION_UNRECOVERABLE_RISING_VELOCITY
|
|
137
137
|
|
|
138
|
-
|
|
138
|
+
Rising-speed threshold used by early termination heuristic.
|
|
139
139
|
|
|
140
140
|
## evaluation/evaluation.fitness.utils.ts
|
|
141
141
|
|
|
@@ -89,25 +89,29 @@ finalizeRolloutEpisodeState(
|
|
|
89
89
|
);
|
|
90
90
|
```
|
|
91
91
|
|
|
92
|
-
###
|
|
92
|
+
### applyRolloutEarlyTerminationIfNeeded
|
|
93
93
|
|
|
94
94
|
```ts
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
95
|
+
applyRolloutEarlyTerminationIfNeeded(
|
|
96
|
+
rolloutEpisodeContext: RolloutEpisodeContext,
|
|
97
|
+
rolloutEpisodeRuntimeState: RolloutEpisodeRuntimeState,
|
|
98
|
+
currentObservationFeatures: SharedObservationFeatures,
|
|
99
|
+
): void
|
|
99
100
|
```
|
|
100
101
|
|
|
101
|
-
|
|
102
|
+
Applies the optional early-termination heuristic for unrecoverable starts.
|
|
102
103
|
|
|
103
|
-
|
|
104
|
-
|
|
104
|
+
Educational note:
|
|
105
|
+
Early termination is an evaluation-speed heuristic, not a gameplay rule. It
|
|
106
|
+
exists to stop obviously doomed warmup trajectories from consuming excessive
|
|
107
|
+
rollout budget.
|
|
105
108
|
|
|
106
109
|
Parameters:
|
|
107
|
-
- `
|
|
108
|
-
- `
|
|
110
|
+
- `rolloutEpisodeContext` - - Normalized rollout configuration.
|
|
111
|
+
- `rolloutEpisodeRuntimeState` - - Mutable runtime state.
|
|
112
|
+
- `currentObservationFeatures` - - Post-step observation features.
|
|
109
113
|
|
|
110
|
-
Returns:
|
|
114
|
+
Returns: Nothing.
|
|
111
115
|
|
|
112
116
|
### createRolloutEpisodeRuntimeState
|
|
113
117
|
|
|
@@ -128,28 +132,6 @@ Parameters:
|
|
|
128
132
|
|
|
129
133
|
Returns: Mutable runtime state.
|
|
130
134
|
|
|
131
|
-
### runRolloutEpisodeLoop
|
|
132
|
-
|
|
133
|
-
```ts
|
|
134
|
-
runRolloutEpisodeLoop(
|
|
135
|
-
network: FlappyNetworkLike,
|
|
136
|
-
rolloutEpisodeContext: RolloutEpisodeContext,
|
|
137
|
-
rolloutEpisodeRuntimeState: RolloutEpisodeRuntimeState,
|
|
138
|
-
): void
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
Runs the main rollout loop until termination or frame-budget exhaustion.
|
|
142
|
-
|
|
143
|
-
This is the episode heartbeat: keep stepping while the bird is alive and the
|
|
144
|
-
rollout still has budget left.
|
|
145
|
-
|
|
146
|
-
Parameters:
|
|
147
|
-
- `network` - - Genome/network to evaluate.
|
|
148
|
-
- `rolloutEpisodeContext` - - Normalized rollout configuration.
|
|
149
|
-
- `rolloutEpisodeRuntimeState` - - Mutable runtime state.
|
|
150
|
-
|
|
151
|
-
Returns: Nothing.
|
|
152
|
-
|
|
153
135
|
### finalizeRolloutEpisodeState
|
|
154
136
|
|
|
155
137
|
```ts
|
|
@@ -170,28 +152,25 @@ Parameters:
|
|
|
170
152
|
|
|
171
153
|
Returns: Nothing.
|
|
172
154
|
|
|
173
|
-
###
|
|
155
|
+
### resolveRolloutEpisodeContext
|
|
174
156
|
|
|
175
157
|
```ts
|
|
176
|
-
|
|
158
|
+
resolveRolloutEpisodeContext(
|
|
177
159
|
network: FlappyNetworkLike,
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
): void
|
|
160
|
+
rolloutOptions: FlappyRolloutOptions,
|
|
161
|
+
): RolloutEpisodeContext
|
|
181
162
|
```
|
|
182
163
|
|
|
183
|
-
|
|
164
|
+
Resolves normalized rollout configuration from user options.
|
|
184
165
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
accumulate shaping reward, then optionally prune the trajectory.
|
|
166
|
+
This is the rollout safety boundary: caller-provided values are clamped into
|
|
167
|
+
deterministic, execution-safe ranges before the main loop touches them.
|
|
188
168
|
|
|
189
169
|
Parameters:
|
|
190
170
|
- `network` - - Genome/network to evaluate.
|
|
191
|
-
- `
|
|
192
|
-
- `rolloutEpisodeRuntimeState` - - Mutable runtime state.
|
|
171
|
+
- `rolloutOptions` - - Optional rollout controls.
|
|
193
172
|
|
|
194
|
-
Returns:
|
|
173
|
+
Returns: Normalized rollout configuration.
|
|
195
174
|
|
|
196
175
|
### resolveRolloutFrameFlapDecision
|
|
197
176
|
|
|
@@ -215,27 +194,48 @@ Parameters:
|
|
|
215
194
|
|
|
216
195
|
Returns: Whether the bird should flap.
|
|
217
196
|
|
|
218
|
-
###
|
|
197
|
+
### runRolloutEpisodeFrame
|
|
219
198
|
|
|
220
199
|
```ts
|
|
221
|
-
|
|
200
|
+
runRolloutEpisodeFrame(
|
|
201
|
+
network: FlappyNetworkLike,
|
|
222
202
|
rolloutEpisodeContext: RolloutEpisodeContext,
|
|
223
203
|
rolloutEpisodeRuntimeState: RolloutEpisodeRuntimeState,
|
|
224
|
-
currentObservationFeatures: SharedObservationFeatures,
|
|
225
204
|
): void
|
|
226
205
|
```
|
|
227
206
|
|
|
228
|
-
|
|
207
|
+
Runs one rollout frame including control, shaping, and early termination.
|
|
229
208
|
|
|
230
209
|
Educational note:
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
rollout budget.
|
|
210
|
+
Each frame follows a compact pipeline: observe, act, step the environment,
|
|
211
|
+
accumulate shaping reward, then optionally prune the trajectory.
|
|
234
212
|
|
|
235
213
|
Parameters:
|
|
214
|
+
- `network` - - Genome/network to evaluate.
|
|
215
|
+
- `rolloutEpisodeContext` - - Normalized rollout configuration.
|
|
216
|
+
- `rolloutEpisodeRuntimeState` - - Mutable runtime state.
|
|
217
|
+
|
|
218
|
+
Returns: Nothing.
|
|
219
|
+
|
|
220
|
+
### runRolloutEpisodeLoop
|
|
221
|
+
|
|
222
|
+
```ts
|
|
223
|
+
runRolloutEpisodeLoop(
|
|
224
|
+
network: FlappyNetworkLike,
|
|
225
|
+
rolloutEpisodeContext: RolloutEpisodeContext,
|
|
226
|
+
rolloutEpisodeRuntimeState: RolloutEpisodeRuntimeState,
|
|
227
|
+
): void
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
Runs the main rollout loop until termination or frame-budget exhaustion.
|
|
231
|
+
|
|
232
|
+
This is the episode heartbeat: keep stepping while the bird is alive and the
|
|
233
|
+
rollout still has budget left.
|
|
234
|
+
|
|
235
|
+
Parameters:
|
|
236
|
+
- `network` - - Genome/network to evaluate.
|
|
236
237
|
- `rolloutEpisodeContext` - - Normalized rollout configuration.
|
|
237
238
|
- `rolloutEpisodeRuntimeState` - - Mutable runtime state.
|
|
238
|
-
- `currentObservationFeatures` - - Post-step observation features.
|
|
239
239
|
|
|
240
240
|
Returns: Nothing.
|
|
241
241
|
|
|
@@ -252,6 +252,35 @@ The rollout subsystem separates simulation from scoring on purpose. The
|
|
|
252
252
|
services file determines what happened; this file determines how that episode
|
|
253
253
|
should be interpreted as fitness.
|
|
254
254
|
|
|
255
|
+
### composeNormalizedFitness
|
|
256
|
+
|
|
257
|
+
```ts
|
|
258
|
+
composeNormalizedFitness(
|
|
259
|
+
framesValue: number,
|
|
260
|
+
pipesPassedValue: number,
|
|
261
|
+
denseShapingValue: number,
|
|
262
|
+
terminalShapingValue: number,
|
|
263
|
+
maxFramesValue: number,
|
|
264
|
+
pipeProgressTarget: number | undefined,
|
|
265
|
+
): number
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
Normalize and cap fitness channels so no single reward term dominates.
|
|
269
|
+
|
|
270
|
+
Educational note:
|
|
271
|
+
Channel normalization is a pragmatic way to keep the objective balanced across
|
|
272
|
+
episodes of different lengths and levels of progress.
|
|
273
|
+
|
|
274
|
+
Parameters:
|
|
275
|
+
- `framesValue` - - Frames survived for the episode.
|
|
276
|
+
- `pipesPassedValue` - - Pipes passed during the episode.
|
|
277
|
+
- `denseShapingValue` - - Accumulated dense shaping reward.
|
|
278
|
+
- `terminalShapingValue` - - Terminal shaping reward.
|
|
279
|
+
- `maxFramesValue` - - Frame budget used for the episode.
|
|
280
|
+
- `pipeProgressTarget` - - Optional target used to normalize pipe progress.
|
|
281
|
+
|
|
282
|
+
Returns: Normalized composite fitness.
|
|
283
|
+
|
|
255
284
|
### composeRolloutEpisodeResult
|
|
256
285
|
|
|
257
286
|
```ts
|
|
@@ -293,6 +322,26 @@ Parameters:
|
|
|
293
322
|
|
|
294
323
|
Returns: Per-step shaped reward.
|
|
295
324
|
|
|
325
|
+
### computeTerminalShapingFitness
|
|
326
|
+
|
|
327
|
+
```ts
|
|
328
|
+
computeTerminalShapingFitness(
|
|
329
|
+
episodeState: FlappyGameState,
|
|
330
|
+
difficultyScale: number,
|
|
331
|
+
): number
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
Adds small terminal bonuses from final progress/alignment signals.
|
|
335
|
+
|
|
336
|
+
Terminal bonuses refine the final ranking, but they are intentionally smaller
|
|
337
|
+
than the main survival and pipe-progress channels.
|
|
338
|
+
|
|
339
|
+
Parameters:
|
|
340
|
+
- `episodeState` - - Final rollout state.
|
|
341
|
+
- `difficultyScale` - - Active rollout difficulty scale.
|
|
342
|
+
|
|
343
|
+
Returns: Terminal shaping reward.
|
|
344
|
+
|
|
296
345
|
### isBirdLikelyUnrecoverable
|
|
297
346
|
|
|
298
347
|
```ts
|
|
@@ -311,6 +360,26 @@ Parameters:
|
|
|
311
360
|
|
|
312
361
|
Returns: Whether the current trajectory appears unrecoverable.
|
|
313
362
|
|
|
363
|
+
### resolveDenseShapingRewardComponents
|
|
364
|
+
|
|
365
|
+
```ts
|
|
366
|
+
resolveDenseShapingRewardComponents(
|
|
367
|
+
previousFeatures: SharedObservationFeatures,
|
|
368
|
+
currentFeatures: SharedObservationFeatures,
|
|
369
|
+
): DenseShapingRewardComponents
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
Resolves every dense-shaping reward component from consecutive observations.
|
|
373
|
+
|
|
374
|
+
If you want background reading, the Wikipedia article on "reward shaping" is
|
|
375
|
+
a good high-level companion concept for why these components exist.
|
|
376
|
+
|
|
377
|
+
Parameters:
|
|
378
|
+
- `previousFeatures` - - Observation before stepping the environment.
|
|
379
|
+
- `currentFeatures` - - Observation after stepping the environment.
|
|
380
|
+
|
|
381
|
+
Returns: Dense-shaping reward components.
|
|
382
|
+
|
|
314
383
|
### resolveRolloutFitnessBreakdown
|
|
315
384
|
|
|
316
385
|
```ts
|
|
@@ -353,75 +422,6 @@ Parameters:
|
|
|
353
422
|
|
|
354
423
|
Returns: Raw unnormalized fitness.
|
|
355
424
|
|
|
356
|
-
### resolveDenseShapingRewardComponents
|
|
357
|
-
|
|
358
|
-
```ts
|
|
359
|
-
resolveDenseShapingRewardComponents(
|
|
360
|
-
previousFeatures: SharedObservationFeatures,
|
|
361
|
-
currentFeatures: SharedObservationFeatures,
|
|
362
|
-
): DenseShapingRewardComponents
|
|
363
|
-
```
|
|
364
|
-
|
|
365
|
-
Resolves every dense-shaping reward component from consecutive observations.
|
|
366
|
-
|
|
367
|
-
If you want background reading, the Wikipedia article on "reward shaping" is
|
|
368
|
-
a good high-level companion concept for why these components exist.
|
|
369
|
-
|
|
370
|
-
Parameters:
|
|
371
|
-
- `previousFeatures` - - Observation before stepping the environment.
|
|
372
|
-
- `currentFeatures` - - Observation after stepping the environment.
|
|
373
|
-
|
|
374
|
-
Returns: Dense-shaping reward components.
|
|
375
|
-
|
|
376
|
-
### computeTerminalShapingFitness
|
|
377
|
-
|
|
378
|
-
```ts
|
|
379
|
-
computeTerminalShapingFitness(
|
|
380
|
-
episodeState: FlappyGameState,
|
|
381
|
-
difficultyScale: number,
|
|
382
|
-
): number
|
|
383
|
-
```
|
|
384
|
-
|
|
385
|
-
Adds small terminal bonuses from final progress/alignment signals.
|
|
386
|
-
|
|
387
|
-
Terminal bonuses refine the final ranking, but they are intentionally smaller
|
|
388
|
-
than the main survival and pipe-progress channels.
|
|
389
|
-
|
|
390
|
-
Parameters:
|
|
391
|
-
- `episodeState` - - Final rollout state.
|
|
392
|
-
- `difficultyScale` - - Active rollout difficulty scale.
|
|
393
|
-
|
|
394
|
-
Returns: Terminal shaping reward.
|
|
395
|
-
|
|
396
|
-
### composeNormalizedFitness
|
|
397
|
-
|
|
398
|
-
```ts
|
|
399
|
-
composeNormalizedFitness(
|
|
400
|
-
framesValue: number,
|
|
401
|
-
pipesPassedValue: number,
|
|
402
|
-
denseShapingValue: number,
|
|
403
|
-
terminalShapingValue: number,
|
|
404
|
-
maxFramesValue: number,
|
|
405
|
-
pipeProgressTarget: number | undefined,
|
|
406
|
-
): number
|
|
407
|
-
```
|
|
408
|
-
|
|
409
|
-
Normalize and cap fitness channels so no single reward term dominates.
|
|
410
|
-
|
|
411
|
-
Educational note:
|
|
412
|
-
Channel normalization is a pragmatic way to keep the objective balanced across
|
|
413
|
-
episodes of different lengths and levels of progress.
|
|
414
|
-
|
|
415
|
-
Parameters:
|
|
416
|
-
- `framesValue` - - Frames survived for the episode.
|
|
417
|
-
- `pipesPassedValue` - - Pipes passed during the episode.
|
|
418
|
-
- `denseShapingValue` - - Accumulated dense shaping reward.
|
|
419
|
-
- `terminalShapingValue` - - Terminal shaping reward.
|
|
420
|
-
- `maxFramesValue` - - Frame budget used for the episode.
|
|
421
|
-
- `pipeProgressTarget` - - Optional target used to normalize pipe progress.
|
|
422
|
-
|
|
423
|
-
Returns: Normalized composite fitness.
|
|
424
|
-
|
|
425
425
|
## evaluation/rollout/evaluation.rollout.types.ts
|
|
426
426
|
|
|
427
427
|
Rollout-internal type contracts.
|
|
@@ -436,6 +436,13 @@ Read them as three layers:
|
|
|
436
436
|
- `RolloutEpisodeRuntimeState`: mutable execution state.
|
|
437
437
|
- fitness and shaping types: named reward channels used during folding.
|
|
438
438
|
|
|
439
|
+
### DenseShapingRewardComponents
|
|
440
|
+
|
|
441
|
+
Per-frame dense shaping channels resolved from consecutive observations.
|
|
442
|
+
|
|
443
|
+
The shaping system rewards more than survival: it also tracks approach,
|
|
444
|
+
centering, clearance, and stable motion.
|
|
445
|
+
|
|
439
446
|
### RolloutEpisodeContext
|
|
440
447
|
|
|
441
448
|
Immutable rollout options normalized into execution-safe ranges.
|
|
@@ -455,13 +462,6 @@ Fitness-channel breakdown used to compose the public episode result.
|
|
|
455
462
|
|
|
456
463
|
Named channels make reward design easier to audit than a single opaque number.
|
|
457
464
|
|
|
458
|
-
### DenseShapingRewardComponents
|
|
459
|
-
|
|
460
|
-
Per-frame dense shaping channels resolved from consecutive observations.
|
|
461
|
-
|
|
462
|
-
The shaping system rewards more than survival: it also tracks approach,
|
|
463
|
-
centering, clearance, and stable motion.
|
|
464
|
-
|
|
465
465
|
## evaluation/rollout/evaluation.rollout.constants.ts
|
|
466
466
|
|
|
467
467
|
Rollout-local constants.
|
|
@@ -477,29 +477,29 @@ sea of raw `0`, `1`, and string literals.
|
|
|
477
477
|
|
|
478
478
|
Default genome id used when a network does not expose one.
|
|
479
479
|
|
|
480
|
-
###
|
|
480
|
+
### FLAPPY_ROLLOUT_DONE_REASON_COLLISION
|
|
481
481
|
|
|
482
|
-
|
|
482
|
+
Rollout done reason used by heuristic early termination.
|
|
483
483
|
|
|
484
|
-
###
|
|
484
|
+
### FLAPPY_ROLLOUT_DONE_REASON_TIMEOUT
|
|
485
485
|
|
|
486
|
-
|
|
486
|
+
Rollout done reason used when the episode exhausts its frame budget.
|
|
487
487
|
|
|
488
488
|
### FLAPPY_ROLLOUT_MIN_EARLY_TERMINATION_CONSECUTIVE_FRAMES
|
|
489
489
|
|
|
490
490
|
Minimum unrecoverable-frame streak required for early termination.
|
|
491
491
|
|
|
492
|
-
###
|
|
492
|
+
### FLAPPY_ROLLOUT_MIN_EARLY_TERMINATION_GRACE_FRAMES
|
|
493
493
|
|
|
494
|
-
|
|
494
|
+
Minimum grace period allowed before early termination can activate.
|
|
495
495
|
|
|
496
|
-
|
|
497
|
-
rollout guard conditions.
|
|
496
|
+
### FLAPPY_ROLLOUT_MIN_MAX_FRAMES
|
|
498
497
|
|
|
499
|
-
|
|
498
|
+
Minimum positive frame-like scalar used by rollout normalization.
|
|
500
499
|
|
|
501
|
-
|
|
500
|
+
### FLAPPY_ROLLOUT_ZERO_FITNESS
|
|
502
501
|
|
|
503
|
-
|
|
502
|
+
Shared zero baseline used across rollout fitness and counters.
|
|
504
503
|
|
|
505
|
-
|
|
504
|
+
This acts as the semantic baseline for both shaping accumulation and several
|
|
505
|
+
rollout guard conditions.
|