org.drools.planner.core.score.calculator
Class DefaultHardAndSoftConstraintScoreCalculator

java.lang.Object
  extended by org.drools.planner.core.score.calculator.AbstractScoreCalculator
      extended by org.drools.planner.core.score.calculator.DefaultHardAndSoftConstraintScoreCalculator
All Implemented Interfaces:
Serializable, Cloneable, HardAndSoftConstraintScoreCalculator, ScoreCalculator

public class DefaultHardAndSoftConstraintScoreCalculator
extends AbstractScoreCalculator
implements HardAndSoftConstraintScoreCalculator

See Also:
Serialized Form

Field Summary
protected  int hardConstraintsBroken
           
protected  int softConstraintsBroken
           
 
Constructor Summary
DefaultHardAndSoftConstraintScoreCalculator()
           
 
Method Summary
 Score calculateScore()
          Calculates the score: the solution (encountered at a step) with the highest score will be seen as the the best solution.
 int getHardConstraintsBroken()
           
 int getSoftConstraintsBroken()
           
 void setHardConstraintsBroken(int hardConstraintsBroken)
           
 void setSoftConstraintsBroken(int softConstraintsBroken)
           
 
Methods inherited from class org.drools.planner.core.score.calculator.AbstractScoreCalculator
clone
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.drools.planner.core.score.calculator.ScoreCalculator
clone
 

Field Detail

hardConstraintsBroken

protected int hardConstraintsBroken

softConstraintsBroken

protected int softConstraintsBroken
Constructor Detail

DefaultHardAndSoftConstraintScoreCalculator

public DefaultHardAndSoftConstraintScoreCalculator()
Method Detail

getHardConstraintsBroken

public int getHardConstraintsBroken()
Specified by:
getHardConstraintsBroken in interface HardAndSoftConstraintScoreCalculator

setHardConstraintsBroken

public void setHardConstraintsBroken(int hardConstraintsBroken)
Specified by:
setHardConstraintsBroken in interface HardAndSoftConstraintScoreCalculator

getSoftConstraintsBroken

public int getSoftConstraintsBroken()
Specified by:
getSoftConstraintsBroken in interface HardAndSoftConstraintScoreCalculator

setSoftConstraintsBroken

public void setSoftConstraintsBroken(int softConstraintsBroken)
Specified by:
setSoftConstraintsBroken in interface HardAndSoftConstraintScoreCalculator

calculateScore

public Score calculateScore()
Description copied from interface: ScoreCalculator
Calculates the score: the solution (encountered at a step) with the highest score will be seen as the the best solution.

The step score calculation should be kept stable over all steps.

When the solution is modified during a Move, the WorkingMemory's FactHandles should have been correctly notified. Before the score is calculated, all rules are fired, which should trigger an update of this instance.

Specified by:
calculateScore in interface ScoreCalculator
Returns:
never null, the score of the solution


Copyright © 2001-2011 JBoss Inc.. All Rights Reserved.