Package org.jenetics

Examples of org.jenetics.DoubleChromosome


}

public class RealFunction {
  public static void main(String[] args) {
    Factory<Genotype<DoubleGene>> gtf = Genotype.of(
      new DoubleChromosome(0.0, 2.0 * PI)
    );
    Function<Genotype<DoubleGene>, Double> ff = new Real();
    GeneticAlgorithm<DoubleGene, Double> ga =
      new GeneticAlgorithm<>(
        gtf, ff, Optimize.MINIMUM
View Full Code Here


  public Genotype<DoubleGene> build() {
    final Array<DoubleChromosome> chromosomes =
      new Array<>(_nchromosomes);

    for (int i = 0; i < _nchromosomes; ++i) {
      chromosomes.set(i, new DoubleChromosome(_min, _max, _ngenes));
    }

    return new Genotype<>(chromosomes.toISeq());
  }
View Full Code Here

  }

  public static Factory<Genotype<DoubleGene>> getGenotypeFactory() {
    return Genotype.of(
      //Rotation
      new DoubleChromosome(-Math.PI, Math.PI),

      //Translation
      new DoubleChromosome(-300.0, 300.0, 2),

      //Shear
      new DoubleChromosome(-0.5, 0.5, 2)
    );
  }
View Full Code Here

}

public class RealFunction {
  public static void main(String[] args) {
    Factory<Genotype<DoubleGene>> gtf = Genotype.of(
      new DoubleChromosome(0.0, 2.0 * PI)
    );
    Function<Genotype<DoubleGene>, Double> ff = new Real();
    GeneticAlgorithm<DoubleGene, Double> ga =
      new GeneticAlgorithm<>(
        gtf, ff, Optimize.MINIMUM
View Full Code Here

    }
  }

  public static void main(final String[] args) {
    final Factory<Genotype<DoubleGene>> gtf = Genotype.of(
      new DoubleChromosome(0.0, 10.0), // x1 in [0, 10]
      new DoubleChromosome(5.0, 33.0// x2 in [5, 33]
    );

    final Function<Genotype<DoubleGene>, Double> ff = new FF();
    final GeneticAlgorithm<DoubleGene, Double> ga = new GeneticAlgorithm<>(gtf, ff);
View Full Code Here

    }
  }

  public static void main(final String[] args) throws Exception {
    final Genotype<DoubleGene> genotype = Genotype.of(
      new DoubleChromosome(0.0, 1.0, 8),
      new DoubleChromosome(1.0, 2.0, 10),
      new DoubleChromosome(0.0, 10.0, 9),
      new DoubleChromosome(0.1, 0.9, 5)
    );

    final GeneticAlgorithm<DoubleGene, Double> ga = new GeneticAlgorithm<>(genotype, new Id(), new Scaler());
    ga.setPopulationSize(5);
    ga.setup();
View Full Code Here

TOP

Related Classes of org.jenetics.DoubleChromosome

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.