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

#include <constraint_solveri.h>

Public Member Functions

 UnsortedNullableRevBitset (int bit_size)
 Size is the number of bits to store in the bitset.
 
 ~UnsortedNullableRevBitset ()
 
void Init (Solver *solver, const std::vector< uint64_t > &mask)
 
bool RevSubtract (Solver *solver, const std::vector< uint64_t > &mask)
 
bool RevAnd (Solver *solver, const std::vector< uint64_t > &mask)
 
int ActiveWordSize () const
 
bool Empty () const
 This method returns true if the active bitset is null.
 
bool Intersects (const std::vector< uint64_t > &mask, int *support_index)
 
int64_t bit_size () const
 Returns the number of bits given in the constructor of the bitset.
 
int64_t word_size () const
 Returns the number of 64 bit words used to store the bitset.
 
const RevIntSet< int > & active_words () const
 Returns the set of active word indices.
 

Detailed Description

This class represents a reversible bitset. It is meant to represent a set of active bits. It does not offer direct access, but just methods that can reversibly subtract another bitset, or check if the current active bitset intersects with another bitset.

Definition at line 3122 of file constraint_solveri.h.

Constructor & Destructor Documentation

◆ UnsortedNullableRevBitset()

operations_research::UnsortedNullableRevBitset::UnsortedNullableRevBitset ( int bit_size)
explicit

Size is the number of bits to store in the bitset.

--— UnsortedNullableRevBitset --—

Definition at line 227 of file utilities.cc.

◆ ~UnsortedNullableRevBitset()

operations_research::UnsortedNullableRevBitset::~UnsortedNullableRevBitset ( )
inline

Definition at line 3127 of file constraint_solveri.h.

Member Function Documentation

◆ active_words()

const RevIntSet< int > & operations_research::UnsortedNullableRevBitset::active_words ( ) const
inline

Returns the set of active word indices.

Definition at line 3162 of file constraint_solveri.h.

◆ ActiveWordSize()

int operations_research::UnsortedNullableRevBitset::ActiveWordSize ( ) const
inline

This method returns the number of non null 64 bit words in the bitset representation.

Definition at line 3143 of file constraint_solveri.h.

◆ bit_size()

int64_t operations_research::UnsortedNullableRevBitset::bit_size ( ) const
inline

Returns the number of bits given in the constructor of the bitset.

Definition at line 3158 of file constraint_solveri.h.

◆ Empty()

bool operations_research::UnsortedNullableRevBitset::Empty ( ) const
inline

This method returns true if the active bitset is null.

Definition at line 3146 of file constraint_solveri.h.

◆ Init()

void operations_research::UnsortedNullableRevBitset::Init ( Solver * solver,
const std::vector< uint64_t > & mask )

This methods overwrites the active bitset with the mask. This method should be called only once.

Definition at line 233 of file utilities.cc.

◆ Intersects()

bool operations_research::UnsortedNullableRevBitset::Intersects ( const std::vector< uint64_t > & mask,
int * support_index )

This method returns true iff the mask and the active bitset have a non null intersection. support_index is used as an accelerator:

  • The first word tested to check the intersection will be the '*support_index'th one.
  • If the intersection is not null, the support_index will be filled with the index of the word that does intersect with the mask. This can be reused later to speed-up the check.

Definition at line 296 of file utilities.cc.

◆ RevAnd()

bool operations_research::UnsortedNullableRevBitset::RevAnd ( Solver * solver,
const std::vector< uint64_t > & mask )

This method ANDs the mask with the active bitset. It returns true if the active bitset was changed in the process.

Zero the word as the mask is implicitly null.

Definition at line 271 of file utilities.cc.

◆ RevSubtract()

bool operations_research::UnsortedNullableRevBitset::RevSubtract ( Solver * solver,
const std::vector< uint64_t > & mask )

This method subtracts the mask from the active bitset. It returns true if the active bitset was changed in the process.

Definition at line 244 of file utilities.cc.

◆ word_size()

int64_t operations_research::UnsortedNullableRevBitset::word_size ( ) const
inline

Returns the number of 64 bit words used to store the bitset.

Definition at line 3160 of file constraint_solveri.h.


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