Package org.uncommons.watchmaker.framework.termination

Examples of org.uncommons.watchmaker.framework.termination.GenerationCount


                                                                                             selection,
                                                                                             new MersenneTwisterRNG());
                engine.addEvolutionObserver(new GenerationTracker());
                return engine.evolve(populationSize,
                                     0,
                                     new GenerationCount(generationCount));
            }

            @Override
            protected void postProcessing(Biomorph result)
            {
View Full Code Here


                }
            });
        }
        return engine.evolve(populationSize,
                             eliteCount,
                             new GenerationCount(generationCount));
    }
View Full Code Here

        elite.add(11);
        elite.add(13);
        engine.evolve(10,
                      2,
                      elite,
                      new GenerationCount(2)); // Do at least 2 generations because the first is just the initial population.
        // Then when we have run the evolution, if the elite canidates were preserved they will
        // lift the average fitness above zero.  The exact value of the expected average fitness
        // is easy to calculate, it is the aggregate fitness divided by the population size.
        assert observer.getAverageFitness() == 24d / 10 : "Elite candidates not preserved correctly: " + observer.getAverageFitness();
        engine.removeEvolutionObserver(observer);
View Full Code Here

     * population size.
     */
    @Test(expectedExceptions = IllegalArgumentException.class)
    public void testEliteCountTooHigh()
    {
        engine.evolve(10, 10, new GenerationCount(10)); // Should throw exception because elite is too big.
    }
View Full Code Here


    @Test(expectedExceptions = IllegalArgumentException.class)
    public void testEliteCountTooLow()
    {
        engine.evolvePopulation(10, -1, new GenerationCount(10)); // Should throw exception because elite is negative.
    }
View Full Code Here


    @Test
    public void testGetSatisfiedTerminationConditions()
    {
        GenerationCount generationsCondition = new GenerationCount(1);
        engine.evolve(10, 0, generationsCondition);
        List<TerminationCondition> satisfiedConditions = engine.getSatisfiedTerminationConditions();
        assert satisfiedConditions.size() == 1 : "Wrong number of conditions: " + satisfiedConditions.size();
        assert satisfiedConditions.get(0) == generationsCondition : "Wrong condition returned.";
    }
View Full Code Here

        {
            islandEpochs.add(new Epoch<T>(islands.get(i),
                                          populationSize,
                                          eliteCount,
                                          islandPopulations.isEmpty() ? Collections.<T>emptyList() : islandPopulations.get(i),
                                          new GenerationCount(epochLength)));
        }
        return islandEpochs;
    }
View Full Code Here

            public void islandPopulationUpdate(int islandIndex, PopulationData<? extends Integer> populationData)
            {
                observedGenerationCounts[islandIndex]++;
            }
        });
        islandEvolution.evolve(5, 0, 5, 0, new GenerationCount(2));
        assert observedEpochCount[0] == 2 : "Listener should have been notified twice, was " + observedEpochCount[0];
        for (int i = 0; i < islandCount; i++)
        {
            int expected = epochCount * generationCount;
            assert observedGenerationCounts[i] == expected
View Full Code Here

TOP

Related Classes of org.uncommons.watchmaker.framework.termination.GenerationCount

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.