Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
|
Public Member Functions | |
Domain (long cPtr, boolean cMemoryOwn) | |
synchronized void | delete () |
Domain () | |
Domain (long value) | |
Domain (long left, long right) | |
long[] | flattenedIntervals () |
boolean | isEmpty () |
long | size () |
long | min () |
long | max () |
boolean | contains (long value) |
Domain | complement () |
Domain | negation () |
Domain | intersectionWith (Domain domain) |
Domain | unionWith (Domain domain) |
Domain | additionWith (Domain domain) |
String | toString () |
Static Public Member Functions | |
static long | getCPtr (Domain obj) |
static long | swigRelease (Domain obj) |
static Domain | allValues () |
static Domain | fromValues (long[] values) |
static Domain | fromIntervals (long[][] intervals) |
static Domain | fromFlatIntervals (long[] flat_intervals) |
Protected Member Functions | |
void | finalize () |
Protected Attributes | |
transient boolean | swigCMemOwn |
We call domain any subset of Int64 = [kint64min, kint64max].
This class can be used to represent such set efficiently as a sorted and
non-adjacent list of intervals. This is efficient as long as the size of such
list stays reasonable.
In the comments below, the domain of *this will always be written 'D'.
Note that all the functions are safe with respect to integer overflow.
Definition at line 21 of file Domain.java.
com.google.ortools.util.Domain.Domain | ( | long | cPtr, |
boolean | cMemoryOwn ) |
Definition at line 25 of file Domain.java.
com.google.ortools.util.Domain.Domain | ( | ) |
By default, Domain will be empty.
Definition at line 64 of file Domain.java.
com.google.ortools.util.Domain.Domain | ( | long | value | ) |
Constructor for the common case of a singleton domain.
Definition at line 71 of file Domain.java.
com.google.ortools.util.Domain.Domain | ( | long | left, |
long | right ) |
Constructor for the common case of a single interval [left, right].
If left > right, this will result in the empty domain.
Definition at line 79 of file Domain.java.
Returns {x ∈ Int64, ∃ a ∈ D, ∃ b ∈ domain, x = a + b}.
Definition at line 198 of file Domain.java.
|
static |
Returns the full domain Int64.
Definition at line 86 of file Domain.java.
Domain com.google.ortools.util.Domain.complement | ( | ) |
Returns the set Int64 ∖ D.
Definition at line 167 of file Domain.java.
boolean com.google.ortools.util.Domain.contains | ( | long | value | ) |
Returns true iff value is in Domain.
Definition at line 160 of file Domain.java.
synchronized void com.google.ortools.util.Domain.delete | ( | ) |
Definition at line 51 of file Domain.java.
|
protected |
Definition at line 47 of file Domain.java.
long[] com.google.ortools.util.Domain.flattenedIntervals | ( | ) |
This method returns the flattened list of interval bounds of the domain.
Thus the domain {0, 1, 2, 5, 8, 9, 10} will return [0, 2, 5, 5,
8, 10] (as a C++ std::vector<int64_t>, as a java or C# long[], as
a python list of integers).
Definition at line 123 of file Domain.java.
|
static |
This method is available in Python, Java and .NET. It allows
building a Domain object from a flattened list of intervals
(long[] in Java and .NET, [0, 2, 5, 5, 8, 10] in python).
Definition at line 112 of file Domain.java.
|
static |
This method is available in Python, Java and .NET. It allows
building a Domain object from a list of intervals (long[][] in Java and
.NET, [[0, 2], [5, 5], [8, 10]] in python).
Definition at line 103 of file Domain.java.
|
static |
Creates a domain from the union of an unsorted list of integer values.
Input values may be repeated, with no consequence on the output
Definition at line 94 of file Domain.java.
|
static |
Definition at line 30 of file Domain.java.
Returns the intersection of D and domain.
Definition at line 184 of file Domain.java.
boolean com.google.ortools.util.Domain.isEmpty | ( | ) |
Returns true if this is the empty set.
Definition at line 130 of file Domain.java.
long com.google.ortools.util.Domain.max | ( | ) |
Returns the max value of the domain.
The domain must not be empty.
Definition at line 153 of file Domain.java.
long com.google.ortools.util.Domain.min | ( | ) |
Returns the min value of the domain.
The domain must not be empty.
Definition at line 145 of file Domain.java.
Domain com.google.ortools.util.Domain.negation | ( | ) |
Returns {x ∈ Int64, ∃ e ∈ D, x = -e}.
Note in particular that if the negation of Int64 is not Int64 but
Int64 \ {kint64min} !!
Definition at line 177 of file Domain.java.
long com.google.ortools.util.Domain.size | ( | ) |
Returns the number of elements in the domain. It is capped at kint64max
Definition at line 137 of file Domain.java.
|
static |
Definition at line 34 of file Domain.java.
String com.google.ortools.util.Domain.toString | ( | ) |
Returns a compact string of a vector of intervals like "[1,4][6][10,20]".
Definition at line 205 of file Domain.java.
Returns the union of D and domain.
Definition at line 191 of file Domain.java.
|
protected |
Definition at line 23 of file Domain.java.