Examples of MutateShuffle


Examples of com.heatonresearch.aifh.genetic.mutate.MutateShuffle

                return false;
            }
        });

        // Create a shuffle operator.  Use it 1.0 (100%) of the time.
        MutateShuffle opp = new MutateShuffle();
        train.addOperation(1.0, opp);

        // Create a single parent, the genes are set to 1,2,3,4,5.
        IntegerArrayGenome[] parents = new IntegerArrayGenome[1];
        parents[0] = (IntegerArrayGenome) pop.getGenomeFactory().factor();
        for (int i = 1; i <= 5; i++) {
            parents[0].getData()[i - 1] = i;
        }

        // Create an array to hold the offspring.
        IntegerArrayGenome[] offspring = new IntegerArrayGenome[1];
        offspring[0] = new IntegerArrayGenome(5);

        // Perform the operation
        opp.performOperation(rnd, parents, 0, offspring, 0);

        // Display the results
        System.out.println("Parent: " + Arrays.toString(parents[0].getData()));
        System.out.println("Offspring: " + Arrays.toString(offspring[0].getData()));
View Full Code Here

Examples of com.heatonresearch.aifh.genetic.mutate.MutateShuffle

        ScoreFunction score = new TSPScore(cities);

        genetic = new BasicEA(pop, score);

        genetic.addOperation(0.9, new SpliceNoRepeat(CITIES / 3));
        genetic.addOperation(0.1, new MutateShuffle());

        int sameSolutionCount = 0;
        int iteration = 1;
        double lastSolution = Double.MAX_VALUE;
View Full Code Here

Examples of org.encog.ml.genetic.mutate.MutateShuffle

    initPopulation(genetic);
    genetic.setMutationPercent(MUTATION_PERCENT);
    genetic.setPercentToMate(PERCENT_TO_MATE);
    genetic.setMatingPopulation(MATING_POPULATION_PERCENT);
    genetic.setCrossover(new SpliceNoRepeat(CITIES/3));
    genetic.setMutate(new MutateShuffle());

    int sameSolutionCount = 0;
    int iteration = 1;
    double lastSolution = Double.MAX_VALUE;
View Full Code Here

Examples of org.encog.ml.genetic.mutate.MutateShuffle

    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)
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.