Package org.encog.ml.genetic.population

Examples of org.encog.ml.genetic.population.BasicPopulation


      final int populationSize, final double mutationPercent,
      final double percentToMate) {
    super(TrainingImplementationType.Iterative);
    this.genetic = new NeuralGeneticAlgorithmHelper();
    this.genetic.setCalculateScore(new GeneticScoreAdapter(calculateScore));
    final Population population = new BasicPopulation(populationSize);
    getGenetic().setMutationPercent(mutationPercent);
    getGenetic().setMatingPopulation(percentToMate * 2);
    getGenetic().setPercentToMate(percentToMate);
    getGenetic().setCrossover(
        new Splice(network.getStructure().calculateSize() / 3));
    getGenetic().setMutate(new MutatePerturb(4.0));
    getGenetic().setPopulation(population);
    for (int i = 0; i < population.getPopulationSize(); i++) {
      final BasicNetwork chromosomeNetwork = (BasicNetwork) network
          .clone();
      randomizer.randomize(chromosomeNetwork);

      final NeuralGenome genome = new NeuralGenome(chromosomeNetwork);
      genome.setGeneticAlgorithm(getGenetic());
      getGenetic().calculateScore(genome);
      getGenetic().getPopulation().add(genome);
    }
    population.sort();
  }
View Full Code Here


 
  private void initPopulation(GeneticAlgorithm ga)
  {
    CalculateGenomeScore score =  new TSPScore(cities);
    ga.setCalculateScore(score);
    Population population = new BasicPopulation(POPULATION_SIZE);
    ga.setPopulation(population);

    for (int i = 0; i < POPULATION_SIZE; i++) {

      final TSPGenome genome = new TSPGenome(ga, cities);
      ga.getPopulation().add(genome);
      ga.calculateScore(genome);
    }
    population.claim(ga);
    population.sort();
  }
View Full Code Here

 
  private static void initPopulation(GeneticAlgorithm ga)
  {
    ScorePlayer score =  new ScorePlayer();
    ga.setCalculateScore(score);
    Population population = new BasicPopulation(POPULATION_SIZE);
    ga.setPopulation(population);

    for (int i = 0; i < POPULATION_SIZE; i++) {

      Player player = new Player(1000);
      player.randomize();
      final PlayerGenome genome = new PlayerGenome(ga, player);
      ga.getPopulation().add(genome);
      ga.calculateScore(genome);
    }
    population.sort();
  }
View Full Code Here

TOP

Related Classes of org.encog.ml.genetic.population.BasicPopulation

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.