Package org.drools.planner.core.score

Examples of org.drools.planner.core.score.Score.compareTo()


            logger.trace("        Move score ({}) for planning entity ({}) for move (TODO).",
                    new Object[]{score, greedyFitStepScope.getPlanningEntity()});
            if (constructionHeuristicPickEarlyType
                    == ConstructionHeuristicPickEarlyType.FIRST_LAST_STEP_SCORE_EQUAL_OR_IMPROVING
                    && lastStepScore != null
                    && score.compareTo(lastStepScore) >= 0) {
                break;
            }
        }
        greedyFitStepScope.setScore(maxScore);
    }
View Full Code Here


    public boolean isAccepted(MoveScope moveScope) {
        LocalSearchSolverPhaseScope localSearchSolverPhaseScope = moveScope.getLocalSearchStepScope().getLocalSearchSolverPhaseScope();
        Score lastStepScore = localSearchSolverPhaseScope.getLastCompletedLocalSearchStepScope().getScore();
        Score moveScore = moveScope.getScore();
        if (moveScore.compareTo(lastStepScore) > 0) {
            return true;
        }
        Score scoreDifference = lastStepScore.subtract(moveScore);
        // TODO don't abuse translateScoreToGraphValue
        Double diff = localSearchSolverPhaseScope.getScoreDefinition().translateScoreToGraphValue(scoreDifference);
View Full Code Here

    public boolean isAccepted(MoveScope moveScope) {
        LocalSearchSolverPhaseScope localSearchSolverPhaseScope = moveScope.getLocalSearchStepScope().getLocalSearchSolverPhaseScope();
        Score lastStepScore = localSearchSolverPhaseScope.getLastCompletedLocalSearchStepScope().getScore();
        Score moveScore = moveScope.getScore();
        if (moveScore.compareTo(lastStepScore) >= 0) {
            return true;
        }
        Score scoreDifference = lastStepScore.subtract(moveScore);
        double acceptChance = 1.0;
        double[] scoreDifferenceParts = scoreDifference.toDoubleArray();
View Full Code Here

                    bedDesignationHandle = workingMemory.insert(bedDesignation);
                } else {
                    workingMemory.update(bedDesignationHandle, bedDesignation);
                }
                Score score = abstractSolverScope.calculateScoreFromWorkingMemory();
                if (score.compareTo(unscheduledScore) < 0) {
                    if (score.compareTo(bestScore) > 0) {
                        bestScore = score;
                        bestBed = bed;
                    }
                } else if (score.equals(unscheduledScore)) {
View Full Code Here

                } else {
                    workingMemory.update(bedDesignationHandle, bedDesignation);
                }
                Score score = abstractSolverScope.calculateScoreFromWorkingMemory();
                if (score.compareTo(unscheduledScore) < 0) {
                    if (score.compareTo(bestScore) > 0) {
                        bestScore = score;
                        bestBed = bed;
                    }
                } else if (score.equals(unscheduledScore)) {
                    perfectMatch = true;
View Full Code Here

            boolean almostPerfectMatch = false;
            Score bestScore = DefaultHardAndSoftScore.valueOf(Integer.MIN_VALUE, Integer.MIN_VALUE);
            Period bestPeriod = null;
            Room bestRoom = null;
            for (PeriodScoring periodScoring : periodScoringList) {
                if (bestScore.compareTo(periodScoring.getScore()) >= 0) {
                    // No need to check the rest
                    break;
                }
                lecture.setPeriod(periodScoring.getPeriod());
                workingMemory.update(lectureHandle, lecture);
View Full Code Here

                for (Room room : roomList) {
                    lecture.setRoom(room);
                    workingMemory.update(lectureHandle, lecture);
                    Score score = abstractSolverScope.calculateScoreFromWorkingMemory();
                    if (score.compareTo(unscheduledScore) < 0) {
                        if (score.compareTo(bestScore) > 0) {
                            bestScore = score;
                            bestPeriod = periodScoring.getPeriod();
                            bestRoom = room;
                        }
View Full Code Here

                for (Room room : roomList) {
                    lecture.setRoom(room);
                    workingMemory.update(lectureHandle, lecture);
                    Score score = abstractSolverScope.calculateScoreFromWorkingMemory();
                    if (score.compareTo(unscheduledScore) < 0) {
                        if (score.compareTo(bestScore) > 0) {
                            bestScore = score;
                            bestPeriod = periodScoring.getPeriod();
                            bestRoom = room;
                        }
                    } else if (score.compareTo(unscheduledScore) >= 0) {
View Full Code Here

                        if (score.compareTo(bestScore) > 0) {
                            bestScore = score;
                            bestPeriod = periodScoring.getPeriod();
                            bestRoom = room;
                        }
                    } else if (score.compareTo(unscheduledScore) >= 0) {
                        // TODO due to the score rules, the score can unscheduledScore can be higher than the score
                        // In theory every possibility should be looked into
                        almostPerfectMatch = true;
                        break;
                    }
View Full Code Here

                    }
                    workingMemory.update(afterCityAssignmentFactHandle, afterCityAssignment);
                    workingMemory.update(beforeCityAssignmentFactHandle, beforeCityAssignment);
                    // Calculate score
                    Score score = abstractSolverScope.calculateScoreFromWorkingMemory();
                    if (score.compareTo(bestScore) > 0) {
                        bestScore = score;
                        bestAfterCityAssignment = afterCityAssignment;
                        bestAfterCityAssignmentFactHandle = afterCityAssignmentFactHandle;
                        bestBeforeCityAssignment = beforeCityAssignment;
                        bestBeforeCityAssignmentFactHandle = beforeCityAssignmentFactHandle;
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.