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 75 of file cp_model.h.
#include <cp_model.h>
◆ BoolVar()
| operations_research::sat::BoolVar::BoolVar |
( |
| ) |
|
|
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.
◆ DebugString()
| std::string operations_research::sat::BoolVar::DebugString |
( |
| ) |
const |
◆ index()
| int operations_research::sat::BoolVar::index |
( |
| ) |
const |
|
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 111 of file cp_model.h.
◆ Name()
| std::string operations_research::sat::BoolVar::Name |
( |
| ) |
const |
Returns the name of the variable.
Definition at line 48 of file cp_model.cc.
◆ Not()
| BoolVar operations_research::sat::BoolVar::Not |
( |
| ) |
const |
|
inline |
Returns the logical negation of the current Boolean variable.
Definition at line 91 of file cp_model.h.
◆ operator!=()
| bool operations_research::sat::BoolVar::operator!= |
( |
const BoolVar & | other | ) |
const |
|
inline |
◆ operator==()
| bool operations_research::sat::BoolVar::operator== |
( |
const BoolVar & | other | ) |
const |
|
inline |
◆ operator~()
| BoolVar operations_research::sat::BoolVar::operator~ |
( |
| ) |
const |
|
inline |
◆ WithName()
| BoolVar operations_research::sat::BoolVar::WithName |
( |
absl::string_view | name | ) |
|
Sets the name of the variable.
- Note
- this will always set the "positive" version of this Boolean.
Definition at line 39 of file cp_model.cc.
◆ CircuitConstraint
| friend class CircuitConstraint |
|
friend |
◆ Constraint
◆ CpModelBuilder
| friend class CpModelBuilder |
|
friend |
◆ DoubleLinearExpr
| friend class DoubleLinearExpr |
|
friend |
◆ IntervalVar
◆ IntVar
◆ LinearExpr
◆ MultipleCircuitConstraint
| friend class MultipleCircuitConstraint |
|
friend |
◆ ReservoirConstraint
| friend class ReservoirConstraint |
|
friend |
◆ SolutionBooleanValue
The documentation for this class was generated from the following files: