Package org.optaplanner.core.api.score

Examples of org.optaplanner.core.api.score.Score


    }

    public void processWorkingSolutionDuringStep(AbstractStepScope stepScope) {
        AbstractPhaseScope phaseScope = stepScope.getPhaseScope();
        int uninitializedVariableCount = stepScope.getUninitializedVariableCount();
        Score score = stepScope.getScore();
        DefaultSolverScope solverScope = phaseScope.getSolverScope();
        int bestUninitializedVariableCount = solverScope.getBestUninitializedVariableCount();
        Score bestScore = solverScope.getBestScore();
        boolean bestScoreImproved;
        if (uninitializedVariableCount == bestUninitializedVariableCount) {
            bestScoreImproved = score.compareTo(bestScore) > 0;
        } else {
            bestScoreImproved = uninitializedVariableCount < bestUninitializedVariableCount;
View Full Code Here


    public void processWorkingSolutionDuringMove(
            int uninitializedVariableCount, Score score, AbstractStepScope stepScope) {
        AbstractPhaseScope phaseScope = stepScope.getPhaseScope();
        DefaultSolverScope solverScope = phaseScope.getSolverScope();
        int bestUninitializedVariableCount = solverScope.getBestUninitializedVariableCount();
        Score bestScore = solverScope.getBestScore();
        boolean bestScoreImproved;
        if (uninitializedVariableCount == bestUninitializedVariableCount) {
            bestScoreImproved = score.compareTo(bestScore) > 0;
        } else {
            bestScoreImproved = uninitializedVariableCount < bestUninitializedVariableCount;
View Full Code Here

        return calculateFeasibilityTimeGradient(
                (FeasibilityScore) phaseScope.getStartingScore(), (FeasibilityScore) phaseScope.getBestScore());
    }

    protected double calculateFeasibilityTimeGradient(FeasibilityScore startScore, FeasibilityScore score) {
        Score totalDiff = startScore.negate();
        Number[] totalDiffNumbers = totalDiff.toLevelNumbers();
        Score scoreDiff = score.subtract(startScore);
        Number[] scoreDiffNumbers = scoreDiff.toLevelNumbers();
        if (scoreDiffNumbers.length != totalDiffNumbers.length) {
            throw new IllegalStateException("The startScore (" + startScore + ") and score (" + score
                    + ") don't have the same levelsSize.");
        }
        return ScoreUtils.calculateTimeGradient(totalDiffNumbers, scoreDiffNumbers, timeGradientWeightFeasibleNumbers,
View Full Code Here

        if (accepted && !finalistIsAccepted) {
            finalistIsAccepted = true;
            finalistScore = null;
            finalistLevelNumbers = null;
        }
        Score moveScore = moveScope.getScore();
        Number[] moveLevelNumbers = moveScore.toLevelNumbers();
        int comparison = doComparison(moveScore, moveLevelNumbers);
        if (comparison > 0) {
            finalistScore = moveScore;
            finalistLevelNumbers = moveLevelNumbers;
            finalistList.clear();
View Full Code Here

    // ************************************************************************
    // Worker methods
    // ************************************************************************

    public boolean isAccepted(LocalSearchMoveScope moveScope) {
        Score moveScore = moveScope.getScore();
        Score lastStepScore = moveScope.getStepScope().getPhaseScope().getLastCompletedStepScope().getScore();
        return moveScore.compareTo(lastStepScore) >= 0;
    }
View Full Code Here

    protected void checkPickEarly(LocalSearchMoveScope moveScope) {
        switch (pickEarlyType) {
            case NEVER:
                break;
            case FIRST_BEST_SCORE_IMPROVING:
                Score bestScore = moveScope.getStepScope().getPhaseScope().getBestScore();
                if (moveScope.getScore().compareTo(bestScore) > 0) {
                    earlyPickedMoveScope = moveScope;
                }
                break;
            case FIRST_LAST_STEP_SCORE_IMPROVING:
                Score lastStepScore = moveScope.getStepScope().getPhaseScope()
                        .getLastCompletedStepScope().getScore();
                if (moveScope.getScore().compareTo(lastStepScore) > 0) {
                    earlyPickedMoveScope = moveScope;
                }
                break;
View Full Code Here

        }
        if (accepted && !finalistIsAccepted) {
            finalistIsAccepted = true;
            finalistScore = null;
        }
        Score moveScore = moveScope.getScore();
        int scoreComparison = doComparison(moveScore);
        if (scoreComparison > 0) {
            finalistScore = moveScore;
            finalistList.clear();
            finalistList.add(moveScope);
View Full Code Here

        thresholdScore = phaseScope.getBestScore();
        count = 0;
    }

    public boolean isAccepted(LocalSearchMoveScope moveScope) {
        Score lastStepScore = moveScope.getStepScope().getPhaseScope().getLastCompletedStepScope().getScore();
        Score moveScore = moveScope.getScore();
        if (moveScore.compareTo(lastStepScore) >= 0) {
            return true;
        }
        return moveScore.compareTo(thresholdScore) >= 0;
    }
View Full Code Here

    @Override
    public void phaseStarted(LocalSearchPhaseScope phaseScope) {
        super.phaseStarted(phaseScope);
        validate();
        previousScores = new Score[lateSimulatedAnnealingSize];
        Score initialScore = phaseScope.getBestScore();
        for (int i = 0; i < previousScores.length; i++) {
            previousScores[i] = initialScore;
        }
        lateScoreIndex = 0;
    }
View Full Code Here

                    + ") cannot be negative or zero.");
        }
    }

    public boolean isAccepted(LocalSearchMoveScope moveScope) {
        Score moveScore = moveScope.getScore();
        Score lastStepScore = moveScope.getStepScope().getPhaseScope().getLastCompletedStepScope().getScore();
        if (moveScore.compareTo(lastStepScore) >= 0) {
            return true;
        }
        Score lateScore = previousScores[lateScoreIndex];
        Score bestScore = moveScope.getStepScope().getPhaseScope().getBestScore();
        Score moveScoreDifference = bestScore.subtract(moveScore);
        double[] moveScoreDifferenceLevels = ScoreUtils.extractLevelDoubles(moveScoreDifference);
        Score lateScoreDifference = bestScore.subtract(lateScore);
        double[] lateScoreDifferenceLevels = ScoreUtils.extractLevelDoubles(lateScoreDifference);
        double acceptChance = 1.0;
        for (int i = 0; i < moveScoreDifferenceLevels.length; i++) {
            double moveScoreDifferenceLevel = moveScoreDifferenceLevels[i];
            double lateScoreDifferenceLevel = lateScoreDifferenceLevels[i];
View Full Code Here

TOP

Related Classes of org.optaplanner.core.api.score.Score

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.