Package org.uncommons.watchmaker.framework.selection

Examples of org.uncommons.watchmaker.framework.selection.RouletteWheelSelection


        operators.add(new Simplification());
        TreeEvaluator evaluator = new TreeEvaluator(data);
        EvolutionEngine<Node> engine = new GenerationalEvolutionEngine<Node>(factory,
                                                                             new EvolutionPipeline<Node>(operators),
                                                                             evaluator,
                                                                             new RouletteWheelSelection(),
                                                                             new MersenneTwisterRNG());
        engine.addEvolutionObserver(new EvolutionLogger<Node>());
        return engine.evolve(1000, 5, new TargetFitness(0d, evaluator.isNatural()));
    }
View Full Code Here


{
    @Test
    public void testInitialisation()
    {
        SelectionStrategy<Object> rank = new RankSelection();
        SelectionStrategy<Object> roulette = new RouletteWheelSelection();
        List<SelectionStrategy<? super Object>> strategies = new LinkedList<SelectionStrategy<? super Object>>();
        strategies.add(rank);
        strategies.add(roulette);
        SelectionStrategyControl<?> control = new SelectionStrategyControl<Object>(strategies);
        JComboBox component = control.getControl();
View Full Code Here

    public static <T> List<SelectionStrategy<? super T>> createDefaultOptions(Probability tournamentProbability,
                                                                              double truncationRatio)
    {
        List<SelectionStrategy<? super T>> options = new LinkedList<SelectionStrategy<? super T>>();
        options.add(new RankSelection());
        options.add(new RouletteWheelSelection());
        options.add(new SigmaScaling());
        options.add(new StochasticUniversalSampling());
        options.add(new TournamentSelection(tournamentProbability));
        options.add(new TruncationSelection(truncationRatio));
        return options;
View Full Code Here

        operators.add(new BitStringMutation(new Probability(0.01d)));
        EvolutionaryOperator<BitString> pipeline = new EvolutionPipeline<BitString>(operators);
        GenerationalEvolutionEngine<BitString> engine = new GenerationalEvolutionEngine<BitString>(new BitStringFactory(length),
                                                                                                   pipeline,
                                                                                                   new BitStringEvaluator(),
                                                                                                   new RouletteWheelSelection(),
                                                                                                   new MersenneTwisterRNG());
        engine.setSingleThreaded(true); // Performs better for very trivial fitness evaluations.
        engine.addEvolutionObserver(new EvolutionLogger<BitString>());
        return engine.evolve(100, // 100 individuals in each generation.
                             0, // Don't use elitism.
View Full Code Here

    public void prepareEngine()
    {
        this.engine = new GenerationalEvolutionEngine<Integer>(new StubIntegerFactory(),
                                                               new IntegerZeroMaker(),
                                                               new IntegerEvaluator(),
                                                               new RouletteWheelSelection(),
                                                               FrameworkTestUtils.getRNG());
    }
View Full Code Here

        IslandEvolution<Integer> islandEvolution = new IslandEvolution<Integer>(islandCount,
                                                                                new RingMigration(),
                                                                                new StubIntegerFactory(),
                                                                                new IntegerAdjuster(2),
                                                                                new DummyFitnessEvaluator(),
                                                                                new RouletteWheelSelection(),
                                                                                FrameworkTestUtils.getRNG());
        final int[] observedEpochCount = new int[1];
        final int[] observedGenerationCounts = new int[islandCount];

        islandEvolution.addEvolutionObserver(new IslandEvolutionObserver<Integer>()
View Full Code Here

        IslandEvolution<Integer> islandEvolution = new IslandEvolution<Integer>(2,
                                                                                new RingMigration(),
                                                                                new StubIntegerFactory(),
                                                                                new IntegerAdjuster(2),
                                                                                new DummyFitnessEvaluator(),
                                                                                new RouletteWheelSelection(),
                                                                                FrameworkTestUtils.getRNG());
        final long timeout = 1000L;
        final Thread requestThread = Thread.currentThread();
        islandEvolution.addEvolutionObserver(new IslandEvolutionObserver<Integer>()
        {
View Full Code Here

    public void testIncrementalEvolution()
    {
        SteadyStateEvolutionEngine<Integer> steadyState = new SteadyStateEvolutionEngine<Integer>(new StubIntegerFactory(),
                                                                                                  new IntegerAdjuster(5),
                                                                                                  new NullFitnessEvaluator(),
                                                                                                  new RouletteWheelSelection(),
                                                                                                  1,
                                                                                                  true,
                                                                                                  FrameworkTestUtils.getRNG());
        @SuppressWarnings("unchecked")
        List<EvaluatedCandidate<Integer>> population = Arrays.asList(new EvaluatedCandidate<Integer>(1, 0),
View Full Code Here

        IslandEvolution<Integer> islandEvolution = new IslandEvolution<Integer>(3,
                                                                                new RingMigration(),
                                                                                new StubIntegerFactory(),
                                                                                new IntegerAdjuster(2),
                                                                                new DummyFitnessEvaluator(),
                                                                                new RouletteWheelSelection(),
                                                                                FrameworkTestUtils.getRNG());
        // Should throw an IllegalStateException because evolution hasn't started, let alone terminated.
        islandEvolution.getSatisfiedTerminationConditions();
    }
View Full Code Here

    public void testForcedSingleCandidateUpdate()
    {
        SteadyStateEvolutionEngine<Integer> steadyState = new SteadyStateEvolutionEngine<Integer>(new StubIntegerFactory(),
                                                                                                  new IntegerAdjuster(5),
                                                                                                  new NullFitnessEvaluator(),
                                                                                                  new RouletteWheelSelection(),
                                                                                                  2,
                                                                                                  true, // Force single update.
                                                                                                  FrameworkTestUtils.getRNG());
        @SuppressWarnings("unchecked")
        List<EvaluatedCandidate<Integer>> population = Arrays.asList(new EvaluatedCandidate<Integer>(1, 0),
View Full Code Here

TOP

Related Classes of org.uncommons.watchmaker.framework.selection.RouletteWheelSelection

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.