View Javadoc
1   package net.bmahe.genetics4j.core.spec.mutation;
2   
3   /**
4    * Marker interface for mutation policy specifications in evolutionary algorithms.
5    * 
6    * <p>MutationPolicy defines the contract for specifying mutation strategies and their parameters.
7    * Mutation policies determine how genetic variation is introduced into the population by making
8    * random changes to individual genotypes. Different mutation policies implement various strategies
9    * for balancing exploration and exploitation during the evolutionary process.
10   * 
11   * <p>Mutation policies are used by:
12   * <ul>
13   * <li><strong>EA Configuration</strong>: To specify the mutation strategy for the algorithm</li>
14   * <li><strong>Mutation handlers</strong>: To create appropriate mutator implementations</li>
15   * <li><strong>Strategy resolution</strong>: To select chromosome-specific mutation operators</li>
16   * <li><strong>Parameter configuration</strong>: To define mutation rates and other parameters</li>
17   * </ul>
18   * 
19   * <p>The framework provides several concrete mutation policy implementations:
20   * <ul>
21   * <li>{@link RandomMutation}: Randomly changes allele values with specified probability</li>
22   * <li>{@link CreepMutation}: Makes small incremental changes to numeric values</li>
23   * <li>{@link SwapMutation}: Exchanges positions of alleles (useful for permutations)</li>
24   * <li>{@link PartialMutation}: Applies mutation to only a subset of chromosomes</li>
25   * <li>{@link MultiMutations}: Combines multiple mutation strategies</li>
26   * </ul>
27   * 
28   * <p>Mutation strategies vary by chromosome type and problem domain:
29   * <ul>
30   * <li><strong>Binary chromosomes</strong>: Bit flip mutations</li>
31   * <li><strong>Numeric chromosomes</strong>: Gaussian noise, uniform perturbation, creep mutation</li>
32   * <li><strong>Permutation chromosomes</strong>: Swap, insert, inversion mutations</li>
33   * <li><strong>Tree chromosomes</strong>: Node replacement, subtree mutation, growth/pruning</li>
34   * </ul>
35   * 
36   * <p>Key considerations for mutation policy design:
37   * <ul>
38   * <li><strong>Mutation rate</strong>: Balance between exploration and exploitation</li>
39   * <li><strong>Chromosome compatibility</strong>: Ensure mutation respects chromosome constraints</li>
40   * <li><strong>Problem-specific operations</strong>: Adapt mutation to problem characteristics</li>
41   * <li><strong>Adaptive strategies</strong>: Allow mutation parameters to evolve during the run</li>
42   * </ul>
43   * 
44   * <p>Example usage in genetic algorithm configuration:
45   * <pre>{@code
46   * // Random mutation with 5% probability per allele
47   * MutationPolicy randomMutation = RandomMutation.of(0.05);
48   * 
49   * // Creep mutation for numeric optimization
50   * MutationPolicy creepMutation = CreepMutation.of(0.1, 1.0);
51   * 
52   * // Combination of multiple mutation strategies
53   * MutationPolicy multiMutation = MultiMutations.of(
54   *     Tuple.of(0.7, randomMutation),
55   *     Tuple.of(0.3, creepMutation)
56   * );
57   * 
58   * // Use in EA configuration
59   * EAConfiguration<Double> config = EAConfigurationBuilder.<Double>builder()
60   *     .chromosomeSpecs(chromosomeSpec)
61   *     .mutationPolicy(randomMutation)
62   *     .build();
63   * }</pre>
64   * 
65   * @see net.bmahe.genetics4j.core.mutation.Mutator
66   * @see net.bmahe.genetics4j.core.mutation.MutationPolicyHandler
67   * @see RandomMutation
68   * @see CreepMutation
69   * @see SwapMutation
70   * @see PartialMutation
71   * @see MultiMutations
72   */
73  public interface MutationPolicy {
74  
75  }