@reicek/neataptic-ts 0.1.23 → 0.1.25

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.
Files changed (766) hide show
  1. package/.github/agents/boundary-mapper.agent.md +23 -0
  2. package/.github/agents/docs-scout.agent.md +27 -1
  3. package/.github/agents/plan-scout.agent.md +18 -0
  4. package/.github/agents/solid-split.agent.md +36 -20
  5. package/.github/copilot-instructions.md +108 -101
  6. package/.github/skills/educational-docs/SKILL.md +604 -0
  7. package/.github/skills/educational-docs/assets/external-sources-and-media.md +118 -0
  8. package/.github/skills/educational-docs/assets/mermaid-diagram-playbook.md +763 -0
  9. package/.github/skills/educational-docs/assets/readme-tone-model.md +74 -0
  10. package/.github/skills/educational-docs/assets/source-mapping-checklist.md +60 -0
  11. package/.github/skills/educational-docs/assets/visual-style-guide.md +165 -0
  12. package/.github/skills/plan-alignment/SKILL.md +114 -0
  13. package/.github/skills/solid-split/SKILL.md +426 -0
  14. package/.github/skills/{solid-split-playbook → solid-split}/assets/docs-checklist.md +8 -2
  15. package/.github/skills/{solid-split-playbook → solid-split}/assets/split-workflow-checklist.md +2 -2
  16. package/.github/skills/test-fix-workflow/SKILL.md +105 -0
  17. package/.github/skills/trace-analyzer-extension/SKILL.md +5 -0
  18. package/.github/skills/trace-audit-reporting/SKILL.md +9 -0
  19. package/.github/skills/tracker-handoff/SKILL.md +153 -0
  20. package/.github/workflows/ci.yml +3 -3
  21. package/.github/workflows/deploy-pages.yml +6 -6
  22. package/.github/workflows/manual_release_pipeline.yml +3 -3
  23. package/.github/workflows/publish.yml +18 -19
  24. package/.github/workflows/release_dispatch.yml +3 -3
  25. package/README.md +84 -1610
  26. package/eslint.config.mjs +1 -1
  27. package/jest.config.mjs +1 -3
  28. package/nn.jpg +0 -0
  29. package/package.json +37 -32
  30. package/plans/Architecture_Primitives_Node_Group_Layer.md +2 -0
  31. package/plans/Browser_Build_and_CDN_Distribution.md +2 -0
  32. package/plans/Construct_From_Parts_Graph_Assembly.md +2 -0
  33. package/plans/ES2023 migration +2 -0
  34. package/plans/Evolution_Training_Interoperability_Contracts.md +2 -0
  35. package/plans/Flappy_Bird_Folder_Documentation_Pass.md +67 -3
  36. package/plans/HyperEvoDevoMorphoNEAT.md +2 -0
  37. package/plans/Interactive_Examples_and_Learning_Path.md +2 -0
  38. package/plans/Memory_Optimization.md +2 -0
  39. package/plans/Network_Visualization_Export_Schema.md +2 -0
  40. package/plans/ONNX_EXPORT_PLAN.md +2 -0
  41. package/plans/Population_Save_Resume_and_Checkpointing.md +2 -0
  42. package/plans/Preconfigured_Architectures_MLP_LSTM_GRU_NARX.md +2 -0
  43. package/plans/README.md +9 -0
  44. package/plans/Roadmap.md +92 -25
  45. package/plans/Stable_Activation_Ordering_and_Explicit_IO_Roles.md +2 -0
  46. package/plans/Standalone_Inference_Export.md +2 -0
  47. package/plans/Turnkey_Multithread_Evaluation_API.md +2 -0
  48. package/plans/Worker_Friendly_Network_Serialization_Fastpath.md +2 -0
  49. package/plans/architecture-solid-split.plans.md +675 -0
  50. package/plans/asciiMaze-typescript-repair.plans.md +42 -0
  51. package/plans/methods-docs.plans.md +173 -0
  52. package/plans/methods-solid-split.plans.md +78 -0
  53. package/plans/neat-docs.plans.md +68 -0
  54. package/plans/neat-test-surface-repair.plans.md +38 -0
  55. package/plans/neat.plans.md +4 -2
  56. package/plans/src-no-explicit-any-cleanup.plans.md +175 -0
  57. package/plans/utils-docs.plans.md +44 -0
  58. package/scripts/assets/theme.css +532 -55
  59. package/scripts/generate-docs.ts +1491 -114
  60. package/scripts/mermaid-cli.mjs +158 -0
  61. package/scripts/render-docs-html.sidebar.ts +513 -0
  62. package/scripts/render-docs-html.ts +391 -90
  63. package/src/README.md +2284 -924
  64. package/src/architecture/README.md +19 -2102
  65. package/src/architecture/activationArrayPool/README.md +35 -0
  66. package/src/architecture/activationArrayPool/activationArrayPool.ts +185 -0
  67. package/src/architecture/activationArrayPool.ts +6 -136
  68. package/src/architecture/architect/README.md +198 -0
  69. package/src/architecture/architect/architect.ts +550 -0
  70. package/src/architecture/architect.ts +5 -641
  71. package/src/architecture/connection/README.md +260 -0
  72. package/src/architecture/connection/connection.ts +455 -0
  73. package/src/architecture/connection.ts +4 -397
  74. package/src/architecture/docs.order.json +35 -0
  75. package/src/architecture/group/README.md +193 -0
  76. package/src/architecture/group/group.ts +506 -0
  77. package/src/architecture/group.ts +5 -417
  78. package/src/architecture/layer/README.md +1101 -458
  79. package/src/architecture/layer/layer.activation.utils.ts +1 -1
  80. package/src/architecture/layer/layer.connection.utils.ts +2 -2
  81. package/src/architecture/layer/layer.factory.core.utils.ts +2 -2
  82. package/src/architecture/layer/layer.factory.experimental.utils.ts +1 -1
  83. package/src/architecture/layer/layer.factory.normalization.utils.ts +1 -1
  84. package/src/architecture/layer/layer.factory.recurrent.utils.ts +3 -7
  85. package/src/architecture/layer/layer.guard.utils.ts +1 -1
  86. package/src/architecture/layer/layer.ts +488 -0
  87. package/src/architecture/layer/layer.utils.types.ts +2 -2
  88. package/src/architecture/layer.ts +4 -470
  89. package/src/architecture/network/README.md +2559 -1276
  90. package/src/architecture/network/activate/README.md +1001 -522
  91. package/src/architecture/network/activate/network.activate.contexts.utils.ts +1 -1
  92. package/src/architecture/network/activate/network.activate.core.utils.ts +4 -4
  93. package/src/architecture/network/activate/network.activate.notrace.utils.ts +1 -1
  94. package/src/architecture/network/activate/network.activate.raw.utils.ts +1 -1
  95. package/src/architecture/network/activate/network.activate.utils.ts +3 -3
  96. package/src/architecture/network/activate/network.activate.utils.types.ts +2 -2
  97. package/src/architecture/network/bootstrap/README.md +207 -0
  98. package/src/architecture/network/bootstrap/network.bootstrap.utils.ts +295 -0
  99. package/src/architecture/network/connect/README.md +146 -60
  100. package/src/architecture/network/connect/network.connect.create.utils.ts +1 -1
  101. package/src/architecture/network/connect/network.connect.remove.utils.ts +1 -1
  102. package/src/architecture/network/connect/network.connect.utils.ts +2 -2
  103. package/src/architecture/network/deterministic/README.md +236 -113
  104. package/src/architecture/network/deterministic/network.deterministic.lifecycle.utils.ts +1 -1
  105. package/src/architecture/network/deterministic/network.deterministic.setup.utils.ts +2 -2
  106. package/src/architecture/network/deterministic/network.deterministic.state.utils.ts +2 -2
  107. package/src/architecture/network/deterministic/network.deterministic.utils.ts +2 -2
  108. package/src/architecture/network/docs.order.json +8 -0
  109. package/src/architecture/network/evolve/README.md +550 -261
  110. package/src/architecture/network/evolve/network.evolve.finalize.utils.ts +1 -1
  111. package/src/architecture/network/evolve/network.evolve.fitness.utils.ts +1 -1
  112. package/src/architecture/network/evolve/network.evolve.loop.utils.ts +1 -1
  113. package/src/architecture/network/evolve/network.evolve.setup.utils.ts +1 -1
  114. package/src/architecture/network/evolve/network.evolve.utils.ts +1 -1
  115. package/src/architecture/network/gating/README.md +221 -111
  116. package/src/architecture/network/gating/network.gating.gate.utils.ts +1 -1
  117. package/src/architecture/network/gating/network.gating.remove.utils.ts +2 -2
  118. package/src/architecture/network/gating/network.gating.utils.ts +2 -2
  119. package/src/architecture/network/genetic/README.md +624 -287
  120. package/src/architecture/network/genetic/network.genetic.setup.utils.ts +2 -2
  121. package/src/architecture/network/genetic/network.genetic.utils.ts +1 -1
  122. package/src/architecture/network/mutate/README.md +1248 -653
  123. package/src/architecture/network/mutate/network.mutate.dispatch.utils.ts +1 -1
  124. package/src/architecture/network/mutate/network.mutate.handlers.utils.ts +15 -42
  125. package/src/architecture/network/mutate/network.mutate.public.utils.ts +60 -0
  126. package/src/architecture/network/mutate/network.mutate.utils.ts +1 -1
  127. package/src/architecture/network/mutate/network.mutate.utils.types.ts +0 -5
  128. package/src/architecture/network/network.ts +1153 -0
  129. package/src/architecture/network/network.types.ts +102 -8
  130. package/src/architecture/network/network.utils.ts +22 -15
  131. package/src/architecture/network/onnx/README.md +1039 -3171
  132. package/src/architecture/network/onnx/docs.order.json +13 -0
  133. package/src/architecture/network/onnx/export/README.md +1691 -0
  134. package/src/architecture/network/onnx/export/layers/README.md +1121 -0
  135. package/src/architecture/network/onnx/{network.onnx.export-conv.utils.ts → export/layers/network.onnx.export-conv.utils.ts} +35 -7
  136. package/src/architecture/network/onnx/{network.onnx.export-dense.utils.ts → export/layers/network.onnx.export-dense.utils.ts} +42 -9
  137. package/src/architecture/network/onnx/{network.onnx.export-layer-common.utils.ts → export/layers/network.onnx.export-layer-common.utils.ts} +22 -16
  138. package/src/architecture/network/onnx/{network.onnx.export-layer-graph.utils.ts → export/layers/network.onnx.export-layer-graph.utils.ts} +51 -4
  139. package/src/architecture/network/onnx/{network.onnx.export-recurrent.utils.ts → export/layers/network.onnx.export-recurrent.utils.ts} +27 -6
  140. package/src/architecture/network/onnx/{network.onnx.export-build.utils.ts → export/network.onnx.export-build.utils.ts} +5 -5
  141. package/src/architecture/network/onnx/{network.onnx.export-flow.utils.ts → export/network.onnx.export-flow.utils.ts} +3 -2
  142. package/src/architecture/network/onnx/{network.onnx.export-orchestrators.utils.ts → export/network.onnx.export-orchestrators.utils.ts} +9 -5
  143. package/src/architecture/network/onnx/{network.onnx.export-postprocess.utils.ts → export/network.onnx.export-postprocess.utils.ts} +11 -7
  144. package/src/architecture/network/onnx/{network.onnx.export-setup.utils.ts → export/network.onnx.export-setup.utils.ts} +9 -7
  145. package/src/architecture/network/onnx/export/network.onnx.export.types.ts +734 -0
  146. package/src/architecture/network/onnx/import/README.md +1515 -0
  147. package/src/architecture/network/onnx/import/docs.order.json +15 -0
  148. package/src/architecture/network/onnx/{network.onnx.import-activations.utils.ts → import/network.onnx.import-activations.utils.ts} +3 -3
  149. package/src/architecture/network/onnx/{network.onnx.import-flow.utils.ts → import/network.onnx.import-flow.utils.ts} +25 -5
  150. package/src/architecture/network/onnx/import/network.onnx.import-fused-recurrent.types.ts +101 -0
  151. package/src/architecture/network/onnx/{network.onnx.import-fused-recurrent.utils.ts → import/network.onnx.import-fused-recurrent.utils.ts} +10 -6
  152. package/src/architecture/network/onnx/import/network.onnx.import-orchestrators.types.ts +74 -0
  153. package/src/architecture/network/onnx/{network.onnx.import-orchestrators.utils.ts → import/network.onnx.import-orchestrators.utils.ts} +9 -7
  154. package/src/architecture/network/onnx/import/network.onnx.import-weights.types.ts +189 -0
  155. package/src/architecture/network/onnx/{network.onnx.import-weights.utils.ts → import/network.onnx.import-weights.utils.ts} +11 -7
  156. package/src/architecture/network/onnx/import/network.onnx.runtime-load.types.ts +52 -0
  157. package/src/architecture/network/onnx/{network.onnx.runtime-load.utils.ts → import/network.onnx.runtime-load.utils.ts} +2 -2
  158. package/src/architecture/network/onnx/network.onnx.layer-analysis.utils.ts +1 -1
  159. package/src/architecture/network/onnx/network.onnx.ts +20 -5
  160. package/src/architecture/network/onnx/network.onnx.utils.ts +32 -11
  161. package/src/architecture/network/onnx/network.onnx.utils.types.ts +172 -1195
  162. package/src/architecture/network/onnx/schema/README.md +120 -0
  163. package/src/architecture/network/onnx/schema/network.onnx.schema.types.ts +202 -0
  164. package/src/architecture/network/prune/README.md +453 -210
  165. package/src/architecture/network/prune/network.prune.evolutionary.utils.ts +1 -1
  166. package/src/architecture/network/prune/network.prune.regrowth.utils.ts +1 -1
  167. package/src/architecture/network/prune/network.prune.schedule.utils.ts +1 -1
  168. package/src/architecture/network/prune/network.prune.sparsity.utils.ts +1 -1
  169. package/src/architecture/network/prune/network.prune.utils.ts +16 -19
  170. package/src/architecture/network/remove/README.md +267 -132
  171. package/src/architecture/network/remove/network.remove.finalize.utils.ts +1 -1
  172. package/src/architecture/network/remove/network.remove.reconnect.utils.ts +1 -1
  173. package/src/architecture/network/remove/network.remove.snapshot.utils.ts +1 -1
  174. package/src/architecture/network/remove/network.remove.utils.ts +2 -2
  175. package/src/architecture/network/remove/network.remove.utils.types.ts +1 -1
  176. package/src/architecture/network/remove/network.remove.validation.utils.ts +1 -1
  177. package/src/architecture/network/runtime/README.md +332 -0
  178. package/src/architecture/network/runtime/network.runtime.controls.utils.ts +301 -0
  179. package/src/architecture/network/runtime/network.runtime.diagnostics.utils.ts +150 -0
  180. package/src/architecture/network/serialize/README.md +903 -359
  181. package/src/architecture/network/serialize/network.serialize.activation.utils.ts +1 -1
  182. package/src/architecture/network/serialize/network.serialize.public.utils.ts +28 -0
  183. package/src/architecture/network/serialize/network.serialize.runtime.utils.ts +1 -1
  184. package/src/architecture/network/serialize/network.serialize.utils.ts +1 -1
  185. package/src/architecture/network/slab/README.md +907 -492
  186. package/src/architecture/network/slab/network.slab.activate.utils.ts +1 -1
  187. package/src/architecture/network/slab/network.slab.adjacency.helpers.utils.ts +1 -1
  188. package/src/architecture/network/slab/network.slab.fast-path.helpers.utils.ts +2 -2
  189. package/src/architecture/network/slab/network.slab.rebuild.helpers.utils.ts +2 -2
  190. package/src/architecture/network/slab/network.slab.shared.helpers.utils.ts +1 -1
  191. package/src/architecture/network/slab/network.slab.utils.ts +3 -3
  192. package/src/architecture/network/slab/network.slab.utils.types.ts +1 -1
  193. package/src/architecture/network/slab/network.slab.view.utils.ts +1 -1
  194. package/src/architecture/network/standalone/README.md +401 -161
  195. package/src/architecture/network/standalone/network.standalone.utils.setup.ts +1 -1
  196. package/src/architecture/network/standalone/network.standalone.utils.ts +1 -1
  197. package/src/architecture/network/stats/README.md +152 -64
  198. package/src/architecture/network/stats/network.stats.test.utils.ts +1 -1
  199. package/src/architecture/network/stats/network.stats.utils.ts +5 -4
  200. package/src/architecture/network/topology/README.md +773 -280
  201. package/src/architecture/network/topology/network.topology.architecture.utils.ts +55 -1
  202. package/src/architecture/network/topology/network.topology.contract.utils.ts +78 -0
  203. package/src/architecture/network/topology/network.topology.factory.utils.ts +5 -1
  204. package/src/architecture/network/topology/network.topology.utils.ts +19 -3
  205. package/src/architecture/network/topology/network.topology.utils.types.ts +1 -1
  206. package/src/architecture/network/training/README.md +385 -158
  207. package/src/architecture/network/training/network.training.backprop.utils.ts +1 -1
  208. package/src/architecture/network/training/network.training.finalize.utils.ts +1 -1
  209. package/src/architecture/network/training/network.training.gradient-clip.utils.ts +1 -1
  210. package/src/architecture/network/training/network.training.loop.utils.ts +1 -1
  211. package/src/architecture/network/training/network.training.utils.ts +1 -1
  212. package/src/architecture/network/training/network.training.utils.types.ts +1 -1
  213. package/src/architecture/network.ts +18 -1744
  214. package/src/architecture/node/README.md +464 -0
  215. package/src/architecture/node/node.ts +1338 -0
  216. package/src/architecture/node.ts +4 -1317
  217. package/src/architecture/nodePool/README.md +78 -0
  218. package/src/architecture/nodePool/nodePool.ts +169 -0
  219. package/src/architecture/nodePool.ts +12 -150
  220. package/src/architecture/onnx.ts +7 -0
  221. package/src/methods/README.md +533 -982
  222. package/src/methods/activation/README.md +639 -0
  223. package/src/methods/{activation.ts → activation/activation.ts} +104 -11
  224. package/src/methods/{activation.utils.ts → activation/activation.utils.ts} +147 -1
  225. package/src/methods/activation/docs.order.json +7 -0
  226. package/src/methods/connection/README.md +97 -0
  227. package/src/methods/connection/connection.ts +100 -0
  228. package/src/methods/cost/README.md +509 -0
  229. package/src/methods/{cost.ts → cost/cost.ts} +56 -0
  230. package/src/methods/{cost.utils.ts → cost/cost.utils.ts} +1 -1
  231. package/src/methods/cost/docs.order.json +7 -0
  232. package/src/methods/crossover/README.md +52 -0
  233. package/src/methods/{crossover.ts → crossover/crossover.ts} +56 -0
  234. package/src/methods/docs.order.json +16 -0
  235. package/src/methods/gating/README.md +52 -0
  236. package/src/methods/gating/gating.ts +106 -0
  237. package/src/methods/methods.ts +58 -8
  238. package/src/methods/mutation/README.md +123 -0
  239. package/src/methods/{mutation.ts → mutation/mutation.ts} +87 -7
  240. package/src/methods/rate/README.md +490 -0
  241. package/src/methods/rate/docs.order.json +7 -0
  242. package/src/methods/{rate.ts → rate/rate.ts} +85 -4
  243. package/src/methods/{rate.utils.ts → rate/rate.utils.ts} +3 -3
  244. package/src/methods/selection/README.md +60 -0
  245. package/src/methods/{selection.ts → selection/selection.ts} +64 -0
  246. package/src/multithreading/README.md +281 -95
  247. package/src/multithreading/multi.ts +2 -2
  248. package/src/multithreading/workers/README.md +8 -6
  249. package/src/multithreading/workers/browser/README.md +21 -11
  250. package/src/multithreading/workers/node/README.md +52 -20
  251. package/src/neat/README.md +397 -10476
  252. package/src/neat/adaptive/README.md +281 -0
  253. package/src/neat/adaptive/acceptance/README.md +361 -0
  254. package/src/neat/adaptive/acceptance/adaptive.acceptance.ts +46 -0
  255. package/src/neat/{neat.adaptive.minimal-criterion.utils.ts → adaptive/acceptance/adaptive.minimal-criterion.utils.ts} +59 -5
  256. package/src/neat/{neat.adaptive.ts → adaptive/adaptive.ts} +103 -54
  257. package/src/neat/adaptive/complexity/README.md +519 -0
  258. package/src/neat/adaptive/complexity/adaptive.complexity.ts +42 -0
  259. package/src/neat/{neat.adaptive.complexity.utils.ts → adaptive/complexity/adaptive.complexity.utils.ts} +72 -10
  260. package/src/neat/{neat.adaptive.phases.utils.ts → adaptive/complexity/adaptive.phases.utils.ts} +27 -4
  261. package/src/neat/adaptive/core/README.md +587 -0
  262. package/src/neat/adaptive/core/adaptive.core.constants.ts +160 -0
  263. package/src/neat/adaptive/core/adaptive.core.ts +33 -0
  264. package/src/neat/{neat.adaptive.shared.ts → adaptive/core/adaptive.core.types.ts} +114 -134
  265. package/src/neat/adaptive/lineage/README.md +369 -0
  266. package/src/neat/{neat.adaptive.ancestor-uniqueness.utils.ts → adaptive/lineage/adaptive.ancestor-uniqueness.utils.ts} +59 -6
  267. package/src/neat/adaptive/lineage/adaptive.lineage.ts +49 -0
  268. package/src/neat/adaptive/mutation/README.md +754 -0
  269. package/src/neat/adaptive/mutation/adaptive.mutation.ts +51 -0
  270. package/src/neat/{neat.adaptive.mutation.utils.ts → adaptive/mutation/adaptive.mutation.utils.ts} +98 -4
  271. package/src/neat/{neat.adaptive.operator.utils.ts → adaptive/mutation/adaptive.operator.utils.ts} +30 -3
  272. package/src/neat/cache/README.md +156 -0
  273. package/src/neat/cache/cache.ts +79 -0
  274. package/src/neat/cache/core/README.md +151 -0
  275. package/src/neat/cache/core/cache.constants.ts +70 -0
  276. package/src/neat/cache/core/cache.core.ts +89 -0
  277. package/src/neat/compat/README.md +186 -0
  278. package/src/neat/compat/compat.ts +222 -0
  279. package/src/neat/compat/core/README.md +257 -0
  280. package/src/neat/{neat.compat.utils.ts → compat/core/compat.core.ts} +92 -102
  281. package/src/neat/compat/core/compat.types.ts +122 -0
  282. package/src/neat/diversity/README.md +160 -0
  283. package/src/neat/diversity/core/README.md +242 -0
  284. package/src/neat/diversity/core/diversity.core.ts +278 -0
  285. package/src/neat/diversity/core/diversity.types.ts +114 -0
  286. package/src/neat/diversity/diversity.ts +170 -0
  287. package/src/neat/evaluate/README.md +268 -0
  288. package/src/neat/evaluate/auto-distance/README.md +242 -0
  289. package/src/neat/evaluate/auto-distance/evaluate.auto-distance.ts +328 -0
  290. package/src/neat/evaluate/entropy-compat/README.md +128 -0
  291. package/src/neat/evaluate/entropy-compat/evaluate.entropy-compat.ts +163 -0
  292. package/src/neat/evaluate/entropy-sharing/README.md +147 -0
  293. package/src/neat/evaluate/entropy-sharing/evaluate.entropy-sharing.ts +179 -0
  294. package/src/neat/evaluate/evaluate.ts +158 -0
  295. package/src/neat/evaluate/fitness/README.md +90 -0
  296. package/src/neat/evaluate/fitness/evaluate.fitness.ts +104 -0
  297. package/src/neat/evaluate/novelty/README.md +281 -0
  298. package/src/neat/evaluate/novelty/evaluate.novelty.ts +348 -0
  299. package/src/neat/evaluate/objectives/README.md +112 -0
  300. package/src/neat/evaluate/objectives/evaluate.objectives.ts +121 -0
  301. package/src/neat/evaluate/shared/README.md +248 -0
  302. package/src/neat/evaluate/shared/evaluate.constants.ts +191 -0
  303. package/src/neat/{neat.evaluate.utils.types.ts → evaluate/shared/evaluate.types.ts} +112 -14
  304. package/src/neat/evaluate/speciation/README.md +138 -0
  305. package/src/neat/evaluate/speciation/evaluate.speciation.ts +144 -0
  306. package/src/neat/evolve/README.md +360 -0
  307. package/src/neat/evolve/adaptive/README.md +219 -0
  308. package/src/neat/evolve/adaptive/evolve.adaptive.utils.ts +324 -0
  309. package/src/neat/{neat.evolve.ts → evolve/evolve.ts} +204 -80
  310. package/src/neat/{neat.evolve.types.ts → evolve/evolve.types.ts} +92 -5
  311. package/src/neat/evolve/objectives/README.md +204 -0
  312. package/src/neat/{neat.evolve.objectives.utils.ts → evolve/objectives/evolve.objectives.utils.ts} +129 -24
  313. package/src/neat/evolve/offspring/README.md +145 -0
  314. package/src/neat/evolve/offspring/evolve.offspring.constants.ts +44 -0
  315. package/src/neat/evolve/offspring/evolve.offspring.utils.ts +163 -0
  316. package/src/neat/evolve/population/README.md +477 -0
  317. package/src/neat/{neat.evolve.population.utils.ts → evolve/population/evolve.population.utils.ts} +258 -40
  318. package/src/neat/evolve/runtime/README.md +188 -0
  319. package/src/neat/evolve/runtime/evolve.runtime.utils.ts +215 -0
  320. package/src/neat/evolve/speciation/README.md +227 -0
  321. package/src/neat/evolve/speciation/evolve.speciation.utils.ts +359 -0
  322. package/src/neat/evolve/telemetry/README.md +133 -0
  323. package/src/neat/evolve/telemetry/evolve.telemetry.utils.ts +143 -0
  324. package/src/neat/evolve/warnings/README.md +43 -0
  325. package/src/neat/evolve/warnings/evolve.warnings.utils.ts +48 -0
  326. package/src/neat/export/README.md +289 -0
  327. package/src/neat/{neat.export.ts → export/neat.export.ts} +127 -45
  328. package/src/neat/harness/README.md +136 -0
  329. package/src/neat/harness/neat.harness.types.ts +144 -0
  330. package/src/neat/helpers/README.md +232 -0
  331. package/src/neat/helpers/neat.helpers.ts +408 -0
  332. package/src/neat/init/README.md +140 -0
  333. package/src/neat/init/neat.init.ts +375 -0
  334. package/src/neat/lineage/README.md +141 -0
  335. package/src/neat/lineage/core/README.md +292 -0
  336. package/src/neat/lineage/core/lineage.core.ts +372 -0
  337. package/src/neat/lineage/core/lineage.types.ts +105 -0
  338. package/src/neat/lineage/lineage.ts +163 -0
  339. package/src/neat/maintenance/README.md +78 -0
  340. package/src/neat/maintenance/facade/README.md +143 -0
  341. package/src/neat/maintenance/facade/maintenance.facade.ts +168 -0
  342. package/src/neat/maintenance/maintenance.ts +80 -0
  343. package/src/neat/multiobjective/README.md +90 -0
  344. package/src/neat/multiobjective/archive/README.md +81 -0
  345. package/src/neat/multiobjective/archive/multiobjective.archive.ts +100 -0
  346. package/src/neat/multiobjective/category/README.md +208 -0
  347. package/src/neat/{neat.multiobjective.category.utils.ts → multiobjective/category/multiobjective.category.ts} +109 -18
  348. package/src/neat/multiobjective/crowding/README.md +516 -0
  349. package/src/neat/{neat.multiobjective.crowding.utils.ts → multiobjective/crowding/multiobjective.crowding.ts} +105 -3
  350. package/src/neat/multiobjective/dominance/README.md +426 -0
  351. package/src/neat/{neat.multiobjective.dominance.utils.ts → multiobjective/dominance/multiobjective.dominance.ts} +110 -4
  352. package/src/neat/multiobjective/fronts/README.md +222 -0
  353. package/src/neat/{neat.multiobjective.fronts.utils.ts → multiobjective/fronts/multiobjective.fronts.ts} +82 -4
  354. package/src/neat/multiobjective/metrics/README.md +140 -0
  355. package/src/neat/multiobjective/metrics/multiobjective.metrics.ts +153 -0
  356. package/src/neat/multiobjective/multiobjective.ts +140 -0
  357. package/src/neat/multiobjective/objectives/README.md +113 -0
  358. package/src/neat/{neat.multiobjective.objectives.utils.ts → multiobjective/objectives/multiobjective.objectives.ts} +42 -2
  359. package/src/neat/multiobjective/shared/README.md +85 -0
  360. package/src/neat/multiobjective/shared/multiobjective.types.ts +155 -0
  361. package/src/neat/mutation/README.md +282 -0
  362. package/src/neat/mutation/add-conn/README.md +271 -0
  363. package/src/neat/{neat.mutation.add-conn.utils.ts → mutation/add-conn/mutation.add-conn.ts} +87 -6
  364. package/src/neat/mutation/add-node/README.md +293 -0
  365. package/src/neat/{neat.mutation.add-node.utils.ts → mutation/add-node/mutation.add-node.ts} +97 -8
  366. package/src/neat/mutation/flow/README.md +379 -0
  367. package/src/neat/{neat.mutation.flow.utils.ts → mutation/flow/mutation.flow.ts} +147 -6
  368. package/src/neat/mutation/mutation.ts +482 -0
  369. package/src/neat/mutation/repair/README.md +497 -0
  370. package/src/neat/{neat.mutation.dead-ends.utils.ts → mutation/repair/mutation.dead-ends.ts} +75 -9
  371. package/src/neat/{neat.mutation.min-hidden.utils.ts → mutation/repair/mutation.min-hidden.ts} +73 -7
  372. package/src/neat/mutation/select/README.md +285 -0
  373. package/src/neat/{neat.mutation.select.utils.ts → mutation/select/mutation.select.ts} +102 -4
  374. package/src/neat/mutation/shared/README.md +109 -0
  375. package/src/neat/{neat.mutation.types.ts → mutation/shared/mutation.types.ts} +77 -4
  376. package/src/neat/neat.constants.ts +116 -7
  377. package/src/neat/neat.defaults.constants.ts +183 -0
  378. package/src/neat/neat.diversity.ts +5 -53
  379. package/src/neat/neat.lineage.ts +2 -134
  380. package/src/neat/neat.types.ts +59 -791
  381. package/src/neat/objectives/README.md +142 -0
  382. package/src/neat/objectives/core/README.md +288 -0
  383. package/src/neat/objectives/core/objectives.core.ts +273 -0
  384. package/src/neat/objectives/core/objectives.types.ts +63 -0
  385. package/src/neat/objectives/objectives.ts +175 -0
  386. package/src/neat/pruning/README.md +120 -0
  387. package/src/neat/pruning/core/README.md +420 -0
  388. package/src/neat/pruning/core/pruning.core.ts +410 -0
  389. package/src/neat/pruning/core/pruning.types.ts +104 -0
  390. package/src/neat/pruning/facade/README.md +121 -0
  391. package/src/neat/pruning/facade/pruning.facade.ts +124 -0
  392. package/src/neat/pruning/pruning.ts +192 -0
  393. package/src/neat/rng/README.md +323 -0
  394. package/src/neat/rng/core/README.md +503 -0
  395. package/src/neat/rng/core/rng.constants.ts +44 -0
  396. package/src/neat/rng/core/rng.core.ts +27 -0
  397. package/src/neat/rng/core/rng.types.ts +87 -0
  398. package/src/neat/rng/core/rng.utils.ts +238 -0
  399. package/src/neat/rng/facade/README.md +162 -0
  400. package/src/neat/rng/facade/rng.facade.ts +150 -0
  401. package/src/neat/rng/rng.ts +88 -0
  402. package/src/neat/selection/README.md +307 -0
  403. package/src/neat/selection/core/README.md +546 -0
  404. package/src/neat/selection/core/selection.core.ts +580 -0
  405. package/src/neat/selection/core/selection.types.ts +120 -0
  406. package/src/neat/selection/facade/README.md +180 -0
  407. package/src/neat/selection/facade/selection.facade.ts +177 -0
  408. package/src/neat/selection/selection.ts +255 -0
  409. package/src/neat/shared/README.md +361 -0
  410. package/src/neat/shared/neat.shared.types.ts +1120 -0
  411. package/src/neat/speciation/README.md +171 -0
  412. package/src/neat/speciation/assignment/README.md +274 -0
  413. package/src/neat/speciation/assignment/docs.order.json +12 -0
  414. package/src/neat/speciation/assignment/speciation.assignment.utils.ts +325 -0
  415. package/src/neat/speciation/history/README.md +254 -0
  416. package/src/neat/speciation/history/docs.order.json +12 -0
  417. package/src/neat/speciation/history/speciation.history.utils.ts +449 -0
  418. package/src/neat/speciation/shared/README.md +313 -0
  419. package/src/neat/speciation/shared/docs.order.json +31 -0
  420. package/src/neat/speciation/shared/speciation.shared.ts +393 -0
  421. package/src/neat/speciation/sharing/README.md +131 -0
  422. package/src/neat/speciation/sharing/speciation.sharing.utils.ts +287 -0
  423. package/src/neat/speciation/speciation.ts +243 -0
  424. package/src/neat/speciation/threshold/README.md +189 -0
  425. package/src/neat/speciation/threshold/speciation.threshold.utils.ts +310 -0
  426. package/src/neat/species/README.md +113 -0
  427. package/src/neat/species/core/README.md +92 -0
  428. package/src/neat/species/core/augmentation/README.md +60 -0
  429. package/src/neat/species/core/augmentation/species.core.augmentation.ts +109 -0
  430. package/src/neat/species/core/shared/README.md +92 -0
  431. package/src/neat/species/core/shared/species.core.shared.ts +154 -0
  432. package/src/neat/species/core/species.core.ts +92 -0
  433. package/src/neat/species/history/README.md +102 -0
  434. package/src/neat/species/history/context/README.md +86 -0
  435. package/src/neat/species/history/context/species.history.context.ts +112 -0
  436. package/src/neat/species/history/read/README.md +74 -0
  437. package/src/neat/species/history/read/species.history.read.ts +86 -0
  438. package/src/neat/species/history/species.history.ts +105 -0
  439. package/src/neat/species/species.ts +114 -0
  440. package/src/neat/species/stats/README.md +91 -0
  441. package/src/neat/species/stats/species.stats.ts +109 -0
  442. package/src/neat/telemetry/README.md +44 -0
  443. package/src/neat/telemetry/accessors/README.md +183 -0
  444. package/src/neat/telemetry/accessors/telemetry.accessors.ts +168 -0
  445. package/src/neat/telemetry/exports/README.md +600 -0
  446. package/src/neat/telemetry/exports/telemetry.exports.ts +549 -0
  447. package/src/neat/{neat.telemetry.exports.utils.ts → telemetry/exports/telemetry.exports.utils.ts} +76 -2
  448. package/src/neat/telemetry/facade/README.md +582 -0
  449. package/src/neat/telemetry/facade/archive/README.md +173 -0
  450. package/src/neat/telemetry/facade/archive/telemetry.facade.archive.ts +175 -0
  451. package/src/neat/telemetry/facade/buffer/README.md +141 -0
  452. package/src/neat/telemetry/facade/buffer/telemetry.facade.buffer.ts +132 -0
  453. package/src/neat/telemetry/facade/lineage/README.md +87 -0
  454. package/src/neat/telemetry/facade/lineage/telemetry.facade.lineage.ts +93 -0
  455. package/src/neat/telemetry/facade/novelty/README.md +79 -0
  456. package/src/neat/telemetry/facade/novelty/telemetry.facade.novelty.ts +70 -0
  457. package/src/neat/telemetry/facade/objectives/README.md +161 -0
  458. package/src/neat/telemetry/facade/objectives/telemetry.facade.objectives.ts +163 -0
  459. package/src/neat/telemetry/facade/operator-stats/README.md +62 -0
  460. package/src/neat/telemetry/facade/operator-stats/telemetry.facade.operator-stats.ts +63 -0
  461. package/src/neat/telemetry/facade/runtime/README.md +96 -0
  462. package/src/neat/telemetry/facade/runtime/telemetry.facade.runtime.ts +104 -0
  463. package/src/neat/telemetry/facade/species/README.md +165 -0
  464. package/src/neat/telemetry/facade/species/telemetry.facade.species.ts +171 -0
  465. package/src/neat/telemetry/facade/telemetry.facade.ts +555 -0
  466. package/src/neat/telemetry/metrics/README.md +1717 -0
  467. package/src/neat/{neat.telemetry.complexity.utils.ts → telemetry/metrics/telemetry.metrics.complexity.ts} +5 -2
  468. package/src/neat/{neat.telemetry.diversity.utils.ts → telemetry/metrics/telemetry.metrics.diversity.ts} +2 -2
  469. package/src/neat/{neat.telemetry.entropy.utils.ts → telemetry/metrics/telemetry.metrics.entropy.ts} +1 -1
  470. package/src/neat/{neat.telemetry.lineage.utils.ts → telemetry/metrics/telemetry.metrics.lineage.ts} +4 -4
  471. package/src/neat/{neat.telemetry.objectives.utils.ts → telemetry/metrics/telemetry.metrics.objectives.ts} +3 -3
  472. package/src/neat/{neat.telemetry.operator.utils.ts → telemetry/metrics/telemetry.metrics.operator.ts} +4 -1
  473. package/src/neat/{neat.telemetry.performance.utils.ts → telemetry/metrics/telemetry.metrics.performance.ts} +2 -2
  474. package/src/neat/{neat.telemetry.rng.utils.ts → telemetry/metrics/telemetry.metrics.rng.ts} +2 -2
  475. package/src/neat/{neat.telemetry.selection.utils.ts → telemetry/metrics/telemetry.metrics.selection.ts} +3 -3
  476. package/src/neat/telemetry/metrics/telemetry.metrics.ts +60 -0
  477. package/src/neat/telemetry/recorder/README.md +220 -0
  478. package/src/neat/{neat.telemetry.ts → telemetry/recorder/telemetry.recorder.ts} +91 -30
  479. package/src/neat/telemetry/runtime/README.md +106 -0
  480. package/src/neat/telemetry/runtime/telemetry.runtime.ts +119 -0
  481. package/src/neat/telemetry/telemetry.ts +46 -0
  482. package/src/neat/telemetry/types/README.md +85 -0
  483. package/src/neat/telemetry/types/telemetry.types.ts +121 -0
  484. package/src/neat/topology-intent/README.md +225 -0
  485. package/src/neat/topology-intent/neat.topology-intent.ts +305 -0
  486. package/src/neat.ts +710 -405
  487. package/src/utils/README.md +367 -114
  488. package/src/utils/memory.ts +74 -10
  489. package/src/utils/memory.utils.ts +77 -4
  490. package/test/architecture/node.test.ts +2 -2
  491. package/test/examples/README.md +168 -0
  492. package/test/examples/asciiMaze/README.md +263 -253
  493. package/test/examples/asciiMaze/asciiMaze.e2e.test.ts +4 -3
  494. package/test/examples/asciiMaze/browser-entry/README.md +316 -57
  495. package/test/examples/asciiMaze/browser-entry/browser-entry.globals.services.ts +7 -4
  496. package/test/examples/asciiMaze/browser-entry/browser-entry.host.services.ts +1 -1
  497. package/test/examples/asciiMaze/browser-entry/browser-entry.ts +16 -0
  498. package/test/examples/asciiMaze/browser-entry.ts +5 -0
  499. package/test/examples/asciiMaze/dashboardManager/README.md +182 -101
  500. package/test/examples/asciiMaze/dashboardManager/archive/README.md +25 -1
  501. package/test/examples/asciiMaze/dashboardManager/archive/dashboardManager.archive.services.ts +17 -0
  502. package/test/examples/asciiMaze/dashboardManager/dashboardManager.types.ts +1 -1
  503. package/test/examples/asciiMaze/dashboardManager/live/README.md +28 -1
  504. package/test/examples/asciiMaze/dashboardManager/live/dashboardManager.live.services.ts +22 -0
  505. package/test/examples/asciiMaze/dashboardManager/telemetry/README.md +60 -21
  506. package/test/examples/asciiMaze/dashboardManager/telemetry/dashboardManager.telemetry.services.ts +20 -0
  507. package/test/examples/asciiMaze/evolutionEngine/README.md +3471 -567
  508. package/test/examples/asciiMaze/evolutionEngine/engineState.types.ts +10 -3
  509. package/test/examples/asciiMaze/evolutionEngine/evolutionEngine.constants.ts +95 -0
  510. package/test/examples/asciiMaze/evolutionEngine/evolutionEngine.services.ts +93 -0
  511. package/test/examples/asciiMaze/evolutionEngine/evolutionEngine.types.ts +74 -5
  512. package/test/examples/asciiMaze/evolutionEngine/evolutionEngine.utils.ts +123 -0
  513. package/test/examples/asciiMaze/evolutionEngine/evolutionLoop.ts +58 -86
  514. package/test/examples/asciiMaze/evolutionEngine/neatConfiguration.ts +29 -17
  515. package/test/examples/asciiMaze/evolutionEngine/networkInspection.ts +19 -38
  516. package/test/examples/asciiMaze/evolutionEngine/optionsAndSetup.ts +96 -36
  517. package/test/examples/asciiMaze/evolutionEngine/populationDynamics.ts +194 -180
  518. package/test/examples/asciiMaze/evolutionEngine/populationPruning.ts +47 -54
  519. package/test/examples/asciiMaze/evolutionEngine/sampling.ts +18 -3
  520. package/test/examples/asciiMaze/evolutionEngine/telemetryMetrics.ts +24 -17
  521. package/test/examples/asciiMaze/evolutionEngine/trainingWarmStart.ts +83 -52
  522. package/test/examples/asciiMaze/evolutionEngine.ts +119 -231
  523. package/test/examples/asciiMaze/index.ts +30 -7
  524. package/test/examples/asciiMaze/mazeMovement/README.md +221 -108
  525. package/test/examples/asciiMaze/mazeMovement/finalization/README.md +44 -17
  526. package/test/examples/asciiMaze/mazeMovement/finalization/mazeMovement.finalization.ts +13 -1
  527. package/test/examples/asciiMaze/mazeMovement/policy/README.md +98 -46
  528. package/test/examples/asciiMaze/mazeMovement/policy/mazeMovement.policy.ts +13 -2
  529. package/test/examples/asciiMaze/mazeMovement/runtime/README.md +93 -43
  530. package/test/examples/asciiMaze/mazeMovement/runtime/mazeMovement.runtime.ts +13 -2
  531. package/test/examples/asciiMaze/mazeMovement/shaping/README.md +115 -44
  532. package/test/examples/asciiMaze/mazeMovement/shaping/mazeMovement.shaping.ts +13 -2
  533. package/test/examples/asciiMaze/mazeVisualization.ts +2 -2
  534. package/test/examples/flappy_bird/README.md +201 -136
  535. package/test/examples/flappy_bird/browser-entry/README.md +891 -553
  536. package/test/examples/flappy_bird/browser-entry/browser-entry.observation.utils.ts +0 -1
  537. package/test/examples/flappy_bird/browser-entry/browser-entry.ts +24 -0
  538. package/test/examples/flappy_bird/browser-entry/browser-entry.types.ts +20 -0
  539. package/test/examples/flappy_bird/browser-entry/browser-entry.worker.types.ts +1 -0
  540. package/test/examples/flappy_bird/browser-entry/docs.order.json +15 -0
  541. package/test/examples/flappy_bird/browser-entry/host/README.md +296 -134
  542. package/test/examples/flappy_bird/browser-entry/host/docs.order.json +15 -0
  543. package/test/examples/flappy_bird/browser-entry/host/host.ts +13 -9
  544. package/test/examples/flappy_bird/browser-entry/host/resize/README.md +278 -119
  545. package/test/examples/flappy_bird/browser-entry/host/resize/docs.order.json +10 -0
  546. package/test/examples/flappy_bird/browser-entry/host/resize/host.resize.service.ts +18 -3
  547. package/test/examples/flappy_bird/browser-entry/network-view/README.md +401 -190
  548. package/test/examples/flappy_bird/browser-entry/network-view/docs.order.json +12 -0
  549. package/test/examples/flappy_bird/browser-entry/network-view/network-view.ts +31 -53
  550. package/test/examples/flappy_bird/browser-entry/playback/README.md +844 -450
  551. package/test/examples/flappy_bird/browser-entry/playback/background/README.md +324 -117
  552. package/test/examples/flappy_bird/browser-entry/playback/background/docs.order.json +16 -0
  553. package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/README.md +935 -497
  554. package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/docs.order.json +22 -0
  555. package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.geometry.utils.ts +0 -3
  556. package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.pulse.utils.test.ts +2 -2
  557. package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.pulse.utils.ts +0 -2
  558. package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.services.ts +1 -4
  559. package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.ts +16 -3
  560. package/test/examples/flappy_bird/browser-entry/playback/background/playback.background.ts +16 -4
  561. package/test/examples/flappy_bird/browser-entry/playback/docs.order.json +23 -0
  562. package/test/examples/flappy_bird/browser-entry/playback/frame-render/README.md +490 -149
  563. package/test/examples/flappy_bird/browser-entry/playback/frame-render/docs.order.json +14 -0
  564. package/test/examples/flappy_bird/browser-entry/playback/frame-render/playback.frame-render.service.ts +19 -7
  565. package/test/examples/flappy_bird/browser-entry/playback/frame-render/playback.frame-render.services.ts +0 -23
  566. package/test/examples/flappy_bird/browser-entry/playback/playback.iteration.services.test.ts +136 -0
  567. package/test/examples/flappy_bird/browser-entry/playback/playback.iteration.services.ts +64 -0
  568. package/test/examples/flappy_bird/browser-entry/playback/playback.orchestration.types.ts +12 -0
  569. package/test/examples/flappy_bird/browser-entry/playback/playback.session.services.ts +1 -0
  570. package/test/examples/flappy_bird/browser-entry/playback/playback.ts +18 -1
  571. package/test/examples/flappy_bird/browser-entry/playback/snapshot/README.md +75 -16
  572. package/test/examples/flappy_bird/browser-entry/playback/snapshot/docs.order.json +7 -0
  573. package/test/examples/flappy_bird/browser-entry/playback/snapshot/playback.snapshot.services.ts +18 -0
  574. package/test/examples/flappy_bird/browser-entry/playback/trail/README.md +96 -28
  575. package/test/examples/flappy_bird/browser-entry/playback/trail/docs.order.json +7 -0
  576. package/test/examples/flappy_bird/browser-entry/playback/trail/playback.trail.history.services.ts +14 -2
  577. package/test/examples/flappy_bird/browser-entry/playback/trail/playback.trail.opacity.utils.ts +21 -0
  578. package/test/examples/flappy_bird/browser-entry/playback/worker-channel/README.md +79 -22
  579. package/test/examples/flappy_bird/browser-entry/playback/worker-channel/docs.order.json +8 -0
  580. package/test/examples/flappy_bird/browser-entry/playback/worker-channel/playback.worker-channel.types.ts +8 -0
  581. package/test/examples/flappy_bird/browser-entry/runtime/README.md +300 -130
  582. package/test/examples/flappy_bird/browser-entry/runtime/docs.order.json +14 -0
  583. package/test/examples/flappy_bird/browser-entry/runtime/runtime.evolution-loop.service.ts +52 -0
  584. package/test/examples/flappy_bird/browser-entry/runtime/runtime.ts +19 -6
  585. package/test/examples/flappy_bird/browser-entry/visualization/README.md +544 -249
  586. package/test/examples/flappy_bird/browser-entry/visualization/docs.order.json +13 -0
  587. package/test/examples/flappy_bird/browser-entry/visualization/visualization.ts +10 -0
  588. package/test/examples/flappy_bird/browser-entry/visualization/visualization.types.ts +4 -0
  589. package/test/examples/flappy_bird/browser-entry/worker-channel/README.md +198 -119
  590. package/test/examples/flappy_bird/browser-entry/worker-channel/docs.order.json +12 -0
  591. package/test/examples/flappy_bird/browser-entry/worker-channel/worker-channel.ts +6 -0
  592. package/test/examples/flappy_bird/constants/README.md +1865 -573
  593. package/test/examples/flappy_bird/constants/constants.runtime.ts +1 -1
  594. package/test/examples/flappy_bird/constants/constants.ts +33 -3
  595. package/test/examples/flappy_bird/constants/docs.order.json +23 -0
  596. package/test/examples/flappy_bird/environment/README.md +113 -40
  597. package/test/examples/flappy_bird/environment/docs.order.json +11 -0
  598. package/test/examples/flappy_bird/environment/environment.step.service.ts +0 -1
  599. package/test/examples/flappy_bird/environment/environment.types.ts +16 -0
  600. package/test/examples/flappy_bird/evaluation/README.md +159 -50
  601. package/test/examples/flappy_bird/evaluation/docs.order.json +13 -0
  602. package/test/examples/flappy_bird/evaluation/evaluation.rollout.service.ts +8 -0
  603. package/test/examples/flappy_bird/evaluation/evaluation.types.ts +19 -0
  604. package/test/examples/flappy_bird/evaluation/rollout/README.md +323 -173
  605. package/test/examples/flappy_bird/evaluation/rollout/docs.order.json +10 -0
  606. package/test/examples/flappy_bird/evaluation/rollout/evaluation.rollout.constants.ts +3 -2
  607. package/test/examples/flappy_bird/evaluation/rollout/evaluation.rollout.service.ts +23 -4
  608. package/test/examples/flappy_bird/evaluation/rollout/evaluation.rollout.services.ts +24 -3
  609. package/test/examples/flappy_bird/evaluation/rollout/evaluation.rollout.types.ts +8 -4
  610. package/test/examples/flappy_bird/evaluation/rollout/evaluation.rollout.utils.ts +3 -2
  611. package/test/examples/flappy_bird/flappy-evolution-worker/README.md +982 -469
  612. package/test/examples/flappy_bird/flappy-evolution-worker/docs.order.json +18 -0
  613. package/test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.constants.ts +42 -0
  614. package/test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.evolution.service.test.ts +50 -0
  615. package/test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.evolution.service.ts +5 -0
  616. package/test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.simulation.utils.ts +1 -1
  617. package/test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.ts +19 -1
  618. package/test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.types.ts +1 -0
  619. package/test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.warm-start.service.test.ts +71 -0
  620. package/test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.warm-start.service.ts +276 -19
  621. package/test/examples/flappy_bird/index.ts +15 -0
  622. package/test/examples/flappy_bird/simulation-shared/README.md +401 -241
  623. package/test/examples/flappy_bird/simulation-shared/docs.order.json +18 -0
  624. package/test/examples/flappy_bird/simulation-shared/observation/README.md +219 -93
  625. package/test/examples/flappy_bird/simulation-shared/observation/docs.order.json +8 -0
  626. package/test/examples/flappy_bird/simulation-shared/simulation-shared.types.ts +15 -0
  627. package/test/examples/flappy_bird/trainer/README.md +901 -183
  628. package/test/examples/flappy_bird/trainer/evaluation/README.md +163 -54
  629. package/test/examples/flappy_bird/trainer/evaluation/trainer.evaluation.service.ts +19 -1
  630. package/test/examples/flappy_bird/trainer/trainer.constants.ts +278 -33
  631. package/test/examples/flappy_bird/trainer/trainer.errors.ts +12 -0
  632. package/test/examples/flappy_bird/trainer/trainer.evaluation-plan.utils.ts +60 -0
  633. package/test/examples/flappy_bird/trainer/trainer.evaluation.service.ts +12 -0
  634. package/test/examples/flappy_bird/trainer/trainer.fitness.service.ts +20 -0
  635. package/test/examples/flappy_bird/trainer/trainer.loop.service.ts +20 -1
  636. package/test/examples/flappy_bird/trainer/trainer.report.service.services.ts +10 -1
  637. package/test/examples/flappy_bird/trainer/trainer.report.service.ts +9 -2
  638. package/test/examples/flappy_bird/trainer/trainer.reporting.utils.ts +11 -0
  639. package/test/examples/flappy_bird/trainer/trainer.selection.utils.ts +11 -0
  640. package/test/examples/flappy_bird/trainer/trainer.setup.service.ts +10 -1
  641. package/test/examples/flappy_bird/trainer/trainer.signals.service.ts +10 -1
  642. package/test/examples/flappy_bird/trainer/trainer.ts +65 -12
  643. package/test/examples/flappy_bird/trainer/trainer.types.ts +42 -7
  644. package/test/methods/activation.test.ts +1 -1
  645. package/test/methods/connection.test.ts +1 -1
  646. package/test/methods/cost.test.ts +1 -1
  647. package/test/methods/crossover.test.ts +1 -1
  648. package/test/methods/gating.test.ts +1 -1
  649. package/test/methods/mutation.test.ts +2 -2
  650. package/test/methods/rate.cosineWarmRestarts.test.ts +1 -1
  651. package/test/methods/rate.linearWarmupDecay.test.ts +1 -1
  652. package/test/methods/rate.reduceOnPlateau.test.ts +1 -1
  653. package/test/methods/rate.test.ts +1 -1
  654. package/test/methods/selection.test.ts +1 -1
  655. package/test/neat/neat.adaptive.ancestorUniq.cooldown.test.ts +3 -3
  656. package/test/neat/neat.adaptive.ancestorUniq.epsilon.test.ts +7 -7
  657. package/test/neat/neat.adaptive.ancestorUniq.lineagePressure.test.ts +7 -7
  658. package/test/neat/neat.adaptive.complexityBudget.connShrink.test.ts +2 -2
  659. package/test/neat/neat.adaptive.complexityBudget.growth.novelty.test.ts +2 -2
  660. package/test/neat/neat.adaptive.complexityBudget.minClamp.test.ts +2 -2
  661. package/test/neat/neat.adaptive.complexityBudget.test.ts +1 -1
  662. package/test/neat/neat.adaptive.complexityBudget.trend.test.ts +2 -2
  663. package/test/neat/neat.adaptive.minimalCriterion.rejection.test.ts +2 -2
  664. package/test/neat/neat.adaptive.mutation.amount.adapt.test.ts +3 -3
  665. package/test/neat/neat.adaptive.mutation.anneal.strategy.test.ts +3 -3
  666. package/test/neat/neat.adaptive.mutation.exploreLow.strategy.test.ts +3 -3
  667. package/test/neat/neat.adaptive.mutation.twotier.balance.test.ts +3 -3
  668. package/test/neat/neat.adaptive.mutation.twotier.fallback.single.test.ts +3 -3
  669. package/test/neat/neat.adaptive.operator.adaptation.decay.balance.test.ts +3 -3
  670. package/test/neat/neat.adaptive.operator.bandit.decay.test.ts +3 -3
  671. package/test/neat/neat.adaptive.phasedComplexity.toggle.test.ts +2 -2
  672. package/test/neat/neat.additional.coverage.test.ts +1 -1
  673. package/test/neat/neat.export.meta.fromjson.test.ts +1 -1
  674. package/test/neat/neat.export.state.rehydrate.test.ts +4 -3
  675. package/test/neat/neat.helpers.spawn.pool.test.ts +1 -1
  676. package/test/neat/neat.lineage.entropy.test.ts +1 -1
  677. package/test/neat/neat.lineage.inbreeding.test.ts +1 -1
  678. package/test/neat/neat.mutation.addconn.cycle.guard.test.ts +1 -1
  679. package/test/neat/neat.mutation.undefined.pool.test.ts +1 -1
  680. package/test/neat/neat.operator.phases.test.ts +1 -1
  681. package/test/neat/neat.spawn.add.test.ts +1 -1
  682. package/test/neat/neat.speciation.age.penalty.test.ts +2 -2
  683. package/test/neat/neat.speciation.assign.existing.test.ts +2 -2
  684. package/test/neat/neat.speciation.auto.tuning.jitter.test.ts +2 -2
  685. package/test/neat/neat.speciation.create.newSpecies.test.ts +2 -2
  686. package/test/neat/neat.speciation.fitnessSharing.equal.test.ts +5 -2
  687. package/test/neat/neat.speciation.fitnessSharing.kernel.test.ts +5 -2
  688. package/test/neat/neat.speciation.pid.threshold.clip.max.test.ts +2 -2
  689. package/test/neat/neat.speciation.pid.threshold.clip.min.test.ts +2 -2
  690. package/test/neat/neat.speciation.stagnation.prune.test.ts +5 -2
  691. package/test/neat/neat.species.history.fallbacks.test.ts +2 -2
  692. package/test/neat/neat.telemetry.advanced.test.ts +1 -1
  693. package/test/neat/neat.telemetry.fastmode.diversity.test.ts +5 -2
  694. package/test/neat/neat.telemetry.objective.events.test.ts +2 -2
  695. package/test/neat/neat.telemetry.select.entropy.cache.test.ts +1 -1
  696. package/test/network/network.deterministic.test.ts +0 -2
  697. package/test/network/network.evolve.multithread.branches.test.ts +0 -2
  698. package/test/network/network.gating.removal.test.ts +1 -1
  699. package/test/network/network.mutate.additional.test.ts +1 -1
  700. package/test/network/network.mutate.edgecases.test.ts +1 -1
  701. package/test/network/network.mutate.test.ts +1 -1
  702. package/test/network/structure.serialization.test.ts +60 -98
  703. package/test/utils/test-helpers.ts +1 -1
  704. package/.github/skills/solid-split-playbook/SKILL.md +0 -220
  705. package/plans/Flappy_Evolution_Worker_Documentation_Pass.md +0 -58
  706. package/plans/asciiMaze_SOLID_split.done.md +0 -130
  707. package/plans/flappy_bird_SOLID_split.done.md +0 -67
  708. package/src/methods/connection.ts +0 -31
  709. package/src/methods/gating.ts +0 -43
  710. package/src/neat/neat.adaptive.utils.ts +0 -7
  711. package/src/neat/neat.cache.ts +0 -1
  712. package/src/neat/neat.cache.utils.ts +0 -12
  713. package/src/neat/neat.compat.ts +0 -103
  714. package/src/neat/neat.diversity.utils.ts +0 -359
  715. package/src/neat/neat.evaluate.auto-distance.utils.ts +0 -210
  716. package/src/neat/neat.evaluate.constants.utils.ts +0 -42
  717. package/src/neat/neat.evaluate.entropy-compat.utils.ts +0 -67
  718. package/src/neat/neat.evaluate.entropy-sharing.utils.ts +0 -78
  719. package/src/neat/neat.evaluate.fitness.utils.ts +0 -48
  720. package/src/neat/neat.evaluate.novelty.utils.ts +0 -225
  721. package/src/neat/neat.evaluate.objectives.utils.ts +0 -50
  722. package/src/neat/neat.evaluate.speciation.utils.ts +0 -35
  723. package/src/neat/neat.evaluate.ts +0 -90
  724. package/src/neat/neat.evaluate.utils.ts +0 -9
  725. package/src/neat/neat.evolve.adaptive.utils.ts +0 -224
  726. package/src/neat/neat.evolve.offspring.constants.ts +0 -8
  727. package/src/neat/neat.evolve.offspring.utils.ts +0 -107
  728. package/src/neat/neat.evolve.runtime.utils.ts +0 -128
  729. package/src/neat/neat.evolve.speciation.utils.ts +0 -251
  730. package/src/neat/neat.evolve.telemetry.utils.ts +0 -39
  731. package/src/neat/neat.evolve.utils.ts +0 -10
  732. package/src/neat/neat.evolve.warnings.utils.ts +0 -14
  733. package/src/neat/neat.harness.types.ts +0 -35
  734. package/src/neat/neat.helpers.ts +0 -316
  735. package/src/neat/neat.lineage.utils.ts +0 -387
  736. package/src/neat/neat.multiobjective.archive.utils.ts +0 -59
  737. package/src/neat/neat.multiobjective.metrics.utils.ts +0 -65
  738. package/src/neat/neat.multiobjective.ts +0 -93
  739. package/src/neat/neat.multiobjective.utils.ts +0 -10
  740. package/src/neat/neat.multiobjective.utils.types.ts +0 -112
  741. package/src/neat/neat.mutation.ts +0 -335
  742. package/src/neat/neat.mutation.utils.ts +0 -6
  743. package/src/neat/neat.novelty.utils.ts +0 -17
  744. package/src/neat/neat.objectives.ts +0 -133
  745. package/src/neat/neat.objectives.utils.ts +0 -195
  746. package/src/neat/neat.pruning.ts +0 -129
  747. package/src/neat/neat.pruning.utils.ts +0 -375
  748. package/src/neat/neat.rng.constants.ts +0 -18
  749. package/src/neat/neat.rng.ts +0 -2
  750. package/src/neat/neat.rng.utils.ts +0 -158
  751. package/src/neat/neat.selection.ts +0 -142
  752. package/src/neat/neat.selection.utils.ts +0 -470
  753. package/src/neat/neat.speciation.ts +0 -136
  754. package/src/neat/neat.speciation.utils.ts +0 -926
  755. package/src/neat/neat.species.history.utils.ts +0 -13
  756. package/src/neat/neat.species.ts +0 -114
  757. package/src/neat/neat.species.utils.ts +0 -156
  758. package/src/neat/neat.telemetry.accessors.utils.ts +0 -71
  759. package/src/neat/neat.telemetry.buffer.utils.ts +0 -58
  760. package/src/neat/neat.telemetry.exports.ts +0 -452
  761. package/src/neat/neat.telemetry.types.ts +0 -51
  762. package/src/neat/neat.telemetry.utils.ts +0 -12
  763. package/src/neat/neat.topology-intent.utils.ts +0 -160
  764. package/srcLint.md +0 -185
  765. package/test/benchmarks/asciiMaze.micro.bench.ts +0 -0
  766. /package/.github/skills/{solid-split-playbook → solid-split}/assets/split-plan-template.md +0 -0
