Package org.encog.neural.neat.training

Examples of org.encog.neural.neat.training.NEATInnovation


    while ((section = in.readNextSection()) != null) {
      if (section.getSectionName().equals("NEAT-POPULATION")
          && section.getSubSectionName().equals("INNOVATIONS")) {
        for (String line : section.getLines()) {
          List<String> cols = EncogFileSection.splitColumns(line);
          NEATInnovation innovation = new NEATInnovation();
          innovation.setInnovationID(Integer.parseInt(cols.get(0)));
          innovation.setInnovationType(PersistNEATPopulation
              .stringToInnovationType(cols.get(1)));
          innovation.setNeuronType(PersistNEATPopulation.stringToNeuronType(cols.get(2)));
          innovation.setSplitX(CSVFormat.EG_FORMAT.parse(cols.get(3)));
          innovation.setSplitY(CSVFormat.EG_FORMAT.parse(cols.get(4)));
          innovation.setNeuronID(Integer.parseInt(cols.get(5)));
          innovation.setFromNeuronID(Integer.parseInt(cols.get(6)));
          innovation.setToNeuronID(Integer.parseInt(cols.get(7)));
          result.getInnovations().add(innovation);
        }
      } else if (section.getSectionName().equals("NEAT-POPULATION")
          && section.getSubSectionName().equals("SPECIES")) {
        for (String line : section.getLines()) {
View Full Code Here


    out.writeProperty(NEATPopulation.PROPERTY_NEXT_SPECIES_ID, pop
        .getSpeciesIDGenerate().getCurrentID());
    out.addSubSection("INNOVATIONS");
    if (pop.getInnovations() != null) {
      for (Innovation innovation : pop.getInnovations().getInnovations()) {
        NEATInnovation neatInnovation = (NEATInnovation) innovation;
        out.addColumn(neatInnovation.getInnovationID());
        out.addColumn(PersistNEATPopulation
            .innovationTypeToString(neatInnovation
                .getInnovationType()));
        out.addColumn(PersistNEATPopulation
            .neuronTypeToString(neatInnovation.getNeuronType()));
        out.addColumn(neatInnovation.getSplitX());
        out.addColumn(neatInnovation.getSplitY());
        out.addColumn(neatInnovation.getNeuronID());
        out.addColumn(neatInnovation.getFromNeuronID());
        out.addColumn(neatInnovation.getToNeuronID());
        out.writeLine();
      }
    }
    out.addSubSection("GENOMES");
    for (Genome genome : pop.getGenomes()) {
View Full Code Here

    splitLink.setEnabled(false);

    final long from = splitLink.getFromNeuronID();
    final long to = splitLink.getToNeuronID();

    final NEATInnovation innovation = ((NEATPopulation)getOwner().getPopulation()).getInnovations()
        .findInnovationSplit(from, to);

    // add the splitting neuron
    final ActivationFunction af = ((NEATPopulation)getOwner().getPopulation())
        .getActivationFunctions().pick(new Random());

    target.getNeuronsChromosome().add(
        new NEATNeuronGene(NEATNeuronType.Hidden, af, innovation
            .getNeuronID(), innovation.getInnovationID()));

    // add the other two sides of the link
    createLink(target, from, innovation.getNeuronID(),
        splitLink.getWeight());
    createLink(target, innovation.getNeuronID(), to, pop.getWeightRange());
   
    target.sortGenes();
  }
View Full Code Here

      if (section.getSectionName().equals("NEAT-POPULATION")
          && section.getSubSectionName().equals("INNOVATIONS")) {
        for (final String line : section.getLines()) {
          final List<String> cols = EncogFileSection
              .splitColumns(line);
          final NEATInnovation innovation = new NEATInnovation();
          final int innovationID = Integer.parseInt(cols.get(1));
          innovation.setInnovationID(innovationID);
          innovation.setNeuronID(Integer.parseInt(cols.get(2)));
          result.getInnovations().getInnovations()
              .put(cols.get(0), innovation);
          nextInnovationID = Math.max(nextInnovationID,
              innovationID + 1);
        }
View Full Code Here

        pop.getSurvivalRate());
    out.addSubSection("INNOVATIONS");
    if (pop.getInnovations() != null) {
      for (final String key : pop.getInnovations().getInnovations()
          .keySet()) {
        final NEATInnovation innovation = pop.getInnovations()
            .getInnovations().get(key);
        out.addColumn(key);
        out.addColumn(innovation.getInnovationID());
        out.addColumn(innovation.getNeuronID());
        out.writeLine();
      }
    }

    out.addSubSection("SPECIES");
View Full Code Here

        return;
      }
    }

    // check to see if this innovation has already been tried
    final NEATInnovation innovation = ((NEATPopulation) target
        .getPopulation()).getInnovations().findInnovation(neuron1ID,
        neuron2ID);

    // now create this link
    final NEATLinkGene linkGene = new NEATLinkGene(neuron1ID, neuron2ID,
        true, innovation.getInnovationID(), weight);
    target.getLinksChromosome().add(linkGene);
  }
View Full Code Here

TOP

Related Classes of org.encog.neural.neat.training.NEATInnovation

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.