Examples of calculateTimeMillisSpent()


Examples of org.optaplanner.core.impl.solver.scope.DefaultSolverScope.calculateTimeMillisSpent()

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

        when(phaseScope.calculateTimeMillisSpent()).thenReturn(0L);
        assertEquals(false, termination.isSolverTerminated(phaseScope));
        assertEquals(0.0, termination.calculateSolverTimeGradient(phaseScope), 0.0);
        when(phaseScope.calculateTimeMillisSpent()).thenReturn(100L);
        assertEquals(false, termination.isSolverTerminated(phaseScope));
        assertEquals(0.1, termination.calculateSolverTimeGradient(phaseScope), 0.0);
View Full Code Here

Examples of org.optaplanner.core.impl.solver.scope.DefaultSolverScope.calculateTimeMillisSpent()

        DefaultSolverScope phaseScope = mock(DefaultSolverScope.class);

        when(phaseScope.calculateTimeMillisSpent()).thenReturn(0L);
        assertEquals(false, termination.isSolverTerminated(phaseScope));
        assertEquals(0.0, termination.calculateSolverTimeGradient(phaseScope), 0.0);
        when(phaseScope.calculateTimeMillisSpent()).thenReturn(100L);
        assertEquals(false, termination.isSolverTerminated(phaseScope));
        assertEquals(0.1, termination.calculateSolverTimeGradient(phaseScope), 0.0);
        when(phaseScope.calculateTimeMillisSpent()).thenReturn(500L);
        assertEquals(false, termination.isSolverTerminated(phaseScope));
        assertEquals(0.5, termination.calculateSolverTimeGradient(phaseScope), 0.0);
View Full Code Here

Examples of org.optaplanner.core.impl.solver.scope.DefaultSolverScope.calculateTimeMillisSpent()

        assertEquals(false, termination.isSolverTerminated(phaseScope));
        assertEquals(0.0, termination.calculateSolverTimeGradient(phaseScope), 0.0);
        when(phaseScope.calculateTimeMillisSpent()).thenReturn(100L);
        assertEquals(false, termination.isSolverTerminated(phaseScope));
        assertEquals(0.1, termination.calculateSolverTimeGradient(phaseScope), 0.0);
        when(phaseScope.calculateTimeMillisSpent()).thenReturn(500L);
        assertEquals(false, termination.isSolverTerminated(phaseScope));
        assertEquals(0.5, termination.calculateSolverTimeGradient(phaseScope), 0.0);
        when(phaseScope.calculateTimeMillisSpent()).thenReturn(700L);
        assertEquals(false, termination.isSolverTerminated(phaseScope));
        assertEquals(0.7, termination.calculateSolverTimeGradient(phaseScope), 0.0);
View Full Code Here

Examples of org.optaplanner.core.impl.solver.scope.DefaultSolverScope.calculateTimeMillisSpent()

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

Examples of org.optaplanner.core.impl.solver.scope.DefaultSolverScope.calculateTimeMillisSpent()

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

Examples of org.optaplanner.core.impl.solver.scope.DefaultSolverScope.calculateTimeMillisSpent()

        assertEquals(false, termination.isSolverTerminated(phaseScope));
        assertEquals(0.7, termination.calculateSolverTimeGradient(phaseScope), 0.0);
        when(phaseScope.calculateTimeMillisSpent()).thenReturn(1000L);
        assertEquals(true, termination.isSolverTerminated(phaseScope));
        assertEquals(1.0, termination.calculateSolverTimeGradient(phaseScope), 0.0);
        when(phaseScope.calculateTimeMillisSpent()).thenReturn(1200L);
        assertEquals(true, termination.isSolverTerminated(phaseScope));
        assertEquals(1.0, termination.calculateSolverTimeGradient(phaseScope), 0.0);
    }

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