Package org.encog.ml.ea.population

Examples of org.encog.ml.ea.population.Population


    return (NEATPopulation)train.getPopulation();
  }
 
  public void testPersistEG()
  {
    Population pop = generate();

    EncogDirectoryPersistence.saveObject((EG_FILENAME), pop);
    NEATPopulation pop2 = (NEATPopulation)EncogDirectoryPersistence.loadObject((EG_FILENAME));
   
    validate(pop2);
View Full Code Here


    training1.iteration();
    // enough training for now, backup current population
    final ByteArrayOutputStream serialized1 = new ByteArrayOutputStream();
    new PersistNEATPopulation().save(serialized1, training1.getPopulation());

    final Population population2 = (Population)new PersistNEATPopulation().read(new ByteArrayInputStream(
      serialized1.toByteArray()));
    final ByteArrayOutputStream serialized2 = new ByteArrayOutputStream();
    new PersistNEATPopulation().save(serialized2, population2);
    Assert.assertEquals(serialized1.size(), serialized2.size());   
  }
View Full Code Here

  public MLMethodGeneticAlgorithm(final MethodFactory phenotypeFactory,
      final CalculateScore calculateScore, final int populationSize) {
    super(TrainingImplementationType.Iterative);

    // Create the population
    final Population population = new BasicPopulation(populationSize, null);
    final Species defaultSpecies = population.createSpecies();

    for (int i = 0; i < population.getPopulationSize(); i++) {
      final MLEncodable chromosomeNetwork = (MLEncodable) phenotypeFactory
          .factor();
      final MLMethodGenome genome = new MLMethodGenome(chromosomeNetwork);
      defaultSpecies.add(genome);
    }
    defaultSpecies.setLeader(defaultSpecies.getMembers().get(0));
   
    population.setGenomeFactory(new MLMethodGenomeFactory(phenotypeFactory,
        population));
   
    // create the trainer
    this.genetic = new MLMethodGeneticAlgorithmHelper(population,
        calculateScore);
View Full Code Here

TOP

Related Classes of org.encog.ml.ea.population.Population

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.