Package org.drools.planner.core.score

Examples of org.drools.planner.core.score.Score


        return solverScope.getScoreDefinition().calculateTimeGradient(
                startingInitializedScore, scoreAttained, bestScore);
    }

    public double calculatePhaseTimeGradient(AbstractSolverPhaseScope phaseScope) {
        Score startingInitializedScore = phaseScope.getStartingScore();
        Score bestScore = phaseScope.getBestScore();
        return phaseScope.getScoreDefinition().calculateTimeGradient(startingInitializedScore, scoreAttained, bestScore);
    }
View Full Code Here


        temperature = startingTemperature;
    }

    public boolean isAccepted(LocalSearchMoveScope moveScope) {
        LocalSearchSolverPhaseScope localSearchSolverPhaseScope = moveScope.getStepScope().getPhaseScope();
        Score lastStepScore = localSearchSolverPhaseScope.getLastCompletedStepScope().getScore();
        Score moveScore = moveScope.getScore();
        if (moveScore.compareTo(lastStepScore) > 0) {
            return true;
        }
        Score scoreDifference = lastStepScore.subtract(moveScore);
        double[] scoreDifferenceLevels = scoreDifference.toDoubleLevels();
        for (int i = 0; i < scoreDifferenceLevels.length - 1; i++) {
            if (scoreDifferenceLevels[i] != 0) {
                // more hard constraints broken, ignore it for now
                return false;
            }
View Full Code Here

        if (waterRisingRate <= 0.0 || waterRisingRate >= 1.0) {
            throw new IllegalArgumentException("The greatDelugeWaterRisingRate (" + waterRisingRate
                    + ") should be between 0.0 and 1.0 (preferably very close to 0.0).");
        }
        waterLevelScore = phaseScope.getBestScore().multiply(waterLevelUpperBoundRate);
        Score perfectMaximumScore = phaseScope.getScoreDefinition().getPerfectMaximumScore();
        if (waterLevelScore.compareTo(perfectMaximumScore) > 0) {
            throw new IllegalArgumentException("The waterLevelScore (" + waterLevelScore
                    + ") should not be higher than the perfectMaximumScore(" + perfectMaximumScore + ").");
        }
    }
View Full Code Here

    public void stepEnded(LocalSearchStepScope stepScope) {
        if (stepScope.getStepIndex() == stepScope.getPhaseScope().getBestSolutionStepIndex()) {
            // New best score
            waterLevelScore = stepScope.getPhaseScope().getBestScore().multiply(waterLevelUpperBoundRate);
        } else {
            Score perfectMaximumScore = stepScope.getPhaseScope().getScoreDefinition()
                    .getPerfectMaximumScore();
            Score waterLevelAugend = perfectMaximumScore.subtract(waterLevelScore).multiply(waterRisingRate);
            waterLevelScore = waterLevelScore.add(waterLevelAugend);
            // TODO maybe if waterlevel is higher than bestScore, than ...
        }
    }
View Full Code Here

        levelsLength = -1;
    }

    public boolean isAccepted(LocalSearchMoveScope moveScope) {
        LocalSearchSolverPhaseScope localSearchSolverPhaseScope = moveScope.getStepScope().getPhaseScope();
        Score lastStepScore = localSearchSolverPhaseScope.getLastCompletedStepScope().getScore();
        Score moveScore = moveScope.getScore();
        if (moveScore.compareTo(lastStepScore) >= 0) {
            return true;
        }
        Score scoreDifference = lastStepScore.subtract(moveScore);
        double acceptChance = 1.0;
        double[] scoreDifferenceLevels = scoreDifference.toDoubleLevels();
        for (int i = 0; i < levelsLength; i++) {
            double scoreDifferenceLevel = scoreDifferenceLevels[i];
            double temperatureLevel = temperatureLevels[i];
            double acceptChanceLevel;
            if (scoreDifferenceLevel <= 0.0) {
View Full Code Here

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

        lateScoreIndex = -1;
    }

    public boolean isAccepted(LocalSearchMoveScope moveScope) {
        moveScope.getStepScope().getStepIndex();
        Score score = moveScope.getScore();
        Score lateScore = previousScores[lateScoreIndex];
        return score.compareTo(lateScore) >= 0;
    }
View Full Code Here

        if (waterRisingRate <= 0.0 || waterRisingRate >= 1.0) {
            throw new IllegalArgumentException("The greatDelugeWaterRisingRate (" + waterRisingRate
                    + ") should be between 0.0 and 1.0 (preferably very close to 0.0).");
        }
        waterLevelScore = localSearchSolverScope.getBestScore().multiply(waterLevelUpperBoundRate);
        Score perfectMaximumScore = localSearchSolverScope.getScoreDefinition().getPerfectMaximumScore();
        if (waterLevelScore.compareTo(perfectMaximumScore) > 0) {
            throw new IllegalArgumentException("The waterLevelScore (" + waterLevelScore
                    + ") should not be higher than the perfectMaximumScore(" + perfectMaximumScore + ").");
        }
    }
View Full Code Here

    public void stepTaken(StepScope stepScope) {
        if (stepScope.getStepIndex() == stepScope.getLocalSearchSolverScope().getBestSolutionStepIndex()) {
            // New best score
            waterLevelScore = stepScope.getLocalSearchSolverScope().getBestScore().multiply(waterLevelUpperBoundRate);
        } else {
            Score perfectMaximumScore = stepScope.getLocalSearchSolverScope().getScoreDefinition()
                    .getPerfectMaximumScore();
            Score waterLevelAugend = perfectMaximumScore.subtract(waterLevelScore).multiply(waterRisingRate);
            waterLevelScore = waterLevelScore.add(waterLevelAugend);
            // TODO maybe if waterlevel is higher than bestScore, than ...
        }
    }
View Full Code Here

            writer.append("\n");
            for (TimeToBestScoresLine timeToBestScoresLine : timeToBestScoresLineList) {
                writer.write(Long.toString(timeToBestScoresLine.getTimeMillisSpend()));
                for (String configName : configNameList) {
                    writer.append(",");
                    Score score = timeToBestScoresLine.getConfigNameToScoreMap().get(configName);
                    if (score != null) {
                        Double scoreGraphValue = scoreDefinition.translateScoreToGraphValue(score);
                        if (scoreGraphValue != null) {
                            writer.append(scoreGraphValue.toString());
                        }
View Full Code Here

TOP

Related Classes of org.drools.planner.core.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.