Package org.encog.ml.genetic

Examples of org.encog.ml.genetic.BasicGeneticAlgorithm


  public void solve() {
    StringBuilder builder = new StringBuilder();

    initCities();

    genetic = new BasicGeneticAlgorithm();
   
    initPopulation(genetic);
    genetic.setMutationPercent(MUTATION_PERCENT);
    genetic.setPercentToMate(PERCENT_TO_MATE);
    genetic.setMatingPopulation(MATING_POPULATION_PERCENT);
View Full Code Here


    }
    population.sort();
  }

  public static void main(String[] args) {
    GeneticAlgorithm genetic = new BasicGeneticAlgorithm();
    initPopulation(genetic);
    genetic.setMutationPercent(MUTATION_PERCENT);
    genetic.setPercentToMate(PERCENT_TO_MATE);
    genetic.setMatingPopulation(MATING_POPULATION_PERCENT);
    genetic.setCrossover(new Splice(CUT_LENGTH));
    genetic.setMutate(new MutateShuffle());
   
    boolean done = false;
    int iteration = 0;
   
    while(!done)
    {
      iteration++;
      genetic.iteration();
      double thisSolution = genetic.getPopulation().getBest().getScore();
      System.out.println(iteration + ": " + thisSolution);
    }
  }
View Full Code Here

TOP

Related Classes of org.encog.ml.genetic.BasicGeneticAlgorithm

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.