neat/genome/heredity
neat/genome/heredity/genome.heredity.types.ts
GenomeHereditySelectionContext
Pure selection context for innovation-aligned genome heredity.
This contract keeps the heredity pass structural-first: two strict genomes, the fitness or equality policy that decides disjoint inheritance, and the deterministic RNG that resolves matching-gene choices plus disabled-gene re-enable behavior.
GenomeHereditySourceParent
Stable parent labels used by the genome-owned heredity selector.
SelectedGenomeConnectionGene
One inherited connection gene selected by the genome-owned heredity pass.
The source-parent label preserves parent provenance for runtime adapters and future narrow seams without pushing runtime node indexing into the genome surface.
neat/genome/heredity/genome.heredity.ts
selectGenomeHeredityConnectionGenes
selectGenomeHeredityConnectionGenes(
context: GenomeHereditySelectionContext,
): SelectedGenomeConnectionGene[]
Select inherited connection genes using only the strict genome contract.
Step 7.2a moves innovation-aligned heredity selection behind the genome boundary without widening the runtime crossover facade. The runtime shelf still owns node scaffolding and phenotype materialization, while this helper owns three structural decisions:
- collect parent connection genes by preserved innovation number,
- resolve matching, disjoint, and excess inheritance from scores plus equal-mode policy,
- apply the explicit disabled-gene re-enable rule through the inherited RNG.
Parameters:
context- Pure genome heredity context.
Returns: Ordered inherited connection genes plus their source-parent labels.
Example:
const selectedGenes = selectGenomeHeredityConnectionGenes({
parent1Genome,
parent2Genome,
parent1Score: 2,
parent2Score: 1,
equal: false,
randomGenerator: () => 0.25,
});