An integer variable.
It will be referred to by an int32 corresponding to its index in a
CpModelProto variables field.
Depending on the context, a reference to a variable whose domain is in [0, 1]
can also be seen as a Boolean that will be true if the variable value is 1
and false if it is 0. When used in this context, the field name will always
contain the word "literal".
Negative reference (advanced usage): to simplify the creation of a model and
for efficiency reasons, all the "literal" or "variable" fields can also
contain a negative index. A negative index i will refer to the negation of
the integer variable at index -i -1 or to NOT the literal at the same index.
Ex: A variable index 4 will refer to the integer variable model.variables(4)
and an index of -5 will refer to the negation of the same variable. A literal
index 4 will refer to the logical fact that model.variable(4) == 1 and a
literal index of -5 will refer to the logical fact model.variable(4) == 0.
Protobuf type
operations_research.sat.IntegerVariableProto
Definition at line 462 of file IntegerVariableProto.java.
| Builder addAllDomain |
( |
java.lang.Iterable<? extends java.lang.Long > |
values | ) |
|
|
inline |
The variable domain given as a sorted list of n disjoint intervals
[min, max] and encoded as [min_0, max_0, ..., min_{n-1}, max_{n-1}].
The most common example being just [min, max].
If min == max, then this is a constant variable.
We have:
- domain_size() is always even.
- min == domain.front();
- max == domain.back();
- for all i < n : min_i <= max_i
- for all i < n-1 : max_i + 1 < min_{i+1}.
Note that we check at validation that a variable domain is small enough so
that we don't run into integer overflow in our algorithms. Because of that,
you cannot just have "unbounded" variable like [0, kint64max] and should
try to specify tighter domains.
repeated int64 domain = 2;
- Parameters
-
- Returns
- This builder for chaining.
Definition at line 884 of file IntegerVariableProto.java.
The variable domain given as a sorted list of n disjoint intervals
[min, max] and encoded as [min_0, max_0, ..., min_{n-1}, max_{n-1}].
The most common example being just [min, max].
If min == max, then this is a constant variable.
We have:
- domain_size() is always even.
- min == domain.front();
- max == domain.back();
- for all i < n : min_i <= max_i
- for all i < n-1 : max_i + 1 < min_{i+1}.
Note that we check at validation that a variable domain is small enough so
that we don't run into integer overflow in our algorithms. Because of that,
you cannot just have "unbounded" variable like [0, kint64max] and should
try to specify tighter domains.
repeated int64 domain = 2;
- Parameters
-
- Returns
- This builder for chaining.
Definition at line 856 of file IntegerVariableProto.java.
The variable domain given as a sorted list of n disjoint intervals
[min, max] and encoded as [min_0, max_0, ..., min_{n-1}, max_{n-1}].
The most common example being just [min, max].
If min == max, then this is a constant variable.
We have:
- domain_size() is always even.
- min == domain.front();
- max == domain.back();
- for all i < n : min_i <= max_i
- for all i < n-1 : max_i + 1 < min_{i+1}.
Note that we check at validation that a variable domain is small enough so
that we don't run into integer overflow in our algorithms. Because of that,
you cannot just have "unbounded" variable like [0, kint64max] and should
try to specify tighter domains.
repeated int64 domain = 2;
- Returns
- This builder for chaining.
Definition at line 913 of file IntegerVariableProto.java.
| long getDomain |
( |
int |
index | ) |
|
|
inline |
The variable domain given as a sorted list of n disjoint intervals
[min, max] and encoded as [min_0, max_0, ..., min_{n-1}, max_{n-1}].
The most common example being just [min, max].
If min == max, then this is a constant variable.
We have:
- domain_size() is always even.
- min == domain.front();
- max == domain.back();
- for all i < n : min_i <= max_i
- for all i < n-1 : max_i + 1 < min_{i+1}.
Note that we check at validation that a variable domain is small enough so
that we don't run into integer overflow in our algorithms. Because of that,
you cannot just have "unbounded" variable like [0, kint64max] and should
try to specify tighter domains.
repeated int64 domain = 2;
- Parameters
-
| index | The index of the element to return.
|
- Returns
- The domain at the given index.
Implements IntegerVariableProtoOrBuilder.
Definition at line 801 of file IntegerVariableProto.java.
The variable domain given as a sorted list of n disjoint intervals
[min, max] and encoded as [min_0, max_0, ..., min_{n-1}, max_{n-1}].
The most common example being just [min, max].
If min == max, then this is a constant variable.
We have:
- domain_size() is always even.
- min == domain.front();
- max == domain.back();
- for all i < n : min_i <= max_i
- for all i < n-1 : max_i + 1 < min_{i+1}.
Note that we check at validation that a variable domain is small enough so
that we don't run into integer overflow in our algorithms. Because of that,
you cannot just have "unbounded" variable like [0, kint64max] and should
try to specify tighter domains.
repeated int64 domain = 2;
- Returns
- The count of domain.
Implements IntegerVariableProtoOrBuilder.
Definition at line 776 of file IntegerVariableProto.java.
| java.util.List<java.lang.Long> getDomainList |
( |
| ) |
|
|
inline |
The variable domain given as a sorted list of n disjoint intervals
[min, max] and encoded as [min_0, max_0, ..., min_{n-1}, max_{n-1}].
The most common example being just [min, max].
If min == max, then this is a constant variable.
We have:
- domain_size() is always even.
- min == domain.front();
- max == domain.back();
- for all i < n : min_i <= max_i
- for all i < n-1 : max_i + 1 < min_{i+1}.
Note that we check at validation that a variable domain is small enough so
that we don't run into integer overflow in our algorithms. Because of that,
you cannot just have "unbounded" variable like [0, kint64max] and should
try to specify tighter domains.
repeated int64 domain = 2;
- Returns
- A list containing the domain.
Implements IntegerVariableProtoOrBuilder.
Definition at line 751 of file IntegerVariableProto.java.
| Builder setDomain |
( |
int |
index, |
|
|
long |
value |
|
) |
| |
|
inline |
The variable domain given as a sorted list of n disjoint intervals
[min, max] and encoded as [min_0, max_0, ..., min_{n-1}, max_{n-1}].
The most common example being just [min, max].
If min == max, then this is a constant variable.
We have:
- domain_size() is always even.
- min == domain.front();
- max == domain.back();
- for all i < n : min_i <= max_i
- for all i < n-1 : max_i + 1 < min_{i+1}.
Note that we check at validation that a variable domain is small enough so
that we don't run into integer overflow in our algorithms. Because of that,
you cannot just have "unbounded" variable like [0, kint64max] and should
try to specify tighter domains.
repeated int64 domain = 2;
- Parameters
-
| index | The index to set the value at.
|
| value | The domain to set.
|
- Returns
- This builder for chaining.
Definition at line 827 of file IntegerVariableProto.java.