![]() |
OR-Tools
9.6
|
A Boolean variable.
This class refer to an IntegerVariableProto with domain [0, 1] or to its logical negation (Not). This is called a Boolean Literal in other context.
This can only be constructed via CpModelBuilder.NewBoolVar().
Definition at line 74 of file cp_model.h.
Public Member Functions | |
| BoolVar ()=default | |
| A default constructed BoolVar can be used to mean not defined yet. More... | |
| BoolVar | WithName (const std::string &name) |
| Sets the name of the variable. More... | |
| std::string | Name () const |
| Returns the name of the variable. More... | |
| BoolVar | Not () const |
| Returns the logical negation of the current Boolean variable. More... | |
| bool | operator== (const BoolVar &other) const |
| bool | operator!= (const BoolVar &other) const |
| std::string | DebugString () const |
| int | index () const |
| Returns the index of the variable in the model. More... | |
|
default |
A default constructed BoolVar 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.
| std::string DebugString | ( | ) | const |
Definition at line 58 of file cp_model.cc.
|
inline |
Returns the index of the variable in the model.
Warning: If the variable is the negation of another variable v, its index is -v.index() - 1. So this can be negative.
Definition at line 108 of file cp_model.h.
| std::string Name | ( | ) | const |
Returns the name of the variable.
Definition at line 47 of file cp_model.cc.
|
inline |
Returns the logical negation of the current Boolean variable.
Definition at line 90 of file cp_model.h.
|
inline |
Definition at line 96 of file cp_model.h.
|
inline |
Definition at line 92 of file cp_model.h.
| BoolVar WithName | ( | const std::string & | name | ) |
Sets the name of the variable.
Note that this will always set the "positive" version of this Boolean.
Definition at line 38 of file cp_model.cc.