|
OptaPlanner core 6.0.0.Final | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.optaplanner.core.api.score.AbstractScore<HardSoftDoubleScore>
org.optaplanner.core.api.score.buildin.hardsoftdouble.HardSoftDoubleScore
public final class HardSoftDoubleScore
This Score is based on 2 levels of double constraints: hard and soft.
Hard constraints have priority over soft constraints.
System.out.println((0.01 + 0.05) == (0.01 + 0.02 + 0.03));
Use HardSoftBigDecimalScore instead.
This class is immutable.
Score,
Serialized Form| Method Summary | |
|---|---|
HardSoftDoubleScore |
add(HardSoftDoubleScore augment)
Returns a Score whose value is (this + augment). |
int |
compareTo(HardSoftDoubleScore other)
|
HardSoftDoubleScore |
divide(double divisor)
Returns a Score whose value is (this / divisor). |
boolean |
equals(Object o)
|
double |
getHardScore()
The total of the broken negative hard constraints and fulfilled positive hard constraints. |
double |
getSoftScore()
The total of the broken negative soft constraints and fulfilled positive soft constraints. |
int |
hashCode()
|
boolean |
isFeasible()
A Solution is feasible if it has no broken hard constraints. |
HardSoftDoubleScore |
multiply(double multiplicand)
Returns a Score whose value is (this * multiplicand). |
static HardSoftDoubleScore |
parseScore(String scoreString)
|
HardSoftDoubleScore |
power(double exponent)
Returns a Score whose value is (this ^ exponent). |
HardSoftDoubleScore |
subtract(HardSoftDoubleScore subtrahend)
Returns a Score whose value is (this - subtrahend). |
Number[] |
toLevelNumbers()
Returns an array of doubles representing the Score. |
String |
toString()
|
static HardSoftDoubleScore |
valueOf(double hardScore,
double softScore)
|
| Methods inherited from class org.optaplanner.core.api.score.AbstractScore |
|---|
buildScorePattern, buildScorePattern, parseLevelStrings, parseLevelStrings |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Method Detail |
|---|
public static HardSoftDoubleScore parseScore(String scoreString)
public static HardSoftDoubleScore valueOf(double hardScore,
double softScore)
public double getHardScore()
public double getSoftScore()
public boolean isFeasible()
FeasibilityScoreSolution is feasible if it has no broken hard constraints.
isFeasible in interface FeasibilityScore<HardSoftDoubleScore>public HardSoftDoubleScore add(HardSoftDoubleScore augment)
Score
add in interface Score<HardSoftDoubleScore>augment - value to be added to this Score
public HardSoftDoubleScore subtract(HardSoftDoubleScore subtrahend)
Score
subtract in interface Score<HardSoftDoubleScore>subtrahend - value to be subtracted from this Score
public HardSoftDoubleScore multiply(double multiplicand)
ScoreMath.floor(double).
/> If the implementation has a scale/precision, then the unspecified scale/precision of the double multiplicand should have no impact on the returned scale/precision.
multiply in interface Score<HardSoftDoubleScore>multiplicand - value to be multiplied by this Score.
public HardSoftDoubleScore divide(double divisor)
ScoreMath.floor(double).
/> If the implementation has a scale/precision, then the unspecified scale/precision of the double divisor should have no impact on the returned scale/precision.
divide in interface Score<HardSoftDoubleScore>divisor - value by which this Score is to be divided
public HardSoftDoubleScore power(double exponent)
ScoreMath.floor(double).
/> If the implementation has a scale/precision, then the unspecified scale/precision of the double exponent should have no impact on the returned scale/precision.
power in interface Score<HardSoftDoubleScore>exponent - value by which this Score is to be powered
public Number[] toLevelNumbers()
ScoreMath.floor(double).
The length of the returned array must be stable for a specific Score implementation.
For example: -0hard/-7soft returns new double{-0.0, -7.0}
toLevelNumbers in interface Score<HardSoftDoubleScore>public boolean equals(Object o)
equals in class Objectpublic int hashCode()
hashCode in class Objectpublic int compareTo(HardSoftDoubleScore other)
compareTo in interface Comparable<HardSoftDoubleScore>public String toString()
toString in class Object
|
OptaPlanner core 6.0.0.Final | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||