Package com.heatonresearch.aifh.genetic.mutate

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


        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

TOP

Related Classes of com.heatonresearch.aifh.genetic.mutate.MutateShuffle

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.