@@ -17,6 +17,7 @@
17
17
 
18
18
  import type { Neat, Network } from '../../../../src/neataptic';
19
19
  import type { EngineState } from './engineState';
20
+ import type { NetworkConnection, NetworkNode } from './evolutionEngine.types';
20
21
  import { drawFastRandom, resolveRngParameters } from './rngAndTiming';
21
22
 
22
23
  /** Weight initialization minimum value for warm-start connections. */
@@ -35,8 +36,20 @@ const OUTPUT_BIAS_CLAMP = 5;
35
36
  */
36
37
  const PRUNE_BULK_INSERTION_MAX = 64;
37
38
 
38
- /** Empty shared vector reused when a fallback empty array is required. */
39
- const EMPTY_VECTOR: Array<Record<string, unknown>> = [];
39
+ interface OutputBiasStats {
40
+ mean: number;
41
+ std: number;
42
+ }
43
+
44
+ interface NetworkWithWarmStartSurface {
45
+ nodes?: NetworkNode[];
46
+ connections?: NetworkConnection[];
47
+ connect: (from: NetworkNode, to: NetworkNode, weight?: number) => unknown;
48
+ }
49
+
50
+ interface NetworkWithOutputBiasStats extends NetworkWithWarmStartSurface {
51
+ _outputBiasStats?: OutputBiasStats;
52
+ }
40
53
 
41
54
  /**
42
55
  * Parameters for applying simplify pruning to a population.
@@ -132,8 +145,10 @@ export const applyCompassWarmStart = ({
132
145
  // Step 1: defensive guards
133
146
  if (!network) return;
134
147
 
135
- const nodesRef = network.nodes ?? EMPTY_VECTOR;
136
- const connectionsRef = network.connections ?? EMPTY_VECTOR;
148
+ const runtimeNetwork = network as unknown as NetworkWithWarmStartSurface;
149
+
150
+ const nodesRef = runtimeNetwork.nodes ?? [];
151
+ const connectionsRef = runtimeNetwork.connections ?? [];
137
152
 
138
153
  // Determine counts for input/output nodes using the engine helper that populates
139
154
  // the pooled node index buffer with indices by type.
@@ -160,9 +175,7 @@ export const applyCompassWarmStart = ({
160
175
  if (!inputNode || !outputNode) continue; // nothing to wire for this direction
161
176
 
162
177
  // Find existing connection input→output (linear scan; avoids allocations)
163
- // Type assertion: conn is a connection object with from/to properties
164
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
165
- let existingConn: any = undefined;
178
+ let existingConn: NetworkConnection | undefined;
166
179
  for (let ci = 0, cLen = connectionsRef.length; ci < cLen; ci++) {
167
180
  const conn = connectionsRef[ci];
168
181
  if (conn.from === inputNode && conn.to === outputNode) {
@@ -174,7 +187,8 @@ export const applyCompassWarmStart = ({
174
187
  // Small random initialization in [wInitMin, wInitMin + wInitRange)
175
188
  const initWeight =
176
189
  drawFastRandom(state, randomParameters) * W_INIT_RANGE + W_INIT_MIN;
177
- if (!existingConn) network.connect(inputNode, outputNode, initWeight);
190
+ if (!existingConn)
191
+ runtimeNetwork.connect(inputNode, outputNode, initWeight);
178
192
  else existingConn.weight = initWeight;
179
193
  }
180
194
 
@@ -190,9 +204,7 @@ export const applyCompassWarmStart = ({
190
204
  if (!outNode) continue;
191
205
 
192
206
  // Find existing connection compass→outNode
193
- // Type assertion: conn is a connection object with from/to properties
194
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
195
- let existingConn: any = undefined;
207
+ let existingConn: NetworkConnection | undefined;
196
208
  for (let ci = 0, cLen = connectionsRef.length; ci < cLen; ci++) {
197
209
  const conn = connectionsRef[ci];
198
210
  if (conn.from === compassNode && conn.to === outNode) {
@@ -202,7 +214,8 @@ export const applyCompassWarmStart = ({
202
214
  }
203
215
 
204
216
  const baseWeight = OUTPUT_BIAS_BASE + outIndex * OUTPUT_BIAS_STEP;
205
- if (!existingConn) network.connect(compassNode, outNode, baseWeight);
217
+ if (!existingConn)
218
+ runtimeNetwork.connect(compassNode, outNode, baseWeight);
206
219
  else existingConn.weight = baseWeight;
207
220
  }
208
221
  } catch {
@@ -239,7 +252,8 @@ export const centerOutputBiases = ({
239
252
  network,
240
253
  }: CenterOutputBiasesParams): void => {
241
254
  try {
242
- const nodeList = network?.nodes ?? EMPTY_VECTOR;
255
+ const runtimeNetwork = network as unknown as NetworkWithOutputBiasStats;
256
+ const nodeList = runtimeNetwork.nodes ?? [];
243
257
  const totalNodeCount = nodeList.length | 0;
244
258
  if (totalNodeCount === 0) return;
245
259
 
@@ -274,9 +288,7 @@ export const centerOutputBiases = ({
274
288
  }
275
289
 
276
290
  // Step 4: Persist stats for optional telemetry.
277
- // Type assertion: dynamic property assignment for telemetry data
278
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
279
- (network as any)._outputBiasStats = { mean: meanBias, std: stdBias };
291
+ runtimeNetwork._outputBiasStats = { mean: meanBias, std: stdBias };
280
292
  } catch {
281
293
  // swallow errors (best-effort maintenance routine)
282
294
  }
@@ -312,9 +324,7 @@ const pruneWeakConnectionsForGenome = (
312
324
  if (rawFraction <= 0) return; // nothing requested
313
325
 
314
326
  // Step 2: Collect enabled connections.
315
- // Type assertion: connections array elements have connection properties
316
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
317
- const allConnections = genome.connections as any[];
327
+ const allConnections = genome.connections as unknown as NetworkConnection[];
318
328
  let candidateConnections = collectEnabledConnections(allConnections);
319
329
  const enabledConnectionCount = candidateConnections.length;
320
330
  if (enabledConnectionCount === 0) return; // no work
@@ -357,18 +367,16 @@ const pruneWeakConnectionsForGenome = (
357
367
  * const enabled = collectEnabledConnections(genome.connections);
358
368
  * const stableCopy = enabled.slice(); // only if retention needed
359
369
  */
