Package org.encog.ml.genetic.genes

Examples of org.encog.ml.genetic.genes.DoubleGene


    this.networkChromosome = new Chromosome();

    // create an array of "double genes"
    final int size = network.getStructure().calculateSize();
    for (int i = 0; i < size; i++) {
      final Gene gene = new DoubleGene();
      this.networkChromosome.getGenes().add(gene);
    }

    getChromosomes().add(this.networkChromosome);
View Full Code Here


   */
  public final void decode() {
    final double[] net = new double[this.networkChromosome.getGenes()
        .size()];
    for (int i = 0; i < net.length; i++) {
      final DoubleGene gene = (DoubleGene) this.networkChromosome
          .getGenes().get(i);
      net[i] = gene.getValue();

    }
    NetworkCODEC.arrayToNetwork(net, (BasicNetwork) getOrganism());

  }
View Full Code Here

   * @param chromosome The chromosome to mutate.
   */
  public final void performMutation(final Chromosome chromosome) {
    for (final Gene gene : chromosome.getGenes()) {
      if (gene instanceof DoubleGene) {
        final DoubleGene doubleGene = (DoubleGene) gene;
        double value = doubleGene.getValue();
        value += (perturbAmount - (Math.random() * perturbAmount * 2));
        doubleGene.setValue(value);
      }
    }
  }
 
View Full Code Here

TOP

Related Classes of org.encog.ml.genetic.genes.DoubleGene

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.