@Test(dataProvider = "alterCountParameters") public void alterCount( final Integer ngenes, final Integer nchromosomes, final Integer npopulation ) { final ISeq<Phenotype<DoubleGene, Double>> p1 = population(ngenes, nchromosomes, npopulation); final Alterer<DoubleGene, Double> mutator = newAlterer(0.01); final AltererResult<DoubleGene, Double> result = mutator.alter(p1, 1); Assert.assertEquals( result.alterations(), diff(p1, result.population()) ); }
@Override public AltererResult<G, C> alter( final Seq<Phenotype<G, C>> population, final long generation ) { AltererResult<G, C> result = AltererResult.of(population.asISeq()); for (var alterer : _alterers) { final AltererResult<G, C> as = alterer.alter( result.population(), generation ); result = AltererResult.of( as.population(), as.alterations() + result.alterations() ); } return result; }
CompositeAlterer extends AbstractAlterer<G, C> { @Override public AltererResult<G, C> alter( final Seq<Phenotype<G, C>> population, final long generation ) { AltererResult<G, C> result = AltererResult.of(population.asISeq()); for (var alterer : _alterers) { final AltererResult<G, C> as = alterer.alter( result.population(), generation ); result = AltererResult.of( as.population(), as.alterations() + result.alterations() ); } return result; } }
CompositeAlterer extends AbstractAlterer<G, C> { @Override public AltererResult<G, C> alter( final Seq<Phenotype<G, C>> population, final long generation ) { AltererResult<G, C> result = AltererResult.of(population.asISeq()); for (var alterer : _alterers) { final AltererResult<G, C> as = alterer.alter( result.population(), generation ); result = AltererResult.of( as.population(), as.alterations() + result.alterations() ); } return result; } CompositeAlterer(final Seq<Alterer<G, C>> alterers); }
CompositeAlterer extends AbstractAlterer<G, C> { @Override public AltererResult<G, C> alter( final Seq<Phenotype<G, C>> population, final long generation ) { AltererResult<G, C> result = AltererResult.of(population.asISeq()); for (var alterer : _alterers) { final AltererResult<G, C> as = alterer.alter( result.population(), generation ); result = AltererResult.of( as.population(), as.alterations() + result.alterations() ); } return result; } CompositeAlterer(final Seq<Alterer<G, C>> alterers); @Override AltererResult<G, C> alter(
		final Seq<Phenotype<G, C>> population,
		final long generation
	); @Override String toString(); }
CompositeAlterer extends AbstractAlterer<G, C> { @Override public AltererResult<G, C> alter( final Seq<Phenotype<G, C>> population, final long generation ) { AltererResult<G, C> result = AltererResult.of(population.asISeq()); for (var alterer : _alterers) { final AltererResult<G, C> as = alterer.alter( result.population(), generation ); result = AltererResult.of( as.population(), as.alterations() + result.alterations() ); } return result; } CompositeAlterer(final Seq<Alterer<G, C>> alterers); @Override AltererResult<G, C> alter(
		final Seq<Phenotype<G, C>> population,
		final long generation
	); @Override String toString();  }