/** Create a population of DoubleGenes */ public static Population<DoubleGene, Double> newDoubleGenePopulation( final int ngenes, final int nchromosomes, final int npopulation) { final MSeq<DoubleChromosome> chromosomes = MSeq.ofLength(nchromosomes); for (int i = 0; i < nchromosomes; ++i) { chromosomes.set(i, DoubleChromosome.of(0, 10, ngenes)); } final Genotype<DoubleGene> genotype = new Genotype<>(chromosomes.toISeq()); final Population<DoubleGene, Double> population = new Population<>(npopulation); for (int i = 0; i < npopulation; ++i) { population.add(Phenotype.of(genotype.newInstance(), 0, FF).evaluate()); } return population; }
public static Phenotype<DoubleGene, Double> newDoublePhenotype(final double value) { return Phenotype.of(Genotype.of(DoubleChromosome.of(DoubleGene.of(value, 0, 10))), 0, FF) .evaluate(); }