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 of chromosomes used 7 * in genetic algorithms. Implementations provide the blueprint for creating chromosome instances with specific 8 * 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 * 36 * <pre>{@code 37 * // Create a specification for 100-bit binary chromosome 38 * ChromosomeSpec bitSpec = BitChromosomeSpec.of(100); 39 * 40 * // Create a specification for integer chromosome with range [0, 50] 41 * ChromosomeSpec intSpec = IntChromosomeSpec.of(10, 0, 50); 42 * 43 * // Use in genotype specification 44 * GenotypeSpec genotypeSpec = GenotypeSpec.of(bitSpec, intSpec); 45 * }</pre> 46 * 47 * @see net.bmahe.genetics4j.core.chromosomes.Chromosome 48 * @see net.bmahe.genetics4j.core.chromosomes.factory.ChromosomeFactory 49 * @see BitChromosomeSpec 50 * @see IntChromosomeSpec 51 * @see DoubleChromosomeSpec 52 * @see FloatChromosomeSpec 53 */ 54 public interface ChromosomeSpec { 55 56 }