Package org.optaplanner.core.impl.score
Class ScoreUtils
- java.lang.Object
-
- org.optaplanner.core.impl.score.ScoreUtils
-
public class ScoreUtils extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static double
calculateTimeGradient(Number[] totalDiffNumbers, Number[] scoreDiffNumbers, double[] timeGradientWeightNumbers, int levelDepth)
static double[]
extractLevelDoubles(Score score)
static Score
parseScore(Class<? extends Score<?>> scoreClass, String scoreString)
-
-
-
Method Detail
-
parseScore
public static Score parseScore(Class<? extends Score<?>> scoreClass, String scoreString)
- Parameters:
scoreClass
- never null, should be of the sameClassLoader
as this class.scoreString
- never null- Returns:
- never null
- Throws:
IllegalArgumentException
- if the scoreClass is a customScore
- See Also:
ScoreDefinition.parseScore(String)
-
extractLevelDoubles
public static double[] extractLevelDoubles(Score score)
-
calculateTimeGradient
public static double calculateTimeGradient(Number[] totalDiffNumbers, Number[] scoreDiffNumbers, double[] timeGradientWeightNumbers, int levelDepth)
- Parameters:
totalDiffNumbers
- never nullscoreDiffNumbers
- never nulltimeGradientWeightNumbers
- never nulllevelDepth
- The number of levels of the diffNumbers that are included- Returns:
0.0 <= value <= 1.0
-
-