Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2010 JBoss Inc
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *      http://www.apache.org/licenses/LICENSE-2.0
   *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 
 package org.drools.planner.core.localsearch.decider.deciderscorecomparator;
 
 
 
 
     private int hardScoreActivationThreshold = 0;
     private int successiveNoHardChangeMinimum = 2;
     private int successiveNoHardChangeMaximum = 20;
     private double successiveNoHardChangeRepetitionMultiplicand = 20.0;
     private double hardWeightSurvivalRatio = 0.8;
 
     private int startingHardWeight = 1000; // TODO determine dynamically
 
     private int successiveNoHardScoreChange;
     private boolean shiftingPenaltyActive;
     private int hardWeight;
 
 
     public void setHardScoreActivationThreshold(int hardScoreActivationThreshold) {
         this. = hardScoreActivationThreshold;
     }
 
     public void setSuccessiveNoHardChangeMinimum(int successiveNoHardChangeMinimum) {
         this. = successiveNoHardChangeMinimum;
     }
 
     public void setSuccessiveNoHardChangeMaximum(int successiveNoHardChangeMaximum) {
         this. = successiveNoHardChangeMaximum;
     }
 
     public void setSuccessiveNoHardChangeRepetitionMultiplicand(double successiveNoHardChangeRepetitionMultiplicand) {
         this. = successiveNoHardChangeRepetitionMultiplicand;
     }
 
     public void setHardWeightSurvivalRatio(double hardWeightSurvivalRatio) {
         this. = hardWeightSurvivalRatio;
     }
 
     public void setStartingHardWeight(int startingHardWeight) {
         this. = startingHardWeight;
     }
 
     // ************************************************************************
     // Worker methods
     // ************************************************************************
 
     @Override
     public void phaseStarted(LocalSearchSolverPhaseScope localSearchSolverPhaseScope) {
          = 0;
          = false;
     }
 
     @Override
     public void stepTaken(LocalSearchStepScope localSearchStepScope) {
         if (localSearchStepScope.getStepIndex() == localSearchStepScope.getLocalSearchSolverPhaseScope().getBestSolutionStepIndex()) {
              = 0;
              = false;
         } else {
             HardAndSoftScore lastStepScore = (HardAndSoftScorelocalSearchStepScope.getLocalSearchSolverPhaseScope()
                     .getLastCompletedLocalSearchStepScope().getScore();
             HardAndSoftScore stepScore = (HardAndSoftScorelocalSearchStepScope.getScore();
             if (stepScore.getHardScore() >= 
                     && lastStepScore.getHardScore() == stepScore.getHardScore()) {
                 ++;
             } else {
                 --;
                 if ( < 0) {
                      = 0;
                 }
            }
            int min = ;
            int max = ;
            while (true) {
                if ( < min) {
                     = false;
                    break;
                } else if ( <= max) {
                     = true;
                    if ( == min) {
                         = ;
                    } else {
                         = (int) Math.round(((double) * );
                    }
                    break;
                }
                min = (int) Math.round(((doublemin) * );
                max = (int) Math.round(((doublemax) * );
            }
        }
    }
        if () {
            return new FlatteningHardAndSoftScoreComparator();
        } else {
            return ;
        }
    }
New to GrepCode? Check out our FAQ X