|
OptaPlanner core 6.0.0.CR3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.optaplanner.core.api.score.AbstractScore<HardSoftScore>
org.optaplanner.core.api.score.buildin.hardsoft.HardSoftScore
public final class HardSoftScore
This Score
is based on 2 levels of int constraints: hard and soft.
Hard constraints have priority over soft constraints.
Score
,
Serialized FormMethod Summary | |
---|---|
HardSoftScore |
add(HardSoftScore augment)
Returns a Score whose value is (this + augment). |
int |
compareTo(HardSoftScore other)
|
HardSoftScore |
divide(double divisor)
Returns a Score whose value is (this / divisor). |
boolean |
equals(Object o)
|
int |
getHardScore()
The total of the broken negative hard constraints and fulfilled positive hard constraints. |
int |
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. |
HardSoftScore |
multiply(double multiplicand)
Returns a Score whose value is (this * multiplicand). |
static HardSoftScore |
parseScore(String scoreString)
|
HardSoftScore |
power(double exponent)
Returns a Score whose value is (this ^ exponent). |
HardSoftScore |
subtract(HardSoftScore subtrahend)
Returns a Score whose value is (this - subtrahend). |
Number[] |
toLevelNumbers()
Returns an array of doubles representing the Score. |
String |
toString()
|
static HardSoftScore |
valueOf(int hardScore,
int 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 HardSoftScore parseScore(String scoreString)
public static HardSoftScore valueOf(int hardScore, int softScore)
public int getHardScore()
public int getSoftScore()
public boolean isFeasible()
FeasibilityScore
Solution
is feasible if it has no broken hard constraints.
isFeasible
in interface FeasibilityScore<HardSoftScore>
public HardSoftScore add(HardSoftScore augment)
Score
add
in interface Score<HardSoftScore>
augment
- value to be added to this Score
public HardSoftScore subtract(HardSoftScore subtrahend)
Score
subtract
in interface Score<HardSoftScore>
subtrahend
- value to be subtracted from this Score
public HardSoftScore multiply(double multiplicand)
Score
Math.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<HardSoftScore>
multiplicand
- value to be multiplied by this Score.
public HardSoftScore divide(double divisor)
Score
Math.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<HardSoftScore>
divisor
- value by which this Score is to be divided
public HardSoftScore power(double exponent)
Score
Math.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<HardSoftScore>
exponent
- value by which this Score is to be powered
public Number[] toLevelNumbers()
Score
Math.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<HardSoftScore>
public boolean equals(Object o)
equals
in class Object
public int hashCode()
hashCode
in class Object
public int compareTo(HardSoftScore other)
compareTo
in interface Comparable<HardSoftScore>
public String toString()
toString
in class Object
|
OptaPlanner core 6.0.0.CR3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |