Interface NeatCombination
- All Superinterfaces:
CombinationPolicy
- All Known Implementing Classes:
ImmutableNeatCombination
NeatCombination defines how neural network chromosomes should be recombined during genetic crossover, including inheritance biases, gene re-enabling policies, and parent comparison strategies. This policy controls the fundamental genetic operators that shape network topology evolution in NEAT.
Key crossover parameters:
- Inheritance threshold: Bias toward fitter parent for gene inheritance
- Gene re-enabling: Probability of re-enabling disabled genes during crossover
- Parent comparison: Strategy for determining relative parent fitness
- Genetic alignment: Innovation-number-based gene matching
NEAT genetic crossover process:
- Gene alignment: Match genes by innovation number between parents
- Matching genes: Randomly inherit from either parent (biased by inheritance threshold)
- Disjoint genes: Inherit from fitter parent based on parent comparison
- Excess genes: Inherit from fitter parent beyond less fit parent's range
- Gene state: Apply re-enabling policy to disabled genes
Gene inheritance strategies:
- Matching genes: Present in both parents with same innovation number
- Disjoint genes: Present in one parent within other parent's innovation range
- Excess genes: Present in one parent beyond other parent's highest innovation
- Disabled genes: May be re-enabled based on re-enabling threshold
Common usage patterns:
// Default NEAT crossover configuration
NeatCombination defaultPolicy = NeatCombination.build();
// Custom crossover with fitness bias
NeatCombination biasedPolicy = NeatCombination.builder()
.inheritanceThresold(0.7) // 70% bias toward fitter parent
.reenableGeneInheritanceThresold(0.3) // 30% chance to re-enable genes
.parentComparisonPolicy(FitnessComparison.build())
.build();
// Unbiased crossover for diversity
NeatCombination unbiasedPolicy = NeatCombination.builder()
.inheritanceThresold(0.5) // No bias toward either parent
.reenableGeneInheritanceThresold(0.1) // Low re-enabling rate
.build();
// Use in EA configuration
var combinationSpec = ChromosomeCombinatorSpec.builder()
.combinationPolicy(biasedPolicy)
.build();
Inheritance threshold effects:
- 0.5 (default): Unbiased inheritance, equal probability from both parents
- > 0.5: Bias toward fitter parent, promotes convergence
- < 0.5: Bias toward less fit parent, increases diversity
- 1.0: Always inherit from fitter parent (if determinable)
Gene re-enabling mechanism:
- Historical information: Disabled genes preserve connection topology
- Re-activation chance: Allows previously disabled connections to contribute again
- Topology exploration: Enables rediscovery of useful connection patterns
- Genetic diversity: Prevents permanent loss of structural information
Parent comparison integration:
- Fitness comparison: Standard fitness-based parent ranking
- Custom strategies: Pluggable comparison policies for different problem domains
- Multi-objective support: Compatible with complex fitness landscapes
- Equal fitness handling: Special rules when parents have identical fitness
Performance considerations:
- Innovation sorting: Leverages pre-sorted connection lists for O(n) crossover
- Memory efficiency: Minimal allocation during gene inheritance
- Cache-friendly: Sequential access patterns for better cache performance
- Parallelizable: Crossover operations can be executed concurrently
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final double
static final double
-
Method Summary
Modifier and TypeMethodDescriptionstatic NeatCombination
build()
Creates a NEAT combination policy with default settings.static NeatCombination.Builder
builder()
default void
check()
default double
Returns the inheritance threshold for biasing gene selection toward fitter parents.default ParentComparisonPolicy
Returns the policy used to compare parent fitness for inheritance decisions.default double
Returns the threshold for re-enabling disabled genes during crossover.
-
Field Details
-
DEFAULT_INHERITANCE_THRESHOLD
static final double DEFAULT_INHERITANCE_THRESHOLD- See Also:
-
DEFAULT_REENABLE_GENE_INHERITANCE_THRESHOLD
static final double DEFAULT_REENABLE_GENE_INHERITANCE_THRESHOLD- See Also:
-
-
Method Details
-
inheritanceThresold
@Default default double inheritanceThresold()Returns the inheritance threshold for biasing gene selection toward fitter parents.This threshold controls the probability of inheriting genes from the fitter parent during crossover. Higher values bias inheritance toward the better performing parent, while lower values provide more equal inheritance or even bias toward the less fit parent.
Inheritance behavior:
- 0.5 (default): Unbiased inheritance, equal probability from both parents
- > 0.5: Bias toward fitter parent, promotes convergence to good solutions
- < 0.5: Bias toward less fit parent, increases population diversity
- 1.0: Always inherit from fitter parent when fitness differs
- 0.0: Always inherit from less fit parent when fitness differs
- Returns:
- inheritance threshold value between 0.0 and 1.0 (inclusive)
-
reenableGeneInheritanceThresold
@Default default double reenableGeneInheritanceThresold()Returns the threshold for re-enabling disabled genes during crossover.When a gene (connection) is disabled in one parent but enabled in the other, this threshold determines the probability that the gene will be enabled in the offspring. This mechanism prevents permanent loss of potentially useful connections and allows rediscovery of structural innovations.
Re-enabling behavior:
- 0.25 (default): 25% chance to re-enable disabled connections
- 0.0: Never re-enable disabled connections
- 1.0: Always re-enable connections that are enabled in either parent
- Higher values: More aggressive topology exploration
- Lower values: More conservative structural preservation
- Returns:
- re-enabling threshold value between 0.0 and 1.0 (inclusive)
-
parentComparisonPolicy
Returns the policy used to compare parent fitness for inheritance decisions.The parent comparison policy determines which parent is considered "fitter" for the purposes of biased gene inheritance. This affects how disjoint and excess genes are inherited and how the inheritance threshold is applied.
Available comparison strategies:
- FitnessComparison (default): Compare parents based on their fitness values
- Custom policies: Pluggable strategies for domain-specific comparisons
- Multi-objective: Specialized comparisons for multi-objective optimization
- Equal fitness handling: Specific behavior when parents have identical fitness
- Returns:
- the parent comparison policy (defaults to fitness-based comparison)
-
check
@Check default void check() -
builder
-
build
Creates a NEAT combination policy with default settings.Default configuration:
- Inheritance threshold: 0.5 (unbiased)
- Gene re-enabling threshold: 0.25 (25% chance)
- Parent comparison: Fitness-based comparison
- Returns:
- a new NEAT combination policy with default settings
-