@reicek/neataptic-ts 0.1.26 → 0.1.27

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 (123) hide show
  1. package/.github/agents/boundary-mapper.agent.md +13 -8
  2. package/.github/agents/docs-scout.agent.md +14 -9
  3. package/.github/agents/plan-scout.agent.md +11 -6
  4. package/.github/agents/solid-split.agent.md +33 -17
  5. package/.github/copilot-instructions.md +100 -88
  6. package/.github/skills/educational-docs/SKILL.md +90 -40
  7. package/.github/skills/educational-docs/assets/mermaid-diagram-playbook.md +141 -141
  8. package/.github/skills/educational-docs/assets/visual-style-guide.md +1 -1
  9. package/.github/skills/plan-alignment/SKILL.md +1 -1
  10. package/.github/skills/solid-split/SKILL.md +54 -35
  11. package/.github/skills/solid-split/assets/docs-checklist.md +1 -1
  12. package/.github/skills/solid-split/assets/split-plan-template.md +41 -12
  13. package/.github/skills/solid-split/assets/split-workflow-checklist.md +4 -1
  14. package/.github/skills/test-fix-workflow/SKILL.md +12 -7
  15. package/.github/skills/trace-analyzer-extension/SKILL.md +1 -1
  16. package/.github/skills/trace-analyzer-extension/assets/extension-checklist.md +1 -1
  17. package/.github/skills/trace-analyzer-extension/references/analyzer-extension-workflow.md +1 -1
  18. package/.github/skills/trace-audit-reporting/SKILL.md +1 -1
  19. package/.github/skills/trace-audit-reporting/assets/performance-report-template.md +1 -1
  20. package/.github/skills/trace-audit-reporting/references/trace-analysis-workflow.md +1 -1
  21. package/.github/skills/tracker-handoff/SKILL.md +53 -5
  22. package/package.json +1 -1
  23. package/plans/Flappy_Bird_Folder_Documentation_Pass.logs.md +42 -0
  24. package/plans/Flappy_Bird_Folder_Documentation_Pass.md +22 -104
  25. package/plans/README.md +6 -2
  26. package/plans/Roadmap.md +35 -31
  27. package/plans/analyze-trace-solid-split.logs.md +35 -0
  28. package/plans/analyze-trace-solid-split.plans.md +21 -52
  29. package/plans/architecture-solid-split.logs.md +44 -0
  30. package/plans/architecture-solid-split.plans.md +20 -653
  31. package/plans/asciiMaze-typescript-repair.logs.md +35 -0
  32. package/plans/asciiMaze-typescript-repair.plans.md +30 -36
  33. package/plans/generate-docs-solid-split.logs.md +36 -0
  34. package/plans/generate-docs-solid-split.plans.md +21 -73
  35. package/plans/methods-docs.logs.md +37 -0
  36. package/plans/methods-docs.plans.md +22 -183
  37. package/plans/methods-solid-split.logs.md +41 -0
  38. package/plans/methods-solid-split.plans.md +23 -65
  39. package/plans/neat-docs.logs.md +38 -0
  40. package/plans/neat-docs.plans.md +21 -63
  41. package/plans/neat-test-surface-repair.logs.md +38 -0
  42. package/plans/neat-test-surface-repair.plans.md +24 -24
  43. package/plans/readme-first-section-pass.logs.md +63 -0
  44. package/plans/readme-first-section-pass.plans.md +42 -0
  45. package/plans/render-docs-html-solid-split.logs.md +36 -0
  46. package/plans/render-docs-html-solid-split.plans.md +20 -54
  47. package/plans/src-no-explicit-any-cleanup.logs.md +39 -0
  48. package/plans/src-no-explicit-any-cleanup.plans.md +23 -161
  49. package/plans/utils-docs.logs.md +37 -0
  50. package/plans/utils-docs.plans.md +20 -35
  51. package/src/README.md +88 -22
  52. package/src/architecture/README.md +94 -17
  53. package/src/architecture/activationArrayPool/README.md +53 -0
  54. package/src/architecture/activationArrayPool/activationArrayPool.ts +53 -0
  55. package/src/architecture/layer/README.md +94 -5
  56. package/src/architecture/layer/layer.ts +94 -5
  57. package/src/architecture/network/README.md +85 -14
  58. package/src/architecture/network/activate/README.md +301 -213
  59. package/src/architecture/network/activate/docs.order.json +9 -0
  60. package/src/architecture/network/activate/network.activate.utils.ts +90 -0
  61. package/src/architecture/network/connect/README.md +80 -3
  62. package/src/architecture/network/connect/docs.order.json +9 -0
  63. package/src/architecture/network/connect/network.connect.utils.ts +79 -0
  64. package/src/architecture/network/deterministic/README.md +96 -12
  65. package/src/architecture/network/deterministic/docs.order.json +10 -0
  66. package/src/architecture/network/deterministic/network.deterministic.utils.ts +90 -0
  67. package/src/architecture/network/evolve/README.md +286 -228
  68. package/src/architecture/network/evolve/docs.order.json +11 -0
  69. package/src/architecture/network/evolve/network.evolve.utils.ts +59 -0
  70. package/src/architecture/network/gating/README.md +58 -16
  71. package/src/architecture/network/gating/docs.order.json +9 -0
  72. package/src/architecture/network/gating/network.gating.utils.ts +43 -0
  73. package/src/architecture/network/genetic/README.md +75 -36
  74. package/src/architecture/network/genetic/docs.order.json +10 -0
  75. package/src/architecture/network/genetic/network.genetic.utils.ts +53 -17
  76. package/src/architecture/network/network.ts +91 -46
  77. package/src/architecture/network/standalone/README.md +309 -285
  78. package/src/architecture/network/standalone/docs.order.json +13 -0
  79. package/src/architecture/network/standalone/network.standalone.utils.ts +51 -28
  80. package/src/architecture/network.ts +94 -17
  81. package/src/architecture/nodePool/README.md +53 -0
  82. package/src/architecture/nodePool/nodePool.ts +53 -0
  83. package/src/methods/README.md +80 -34
  84. package/src/methods/methods.ts +80 -34
  85. package/src/methods/mutation/README.md +39 -93
  86. package/src/methods/mutation/mutation.ts +58 -0
  87. package/src/multithreading/README.md +114 -14
  88. package/src/multithreading/docs.order.json +5 -0
  89. package/src/multithreading/multi.ts +103 -7
  90. package/src/multithreading/types.ts +6 -1
  91. package/src/multithreading/workers/README.md +72 -2
  92. package/src/multithreading/workers/browser/README.md +39 -0
  93. package/src/multithreading/workers/browser/testworker.ts +40 -0
  94. package/src/multithreading/workers/node/README.md +50 -11
  95. package/src/multithreading/workers/node/docs.order.json +4 -0
  96. package/src/multithreading/workers/node/testworker.ts +43 -3
  97. package/src/multithreading/workers/workers.ts +36 -1
  98. package/src/neat/README.md +230 -152
  99. package/src/neat/adaptive/core/README.md +99 -42
  100. package/src/neat/adaptive/core/adaptive.core.ts +71 -14
  101. package/src/neat/adaptive/core/docs.order.json +8 -0
  102. package/src/neat/docs.order.json +9 -0
  103. package/src/neat/lineage/README.md +118 -16
  104. package/src/neat/lineage/lineage.ts +115 -13
  105. package/src/neat/neat.defaults.constants.ts +91 -13
  106. package/src/neat.ts +86 -20
  107. package/src/utils/README.md +71 -21
  108. package/src/utils/memory.ts +69 -19
  109. package/test/examples/asciiMaze/browser-entry/README.md +81 -8
  110. package/test/examples/asciiMaze/browser-entry/browser-entry.ts +81 -8
  111. package/test/examples/asciiMaze/dashboardManager/README.md +68 -4
  112. package/test/examples/asciiMaze/dashboardManager/dashboardManager.ts +68 -4
  113. package/test/examples/asciiMaze/evolutionEngine/README.md +1259 -1174
  114. package/test/examples/asciiMaze/evolutionEngine/docs.order.json +10 -0
  115. package/test/examples/asciiMaze/evolutionEngine/evolutionEngine.types.ts +87 -0
  116. package/test/examples/asciiMaze/mazeMovement/README.md +81 -4
  117. package/test/examples/asciiMaze/mazeMovement/mazeMovement.ts +81 -4
  118. package/test/examples/flappy_bird/browser-entry/README.md +64 -21
  119. package/test/examples/flappy_bird/browser-entry/browser-entry.ts +64 -21
  120. package/test/examples/flappy_bird/flappy-evolution-worker/README.md +98 -10
  121. package/test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.ts +98 -10
  122. package/test/examples/flappy_bird/simulation-shared/README.md +88 -4
  123. package/test/examples/flappy_bird/simulation-shared/simulation-shared.types.ts +88 -4
