Class LinearDistributionNearbyRandom
java.lang.Object
org.optaplanner.core.impl.heuristic.selector.common.nearby.LinearDistributionNearbyRandom
- All Implemented Interfaces:
NearbyRandom
P(x) = 2/m - 2x/m²
.
Cumulative probability: F(x) = x(2m - x)/m²
.
Inverse cumulative probability: F(p) = m(1 - (1 - p)^(1/2))
.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
LinearDistributionNearbyRandom
public LinearDistributionNearbyRandom(int sizeMaximum)
-
-
Method Details
-
nextInt
- Specified by:
nextInt
in interfaceNearbyRandom
- Parameters:
random
- never nullnearbySize
- never negative. The number of available values to select from. Normally this is the size of the value range for a non-chained variable and the size of the value range (= size of the entity list) minus 1 for a chained variable.- Returns:
0 <= x < nearbySize
-
getOverallSizeMaximum
public int getOverallSizeMaximum()Description copied from interface:NearbyRandom
Used to limit the RAM memory size of the nearby distance matrix.- Specified by:
getOverallSizeMaximum
in interfaceNearbyRandom
- Returns:
- one more than the maximum number that
NearbyRandom.nextInt(Random, int)
can return,Integer.MAX_VALUE
if there is none
-
equals
-
hashCode
public int hashCode()
-