@Test public void mutateValidGene() { final var mutator = new GaussianMutator<DoubleGene, Double>() { public DoubleGene mutate(final DoubleGene gene, final Random random) { return super.mutate(gene, random); } }; final var random = new Random() { @Override public double nextGaussian() { return 1; } }; DoubleGene gene = DoubleGene.of(0.9, 0, 1); Assert.assertTrue(gene.isValid()); gene = mutator.mutate(gene, random); Assert.assertTrue(gene.isValid()); Assert.assertEquals(gene.doubleValue(), Math.nextDown(1.0)); }
@Override protected G mutate(final G gene, final Random random) { return gene.isValid() ? mutate0(gene, random) : gene; }
GaussianMutator extends Mutator<G, C> { @Override protected G mutate(final G gene, final Random random) { return gene.isValid() ? mutate0(gene, random) : gene; } }
GaussianMutator extends Mutator<G, C> { @Override protected G mutate(final G gene, final Random random) { return gene.isValid() ? mutate0(gene, random) : gene; } GaussianMutator(final double probability);  GaussianMutator(); }
GaussianMutator extends Mutator<G, C> { @Override protected G mutate(final G gene, final Random random) { return gene.isValid() ? mutate0(gene, random) : gene; } GaussianMutator(final double probability);  GaussianMutator(); @Override String toString(); }
GaussianMutator extends Mutator<G, C> { @Override protected G mutate(final G gene, final Random random) { return gene.isValid() ? mutate0(gene, random) : gene; } GaussianMutator(final double probability);  GaussianMutator(); @Override String toString();  }