Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
operations_research::SmallRevBitSet Class Reference

#include <constraint_solveri.h>

Public Member Functions

 SmallRevBitSet (int64_t size)
 -------— SmallRevBitSet -------—
 
void SetToOne (Solver *solver, int64_t pos)
 Sets the 'pos' bit.
 
void SetToZero (Solver *solver, int64_t pos)
 Erases the 'pos' bit.
 
int64_t Cardinality () const
 Returns the number of bits set to one.
 
bool IsCardinalityZero () const
 Is bitset null?
 
bool IsCardinalityOne () const
 Does it contains only one bit set?
 
int64_t GetFirstOne () const
 

Detailed Description

This class represents a small reversible bitset (size <= 64). This class is useful to maintain supports.

Definition at line 408 of file constraint_solveri.h.

Constructor & Destructor Documentation

◆ SmallRevBitSet()

operations_research::SmallRevBitSet::SmallRevBitSet ( int64_t size)
explicit

-------— SmallRevBitSet -------—

Definition at line 34 of file utilities.cc.

Member Function Documentation

◆ Cardinality()

int64_t operations_research::SmallRevBitSet::Cardinality ( ) const

Returns the number of bits set to one.

Definition at line 49 of file utilities.cc.

◆ GetFirstOne()

int64_t operations_research::SmallRevBitSet::GetFirstOne ( ) const

Gets the index of the first bit set starting from 0. It returns -1 if the bitset is empty.

Definition at line 53 of file utilities.cc.

◆ IsCardinalityOne()

bool operations_research::SmallRevBitSet::IsCardinalityOne ( ) const
inline

Does it contains only one bit set?

Definition at line 420 of file constraint_solveri.h.

◆ IsCardinalityZero()

bool operations_research::SmallRevBitSet::IsCardinalityZero ( ) const
inline

Is bitset null?

Definition at line 418 of file constraint_solveri.h.

◆ SetToOne()

void operations_research::SmallRevBitSet::SetToOne ( Solver * solver,
int64_t pos )

Sets the 'pos' bit.

Definition at line 39 of file utilities.cc.

◆ SetToZero()

void operations_research::SmallRevBitSet::SetToZero ( Solver * solver,
int64_t pos )

Erases the 'pos' bit.

Definition at line 44 of file utilities.cc.


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