Class TriangularNumbers
java.lang.Object
org.optaplanner.core.impl.heuristic.selector.list.TriangularNumbers
-
Method Summary
-
Method Details
-
nthTriangle
Calculate nth triangular number. This is used to calculate the number of subLists for a given list variable of size n. To be able to useint
arithmetic to calculate the triangular number, n must be less than or equal toHIGHEST_SAFE_N
. If the n is higher, the method throws an exception.- Parameters:
n
- size of the triangle (the length of its side)- Returns:
- nth triangular number
- Throws:
ArithmeticException
- ifn
is higher thanHIGHEST_SAFE_N
-