An integer variable.
This class wraps an IntegerVariableProto. This can only be constructed via CpModelBuilder.NewIntVar().
Definition at line 142 of file cp_model.h.
◆ IntVar() [1/2]
A default constructed IntVar can be used to mean not defined yet.
However, it shouldn't be passed to any of the functions in this file. Doing so will crash in debug mode and will result in an invalid model in opt mode.
◆ IntVar() [2/2]
Cast BoolVar -> IntVar.
The IntVar will take the value 1 (when the bool is true) and 0 otherwise.
Warning: If you construct an IntVar from a negated BoolVar, this might create a new variable in the model. Otherwise this just point to the same underlying variable.
◆ DebugString()
| std::string DebugString |
( |
| ) |
const |
◆ Domain()
◆ index()
Returns the index of the variable in the model. This will be non-negative.
Definition at line 187 of file cp_model.h.
◆ Name()
| std::string Name |
( |
| ) |
const |
Returns the name of the variable (or the empty string if not set).
◆ operator!=()
| bool operator!= |
( |
const IntVar & |
other | ) |
const |
|
inline |
◆ operator==()
| bool operator== |
( |
const IntVar & |
other | ) |
const |
|
inline |
◆ ToBoolVar()
Cast IntVar -> BoolVar.
Warning: The domain of the var must be within {0,1}. If not, we crash in debug mode, and in opt mode you will get an invalid model if you use this BoolVar anywhere since it will not have a valid domain.
◆ WithName()
| IntVar WithName |
( |
const std::string & |
name | ) |
|
Sets the name of the variable.
The documentation for this class was generated from the following file: