Class ParabolicDistributionNearbyRandom
- java.lang.Object
-
- org.optaplanner.core.impl.heuristic.selector.common.nearby.ParabolicDistributionNearbyRandom
-
- All Implemented Interfaces:
NearbyRandom
public class ParabolicDistributionNearbyRandom extends Object implements NearbyRandom
P(x) = 3(m - x)²/m³
.Cumulative probability:
F(x) = 1 - (1 - x/m)³
.Inverse cumulative probability:
F(p) = m(1 - (1 - p)^(1/3))
.
-
-
Field Summary
Fields Modifier and Type Field Description protected int
sizeMaximum
-
Constructor Summary
Constructors Constructor Description ParabolicDistributionNearbyRandom(int sizeMaximum)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getOverallSizeMaximum()
Used to limit the RAM memory size of the nearby distance matrix.int
nextInt(Random random, int nearbySize)
-
-
-
Method Detail
-
nextInt
public int nextInt(Random random, int nearbySize)
- 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
-
-