Class GaussianMutation
- All Implemented Interfaces:
MutationOperator<PolygonChromosome>
PolygonChromosome.
Mutation model
Each triangle is mutated with probability mutationRate. A selected
triangle receives one coherent edit: translation, scaling about its centroid,
movement of one vertex, color/opacity adjustment, or an occasional full reset.
This preserves useful triangles while still exploring their local neighborhood.
The effective mutation rate and Gaussian scale decay exponentially over roughly the first 3,000 generations, retaining 25% and 20% of their initial values respectively. This shifts the search from exploration toward fine adjustment without ever eliminating mutation entirely.
Typical values
mutationRate—0.02to0.05per trianglesigma—0.03to0.08; larger values explore more aggressively but can destabilize good solutionsresetProbability—0.05to0.15; keep small so resets are rare escapes, not routine disruption
-
Constructor Summary
ConstructorsConstructorDescriptionGaussianMutation(double mutationRate, double sigma) Convenience constructor with no reset mutations.GaussianMutation(double mutationRate, double sigma, double resetProbability) Construct with explicit mutation rate, sigma, and reset probability. -
Method Summary
Modifier and TypeMethodDescriptionvoidbeginGeneration(long generation, long maxGenerations) Notify the operator before offspring are created for a generation.mutate(PolygonChromosome individual, Random rng) Mutate an individual, either in-place or by returning a replacement.mutate(PolygonChromosome individual, Random rng, double configuredRate) Apply the configured mutation probability to one offspring.
-
Constructor Details
-
GaussianMutation
public GaussianMutation(double mutationRate, double sigma, double resetProbability) Construct with explicit mutation rate, sigma, and reset probability.- Parameters:
mutationRate- per-triangle mutation probability (must be in [0, 1])sigma- standard deviation of Gaussian perturbation (must be > 0)resetProbability- probability of full gene reset vs. perturbation (must be in [0, 1])- Throws:
IllegalArgumentException- if any argument is out of range
-
GaussianMutation
public GaussianMutation(double mutationRate, double sigma) Convenience constructor with no reset mutations. Equivalent toGaussianMutation(mutationRate, sigma, 0.0).- Parameters:
mutationRate- per-triangle mutation probabilitysigma- standard deviation of Gaussian perturbation
-
-
Method Details
-
beginGeneration
public void beginGeneration(long generation, long maxGenerations) Description copied from interface:MutationOperatorNotify the operator before offspring are created for a generation. Stateful operators may use this to adapt their mutation strength.- Specified by:
beginGenerationin interfaceMutationOperator<PolygonChromosome>- Parameters:
generation- generation about to be produced, starting at zeromaxGenerations- configured generation limit
-
mutate
Description copied from interface:MutationOperatorMutate an individual, either in-place or by returning a replacement.- Specified by:
mutatein interfaceMutationOperator<PolygonChromosome>- Parameters:
individual- individual to mutaterng- source of randomness- Returns:
- non-null mutated individual
-
mutate
Apply the configured mutation probability to one offspring. Operators with gene-level mutation semantics may override this method and interpretmutationRateat that finer granularity.Interprets
configuredRateas a direct per-triangle mutation probability (finer-grained than the interface's default whole-individual gate), then applies this generation's cooling to it. The cooling is applied as the dimensionless ratioeffectiveMutationRate / mutationRate, which reduces to the cooling schedule's(0.25 + 0.75 * cooling)factor regardless of this instance's ownmutationRate— soconfiguredRateneed not match the constructor'smutationRatefor the cooling curve to apply correctly.- Specified by:
mutatein interfaceMutationOperator<PolygonChromosome>- Parameters:
individual- offspring to consider for mutationrng- source of randomnessconfiguredRate- configured rate in[0,1]- Returns:
- the original or mutated individual; never
null
-