|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.drools.planner.core.score.AbstractScore<HardAndSoftScore>
org.drools.planner.core.score.buildin.hardandsoft.DefaultHardAndSoftScore
public final class DefaultHardAndSoftScore
Default implementation of HardAndSoftScore
.
HardAndSoftScore
,
Serialized FormConstructor Summary | |
---|---|
DefaultHardAndSoftScore(int hardScore)
|
|
DefaultHardAndSoftScore(int hardScore,
int softScore)
|
Method Summary | |
---|---|
HardAndSoftScore |
add(HardAndSoftScore augment)
Returns a Score whose value is (this + augment). |
int |
compareTo(HardAndSoftScore other)
|
HardAndSoftScore |
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. |
HardAndSoftScore |
multiply(double multiplicand)
Returns a Score whose value is (this * multiplicand). |
static DefaultHardAndSoftScore |
parseScore(String scoreString)
|
HardAndSoftScore |
subtract(HardAndSoftScore subtrahend)
Returns a Score whose value is (this - subtrahend). |
double[] |
toDoubleLevels()
Returns an array of doubles representing the Score. |
String |
toString()
|
static DefaultHardAndSoftScore |
valueOf(int hardScore)
|
static DefaultHardAndSoftScore |
valueOf(int hardScore,
int softScore)
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public DefaultHardAndSoftScore(int hardScore)
public DefaultHardAndSoftScore(int hardScore, int softScore)
Method Detail |
---|
public static DefaultHardAndSoftScore parseScore(String scoreString)
public static DefaultHardAndSoftScore valueOf(int hardScore)
public static DefaultHardAndSoftScore valueOf(int hardScore, int softScore)
public int getHardScore()
HardAndSoftScore
getHardScore
in interface HardAndSoftScore
public int getSoftScore()
HardAndSoftScore
getSoftScore
in interface HardAndSoftScore
public boolean isFeasible()
HardAndSoftScore
Solution
is feasible if it has no broken hard constraints.
isFeasible
in interface HardAndSoftScore
HardAndSoftScore.getHardScore()
is 0 or higherpublic HardAndSoftScore add(HardAndSoftScore augment)
Score
add
in interface Score<HardAndSoftScore>
augment
- value to be added to this Score
public HardAndSoftScore subtract(HardAndSoftScore subtrahend)
Score
subtract
in interface Score<HardAndSoftScore>
subtrahend
- value to be subtracted from this Score
public HardAndSoftScore multiply(double multiplicand)
Score
Math.floor(double)
.
multiply
in interface Score<HardAndSoftScore>
multiplicand
- value to be multiplied by this Score.
public HardAndSoftScore divide(double divisor)
Score
Math.floor(double)
.
divide
in interface Score<HardAndSoftScore>
divisor
- value by which this Score is to be divided
public double[] toDoubleLevels()
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}
toDoubleLevels
in interface Score<HardAndSoftScore>
public boolean equals(Object o)
equals
in class Object
public int hashCode()
hashCode
in class Object
public int compareTo(HardAndSoftScore other)
compareTo
in interface Comparable<HardAndSoftScore>
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |