org.drools.planner.core.score.buildin.hardandsoftlong
Class HardAndSoftLongScoreDefinition

java.lang.Object
  extended by org.drools.planner.core.score.definition.AbstractScoreDefinition<HardAndSoftLongScore>
      extended by org.drools.planner.core.score.buildin.hardandsoftlong.HardAndSoftLongScoreDefinition
All Implemented Interfaces:
Serializable, ScoreDefinition<HardAndSoftLongScore>

public class HardAndSoftLongScoreDefinition
extends AbstractScoreDefinition<HardAndSoftLongScore>

See Also:
Serialized Form

Constructor Summary
HardAndSoftLongScoreDefinition()
           
 
Method Summary
 ScoreHolder buildScoreHolder()
          TODO JBRULES-2238 remove when the rule that sums the final score can be written as a single rule and ScoreHolder is dead
 double calculateTimeGradient(HardAndSoftLongScore startScore, HardAndSoftLongScore endScore, HardAndSoftLongScore score)
          See explanation in Termination.calculateSolverTimeGradient(DefaultSolverScope).
 HardAndSoftLongScore getPerfectMaximumScore()
          The perfect maximum score is the score of which there is no better in any problem instance.
 HardAndSoftLongScore getPerfectMinimumScore()
          The perfect minimum score is the score of which there is no worser in any problem instance.
 Score parseScore(String scoreString)
          Parses the String and returns a Score.
 void setHardScoreTimeGradientWeight(double hardScoreTimeGradientWeight)
          It's recommended to use a number which can be exactly represented as a double, such as 0.5, 0.25, 0.75, 0.125, ... but not 0.1, 0.2, ...
 void setPerfectMaximumScore(HardAndSoftLongScore perfectMaximumScore)
           
 void setPerfectMinimumScore(HardAndSoftLongScore perfectMinimumScore)
           
 Double translateScoreToGraphValue(HardAndSoftLongScore score)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HardAndSoftLongScoreDefinition

public HardAndSoftLongScoreDefinition()
Method Detail

setHardScoreTimeGradientWeight

public void setHardScoreTimeGradientWeight(double hardScoreTimeGradientWeight)
It's recommended to use a number which can be exactly represented as a double, such as 0.5, 0.25, 0.75, 0.125, ... but not 0.1, 0.2, ...

Parameters:
hardScoreTimeGradientWeight - 0.0 <= hardScoreTimeGradientWeight <= 1.0

setPerfectMaximumScore

public void setPerfectMaximumScore(HardAndSoftLongScore perfectMaximumScore)

setPerfectMinimumScore

public void setPerfectMinimumScore(HardAndSoftLongScore perfectMinimumScore)

getPerfectMaximumScore

public HardAndSoftLongScore getPerfectMaximumScore()
Description copied from interface: ScoreDefinition
The perfect maximum score is the score of which there is no better in any problem instance. This doesn't mean that the current problem instance, or any problem instance for that matter, could ever attain that score.

For example, most cases have a perfect maximum score of zero, as most use cases only have negative scores.

Specified by:
getPerfectMaximumScore in interface ScoreDefinition<HardAndSoftLongScore>
Overrides:
getPerfectMaximumScore in class AbstractScoreDefinition<HardAndSoftLongScore>
Returns:
null if not supported

getPerfectMinimumScore

public HardAndSoftLongScore getPerfectMinimumScore()
Description copied from interface: ScoreDefinition
The perfect minimum score is the score of which there is no worser in any problem instance. This doesn't mean that the current problem instance, or any problem instance for that matter, could ever attain such a bad score.

For example, most cases have a perfect minimum score of negative infinity.

Specified by:
getPerfectMinimumScore in interface ScoreDefinition<HardAndSoftLongScore>
Overrides:
getPerfectMinimumScore in class AbstractScoreDefinition<HardAndSoftLongScore>
Returns:
null if not supported

parseScore

public Score parseScore(String scoreString)
Description copied from interface: ScoreDefinition
Parses the String and returns a Score.

Parameters:
scoreString - never null
Returns:
never null

calculateTimeGradient

public double calculateTimeGradient(HardAndSoftLongScore startScore,
                                    HardAndSoftLongScore endScore,
                                    HardAndSoftLongScore score)
Description copied from interface: ScoreDefinition
See explanation in Termination.calculateSolverTimeGradient(DefaultSolverScope).

Parameters:
startScore - never null
endScore - never null
score - never null
Returns:
between 0.0 and 1.0

translateScoreToGraphValue

public Double translateScoreToGraphValue(HardAndSoftLongScore score)
Parameters:
score - never null
Returns:
null if should not be shown on the graph

buildScoreHolder

public ScoreHolder buildScoreHolder()
Description copied from interface: ScoreDefinition
TODO JBRULES-2238 remove when the rule that sums the final score can be written as a single rule and ScoreHolder is dead

Returns:
never null


Copyright © 2001-2012 JBoss by Red Hat. All Rights Reserved.