OR-Tools  9.6
RevBitSet

Detailed Description

This class represents a reversible bitset.

This class is useful to maintain supports.

Definition at line 422 of file constraint_solveri.h.

Public Member Functions

 RevBitSet (int64_t size)
 
 ~RevBitSet ()
 
void SetToOne (Solver *const solver, int64_t index)
 Sets the 'index' bit. More...
 
void SetToZero (Solver *const solver, int64_t index)
 Erases the 'index' bit. More...
 
bool IsSet (int64_t index) const
 Returns whether the 'index' bit is set. More...
 
int64_t Cardinality () const
 Returns the number of bits set to one. More...
 
bool IsCardinalityZero () const
 Is bitset null? More...
 
bool IsCardinalityOne () const
 Does it contains only one bit set? More...
 
int64_t GetFirstBit (int start) const
 Gets the index of the first bit set starting from start. More...
 
void ClearAll (Solver *const solver)
 Cleans all bits. More...
 

Constructor & Destructor Documentation

◆ RevBitSet()

RevBitSet ( int64_t  size)
explicit

Definition at line 62 of file utilities.cc.

◆ ~RevBitSet()

~RevBitSet ( )

Definition at line 72 of file utilities.cc.

Member Function Documentation

◆ Cardinality()

int64_t Cardinality ( ) const

Returns the number of bits set to one.

Definition at line 113 of file utilities.cc.

◆ ClearAll()

void ClearAll ( Solver *const  solver)

Cleans all bits.

Definition at line 152 of file utilities.cc.

◆ GetFirstBit()

int64_t GetFirstBit ( int  start) const

Gets the index of the first bit set starting from start.

It returns -1 if the bitset is empty after start.

Definition at line 148 of file utilities.cc.

◆ IsCardinalityOne()

bool IsCardinalityOne ( ) const

Does it contains only one bit set?

Definition at line 130 of file utilities.cc.

◆ IsCardinalityZero()

bool IsCardinalityZero ( ) const

Is bitset null?

Definition at line 121 of file utilities.cc.

◆ IsSet()

bool IsSet ( int64_t  index) const

Returns whether the 'index' bit is set.

Definition at line 107 of file utilities.cc.

◆ SetToOne()

void SetToOne ( Solver *const  solver,
int64_t  index 
)

Sets the 'index' bit.

Definition at line 85 of file utilities.cc.

◆ SetToZero()

void SetToZero ( Solver *const  solver,
int64_t  index 
)

Erases the 'index' bit.

Definition at line 96 of file utilities.cc.


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