Package org.uncommons.watchmaker.framework

Examples of org.uncommons.watchmaker.framework.TerminationCondition.shouldTerminate()


    @Test
    public void testNonNaturalFitness()
    {
        TerminationCondition condition = new TargetFitness(1.0d, false);
        PopulationData<Object> data = new PopulationData<Object>(new Object(), 5.0d, 4.0d, 0, true, 2, 0, 0, 100);
        assert !condition.shouldTerminate(data) : "Should not terminate before target fitness is reached.";
        data = new PopulationData<Object>(new Object(), 1.0d, 3.1d, 0, true, 2, 0, 0, 100);
        assert condition.shouldTerminate(data) : "Should terminate once target fitness is reached.";
    }
}
View Full Code Here


    {
        TerminationCondition condition = new TargetFitness(1.0d, false);
        PopulationData<Object> data = new PopulationData<Object>(new Object(), 5.0d, 4.0d, 0, true, 2, 0, 0, 100);
        assert !condition.shouldTerminate(data) : "Should not terminate before target fitness is reached.";
        data = new PopulationData<Object>(new Object(), 1.0d, 3.1d, 0, true, 2, 0, 0, 100);
        assert condition.shouldTerminate(data) : "Should terminate once target fitness is reached.";
    }
}
View Full Code Here

    @Test
    public void testElapsedTimes()
    {
        TerminationCondition condition = new ElapsedTime(1000);
        PopulationData<Object> data = new PopulationData<Object>(new Object(), 0, 0, 0, true, 2, 0, 0, 100);
        assert !condition.shouldTerminate(data) : "Should not terminate before timeout.";
        data = new PopulationData<Object>(new Object(), 0, 0, 0, true, 2, 0, 0, 1000);
        assert condition.shouldTerminate(data) : "Should terminate after timeout.";
    }

View Full Code Here

    {
        TerminationCondition condition = new ElapsedTime(1000);
        PopulationData<Object> data = new PopulationData<Object>(new Object(), 0, 0, 0, true, 2, 0, 0, 100);
        assert !condition.shouldTerminate(data) : "Should not terminate before timeout.";
        data = new PopulationData<Object>(new Object(), 0, 0, 0, true, 2, 0, 0, 1000);
        assert condition.shouldTerminate(data) : "Should terminate after timeout.";
    }


    /**
     * The duration must be greater than zero to be useful.  This test
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.