Package org.encog.ml.ea.species

Examples of org.encog.ml.ea.species.BasicSpecies


        for (final String line : section.getLines()) {
          final List<String> cols = EncogFileSection
              .splitColumns(line);

          if (cols.get(0).equalsIgnoreCase("s")) {
            lastSpecies = new BasicSpecies();
            lastSpecies.setAge(Integer.parseInt(cols.get(1)));
            lastSpecies.setBestScore(CSVFormat.EG_FORMAT.parse(cols
                .get(2)));
            lastSpecies.setPopulation(result);
            lastSpecies.setGensNoImprovement(Integer.parseInt(cols
View Full Code Here


    getInnovationIDGenerate().setCurrentID(1);

    final Random rnd = this.randomNumberFactory.factor();

    // create one default species
    final BasicSpecies defaultSpecies = new BasicSpecies();
    defaultSpecies.setPopulation(this);

    // create the initial population
    for (int i = 0; i < getPopulationSize(); i++) {
      final NEATGenome genome = getGenomeFactory().factor(rnd, this,
          this.inputCount, this.outputCount,
          this.initialConnectionDensity);
      defaultSpecies.add(genome);
    }
    defaultSpecies.setLeader(defaultSpecies.getMembers().get(0));
    getSpecies().add(defaultSpecies);

    // create initial innovations
    setInnovations(new NEATInnovationList(this));
  }
View Full Code Here

              innovationID + 1);
        }
      } else if (section.getSectionName().equals("NEAT-POPULATION")
          && section.getSubSectionName().equals("SPECIES")) {
        NEATGenome lastGenome = null;
        BasicSpecies lastSpecies = null;

        for (final String line : section.getLines()) {
          final List<String> cols = EncogFileSection
              .splitColumns(line);

          if (cols.get(0).equalsIgnoreCase("s")) {
            lastSpecies = new BasicSpecies();
            lastSpecies.setPopulation(result);
            lastSpecies.setAge(Integer.parseInt(cols.get(1)));
            lastSpecies.setBestScore(CSVFormat.EG_FORMAT.parse(cols
                .get(2)));
            lastSpecies.setGensNoImprovement(Integer.parseInt(cols
                .get(3)));
            result.getSpecies().add(lastSpecies);
          } else if (cols.get(0).equalsIgnoreCase("g")) {
            final boolean isLeader = lastGenome == null;
            lastGenome = new NEATGenome();
            lastGenome.setInputCount(result.getInputCount());
            lastGenome.setOutputCount(result.getOutputCount());
            lastGenome.setSpecies(lastSpecies);
            lastGenome.setAdjustedScore(CSVFormat.EG_FORMAT
                .parse(cols.get(1)));
            lastGenome.setScore(CSVFormat.EG_FORMAT.parse(cols
                .get(2)));
            lastGenome.setBirthGeneration(Integer.parseInt(cols
                .get(3)));
            lastSpecies.add(lastGenome);
            if (isLeader) {
              lastSpecies.setLeader(lastGenome);
            }
          } else if (cols.get(0).equalsIgnoreCase("n")) {
            final NEATNeuronGene neuronGene = new NEATNeuronGene();
            final int geneID = Integer.parseInt(cols.get(1));
            neuronGene.setId(geneID);
View Full Code Here

  /**
   * {@inheritDoc}
   */
  @Override
  public Species createSpecies() {
    final Species species = new BasicSpecies();
    species.setPopulation(this);
    getSpecies().add(species);
    return species;
  }
View Full Code Here

TOP

Related Classes of org.encog.ml.ea.species.BasicSpecies

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.