OR-Tools  8.2
SmallRevBitSet

Detailed Description

This class represents a small reversible bitset (size <= 64).

This class is useful to maintain supports.

Definition at line 403 of file constraint_solveri.h.

Public Member Functions

 SmallRevBitSet (int64 size)
 
void SetToOne (Solver *const solver, int64 pos)
 Sets the 'pos' bit. More...
 
void SetToZero (Solver *const solver, int64 pos)
 Erases the 'pos' bit. More...
 
int64 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 GetFirstOne () const
 Gets the index of the first bit set starting from 0. More...
 

Constructor & Destructor Documentation

◆ SmallRevBitSet()

SmallRevBitSet ( int64  size)
explicit

Definition at line 32 of file utilities.cc.

Member Function Documentation

◆ Cardinality()

int64 Cardinality ( ) const

Returns the number of bits set to one.

Definition at line 47 of file utilities.cc.

◆ GetFirstOne()

int64 GetFirstOne ( ) const

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

It returns -1 if the bitset is empty.

Definition at line 49 of file utilities.cc.

◆ IsCardinalityOne()

bool IsCardinalityOne ( ) const
inline

Does it contains only one bit set?

Definition at line 415 of file constraint_solveri.h.

◆ IsCardinalityZero()

bool IsCardinalityZero ( ) const
inline

Is bitset null?

Definition at line 413 of file constraint_solveri.h.

◆ SetToOne()

void SetToOne ( Solver *const  solver,
int64  pos 
)

Sets the 'pos' bit.

Definition at line 37 of file utilities.cc.

◆ SetToZero()

void SetToZero ( Solver *const  solver,
int64  pos 
)

Erases the 'pos' bit.

Definition at line 42 of file utilities.cc.


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