@@ -1,3 +1,46 @@
1
+ /**
2
+ * Connection-gating utilities and gate-aware repair helpers for network edits.
3
+ *
4
+ * Gating is the lightweight way to let one node decide how strongly another
5
+ * connection should matter right now. That makes this chapter about more than
6
+ * a simple `gate()` setter. It also owns the awkward structural case where a
7
+ * hidden node is removed and the network tries to preserve useful gated
8
+ * behavior by reconnecting predecessor and successor nodes, then reassigning
9
+ * preserved gaters onto the new bridge connections.
10
+ *
11
+ * The split inside this folder follows those two jobs. `gate.utils` keeps
12
+ * ordinary gate and ungate bookkeeping small and predictable. `remove.utils`
13
+ * handles the more invasive bridge-repair flow used during gate-aware hidden
14
+ * node removal. The shared types file only carries temporary collections used
15
+ * during that repair work; it is not the right chapter intro.
16
+ *
17
+ * ```mermaid
18
+ * flowchart LR
19
+ * Gater[Gater node activation] --> Modulate[Modulate connection gain]
20
+ * Modulate --> Target[Target node input sum]
21
+ * Remove[Remove hidden node] --> Bridge[Create bridge connections]
22
+ * Bridge --> Preserve[Reassign preserved gaters]
23
+ * ```
24
+ *
25
+ * A useful mental model is that gating changes when a connection is
26
+ * influential, while bridge repair tries to preserve where information can
27
+ * still travel after topology surgery. Keeping both concerns together makes
28
+ * the public surface easier to learn because callers usually encounter them in
29
+ * the same network-editing workflows.
30
+ *
31
+ * Example: attach a hidden node as a gater for one connection.
32
+ *
33
+ * ```ts
34
+ * network.gate(hiddenNode, connection);
35
+ * ```
36
+ *
37
+ * Example: later remove that modulation and return the connection to static
38
+ * weighting.
39
+ *
40
+ * ```ts
41
+ * network.ungate(connection);
42
+ * ```
43
+ */
1
44
  import type Network from '../../network/network';
2
45
  import Node from '../../node';
3
46
  import Connection from '../../connection';
@@ -1,52 +1,59 @@
1
1
  # architecture/network/genetic
2
2
 
3
- Canonical threshold used for random binary parent/gene choice.
4
-
5
- ## architecture/network/genetic/network.genetic.utils.types.ts
6
-
7
- ### DEFAULT_REENABLE_PROBABILITY
8
-
9
- Default probability for re-enabling disabled genes during crossover.
10
-
11
- ### FIRST_INDEX
12
-
13
- First element index used when reading newly created connections.
3
+ Network-level crossover boundary for recombining two compatible parent
4
+ graphs into one offspring.
5
+
6
+ This chapter is the genetic shelf of `architecture/network/`: the place
7
+ where structure is inherited rather than mutated from scratch. It answers a
8
+ practical question that shows up during neuroevolution and testing alike: if
9
+ two networks already expose the same input and output contract, how should a
10
+ child network mix their node and connection genes without losing a runnable
11
+ topology?
12
+
13
+ The helpers below split that answer into setup, selection, and
14
+ materialization. Setup decides how large the offspring can be and which
15
+ parent has inheritance priority. Selection chooses overlapping and disjoint
16
+ genes. Materialization turns the chosen genes back into a concrete `Network`
17
+ instance and restores gating when the chosen gater still exists. That keeps
18
+ the public `crossOver()` surface compact while the README can still teach the
19
+ full inheritance flow.
20
+
21
+ ```mermaid
22
+ flowchart LR
23
+ ParentA[Parent A] --> Context[Build crossover context]
24
+ ParentB[Parent B] --> Context
25
+ Context --> Nodes[Assign offspring nodes]
26
+ Nodes --> Genes[Choose connection genes]
27
+ Genes --> Offspring[Materialize offspring network]
28
+ ```
14
29
 
15
- ### NO_GATER_INDEX
30
+ This is inspired by NEAT-style crossover, but it stays intentionally
31
+ pragmatic. Innovation identity is derived from endpoint indices, node
32
+ alignment depends on current ordering, and the goal is a predictable,
33
+ inspectable operator for this repo's runtime rather than a full historical
34
+ innovation tracker.
16
35
 
17
- Sentinel index representing that no gater node is assigned.
36
+ For compact background reading on the wider idea, see Wikipedia
37
+ contributors,
38
+ [Crossover (genetic algorithm)](https://en.wikipedia.org/wiki/Crossover_(genetic_algorithm)).
39
+ The implementation here specializes that idea to graph-shaped neural
40
+ networks with gating and disabled genes.
18
41
 
19
- ### PARENT_COMPATIBILITY_ERROR_MESSAGE
42
+ Example: create one offspring using ordinary fitness-biased inheritance.
20
43
 
21
- Shared compatibility error message for crossover parent validation.
22
-
23
- ### RANDOM_BINARY_SELECTION_THRESHOLD
24
-
25
- Canonical threshold used for random binary parent/gene choice.
44
+ ```ts
45
+ const child = crossOver(parentA, parentB);
46
+ ```
26
47
 
27
- ### RandomGenerator
48
+ Example: force symmetric inheritance when you want experimentation rather
49
+ than fitter-parent bias.
28
50
 
29
51
  ```ts
30
- RandomGenerator(): number
52
+ const exploratoryChild = crossOver(parentA, parentB, true);
31
53
  ```
32
54
 
33
- Shared random generator signature for genetic operators.
34
-
35
55
  ## architecture/network/genetic/network.genetic.utils.ts
36
56
 
37
- Genetic operator: NEAT‑style crossover (legacy merge operator removed).
38
-
39
- This module now focuses solely on producing recombinant offspring via {@link crossOver}.
40
- The previous experimental `Network.merge` flow has been removed to reduce maintenance
41
- surface area and avoid implying a misleading sequential-composition guarantee.
42
-
43
- Design notes:
44
- - The implementation favors deterministic, inspectable orchestration at the top level.
45
- - Gene-selection details are delegated to setup/materialization helpers so the public
46
- crossover API stays compact and predictable.
47
- - The resulting offspring preserves the same input/output interface as both parents,
48
- which keeps downstream evaluation and training pipelines compatible.
49
-
50
57
  ### crossOver
51
58
 
52
59
  ```ts
@@ -1004,3 +1011,35 @@ Parameters:
1004
1011
  - `traversalContext` - - Traversal context.
1005
1012
 
1006
1013
  Returns: Endpoint context or undefined.
1014
+
1015
+ ## architecture/network/genetic/network.genetic.utils.types.ts
1016
+
1017
+ Canonical threshold used for random binary parent/gene choice.
1018
+
1019
+ ### DEFAULT_REENABLE_PROBABILITY
1020
+
1021
+ Default probability for re-enabling disabled genes during crossover.
1022
+
1023
+ ### FIRST_INDEX
1024
+
1025
+ First element index used when reading newly created connections.
1026
+
1027
+ ### NO_GATER_INDEX
1028
+
1029
+ Sentinel index representing that no gater node is assigned.
1030
+
1031
+ ### PARENT_COMPATIBILITY_ERROR_MESSAGE
1032
+
1033
+ Shared compatibility error message for crossover parent validation.
1034
+
1035
+ ### RANDOM_BINARY_SELECTION_THRESHOLD
1036
+
1037
+ Canonical threshold used for random binary parent/gene choice.
1038
+
1039
+ ### RandomGenerator
1040
+
1041
+ ```ts
1042
+ RandomGenerator(): number
1043
+ ```
1044
+
1045
+ Shared random generator signature for genetic operators.
@@ -0,0 +1,10 @@
1
+ {
2
+ "introFile": "network.genetic.utils.ts",
3
+ "fileOrder": [
4
+ "network.genetic.utils.ts",
5
+ "network.genetic.setup.utils.ts",
6
+ "network.genetic.selection.utils.ts",
7
+ "network.genetic.materialize.utils.ts",
8
+ "network.genetic.utils.types.ts"
9
+ ]
10
+ }
@@ -1,3 +1,56 @@
1
+ /**
2
+ * Network-level crossover boundary for recombining two compatible parent
3
+ * graphs into one offspring.
4
+ *
5
+ * This chapter is the genetic shelf of `architecture/network/`: the place
6
+ * where structure is inherited rather than mutated from scratch. It answers a
7
+ * practical question that shows up during neuroevolution and testing alike: if
8
+ * two networks already expose the same input and output contract, how should a
9
+ * child network mix their node and connection genes without losing a runnable
10
+ * topology?
11
+ *
12
+ * The helpers below split that answer into setup, selection, and
13
+ * materialization. Setup decides how large the offspring can be and which
14
+ * parent has inheritance priority. Selection chooses overlapping and disjoint
15
+ * genes. Materialization turns the chosen genes back into a concrete `Network`
16
+ * instance and restores gating when the chosen gater still exists. That keeps
17
+ * the public `crossOver()` surface compact while the README can still teach the
18
+ * full inheritance flow.
19
+ *
20
+ * ```mermaid
21
+ * flowchart LR
22
+ * ParentA[Parent A] --> Context[Build crossover context]
23
+ * ParentB[Parent B] --> Context
24
+ * Context --> Nodes[Assign offspring nodes]
25
+ * Nodes --> Genes[Choose connection genes]
26
+ * Genes --> Offspring[Materialize offspring network]
27
+ * ```
28
+ *
29
+ * This is inspired by NEAT-style crossover, but it stays intentionally
30
+ * pragmatic. Innovation identity is derived from endpoint indices, node
31
+ * alignment depends on current ordering, and the goal is a predictable,
32
+ * inspectable operator for this repo's runtime rather than a full historical
33
+ * innovation tracker.
34
+ *
35
+ * For compact background reading on the wider idea, see Wikipedia
36
+ * contributors,
37
+ * [Crossover (genetic algorithm)](https://en.wikipedia.org/wiki/Crossover_(genetic_algorithm)).
38
+ * The implementation here specializes that idea to graph-shaped neural
39
+ * networks with gating and disabled genes.
40
+ *
41
+ * Example: create one offspring using ordinary fitness-biased inheritance.
42
+ *
43
+ * ```ts
44
+ * const child = crossOver(parentA, parentB);
45
+ * ```
46
+ *
47
+ * Example: force symmetric inheritance when you want experimentation rather
48
+ * than fitter-parent bias.
49
+ *
50
+ * ```ts
51
+ * const exploratoryChild = crossOver(parentA, parentB, true);
52
+ * ```
53
+ */
1
54
  import type Network from '../../network/network';
2
55
  import { materializeOffspringConnections } from './network.genetic.materialize.utils';
3
56
  import {
@@ -7,23 +60,6 @@ import {
7
60
  createNodeBuildContext,
8
61
  } from './network.genetic.setup.utils';
9
62
 
10
- /**
11
- * Genetic operator: NEAT‑style crossover (legacy merge operator removed).
12
- *
13
- * This module now focuses solely on producing recombinant offspring via {@link crossOver}.
14
- * The previous experimental `Network.merge` flow has been removed to reduce maintenance
15
- * surface area and avoid implying a misleading sequential-composition guarantee.
16
- *
17
- * Design notes:
18
- * - The implementation favors deterministic, inspectable orchestration at the top level.
19
- * - Gene-selection details are delegated to setup/materialization helpers so the public
20
- * crossover API stays compact and predictable.
21
- * - The resulting offspring preserves the same input/output interface as both parents,
22
- * which keeps downstream evaluation and training pipelines compatible.
23
- *
24
- * @module network.genetic
25
- */
26
-
27
63
  /**
28
64
  * NEAT-inspired crossover between two parent networks producing a single offspring.
29
65
  *
@@ -1,20 +1,91 @@
1
1
  /**
2
2
  * Core network chapter for the architecture surface.
3
3
  *
4
- * This folder now owns the public `Network` class that readers and callers use
5
- * to build, activate, evolve, serialize, and export graph-shaped neural
6
- * systems. The surrounding helper chapters keep activation, training,
7
- * topology, pruning, ONNX, and slab execution policy focused, while this file
8
- * preserves the orchestration story that ties those responsibilities into one
9
- * runtime boundary.
4
+ * This folder owns the public `Network` class: the boundary where a graph stops
5
+ * being only nodes and connections and starts behaving like one runnable,
6
+ * mutable, trainable system. Higher-level NEAT code can mutate or score a
7
+ * network, but this chapter is where the graph itself learns how to activate,
8
+ * accept structural edits, preserve deterministic state, serialize, and cross
9
+ * the ONNX boundary.
10
10
  *
11
- * Read this chapter in three passes:
11
+ * That boundary matters because the same instance has to serve several jobs
12
+ * without changing shape. A caller may want ordinary inference, training-aware
13
+ * forward passes, topology edits, reproducible stochastic behavior, sparse
14
+ * pruning, or a portable checkpoint. Keeping those responsibilities under one
15
+ * facade makes the public API readable while the helper chapters keep each
16
+ * policy cluster narrow enough to teach.
12
17
  *
13
- * 1. start here to understand the public `Network` contract and why it sits
14
- * above nodes, layers, and connections,
15
- * 2. continue into the helper chapters when you want one subsystem in detail,
16
- * 3. return here when you need to see how the public API composes those
17
- * subsystem policies back into one runtime object.
18
+ * A useful mental model is to read `network/` as four cooperating shelves.
19
+ * `bootstrap/` explains one-time construction policy. `activate/`, `runtime/`,
20
+ * and `training/` explain how a graph is stepped and regularized once it is
21
+ * alive. `connect/`, `mutate/`, `remove/`, `prune/`, and `topology/` explain
22
+ * graph surgery. `serialize/`, `standalone/`, `onnx/`, and `stats/` explain
23
+ * portability, inspection, and reporting.
24
+ *
25
+ * The performance story is equally important. This chapter deliberately hides
26
+ * storage details until they matter. Callers should be able to ask for
27
+ * `activate()` or `train()` without first understanding slab packing, pooled
28
+ * activation arrays, or cache invalidation. The helper folders then expose how
29
+ * the same graph can switch between object traversal and denser typed-array
30
+ * paths without changing the surface contract.
31
+ *
32
+ * ```mermaid
33
+ * flowchart LR
34
+ * classDef base fill:#08131f,stroke:#1ea7ff,color:#dff6ff,stroke-width:1px;
35
+ * classDef accent fill:#0f2233,stroke:#ffd166,color:#fff4cc,stroke-width:1.5px;
36
+ *
37
+ * Build[bootstrap and topology intent]:::base --> NetworkClass[Network facade]:::accent
38
+ * NetworkClass --> Execute[activate runtime and training]:::base
39
+ * Execute --> Edit[connect mutate prune remove]:::base
40
+ * Edit --> Persist[serialize standalone and ONNX]:::base
41
+ * ```
42
+ *
43
+ * ```mermaid
44
+ * flowchart TD
45
+ * classDef base fill:#08131f,stroke:#1ea7ff,color:#dff6ff,stroke-width:1px;
46
+ * classDef accent fill:#0f2233,stroke:#ffd166,color:#fff4cc,stroke-width:1.5px;
47
+ *
48
+ * NetworkChapter[network chapter]:::accent --> Bootstrap[bootstrap/ one-time setup]:::base
49
+ * NetworkChapter --> Activate[activate/ forward-pass policy]:::base
50
+ * NetworkChapter --> Runtime[runtime/ training-time controls]:::base
51
+ * NetworkChapter --> Structure[connect mutate topology prune]:::base
52
+ * NetworkChapter --> Interop[serialize standalone onnx stats]:::base
53
+ * ```
54
+ *
55
+ * For background on the execution-order side of this chapter, see Wikipedia
56
+ * contributors, [Topological sorting](https://en.wikipedia.org/wiki/Topological_sorting).
57
+ * Feed-forward network execution, acyclic guards, and some of the helper
58
+ * policies in this folder all depend on the same scheduling idea even when the
59
+ * public API keeps that detail out of the caller's way.
60
+ *
61
+ * Example: create a compact layered network and use the ordinary activation
62
+ * surface.
63
+ *
64
+ * ```ts
65
+ * const network = Network.createMLP(2, [4], 1);
66
+ * const outputValues = network.activate([0, 1]);
67
+ * ```
68
+ *
69
+ * Example: checkpoint one network, then restore it for another run.
70
+ *
71
+ * ```ts
72
+ * const network = new Network(2, 1, { seed: 7 });
73
+ * const saved = network.toJSON();
74
+ * const restored = Network.fromJSON(saved);
75
+ * const replayed = restored.activate([1, 0]);
76
+ * ```
77
+ *
78
+ * Practical reading order:
79
+ *
80
+ * 1. Start here for the public `Network` facade and the cross-chapter map.
81
+ * 2. Continue into `bootstrap/` when the constructor contract is the next
82
+ * question.
83
+ * 3. Continue into `activate/`, `runtime/`, and `training/` for execution and
84
+ * learning policy.
85
+ * 4. Continue into `connect/`, `mutate/`, `remove/`, `prune/`, and `topology/`
86
+ * for structural editing.
87
+ * 5. Finish in `serialize/`, `standalone/`, `onnx/`, and `stats/` for
88
+ * portability, derived reports, and export flows.
18
89
  */
19
90
 
20
91
  import Node from '../node/node';
@@ -114,42 +185,16 @@ import type {
114
185
  } from './network.types';
115
186
 
116
187
  /**
117
- * Network (Evolvable / Trainable Graph)
118
- * =====================================
119
- * Represents a directed neural computation graph used both as a NEAT genome
120
- * phenotype and (optionally) as a gradientΓÇætrainable model. The class binds
121
- * together specialized modules (topology, pruning, serialization, slab packing)
122
- * to keep the core surface approachable for learners.
123
- *
124
- * Educational Highlights:
125
- * - Structural Mutation: functions like `addNodeBetween()` and evolutionary
126
- * helpers (in higher-level `Neat`) mutate topology to explore architectures.
127
- * - Fast Execution Paths: a StructureΓÇæofΓÇæArrays (SoA) slab (`rebuildConnectionSlab`)
128
- * packs connection data into typed arrays to improve cache locality.
129
- * - Memory Optimization: node pooling & typed array pooling demonstrate how
130
- * allocation patterns affect performance and GC pressure.
131
- * - Determinism: RNG snapshot/restore methods allow reproducible experiments.
132
- * - Hybrid Workflows: dropout, stochastic depth, weight noise and mixed precision
133
- * illustrate gradientΓÇæera regularization applied to evolved topologies.
134
- *
135
- * Typical Usage:
136
- * ```ts
137
- * const net = new Network(4, 2); // create network
138
- * const out = net.activate([0.1,0.3,0.2,0.9]);
139
- * net.addNodeBetween(); // structural mutation
140
- * const slab = net.getConnectionSlab(); // inspect packed arrays
141
- * const clone = net.clone(); // deep copy
142
- * ```
188
+ * Public graph runtime that combines execution, editing, and portability.
143
189
  *
144
- * Performance Guidance:
145
- * - Invoke `activate()` normally; the class autoΓÇæselects slab vs object path.
146
- * - Batch structural mutations then call `rebuildConnectionSlab(true)` if you
147
- * need an immediate fastΓÇæpath (it is invoked lazily otherwise).
148
- * - Keep input array length exactly equal to `input`; mismatches throw early.
190
+ * `Network` is the instance callers reach for when one directed graph should be
191
+ * activated immediately, mutated structurally, regularized during training, or
192
+ * shipped across a checkpoint or export boundary without changing types.
149
193
  *
150
- * Serialization:
151
- * - `toJSON()` / `fromJSON()` support experiment checkpointing.
152
- * - ONNX export (`exportToONNX`) enables interoperability with other tools.
194
+ * Read the class as an orchestration facade over the helper chapters in this
195
+ * folder. The public methods stay on the instance so older imports and examples
196
+ * remain stable, while the heavier activation, topology, deterministic, and
197
+ * interoperability policies live in narrower modules below this surface.
153
198
  */
154
199
  import type { NetworkView } from '../../utils/memory';
155
200