Class NeatEAExecutionContexts
NeatEAExecutionContexts provides convenient factory methods for setting up evolutionary algorithm execution contexts with all the necessary NEAT-specific components, including innovation management, species-based selection, structural mutations, and neural network-specific genetic operators. This class serves as the primary entry point for configuring NEAT evolutionary systems.
Key NEAT components integrated:
- Innovation management: Historical marking system for structural mutations
- Species-based selection: Population organization by genetic similarity
- Structural mutations: Add/delete nodes and connections with innovation tracking
- Neural network crossover: Topology-aware genetic recombination
- Chromosome factories: Initial network generation with proper connectivity
NEAT algorithm configuration:
- Mutation operators: Weight perturbation, add/delete nodes, add/delete connections
- Selection strategy: Species-based selection with fitness sharing
- Crossover mechanism: Innovation-number-based gene alignment
- Network initialization: Configurable initial topology generation
Common usage patterns:
// Standard NEAT setup with default components
EAExecutionContext<Double> context = NeatEAExecutionContexts.<Double>standard().build();
// Custom NEAT setup with existing builder
var builder = EAExecutionContexts.<Double>forScalarFitness()
.randomGenerator(myRandomGenerator)
.termination(myTerminationCondition);
EAExecutionContext<Double> context = NeatEAExecutionContexts.enrichWithNeat(builder).build();
// Advanced setup with custom innovation manager
InnovationManager customInnovationManager = new InnovationManager(1000);
SpeciesIdGenerator customSpeciesIdGenerator = new SpeciesIdGenerator();
ChromosomeFactoryProvider customFactoryProvider = // ... create custom provider
var context = NeatEAExecutionContexts.enrichWithNeat(
builder, customInnovationManager, customSpeciesIdGenerator, customFactoryProvider
).build();
Integrated NEAT genetic operators:
- Weight mutations: Gaussian perturbation, random replacement, creep mutation
- Structural mutations: Add node, add connection, delete node, delete connection
- State mutations: Enable/disable connections for network topology exploration
- Crossover operations: Innovation-guided gene alignment and inheritance
Species-based evolution:
- Compatibility distance: Genetic similarity measurement for speciation
- Fitness sharing: Population diversity maintenance through species-based selection
- Species management: Dynamic species formation and extinction
- Representative selection: Species representative selection for next generation
Performance and scalability:
- Efficient innovation tracking: O(1) innovation number lookup
- Concurrent execution: Thread-safe components for parallel evolution
- Memory management: Configurable cache management for large populations
- Modular design: Customizable components for specific problem domains
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends Number & Comparable<T>>
ImmutableEAExecutionContext.Builder<T> enrichWithNeat
(ImmutableEAExecutionContext.Builder<T> builder) Enriches an existing EA execution context builder with standard NEAT components.static <T extends Number & Comparable<T>>
ImmutableEAExecutionContext.Builder<T> enrichWithNeat
(ImmutableEAExecutionContext.Builder<T> builder, InnovationManager innovationManager, SpeciesIdGenerator speciesIdGenerator, ChromosomeFactoryProvider chromosomeFactoryProvider) Enriches an EA execution context builder with custom NEAT components.static <T extends Number & Comparable<T>>
ImmutableEAExecutionContext.Builder<T> standard()
Creates a standard NEAT execution context builder with default configuration.
-
Constructor Details
-
NeatEAExecutionContexts
private NeatEAExecutionContexts()
-
-
Method Details
-
enrichWithNeat
public static <T extends Number & Comparable<T>> ImmutableEAExecutionContext.Builder<T> enrichWithNeat(ImmutableEAExecutionContext.Builder<T> builder) Enriches an existing EA execution context builder with standard NEAT components.This method configures the builder with default NEAT components including a new innovation manager, species ID generator, and connected chromosome factory. All NEAT-specific genetic operators, selection mechanisms, and mutation handlers are automatically registered.
- Type Parameters:
T
- the fitness value type- Parameters:
builder
- the execution context builder to enrich with NEAT capabilities- Returns:
- the builder configured with NEAT components
- Throws:
IllegalArgumentException
- if builder is null
-
enrichWithNeat
public static <T extends Number & Comparable<T>> ImmutableEAExecutionContext.Builder<T> enrichWithNeat(ImmutableEAExecutionContext.Builder<T> builder, InnovationManager innovationManager, SpeciesIdGenerator speciesIdGenerator, ChromosomeFactoryProvider chromosomeFactoryProvider) Enriches an EA execution context builder with custom NEAT components.This method allows full customization of NEAT components while still configuring all necessary genetic operators and handlers. This is useful when you need custom innovation tracking, species management, or initial network topology generation.
- Type Parameters:
T
- the fitness value type- Parameters:
builder
- the execution context builder to enrichinnovationManager
- custom innovation manager for structural mutation trackingspeciesIdGenerator
- custom species ID generator for population organizationchromosomeFactoryProvider
- custom factory provider for initial network generation- Returns:
- the builder configured with custom NEAT components
- Throws:
IllegalArgumentException
- if any parameter is null
-
standard
Creates a standard NEAT execution context builder with default configuration.This is the most convenient method for setting up a NEAT evolutionary algorithm with standard components and configurations. The returned builder is pre-configured with:
- Scalar fitness evaluation
- Default innovation manager and species ID generator
- Connected initial network topology
- All standard NEAT genetic operators
- Species-based selection mechanism
- Type Parameters:
T
- the fitness value type (typically Double)- Returns:
- a builder configured with standard NEAT components
-