/** * This method simply calls the {@link #evaluate()} method. The purpose of * this method is to have a simple way for concurrent fitness calculation * for expensive fitness values. */ @Override public void run() { evaluate(); }
@Override protected Factory<Phenotype<DoubleGene, Double>> factory() { return () -> Phenotype.of(_genotype.newInstance(), 0, _ff).evaluate(); }
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<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<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<DoubleGene, Double> nextPhenotypeDoubleGeneDouble() { return Phenotype.of( nextGenotypeDoubleGene(), Math.abs(random().nextInt()), FitnessFunction(random().nextDouble()), FitnessScaler() ).evaluate(); }
public static Phenotype<EnumGene<Integer>, Double> nextPhenotypeEnumGeneIntegerDouble() { return Phenotype.of( nextGenotypeEnumGeneInteger(), Math.abs(random().nextInt()), FitnessFunction(random().nextDouble()), FitnessScaler() ).evaluate(); }
public static Phenotype<EnumGene<Long>, Double> nextPhenotypeEnumGeneLongDouble() { return Phenotype.of( nextGenotypeEnumGeneLong(), Math.abs(random().nextInt()), FitnessFunction(random().nextDouble()), FitnessScaler() ).evaluate(); }
public static Phenotype<EnumGene<Float>, Double> nextPhenotypeEnumGeneFloatDouble() { return Phenotype.of( nextGenotypeEnumGeneFloat(), 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(); }
/** * Create a population of DoubleGenes */ public static ISeq<Phenotype<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 MSeq<Phenotype<DoubleGene, Double>> population = MSeq.ofLength(npopulation); for (int i = 0; i < npopulation; ++i) { population.set(i, Phenotype.of(genotype.newInstance(), 0, FF).evaluate()); } return population.toISeq(); }