Class DoubleValueRange
java.lang.Object
org.optaplanner.core.impl.domain.valuerange.AbstractUncountableValueRange<Double>
org.optaplanner.core.impl.domain.valuerange.buildin.primdouble.DoubleValueRange
- All Implemented Interfaces:
ValueRange<Double>
Note: Floating point numbers (float, double) cannot represent a decimal number correctly.
If floating point numbers leak into the scoring function, they are likely to cause score corruptions.
To avoid that, use either
BigDecimal
or fixed-point arithmetic.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
createRandomIterator
(Random workingRandom) Select in random order, but without shuffling the elements.boolean
isEmpty()
In aCountableValueRange
, this must be consistent withCountableValueRange.getSize()
.toString()
-
Constructor Details
-
DoubleValueRange
public DoubleValueRange(double from, double to) - Parameters:
from
- inclusive minimumto
- exclusive maximum,>= from
-
-
Method Details
-
isEmpty
public boolean isEmpty()Description copied from interface:ValueRange
In aCountableValueRange
, this must be consistent withCountableValueRange.getSize()
.- Returns:
- true if the range is empty
-
contains
- Parameters:
value
- sometimes null- Returns:
- true if the ValueRange contains that value
-
createRandomIterator
Description copied from interface:ValueRange
Select in random order, but without shuffling the elements. Each element might be selected multiple times. Scales well because it does not require caching.- Parameters:
workingRandom
- never null, theRandom
to use when any random number is needed, so runs are reproducible.- Returns:
- never null
-
toString
-