Package org.drools.planner.core.score

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


            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


            XYSeries configSeries = new XYSeries(configName);
            List<BestScoreStatisticPoint> statisticPointList = listenerEntry.getValue()
                    .getBestScoreStatisticPointList();
            for (BestScoreStatisticPoint statisticPoint : statisticPointList) {
                long timeMillisSpend = statisticPoint.getTimeMillisSpend();
                Score score = statisticPoint.getScore();
                Double scoreGraphValue = scoreDefinition.translateScoreToGraphValue(score);
                if (scoreGraphValue != null) {
                    configSeries.add(timeMillisSpend, scoreGraphValue);
                }
            }
View Full Code Here

        calculateCount = 0L;
    }

    public Score calculateScoreFromWorkingMemory() {
        workingMemory.fireAllRules();
        Score score = workingScoreCalculator.calculateScore();
        workingSolution.setScore(score);
        calculateCount++;
        return score;
    }
View Full Code Here

        tmpWorkingMemory.setGlobal(GLOBAL_SCORE_CALCULATOR_KEY, tmpScoreCalculator);
        for (Object fact : workingSolution.getFacts()) {
            tmpWorkingMemory.insert(fact);
        }
        tmpWorkingMemory.fireAllRules();
        Score realScore = tmpScoreCalculator.calculateScore();
        tmpWorkingMemory.dispose();
        if (!presumedScore.equals(realScore)) {
            throw new IllegalStateException(
                    "The presumedScore (" + presumedScore + ") is corrupted because it is not the realScore  ("
                            + realScore + ").\n"
View Full Code Here

        moveScope.setUndoMove(undoMove);
        move.doMove(workingMemory);
        processMove(moveScope);
        undoMove.doMove(workingMemory);
        if (assertUndoMoveIsUncorrupted) {
            Score undoScore = moveScope.getLocalSearchStepScope().getLocalSearchSolverScope().calculateScoreFromWorkingMemory();
            Score lastCompletedStepScore = moveScope.getLocalSearchStepScope().getLocalSearchSolverScope()
                    .getLastCompletedLocalSearchStepScope().getScore();
            if (!undoScore.equals(lastCompletedStepScore)) {
                throw new IllegalStateException(
                        "Corrupted undo move (" + undoMove + ") received from move (" + move + ").\n"
                                + "Unequal lastCompletedStepScore (" + lastCompletedStepScore + ") and undoScore ("
View Full Code Here

        logger.debug("    Move score ({}), accept chance ({}) for move ({}).",
                new Object[]{moveScope.getScore(), moveScope.getAcceptChance(), moveScope.getMove()});
    }

    private void processMove(MoveScope moveScope) {
        Score score = moveScope.getLocalSearchStepScope().getLocalSearchSolverScope().calculateScoreFromWorkingMemory();
        if (assertMoveScoreIsUncorrupted) {
            moveScope.getLocalSearchStepScope().getLocalSearchSolverScope().assertWorkingScore(score);
        }
        moveScope.setScore(score);
        double acceptChance = acceptor.calculateAcceptChance(moveScope);
View Full Code Here

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

    public boolean isTerminated(LocalSearchStepScope localSearchStepScope) {
        Score bestScore = localSearchStepScope.getLocalSearchSolverScope().getBestScore();
        return bestScore.compareTo(scoreAttained) >= 0;
    }
View Full Code Here

        return bestScore.compareTo(scoreAttained) >= 0;
    }

    public double calculateTimeGradient(LocalSearchStepScope localSearchStepScope) {
        LocalSearchSolverScope localSearchSolverScope = localSearchStepScope.getLocalSearchSolverScope();
        Score startingScore = localSearchSolverScope.getStartingScore();
        Score stepScore = localSearchSolverScope.getLastCompletedLocalSearchStepScope().getScore();
        return localSearchSolverScope.getScoreDefinition()
                .calculateTimeGradient(startingScore, scoreAttained, stepScore);
    }
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(LocalSearchStepScope localSearchStepScope) {
        if (localSearchStepScope.getStepIndex() == localSearchStepScope.getLocalSearchSolverScope().getBestSolutionStepIndex()) {
            // New best score
            waterLevelScore = localSearchStepScope.getLocalSearchSolverScope().getBestScore().multiply(waterLevelUpperBoundRate);
        } else {
            Score perfectMaximumScore = localSearchStepScope.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

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.