private Phenotype<G, C> repair(final Phenotype<G, C> pt) { return Phenotype.of( _repair.apply(pt.getGenotype()), pt.getGeneration(), null, //pt.getFitnessFunction(), null //pt.getFitnessScaler() ); }
private EvolutionResult<IntegerGene, Integer> result(final ISeq<Genotype<IntegerGene>> genotypes) { return EvolutionResult.of( Optimize.MAXIMUM, genotypes.map(gt -> Phenotype.of(gt, 1, Genotype::length)), 8, 2, EvolutionDurations.ZERO, 3, 4, 5 ); }
private static EvolutionStart<DoubleGene, Double> start(final int populationSize, final long generation) { final ISeq<Phenotype<DoubleGene, Double>> population = Genotype.of(DoubleChromosome.of(0, 1)).instances() .map(gt -> Phenotype.of(gt, generation, SpecialEngine::fitness)) .limit(populationSize) .collect(ISeq.toISeq()); return EvolutionStart.of(population, generation); }
public static Phenotype<IntegerGene, Long> nextPhenotypeIntegerGeneLong() { return Phenotype.of( nextGenotypeIntegerGene(), Math.abs(random().nextInt()), FitnessFunction(random().nextLong()), FitnessScaler() ).evaluate(); }
public static Phenotype<EnumGene<Character>, Double> nextPhenotypeEnumGeneCharacterDouble() { return Phenotype.of( nextGenotypeEnumGeneCharacter(), Math.abs(random().nextInt()), FitnessFunction(random().nextDouble()), FitnessScaler() ).evaluate(); }
public static Phenotype<CharacterGene, Integer> nextPhenotypeCharacterGeneInteger() { return Phenotype.of( nextGenotypeCharacterGene(), Math.abs(random().nextInt()), FitnessFunction(random().nextInt()), FitnessScaler() ).evaluate(); }
public static Phenotype<IntegerGene, Double> nextPhenotypeIntegerGeneDouble() { return Phenotype.of( nextGenotypeIntegerGene(), Math.abs(random().nextInt()), FitnessFunction(random().nextDouble()), FitnessScaler() ).evaluate(); }
public static Phenotype<BitGene, Integer> nextPhenotypeBitGeneInteger() { return Phenotype.of( nextGenotypeBitGene(), Math.abs(random().nextInt()), FitnessFunction(random().nextInt()), FitnessScaler() ).evaluate(); }
public static Phenotype<IntegerGene, Integer> nextPhenotypeIntegerGeneInteger() { return Phenotype.of( nextGenotypeIntegerGene(), Math.abs(random().nextInt()), FitnessFunction(random().nextInt()), FitnessScaler() ).evaluate(); }
public static Phenotype<LongGene, Long> nextPhenotypeLongGeneLong() { return Phenotype.of( nextGenotypeLongGene(), Math.abs(random().nextInt()), FitnessFunction(random().nextLong()), FitnessScaler() ).evaluate(); }
public static Phenotype<LongGene, Double> nextPhenotypeLongGeneDouble() { return Phenotype.of( nextGenotypeLongGene(), Math.abs(random().nextInt()), FitnessFunction(random().nextDouble()), FitnessScaler() ).evaluate(); }
public static Phenotype<DoubleGene, Long> nextPhenotypeDoubleGeneLong() { return Phenotype.of( nextGenotypeDoubleGene(), Math.abs(random().nextInt()), FitnessFunction(random().nextLong()), FitnessScaler() ).evaluate(); }
public static Phenotype<LongGene, Integer> nextPhenotypeLongGeneInteger() { return Phenotype.of( nextGenotypeLongGene(), Math.abs(random().nextInt()), FitnessFunction(random().nextInt()), FitnessScaler() ).evaluate(); }
public static Phenotype<DoubleGene, Integer> nextPhenotypeDoubleGeneInteger() { return Phenotype.of( nextGenotypeDoubleGene(), Math.abs(random().nextInt()), FitnessFunction(random().nextInt()), FitnessScaler() ).evaluate(); }
public static Phenotype<EnumGene<Double>, Double> nextPhenotypeEnumGeneDoubleDouble() { return Phenotype.of( nextGenotypeEnumGeneDouble(), Math.abs(random().nextInt()), FitnessFunction(random().nextDouble()), FitnessScaler() ).evaluate(); }
public static Phenotype<DoubleGene, Double> newDoublePhenotype(final double value) { return Phenotype.of(Genotype.of( DoubleChromosome.of(DoubleGene.of(value, 0, 10))), 0, FF ).evaluate(); }
private Phenotype<DoubleGene, Vec<double[]>> phenotype() { return Phenotype.of( PROBLEM.codec().encoding().newInstance(), 1L, gt -> PROBLEM.fitness().apply(PROBLEM.codec().decode(gt)) ); }
private Phenotype<DoubleGene, Vec<double[]>> phenotype() { return Phenotype.of( PROBLEM.codec().encoding().newInstance(), 1L, gt -> PROBLEM.fitness().apply(PROBLEM.codec().decode(gt)) ); }
private static Phenotype<DoubleGene, Double> pt(double value) { return Phenotype.of( Genotype.of(DoubleChromosome.of(DoubleGene.of(value, 0, 10))), 0, gt -> gt.getGene().getAllele() ); }
@Test(expectedExceptions = IllegalArgumentException.class) public void selectNegativeCountArgument() { final Factory<Genotype<DoubleGene>> gtf = Genotype.of(DoubleChromosome.of(0.0, 1.0)); final MSeq<Phenotype<DoubleGene, Double>> population = MSeq.ofLength(2); for (int i = 0, n = 2; i < n; ++i) { population.set(i, Phenotype.of(gtf.newInstance(), 12, TestUtils.FF)); } selector().select(population.toISeq(), -1, Optimize.MAXIMUM); }