Package org.uncommons.watchmaker.framework.factories

Examples of org.uncommons.watchmaker.framework.factories.BitStringFactory


    {
        List<EvolutionaryOperator<BitString>> operators = new ArrayList<EvolutionaryOperator<BitString>>(2);
        operators.add(new BitStringCrossover(1, new Probability(0.7d)));
        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.
View Full Code Here


{
    @Test
    public void testCrossover()
    {
        EvolutionaryOperator<BitString> operator = new BitStringCrossover();
        CandidateFactory<BitString> factory = new BitStringFactory(50);
        List<BitString> population = factory.generateInitialPopulation(2, FrameworkTestUtils.getRNG());
        // Test to make sure that cross-over correctly preserves all genetic material
        // originally present in the population and does not introduce anything new.
        int totalSetBits = population.get(0).countSetBits() + population.get(1).countSetBits();
        for (int i = 0; i < 50; i++) // Test several generations.
        {
View Full Code Here

TOP

Related Classes of org.uncommons.watchmaker.framework.factories.BitStringFactory

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.