Examples of AbstractSolverPhaseScope


Examples of org.drools.planner.core.phase.AbstractSolverPhaseScope

    public void extractBestSolution(AbstractStepScope stepScope) {
        if (!stepScope.isSolutionInitialized()) {
            return;
        }
        AbstractSolverPhaseScope solverPhaseScope = stepScope.getSolverPhaseScope();
        DefaultSolverScope solverScope = solverPhaseScope.getSolverScope();
        Score newScore = stepScope.getScore();
        Score bestScore = solverPhaseScope.getBestScore();
        boolean bestScoreImproved;
        if (bestScore == null) {
            bestScoreImproved = true;
            solverScope.setStartingInitializedScore(newScore);
        } else {
            bestScoreImproved = newScore.compareTo(bestScore) > 0;
        }
        stepScope.setBestScoreImproved(bestScoreImproved);
        if (bestScoreImproved) {
            solverPhaseScope.setBestSolutionStepIndex(stepScope.getStepIndex());
            Solution newBestSolution = stepScope.createOrGetClonedSolution();
            solverScope.setBestSolution(newBestSolution);
            solverScope.setBestScore(newBestSolution.getScore());
            solverEventSupport.fireBestSolutionChanged(newBestSolution);
        }
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.