1 package net.bmahe.genetics4j.core.spec.chromosome; 2 3 /** 4 * Marker interface for chromosome specifications in evolutionary algorithms. 5 * 6 * <p>ChromosomeSpec defines the contract for specifying the structure, constraints, and properties 7 * of chromosomes used in genetic algorithms. Implementations provide the blueprint for creating 8 * chromosome instances with specific characteristics such as size, value ranges, and data types. 9 * 10 * <p>Chromosome specifications are used by: 11 * <ul> 12 * <li><strong>Chromosome factories</strong>: To create chromosome instances with correct properties</li> 13 * <li><strong>Genetic operators</strong>: To understand chromosome structure for crossover and mutation</li> 14 * <li><strong>Validation logic</strong>: To ensure chromosome integrity and constraint satisfaction</li> 15 * <li><strong>Algorithm configuration</strong>: To specify the genetic representation for problems</li> 16 * </ul> 17 * 18 * <p>The framework provides several concrete implementations: 19 * <ul> 20 * <li>{@link BitChromosomeSpec}: Specifications for binary string chromosomes</li> 21 * <li>{@link IntChromosomeSpec}: Specifications for integer array chromosomes</li> 22 * <li>{@link DoubleChromosomeSpec}: Specifications for double-precision floating-point chromosomes</li> 23 * <li>{@link FloatChromosomeSpec}: Specifications for single-precision floating-point chromosomes</li> 24 * </ul> 25 * 26 * <p>Chromosome specifications typically define: 27 * <ul> 28 * <li><strong>Size/Length</strong>: Number of alleles or genes in the chromosome</li> 29 * <li><strong>Value constraints</strong>: Valid ranges, domains, or sets of allowed values</li> 30 * <li><strong>Data type</strong>: The primitive or object type used for allele representation</li> 31 * <li><strong>Structural properties</strong>: Fixed vs. variable length, constraints between alleles</li> 32 * </ul> 33 * 34 * <p>Example usage in genetic algorithm configuration: 35 * <pre>{@code 36 * // Create a specification for 100-bit binary chromosome 37 * ChromosomeSpec bitSpec = BitChromosomeSpec.of(100); 38 * 39 * // Create a specification for integer chromosome with range [0, 50] 40 * ChromosomeSpec intSpec = IntChromosomeSpec.of(10, 0, 50); 41 * 42 * // Use in genotype specification 43 * GenotypeSpec genotypeSpec = GenotypeSpec.of(bitSpec, intSpec); 44 * }</pre> 45 * 46 * @see net.bmahe.genetics4j.core.chromosomes.Chromosome 47 * @see net.bmahe.genetics4j.core.chromosomes.factory.ChromosomeFactory 48 * @see BitChromosomeSpec 49 * @see IntChromosomeSpec 50 * @see DoubleChromosomeSpec 51 * @see FloatChromosomeSpec 52 */ 53 public interface ChromosomeSpec { 54 55 }