360
- // Type assertion: connections are dynamic objects checked at runtime
361
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
362
- const collectEnabledConnections = (connectionsSource: any[]): any[] => {
370
+ const collectEnabledConnections = (
371
+ connectionsSource: NetworkConnection[],
372
+ ): NetworkConnection[] => {
363
373
  // Step 1: Validate input & fast exit.
364
374
  if (!Array.isArray(connectionsSource) || connectionsSource.length === 0)
365
375
  return [];
366
376
 
367
377
  // Step 2: Reset pooled buffer (reusing the scratch array from state; needs access via closure or parameter).
368
378
  // Note: This is a simplified version; in practice this would access state.scratch.connectionCandidates
369
- // Type assertion: buffer holds connection objects
370
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
371
- const candidateBuffer: any[] = [];
379
+ const candidateBuffer: NetworkConnection[] = [];
372
380
 
373
381
  // Step 3: Linear scan & collect enabled connections.
374
382
  for (
@@ -401,12 +409,9 @@ const collectEnabledConnections = (connectionsSource: any[]): any[] => {
401
409
  * sortCandidatesByStrategy(candidates, 'weakRecurrentPreferred');
402
410
  */
403
411
  const sortCandidatesByStrategy = (
404
- // Type assertion: connections are dynamic objects with weight/gater properties
405
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
406
- candidateConnections: any[],
412
+ candidateConnections: NetworkConnection[],
407
413
  strategyKey: string,
408
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
409
- ): any[] => {
414
+ ): NetworkConnection[] => {
410
415
  // Step 1: Validate input.
411
416
  if (!Array.isArray(candidateConnections) || candidateConnections.length === 0)
412
417
  return candidateConnections;
@@ -471,9 +476,7 @@ const sortCandidatesByStrategy = (
471
476
  * insertionSortByAbsWeight(buf, 0, 10);
472
477
  */
473
478
  const insertionSortByAbsWeight = (
474
- // Type assertion: buffer holds connection objects with weight property
475
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
476
- connectionsBuffer: any[],
479
+ connectionsBuffer: NetworkConnection[],
477
480
  startIndex: number,
478
481
  endExclusive: number,
479
482
  ): void => {
@@ -491,17 +494,17 @@ const insertionSortByAbsWeight = (
491
494
  for (let scanIndex = from + 1; scanIndex < to; scanIndex++) {
492
495
  // 2.1: Extract the candidate and compute its absolute weight (treat non-finite as 0).
493
496
  const candidate = connectionsBuffer[scanIndex];
497
+ const candidateWeight = Number(candidate?.weight);
494
498
  const candidateAbs = Math.abs(
495
- candidate && Number.isFinite(candidate.weight) ? candidate.weight : 0,
499
+ Number.isFinite(candidateWeight) ? candidateWeight : 0,
496
500
  );
497
501
 
498
502
  // 2.2: Shift larger elements one slot to the right to make room for the candidate.
499
503
  let writePos = scanIndex - 1;
500
504
  while (writePos >= from) {
501
505
  const probe = connectionsBuffer[writePos];
502
- const probeAbs = Math.abs(
503
- probe && Number.isFinite(probe.weight) ? probe.weight : 0,
504
- );
506
+ const probeWeight = Number(probe?.weight);
507
+ const probeAbs = Math.abs(Number.isFinite(probeWeight) ? probeWeight : 0);
505
508
  // Preserve stability: stop when probe <= candidate (no swap for equals).
506
509
  if (probeAbs <= candidateAbs) break;
507
510
  connectionsBuffer[writePos + 1] = probe;
@@ -529,9 +532,7 @@ const insertionSortByAbsWeight = (
529
532
  * disableSmallestEnabledConnections(candidates, 5);
530
533
  */
531
534
  const disableSmallestEnabledConnections = (
532
- // Type assertion: buffer holds connection objects with enabled property
533
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
534
- candidateConnections: any[],
535
+ candidateConnections: NetworkConnection[],
535
536
  pruneCount: number,
536
537
  ): void => {
537
538
  // Step 0: Defensive validation & normalization.
@@ -563,9 +564,7 @@ const disableSmallestEnabledConnections = (
563
564
  candidateConnections
564
565
  .slice(0, activeEnabledCount) // sort only active slice; slice() to avoid comparing undefined tail beyond active
565
566
  .sort(
566
- // Type assertion: comparing connection objects with weight property
567
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
568
- (firstConnection: any, secondConnection: any) =>
567
+ (firstConnection, secondConnection) =>
569
568
  Math.abs(firstConnection?.weight || 0) -
570
569
  Math.abs(secondConnection?.weight || 0),
571
570
  )
@@ -588,16 +587,12 @@ const disableSmallestEnabledConnections = (
588
587
  while (remainingToDisable > 0 && activeSliceLength > 0) {
589
588
  // 3a. Find index of current minimum |weight| in [0, activeSliceLength).
590
589
  let minIndex = 0;
591
- let minAbsWeight = Math.abs(
592
- candidateConnections[0] && Number.isFinite(candidateConnections[0].weight)
593
- ? candidateConnections[0].weight
594
- : 0,
595
- );
590
+ const firstWeight = Number(candidateConnections[0]?.weight);
591
+ let minAbsWeight = Math.abs(Number.isFinite(firstWeight) ? firstWeight : 0);
596
592
  for (let probeIndex = 1; probeIndex < activeSliceLength; probeIndex++) {
597
593
  const probe = candidateConnections[probeIndex];
598
- const probeAbs = Math.abs(
599
- probe && Number.isFinite(probe.weight) ? probe.weight : 0,
600
- );
594
+ const probeWeight = Number(probe?.weight);
595
+ const probeAbs = Math.abs(Number.isFinite(probeWeight) ? probeWeight : 0);
601
596
  if (probeAbs < minAbsWeight) {
602
597
  minAbsWeight = probeAbs;
603
598
  minIndex = probeIndex;
@@ -633,9 +628,7 @@ const disableSmallestEnabledConnections = (
633
628
  */
634
629
  const collectNodeIndicesByType = (
635
630
  state: EngineState,
636
- // Type assertion: nodes are dynamic objects with type property
637
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
638
- nodes: any[] | undefined,
631
+ nodes: NetworkNode[] | undefined,
639
632
  nodeType: string,
640
633
  ): number => {
641
634
  // Step 1: Defensive validation & fast exit.
@@ -5,6 +5,10 @@
5
5
  * 1. Provide allocation-light array sampling utilities that reuse the shared `EngineState` scratch pools.
6
6
  * 2. Expose history helpers that mirror the façade behaviour while keeping pooled buffers centralised.
7
7
  * 3. Centralise RNG parameter resolution for sampling paths to keep behaviour deterministic under shared state.
8
+ *
9
+ * These helpers look small, but they sit under several hot paths. The main job
10
+ * is not "random choice" in the abstract; it is random choice without quietly
11
+ * reintroducing per-generation array churn into long-running experiments.
8
12
  */
9
13
 
10
14
  import type { EngineState } from './engineState.types';
@@ -14,6 +18,10 @@ import { MazeUtils } from '../mazeUtils';
14
18
  /**
15
19
  * Sample `sampleCount` items (with replacement) from `source` into the pooled scratch buffer.
16
20
  *
21
+ * This helper is for callers that want an ephemeral array view immediately. The
22
+ * returned array reuses shared scratch storage, so callers should copy it first
23
+ * if they need the contents to survive another helper call.
24
+ *
17
25
  * Steps:
18
26
  * 1. Validate the input array and normalise `sampleCount` to an integer.
19
27
  * 2. Grow the shared `sampleResultBuffer` to the next power of two when capacity is insufficient.
@@ -62,6 +70,10 @@ export const sampleArray = <T>(
62
70
  /**
63
71
  * Sample up to `sampleCount` items (with replacement) into the shared `samplePool` buffer.
64
72
  *
73
+ * Compared with `sampleArray`, this form is for callers that only need a count
74
+ * plus access to the pooled buffer on `state.scratch.samplePool`. That avoids
75
+ * one more logical array object on the hottest paths.
76
+ *
65
77
  * Steps:
66
78
  * 1. Validate inputs and ensure the pooled buffer exists.
67
79
  * 2. Grow the buffer by powers of two when more capacity is required.
@@ -91,9 +103,9 @@ export const sampleIntoScratch = <T>(
91
103
  if (sourceLength === 0 || normalisedCount <= 0) return 0;
92
104
 
93
105
  const scratch = state.scratch;
94
- // Type assertion: pool holds T[] at runtime but declared as Array<unknown> for reuse flexibility
95
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
96
- let pooledBuffer = scratch.samplePool as any as T[];
106
+ // The shared pool is declared as Array<unknown> because different helpers reuse it
107
+ // for different element types across generations.
108
+ let pooledBuffer = scratch.samplePool as T[];
97
109
  if (!Array.isArray(pooledBuffer)) {
98
110
  pooledBuffer = [];
99
111
  scratch.samplePool = pooledBuffer;
@@ -141,6 +153,9 @@ export const sampleIntoScratch = <T>(
141
153
  /**
142
154
  * Sample from a suffix of `source` starting at `segmentStart` into the pooled buffer.
143
155
  *
156
+ * The common use case is "sample from the non-elite tail" or some later slice
157
+ * of a population without first allocating `source.slice(segmentStart)`.
158
+ *
144
159
  * Steps:
145
160
  * 1. Clamp indices and ensure there is a non-empty segment.
146
161
  * 2. Ensure the pooled buffer can store the requested sample count.
@@ -6,7 +6,7 @@
6
6
  * internal error is swallowed so that logging never impacts the evolution loop.
7
7
  */
8
8
  import type { Neat, Network } from '../../../../src/neataptic';
9
- import type { GenomeDetailed } from '../../../../src/neat/neat.types';
9
+ import type { GenomeDetailed } from '../../../../src/neat/shared/neat.shared.types';
10
10
  import type { EngineState } from './engineState.types';
11
11
  import type {
12
12
  EvolutionGenomeLike,
@@ -84,6 +84,10 @@ type TelemetryWriter = (message: string) => void;
84
84
  interface GenerationResult {
85
85
  /** Path taken by the agent (array of [x, y] coordinate pairs). */
86
86
  path?: ReadonlyArray<[number, number]>;
87
+ /** Progress score accumulated during the run. */
88
+ progress?: number;
89
+ /** Fraction of the maze saturation reached during the run. */
90
+ saturationFraction?: number;
87
91
  }
88
92
 
89
93
  /**
@@ -524,12 +528,10 @@ const computeExplorationStats = (
524
528
  }
525
529
 
526
530
  // Step 2: Choose the most efficient distinct-coordinate counter based on path length.
527
- let unique = 0;
528
- if (pathLength < 32) {
529
- unique = countDistinctCoordinatesTiny(state, path!, pathLength);
530
- } else {
531
- unique = countDistinctCoordinatesHashed(state, path!, pathLength);
532
- }
531
+ const unique =
532
+ pathLength < 32
533
+ ? countDistinctCoordinatesTiny(state, path!, pathLength)
534
+ : countDistinctCoordinatesHashed(state, path!, pathLength);
533
535
 
534
536
  // Step 3: Aggregate the summary metrics while keeping floating-point ratios guarded.
535
537
  return {
@@ -707,12 +709,16 @@ const computeDiversityMetrics = (
707
709
  let weightMean = 0;
708
710
  let weightM2 = 0;
709
711
  let enabledWeights = 0;
710
- const sampleBuffer = state.scratch.samplePool ?? EMPTY_VECTOR;
711
712
  for (let sampleIndex = 0; sampleIndex < sampledLength; sampleIndex++) {
712
- const genome = sampleBuffer[sampleIndex] as GenomeDetailed | undefined;
713
- const connections = Array.isArray(genome?.connections)
714
- ? genome.connections
715
- : EMPTY_VECTOR;
713
+ const genome = state.scratch.samplePool[sampleIndex] as
714
+ | GenomeDetailed
715
+ | undefined;
716
+ const connections = (
717
+ Array.isArray(genome?.connections) ? genome.connections : EMPTY_VECTOR
718
+ ) as Array<{
719
+ enabled?: boolean;
720
+ weight?: number;
721
+ }>;
716
722
  for (
717
723
  let connectionIndex = 0;
718
724
  connectionIndex < connections.length;
@@ -859,15 +865,16 @@ const computeLogitStats = ({
859
865
 
860
866
  resetLogitScratch(state, actionDimension, reducedTelemetry);
861
867
 
862
- let entropySum = 0;
868
+ const entropySum = reducedTelemetry
869
+ ? accumulateLogitStatsReduced(state, recent, actionDimension)
870
+ : actionDimension === 4
871
+ ? accumulateLogitStatsUnrolled4(state, recent, recent.length)
872
+ : accumulateLogitStatsGeneric(state, recent, actionDimension);
863
873
  if (reducedTelemetry) {
864
- entropySum = accumulateLogitStatsReduced(state, recent, actionDimension);
865
874
  finalizeLogitStatsReduced(state, actionDimension, recent.length);
866
875
  } else if (actionDimension === 4) {
867
- entropySum = accumulateLogitStatsUnrolled4(state, recent, recent.length);
868
876
  finalizeLogitStatsFull(state, actionDimension, recent.length);
869
877
  } else {
870
- entropySum = accumulateLogitStatsGeneric(state, recent, actionDimension);
871
878
  finalizeLogitStatsFull(state, actionDimension, recent.length);
872
879
  }
873
880
 
@@ -1356,7 +1363,7 @@ const computeDecisionStability = (
1356
1363
  for (let rowIndex = 0; rowIndex < sequenceLength; rowIndex++) {
1357
1364
  const row = recent[rowIndex];
1358
1365
  if (!row || row.length === 0) continue;
1359
- let argmax = 0;
1366
+ let argmax: number;
1360
1367
  if (unrolled && row.length >= 4) {
1361
1368
  let bestValue = row[0] ?? 0;
1362
1369
  argmax = 0;
@@ -3,14 +3,21 @@
3
3
  *
4
4
  * Lamarckian warm-start and population pretraining subsystem.
5
5
  *
6
+ * This module is the part of the ASCII Maze engine that briefly steps outside
7
+ * pure neuroevolution and asks a pragmatic question: can a small amount of
8
+ * supervised guidance give the population a better starting shape before the
9
+ * main search pressure takes over again?
10
+ *
6
11
  * Responsibilities:
7
- * - Build supervised training datasets for compass-guided navigation
8
- * - Apply Lamarckian backpropagation training to populations
9
- * - Adjust output biases after training to maintain exploration
10
- * - Orchestrate conditional warm-start pretraining with buffer management
12
+ * - Build a tiny curriculum-style supervised dataset for compass-guided motion
13
+ * - Apply bounded Lamarckian backpropagation to whole populations
14
+ * - Re-center output biases after training so exploration does not collapse
15
+ * - Orchestrate optional warm-start passes without polluting the main loop
11
16
  *
12
- * All functions are pure/side-effect-free except where explicitly documented.
13
- * Mutations are limited to NEAT population networks and engine scratch buffers.
17
+ * The important design constraint is restraint. These helpers are not trying to
18
+ * solve the maze with backprop. They are trying to give evolution a better
19
+ * first draft while preserving the example's core identity as an evolutionary
20
+ * system.
14
21
  *
15
22
  * @module trainingWarmStart
16
23
  */
@@ -19,12 +26,44 @@ import type { Neat, Network } from '../../../../src/neataptic';
19
26
  import { methods } from '../../../../src/neataptic';
20
27
  import type { EngineState, RngCacheParameters } from './engineState.types';
21
28
  import { initialiseTelemetryScratch } from './engineState';
29
+ import type { NetworkNode } from './evolutionEngine.types';
22
30
  import { drawFastRandom, readHighResolutionTime } from './rngAndTiming';
23
31
  import { sampleArray } from './sampling';
24
32
 
25
33
  /** Empty array constant for defensive fallbacks. */
26
34
  const EMPTY_VEC: readonly never[] = [];
27
35
 
36
+ /** Small supervised case used during Lamarckian warm-start. */
37
+ interface LamarckianTrainingCase {
38
+ input: number[];
39
+ output: number[];
40
+ }
41
+
42
+ /** The warm-start path trains ordinary runtime networks; this alias keeps intent explicit. */
43
+ type TrainableNetwork = Network;
44
+
45
+ /**
46
+ * Narrow NEAT view used by the warm-start helpers.
47
+ *
48
+ * These helpers only need population access and a couple of option fields, so
49
+ * they avoid depending on the entire engine-facing driver surface.
50
+ */
51
+ type WarmStartNeatLike = Neat & {
52
+ population: TrainableNetwork[];
53
+ };
54
+
55
+ /** Callback used when a helper needs to write node indices of a specific role into scratch. */
56
+ type NodeIndexCollector = (nodes: NetworkNode[], nodeType: string) => number;
57
+
58
+ /** Best-effort post-training hook applied to one network at a time. */
59
+ type WarmStartNetworkCallback = (network: TrainableNetwork) => void;
60
+
61
+ /** Population-wide warm-start hook used by the public orchestration helper. */
62
+ type PretrainPopulationCallback = (
63
+ neat: Neat,
64
+ trainingSet: LamarckianTrainingCase[],
65
+ ) => void;
66
+
28
67
  /**
29
68
  * Build the supervised training set used for Lamarckian warm-start training.
30
69
  *
@@ -190,8 +229,10 @@ export const buildLamarckianTrainingSet = (
190
229
  /**
191
230
  * Adjust output node biases after training to maintain exploration diversity.
192
231
  *
193
- * This heuristic prevents trained networks from collapsing into deterministic behavior
194
- * by centering output biases (subtracting mean) and optionally scaling when variance is low.
232
+ * This heuristic exists because short supervised bursts can make the action
233
+ * head too confident too early. By re-centering output biases and nudging very
234
+ * low-variance heads back outward, the engine keeps exploration pressure alive
235
+ * after warm-start training instead of letting one action dominate forever.
195
236
  *
196
237
  * Steps:
197
238
  * 1. Collect output node biases into scratch buffer
@@ -223,15 +264,15 @@ export const adjustOutputBiasesAfterTraining = (
223
264
  DEFAULT_STD_ADJUST_MULT: number;
224
265
  },
225
266
  scratchNodeIdx: Int32Array,
226
- // Type assertion: helper function working with dynamic node arrays
227
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
228
- getNodeIndicesByType: (nodes: any[], nodeType: string) => number,
267
+ getNodeIndicesByType: NodeIndexCollector,
229
268
  ): void => {
230
269
  try {
231
270
  // Step 1: Early exit when no network or no nodes exist.
232
271
  if (!network) return;
233
272
 
234
- const nodesRef = network.nodes ?? EMPTY_VEC;
273
+ const nodesRef: NetworkNode[] = Array.isArray(network.nodes)
274
+ ? (network.nodes as unknown as NetworkNode[])
275
+ : [];
235
276
  const outputNodeCount = getNodeIndicesByType(nodesRef, 'output');
236
277
  if (outputNodeCount <= 0) return;
237
278
 
@@ -280,10 +321,14 @@ export const adjustOutputBiasesAfterTraining = (
280
321
  * Pretrain the population using a small supervised dataset and apply warm-start heuristics.
281
322
  *
282
323
  * Behaviour & contract:
283
- * - Runs a short supervised training pass (backprop) on each network in `neat.population`
284
- * - Applies lightweight warm-start heuristics after training: compass wiring and output bias centering
285
- * - Errors are isolated per-network: a failing network does not abort the overall pretrain step
286
- * - This helper is allocation-light and does not create sizable temporary buffers
324
+ * - Runs a short supervised training pass on each network in `neat.population`
325
+ * - Treats the training set as a biasing hint, not as a replacement for later evolution
326
+ * - Applies lightweight warm-start heuristics after training: compass wiring
327
+ * and output-bias centering
328
+ * - Isolates failures per network so one bad trainer state does not abort the
329
+ * rest of the population
330
+ * - Stays allocation-light so warm-start remains cheap enough to use as a
331
+ * tactical assist instead of a second training regime
287
332
  *
288
333
  * Steps:
289
334
  * 1. Validate inputs and obtain `population` (fast-exit on empty populations)
@@ -307,9 +352,7 @@ export const adjustOutputBiasesAfterTraining = (
307
352
  */
308
353
  export const pretrainPopulationWarmStart = (
309
354
  neat: Neat,
310
- // Type assertion: training dataset structure
311
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
312
- lamarckianTrainingSet: any[],
355
+ lamarckianTrainingSet: LamarckianTrainingCase[],
313
356
  constants: {
314
357
  PRETRAIN_MAX_ITER: number;
315
358
  PRETRAIN_BASE_ITER: number;
@@ -318,22 +361,17 @@ export const pretrainPopulationWarmStart = (
318
361
  DEFAULT_PRETRAIN_MOMENTUM: number;
319
362
  DEFAULT_TRAIN_BATCH_SMALL: number;
320
363
  },
321
- // Type assertion: helper functions working with networks
322
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
323
- applyCompassWarmStart: (network: any) => void,
324
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
325
- centerOutputBiases: (network: any) => void,
364
+ applyCompassWarmStart: WarmStartNetworkCallback,
365
+ centerOutputBiases: WarmStartNetworkCallback,
326
366
  ): void => {
327
367
  // Step 1: Defensive validation & fast exit.
328
368
  if (!neat) return;
329
- const population = neat.population ?? EMPTY_VEC;
369
+ const population = (neat as WarmStartNeatLike).population ?? EMPTY_VEC;
330
370
  if (!Array.isArray(population) || population.length === 0) return;
331
371
 
332
372
  // Step 2: Iterate population and apply supervised training per network (best-effort).
333
373
  for (let networkIndex = 0; networkIndex < population.length; networkIndex++) {
334
- // Type assertion: network from population array
335
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
336
- const network: any = population[networkIndex];
374
+ const network = population[networkIndex];
337
375
  try {
338
376
  if (!network || typeof network.train !== 'function') continue; // skip non-trainable entries
339
377
 
@@ -376,9 +414,11 @@ export const pretrainPopulationWarmStart = (
376
414
  /**
377
415
  * Apply Lamarckian backpropagation training to the entire population with optional profiling.
378
416
  *
379
- * Runs a bounded supervised training pass on each network in the population, optionally
380
- * downsampling the training set for efficiency. Collects gradient norm statistics and
381
- * applies bias adjustment heuristics to maintain exploration after training.
417
+ * Runs a bounded supervised training pass on each network in the population,
418
+ * optionally downsampling the training set for efficiency. The intent is to
419
+ * "tilt" the policy landscape toward obviously sensible moves before the main
420
+ * evolutionary loop takes over, while still measuring and logging enough to see
421
+ * whether the warm-start is becoming too aggressive or too weak.
382
422
  *
383
423
  * Steps:
384
424
  * 1. Validate inputs & early exits
@@ -418,9 +458,7 @@ export const pretrainPopulationWarmStart = (
418
458
  */
419
459
  export const applyLamarckianTraining = (
420
460
  neat: Neat,
421
- // Type assertion: training dataset structure
422
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
423
- trainingSet: any[],
461
+ trainingSet: LamarckianTrainingCase[],
424
462
  iterations: number,
425
463
  sampleSize: number | undefined,
426
464
  safeWrite: (msg: string) => void,
@@ -433,9 +471,7 @@ export const applyLamarckianTraining = (
433
471
  DEFAULT_TRAIN_MOMENTUM: number;
434
472
  DEFAULT_TRAIN_BATCH_SMALL: number;
435
473
  },
436
- // Type assertion: helper function working with networks
437
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
438
- adjustOutputBiases: (network: any) => void,
474
+ adjustOutputBiases: WarmStartNetworkCallback,
439
475
  ): number => {
440
476
  // Step 1: Validate inputs & early exits.
441
477
  if (
@@ -460,9 +496,7 @@ export const applyLamarckianTraining = (
460
496
  // Step 4: Iterate networks performing a bounded training pass.
461
497
  let gradientNormSum = 0;
462
498
  let gradientNormSamples = 0;
463
- // Type assertion: population is Network array from Neat
464
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
465
- const populationRef = neat.population as any[];
499
+ const populationRef = (neat as WarmStartNeatLike).population;
466
500
 
467
501
  for (const network of populationRef) {
468
502
  if (!network) continue; // defensive guard for sparse arrays
@@ -483,9 +517,7 @@ export const applyLamarckianTraining = (
483
517
 
484
518
  // 4.3: Collect optional training stats (use optional chaining to avoid errors).
485
519
  try {
486
- // Type assertion: accessing optional training stats method
487
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
488
- const stats = (network as any).getTrainingStats?.();
520
+ const stats = network.getTrainingStats?.();
489
521
  const gradNorm = stats?.gradNorm;
490
522
  if (Number.isFinite(gradNorm)) {
491
523
  gradientNormSum += gradNorm;
@@ -545,13 +577,9 @@ export const applyLamarckianTraining = (
545
577
  */
546
578
  export const warmStartPopulationIfNeeded = (
547
579
  neat: Neat,
548
- // Type assertion: training dataset structure
549
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
550
- trainingSet: any[],
580
+ trainingSet: LamarckianTrainingCase[],
551
581
  state: EngineState,
552
- // Type assertion: helper function for population pretraining
553
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
554
- pretrainPopulation: (neat: any, trainingSet: any[]) => void,
582
+ pretrainPopulation: PretrainPopulationCallback,
555
583
  ): void => {
556
584
  try {
557
585
  // Step 1: Fast-guard invalid inputs – nothing to do when no data or driver.
@@ -561,9 +589,12 @@ export const warmStartPopulationIfNeeded = (
561
589
 
562
590
  // Step 2: Best-effort ensure pooled buffers exist and have capacity.
563
591
  // Determine a sensible sizing target (prefer driver configured popSize when available).
564
- const configuredPopulationSize = Number.isFinite(neat?.options?.popSize)
565
- ? Math.max(0, Math.floor(neat.options.popSize))
566
- : Math.max(8, trainingSet.length);
592
+ const neatRef = neat as WarmStartNeatLike;
593
+ const rawPopSize = neatRef.options?.popSize;
594
+ const configuredPopulationSize =
595
+ typeof rawPopSize === 'number' && Number.isFinite(rawPopSize)
596
+ ? Math.max(0, Math.floor(rawPopSize))
597
+ : Math.max(8, trainingSet.length);
567
598
 
568
599
  // Helper: next power-of-two >= n
569
600
  const nextPowerOfTwo = (n: number) =>