C++ Reference

C++ Reference: CP-SAT

Detailed Description

A Boolean variable.

This class wraps an IntegerVariableProto with domain [0, 1]. It supports the logical negation (Not).

This can only be constructed via CpModelBuilder.NewBoolVar().

Definition at line 67 of file cp_model.h.

Public Member Functions

 BoolVar ()
 
BoolVar WithName (const std::string &name)
 Sets the name of the variable. More...
 
const 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
 Equality test with another boolvar. More...
 
bool operator!= (const BoolVar &other) const
 Dis-Equality test. More...
 
std::string DebugString () const
 Debug string. More...
 
const IntegerVariableProto & Proto () const
 Returns the underlying protobuf object (useful for testing). More...
 
IntegerVariableProto * MutableProto () const
 Returns the mutable underlying protobuf object (useful for model edition). More...
 
int index () const
 Returns the index of the variable in the model. More...
 

Constructor & Destructor Documentation

◆ BoolVar()

BoolVar ( )

Member Function Documentation

◆ DebugString()

std::string DebugString ( ) const

Debug string.

◆ index()

int index ( ) const
inline

Returns the index of the variable in the model.

If the variable is the negation of another variable v, its index is -v.index() - 1.

Definition at line 109 of file cp_model.h.

◆ MutableProto()

IntegerVariableProto* MutableProto ( ) const
inline

Returns the mutable underlying protobuf object (useful for model edition).

Definition at line 99 of file cp_model.h.

◆ Name()

const std::string& Name ( ) const
inline

Returns the name of the variable.

Definition at line 75 of file cp_model.h.

◆ Not()

BoolVar Not ( ) const
inline

Returns the logical negation of the current Boolean variable.

Definition at line 78 of file cp_model.h.

◆ operator!=()

bool operator!= ( const BoolVar other) const
inline

Dis-Equality test.

Definition at line 86 of file cp_model.h.

◆ operator==()

bool operator== ( const BoolVar other) const
inline

Equality test with another boolvar.

Definition at line 81 of file cp_model.h.

◆ Proto()

const IntegerVariableProto& Proto ( ) const
inline

Returns the underlying protobuf object (useful for testing).

Definition at line 94 of file cp_model.h.

◆ WithName()

BoolVar WithName ( const std::string &  name)

Sets the name of the variable.


The documentation for this class was generated from the following file: