Detailed Description
header only, simple implementation of a bitset
Implements a simple bitset. Should be set to NULL if undefined. NOTE: for efficiency reasons the bitset type is based on an STP_Vector and thus uses a non-SCIP-standard allocation method. In this way we avoid indirections, because we directly access the raw array. todo if too slow use extra fixed-size vector that uses standard memory allocs, or even cache-aligned mallocs
Definition in file stpbitset.h.
Go to the source code of this file.
Macros | |
#define | STP_Bitset STP_Vectype(uint64_t) |
Macro Definition Documentation
◆ STP_Bitset
#define STP_Bitset STP_Vectype(uint64_t) |
Definition at line 44 of file stpbitset.h.
Referenced by stpbitset_new(), stpbitset_newAllTrue(), stpbitset_newAnd(), stpbitset_newCopy(), stpbitset_newNot(), stpbitset_newOr(), and stpbitset_newXor().
Function Documentation
◆ bitsetinternalPopcount()
|
inlinestatic |
todo: do that more efficiently; currently just a text-book implementation. probably want to have case distinction for compilers and use intrinsics at least for gcc, clang, and intel
- Parameters
-
number to get popcount for
Definition at line 51 of file stpbitset.h.
References number.
Referenced by stpbitset_getPopcount().
◆ stpbitset_new()
|
inlinestatic |
initializes clean (all-0) bitset and returns it
- Parameters
-
scip SCIP data structure maxnbits size of bitset
Definition at line 75 of file stpbitset.h.
References NULL, STP_Bitset, StpVecPushBack, and StpVecReserve.
Referenced by dpiterAddNewPrepare(), dpsolverInitData(), stpbitset_newAllTrue(), stpbitset_newAnd(), stpbitset_newCopy(), stpbitset_newNot(), stpbitset_newOr(), and stpbitset_newXor().
◆ stpbitset_free()
|
inlinestatic |
frees
- Parameters
-
scip SCIP data structure bitset bitset pointer
Definition at line 100 of file stpbitset.h.
References NULL, and StpVecFree.
Referenced by combineWithIntersecting(), dpiterAddNewPrepare(), dpiterFinalizeSol(), dpiterPopSol(), dpmiscFree(), dpterms_dpsubsolFree(), dpterms_streeFree(), subtreesAddNewFinalize(), and updateIncumbent().
◆ stpbitset_getCapacity()
|
inlinestatic |
gets number of bits that can be stored
- Parameters
-
bitset bitset
Definition at line 116 of file stpbitset.h.
References StpVecGetcapacity, and StpVecGetSize.
Referenced by bitsetsizesAreValid(), stpbitset_bitIsTrue(), stpbitset_newAllTrue(), stpbitset_newAnd(), stpbitset_newCopy(), stpbitset_newNot(), stpbitset_newOr(), stpbitset_newXor(), stpbitset_print(), stpbitset_setBitFalse(), stpbitset_setBitTrue(), and stpbitset_setsAreCompatible().
◆ stpbitset_setBitTrue()
|
inlinestatic |
sets bit to TRUE (1)
- Parameters
-
bitset bitset index bit index
Definition at line 129 of file stpbitset.h.
References stpbitset_getCapacity().
Referenced by dpiterAddNewPrepare(), dpsolverInitData(), and stpbitset_newAllTrue().
◆ stpbitset_setBitFalse()
|
inlinestatic |
sets bit to FALSE (0)
- Parameters
-
bitset bitset index bit index
Definition at line 143 of file stpbitset.h.
References stpbitset_getCapacity().
◆ stpbitset_setsAreCompatible()
|
inlinestatic |
are given bitsets compatible?
- Parameters
-
bitset1 bitset bitset2 bitset
Definition at line 157 of file stpbitset.h.
References FALSE, stpbitset_getCapacity(), StpVecGetSize, and TRUE.
Referenced by STP_Vectype(), stpbitset_and(), stpbitset_areEqual(), stpbitset_GT(), stpbitset_haveIntersection(), stpbitset_LT(), stpbitset_newAnd(), stpbitset_newCopy(), stpbitset_newOr(), stpbitset_newXor(), and stpbitset_or().
◆ stpbitset_haveIntersection()
|
inlinestatic |
do bitsets (of same size) intersect?
- Parameters
-
bitset1 bitset bitset2 bitset
Definition at line 177 of file stpbitset.h.
References FALSE, stpbitset_setsAreCompatible(), StpVecGetSize, and TRUE.
Referenced by STP_Vectype(), and streeCollectIntersects().
◆ stpbitset_areEqual()
|
inlinestatic |
are bitsets the same?
- Parameters
-
bitset1 bitset bitset2 bitset
Definition at line 200 of file stpbitset.h.
References FALSE, stpbitset_setsAreCompatible(), StpVecGetSize, and TRUE.
Referenced by dpiterPopSol().
◆ stpbitset_bitIsTrue()
|
inlinestatic |
is bit at given index set?
- Parameters
-
bitset bitset index bit index
Definition at line 223 of file stpbitset.h.
References FALSE, stpbitset_getCapacity(), and TRUE.
Referenced by allExtensionsAreInvalid(), dpiterGetNextSol(), insertData(), nodeIsNonSolTerm(), STP_Vectype(), stpbitset_newAllTrue(), stpbitset_newNot(), stpbitset_print(), and streeCollectIntersects().
◆ stpbitset_getPopcount()
|
inlinestatic |
gets number of 1-bits
- Parameters
-
bitset bitset
Definition at line 247 of file stpbitset.h.
References bitsetinternalPopcount(), and StpVecGetSize.
Referenced by combineWithIntersecting(), dpiterPopSol(), dpterms_streeInsert(), insertData(), and subtreesAddNew().
◆ stpbitset_newCopy()
|
inlinestatic |
gets copy
- Parameters
-
scip SCIP data structure bitsetOrg bitset
Definition at line 267 of file stpbitset.h.
References BMScopyMemoryArray, STP_Bitset, stpbitset_getCapacity(), stpbitset_new(), stpbitset_setsAreCompatible(), and StpVecGetSize.
Referenced by combineWithIntersecting(), dpsolverInitData(), insertData(), and subtreesAddNewFinalize().
◆ stpbitset_and()
|
inlinestatic |
sets AND bitset
- Parameters
-
scip SCIP data structure bitset1 bitset bitset2 bitset bitsetAnd bitset to set
Definition at line 286 of file stpbitset.h.
References stpbitset_setsAreCompatible(), and StpVecGetSize.
Referenced by insertData(), and stpbitset_newAnd().
◆ stpbitset_or()
|
inlinestatic |
sets OR bitset
- Parameters
-
scip SCIP data structure bitset1 bitset bitset2 bitset bitsetOr bitset to set
Definition at line 308 of file stpbitset.h.
References stpbitset_setsAreCompatible(), and StpVecGetSize.
Referenced by insertData(), and stpbitset_newOr().
◆ stpbitset_newAnd()
|
inlinestatic |
gets new AND bitset
- Parameters
-
scip SCIP data structure bitset1 bitset bitset2 bitset
Definition at line 330 of file stpbitset.h.
References STP_Bitset, stpbitset_and(), stpbitset_getCapacity(), stpbitset_new(), and stpbitset_setsAreCompatible().
◆ stpbitset_newOr()
|
inlinestatic |
gets new OR bitset
- Parameters
-
scip SCIP data structure bitset1 bitset bitset2 bitset
Definition at line 348 of file stpbitset.h.
References STP_Bitset, stpbitset_getCapacity(), stpbitset_new(), stpbitset_or(), and stpbitset_setsAreCompatible().
Referenced by combineWithIntersecting().
◆ stpbitset_newXor()
|
inlinestatic |
gets new XOR bitset
- Parameters
-
scip SCIP data structure bitset1 bitset bitset2 bitset
Definition at line 366 of file stpbitset.h.
References STP_Bitset, stpbitset_getCapacity(), stpbitset_new(), stpbitset_setsAreCompatible(), and StpVecGetSize.
◆ stpbitset_newNot()
|
inlinestatic |
gets new Not bitset
- Parameters
-
scip SCIP data structure bitset1 bitset for not size size to apply not operation to
Definition at line 390 of file stpbitset.h.
References STP_Bitset, stpbitset_bitIsTrue(), stpbitset_getCapacity(), stpbitset_new(), and StpVecGetSize.
Referenced by updateIncumbent().
◆ stpbitset_newAllTrue()
|
inlinestatic |
initializes all TRUE bitset and returns it todo more efficiently
- Parameters
-
scip SCIP data structure maxnbits size of bitset
Definition at line 430 of file stpbitset.h.
References STP_Bitset, stpbitset_bitIsTrue(), stpbitset_getCapacity(), stpbitset_new(), and stpbitset_setBitTrue().
◆ stpbitset_print()
|
inlinestatic |
prints bitset (0,1) ... for debugging
- Parameters
-
bitset bitset to print
Definition at line 452 of file stpbitset.h.
References stpbitset_bitIsTrue(), and stpbitset_getCapacity().
Referenced by dpiterGetNextSol(), dpterms_streeInsert(), printNodeDebugInfo(), subtreesAddNew(), and updateIncumbent().
◆ stpbitset_GT()
|
inlinestatic |
bitset1 > bitset2?
- Parameters
-
bitset1 bitset bitset2 bitset
Definition at line 473 of file stpbitset.h.
References stpbitset_setsAreCompatible(), and StpVecGetSize.
◆ stpbitset_LT()
|
inlinestatic |
bitset1 < bitset2?
- Parameters
-
bitset1 bitset bitset2 bitset
Definition at line 492 of file stpbitset.h.
References stpbitset_setsAreCompatible(), and StpVecGetSize.