Examples of calculatePhaseTimeMillisSpent()


Examples of org.optaplanner.core.impl.phase.scope.AbstractPhaseScope.calculatePhaseTimeMillisSpent()

    @Test
    public void phaseTermination() {
        Termination termination = new TimeMillisSpentTermination(1000L);
        AbstractPhaseScope phaseScope = mock(AbstractPhaseScope.class);

        when(phaseScope.calculatePhaseTimeMillisSpent()).thenReturn(0L);
        assertEquals(false, termination.isPhaseTerminated(phaseScope));
        assertEquals(0.0, termination.calculatePhaseTimeGradient(phaseScope), 0.0);
        when(phaseScope.calculatePhaseTimeMillisSpent()).thenReturn(100L);
        assertEquals(false, termination.isPhaseTerminated(phaseScope));
        assertEquals(0.1, termination.calculatePhaseTimeGradient(phaseScope), 0.0);
View Full Code Here

Examples of org.optaplanner.core.impl.phase.scope.AbstractPhaseScope.calculatePhaseTimeMillisSpent()

        AbstractPhaseScope phaseScope = mock(AbstractPhaseScope.class);

        when(phaseScope.calculatePhaseTimeMillisSpent()).thenReturn(0L);
        assertEquals(false, termination.isPhaseTerminated(phaseScope));
        assertEquals(0.0, termination.calculatePhaseTimeGradient(phaseScope), 0.0);
        when(phaseScope.calculatePhaseTimeMillisSpent()).thenReturn(100L);
        assertEquals(false, termination.isPhaseTerminated(phaseScope));
        assertEquals(0.1, termination.calculatePhaseTimeGradient(phaseScope), 0.0);
        when(phaseScope.calculatePhaseTimeMillisSpent()).thenReturn(500L);
        assertEquals(false, termination.isPhaseTerminated(phaseScope));
        assertEquals(0.5, termination.calculatePhaseTimeGradient(phaseScope), 0.0);
View Full Code Here

Examples of org.optaplanner.core.impl.phase.scope.AbstractPhaseScope.calculatePhaseTimeMillisSpent()

        assertEquals(false, termination.isPhaseTerminated(phaseScope));
        assertEquals(0.0, termination.calculatePhaseTimeGradient(phaseScope), 0.0);
        when(phaseScope.calculatePhaseTimeMillisSpent()).thenReturn(100L);
        assertEquals(false, termination.isPhaseTerminated(phaseScope));
        assertEquals(0.1, termination.calculatePhaseTimeGradient(phaseScope), 0.0);
        when(phaseScope.calculatePhaseTimeMillisSpent()).thenReturn(500L);
        assertEquals(false, termination.isPhaseTerminated(phaseScope));
        assertEquals(0.5, termination.calculatePhaseTimeGradient(phaseScope), 0.0);
        when(phaseScope.calculatePhaseTimeMillisSpent()).thenReturn(700L);
        assertEquals(false, termination.isPhaseTerminated(phaseScope));
        assertEquals(0.7, termination.calculatePhaseTimeGradient(phaseScope), 0.0);
View Full Code Here

Examples of org.optaplanner.core.impl.phase.scope.AbstractPhaseScope.calculatePhaseTimeMillisSpent()

        assertEquals(false, termination.isPhaseTerminated(phaseScope));
        assertEquals(0.1, termination.calculatePhaseTimeGradient(phaseScope), 0.0);
        when(phaseScope.calculatePhaseTimeMillisSpent()).thenReturn(500L);
        assertEquals(false, termination.isPhaseTerminated(phaseScope));
        assertEquals(0.5, termination.calculatePhaseTimeGradient(phaseScope), 0.0);
        when(phaseScope.calculatePhaseTimeMillisSpent()).thenReturn(700L);
        assertEquals(false, termination.isPhaseTerminated(phaseScope));
        assertEquals(0.7, termination.calculatePhaseTimeGradient(phaseScope), 0.0);
        when(phaseScope.calculatePhaseTimeMillisSpent()).thenReturn(1000L);
        assertEquals(true, termination.isPhaseTerminated(phaseScope));
        assertEquals(1.0, termination.calculatePhaseTimeGradient(phaseScope), 0.0);
View Full Code Here

Examples of org.optaplanner.core.impl.phase.scope.AbstractPhaseScope.calculatePhaseTimeMillisSpent()

        assertEquals(false, termination.isPhaseTerminated(phaseScope));
        assertEquals(0.5, termination.calculatePhaseTimeGradient(phaseScope), 0.0);
        when(phaseScope.calculatePhaseTimeMillisSpent()).thenReturn(700L);
        assertEquals(false, termination.isPhaseTerminated(phaseScope));
        assertEquals(0.7, termination.calculatePhaseTimeGradient(phaseScope), 0.0);
        when(phaseScope.calculatePhaseTimeMillisSpent()).thenReturn(1000L);
        assertEquals(true, termination.isPhaseTerminated(phaseScope));
        assertEquals(1.0, termination.calculatePhaseTimeGradient(phaseScope), 0.0);
        when(phaseScope.calculatePhaseTimeMillisSpent()).thenReturn(1200L);
        assertEquals(true, termination.isPhaseTerminated(phaseScope));
        assertEquals(1.0, termination.calculatePhaseTimeGradient(phaseScope), 0.0);
View Full Code Here

Examples of org.optaplanner.core.impl.phase.scope.AbstractPhaseScope.calculatePhaseTimeMillisSpent()

        assertEquals(false, termination.isPhaseTerminated(phaseScope));
        assertEquals(0.7, termination.calculatePhaseTimeGradient(phaseScope), 0.0);
        when(phaseScope.calculatePhaseTimeMillisSpent()).thenReturn(1000L);
        assertEquals(true, termination.isPhaseTerminated(phaseScope));
        assertEquals(1.0, termination.calculatePhaseTimeGradient(phaseScope), 0.0);
        when(phaseScope.calculatePhaseTimeMillisSpent()).thenReturn(1200L);
        assertEquals(true, termination.isPhaseTerminated(phaseScope));
        assertEquals(1.0, termination.calculatePhaseTimeGradient(phaseScope), 0.0);
    }

}
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.