Package org.optaplanner.core.impl.score.definition

Examples of org.optaplanner.core.impl.score.definition.FeasibilityScoreDefinition


            }
            if (!bestScoreFeasible) {
                throw new IllegalArgumentException("The termination bestScoreFeasible (" + bestScoreFeasible
                        + ") cannot be false.");
            }
            FeasibilityScoreDefinition feasibilityScoreDefinition = (FeasibilityScoreDefinition) scoreDefinition;
            double[] timeGradientWeightFeasibleNumbers
                    = new double[feasibilityScoreDefinition.getFeasibleLevelsSize() - 1];
            for (int i = 0; i < timeGradientWeightFeasibleNumbers.length; i++) {
                timeGradientWeightFeasibleNumbers[i] = 0.50; // Number pulled out of thin air
            }
            terminationList.add(new BestScoreFeasibleTermination(feasibilityScoreDefinition,
                    timeGradientWeightFeasibleNumbers));
View Full Code Here


public class BestScoreFeasibleTerminationTest {

    @Test
    public void solveTermination() {
        FeasibilityScoreDefinition scoreDefinition = mock(FeasibilityScoreDefinition.class);
        when(scoreDefinition.getFeasibleLevelsSize()).thenReturn(1);
        Termination termination = new BestScoreFeasibleTermination(scoreDefinition, new double[]{});
        DefaultSolverScope solverScope = mock(DefaultSolverScope.class);
        when(solverScope.getScoreDefinition()).thenReturn(new HardSoftScoreDefinition());
        when(solverScope.getStartingInitializedScore()).thenReturn(HardSoftScore.valueOf(-100, -100));
        when(solverScope.isBestSolutionInitialized()).thenReturn(true);
View Full Code Here

        assertEquals(1.0, termination.calculateSolverTimeGradient(solverScope), 0.0);
    }

    @Test
    public void phaseTermination() {
        FeasibilityScoreDefinition scoreDefinition = mock(FeasibilityScoreDefinition.class);
        when(scoreDefinition.getFeasibleLevelsSize()).thenReturn(1);
        Termination termination = new BestScoreFeasibleTermination(scoreDefinition, new double[]{});
        AbstractPhaseScope phaseScope = mock(AbstractPhaseScope.class);
        when(phaseScope.getScoreDefinition()).thenReturn(new HardSoftScoreDefinition());
        when(phaseScope.getStartingScore()).thenReturn(HardSoftScore.valueOf(-100, -100));
        when(phaseScope.isBestSolutionInitialized()).thenReturn(true);
View Full Code Here

        assertEquals(1.0, termination.calculatePhaseTimeGradient(phaseScope), 0.0);
    }

    @Test
    public void calculateTimeGradientBendableScoreHHSSS() {
        FeasibilityScoreDefinition scoreDefinition = mock(FeasibilityScoreDefinition.class);
        when(scoreDefinition.getFeasibleLevelsSize()).thenReturn(2);
        BestScoreFeasibleTermination termination = new BestScoreFeasibleTermination(scoreDefinition,
                new double[]{0.75});

        // Normal cases
        // Smack in the middle
View Full Code Here

TOP

Related Classes of org.optaplanner.core.impl.score.definition.FeasibilityScoreDefinition

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.