Scippy

SCIP

Solving Constraint Integer Programs

Detailed Description

very lightweight hash set of pointers

Functions

SCIP_EXPORT SCIP_RETCODE SCIPhashsetCreate (SCIP_HASHSET **hashset, BMS_BLKMEM *blkmem, int size)
 
SCIP_EXPORT void SCIPhashsetFree (SCIP_HASHSET **hashset, BMS_BLKMEM *blkmem)
 
SCIP_EXPORT SCIP_RETCODE SCIPhashsetInsert (SCIP_HASHSET *hashset, BMS_BLKMEM *blkmem, void *element)
 
SCIP_EXPORT SCIP_Bool SCIPhashsetExists (SCIP_HASHSET *hashset, void *element)
 
SCIP_EXPORT SCIP_RETCODE SCIPhashsetRemove (SCIP_HASHSET *hashset, void *element)
 
SCIP_EXPORT void SCIPhashsetPrintStatistics (SCIP_HASHSET *hashset, SCIP_MESSAGEHDLR *messagehdlr)
 
SCIP_EXPORT SCIP_Bool SCIPhashsetIsEmpty (SCIP_HASHSET *hashset)
 
SCIP_EXPORT int SCIPhashsetGetNElements (SCIP_HASHSET *hashset)
 
SCIP_EXPORT int SCIPhashsetGetNSlots (SCIP_HASHSET *hashset)
 
SCIP_EXPORT void ** SCIPhashsetGetSlots (SCIP_HASHSET *hashset)
 
SCIP_EXPORT void SCIPhashsetRemoveAll (SCIP_HASHSET *hashset)
 

Function Documentation

◆ SCIPhashsetCreate()

SCIP_EXPORT SCIP_RETCODE SCIPhashsetCreate ( SCIP_HASHSET **  hashset,
BMS_BLKMEM blkmem,
int  size 
)

creates a hash set of pointers

Parameters
hashsetpointer to store the created hash set
blkmemblock memory used to store hash set entries
sizeinitial size of the hash set; it is guaranteed that the set is not resized if at most that many elements are inserted

Definition at line 3576 of file misc.c.

References BMSallocBlockMemory, BMSallocClearBlockMemoryArray, log(), MAX, NULL, SCIP_ALLOC, SCIP_OKAY, and SCIPhashsetGetNSlots().

Referenced by mod2MatrixAddCol(), and SCIPrealHashCode().

◆ SCIPhashsetFree()

SCIP_EXPORT void SCIPhashsetFree ( SCIP_HASHSET **  hashset,
BMS_BLKMEM blkmem 
)

frees the hash set

Parameters
hashsetpointer to the hash set
blkmemblock memory used to store hash set entries

Definition at line 3607 of file misc.c.

References BMSfreeBlockMemory, BMSfreeBlockMemoryArray, and SCIPhashsetGetNSlots().

Referenced by destroyMod2Matrix(), mod2matrixRemoveCol(), and SCIPrealHashCode().

◆ SCIPhashsetInsert()

SCIP_EXPORT SCIP_RETCODE SCIPhashsetInsert ( SCIP_HASHSET hashset,
BMS_BLKMEM blkmem,
void *  element 
)

inserts new element into the hash set

Parameters
hashsethash set
blkmemblock memory used to store hash set entries
elementelement to insert

Definition at line 3617 of file misc.c.

References hashsetCheckLoad(), hashsetInsert(), NULL, SCIP_CALL, SCIP_OKAY, and SCIP_HashSet::slots.

Referenced by mod2colLinkRow(), and SCIPrealHashCode().

◆ SCIPhashsetExists()

SCIP_EXPORT SCIP_Bool SCIPhashsetExists ( SCIP_HASHSET hashset,
void *  element 
)

checks whether an element exists in the hash set

Parameters
hashsethash set
elementelement to search for

Definition at line 3634 of file misc.c.

References ELEM_DISTANCE, FALSE, hashSetDesiredPos(), NULL, SCIPhashsetGetNSlots(), SCIP_HashSet::slots, and TRUE.

Referenced by mod2colLinkRow(), mod2colUnlinkRow(), SCIP_DECL_HASHKEYEQ(), SCIPhashsetRemove(), and SCIPrealHashCode().

◆ SCIPhashsetRemove()

SCIP_EXPORT SCIP_RETCODE SCIPhashsetRemove ( SCIP_HASHSET hashset,
void *  element 
)

removes an element from the hash set, if it exists

Parameters
hashsethash set
elementorigin to remove from the list

Definition at line 3675 of file misc.c.

References ELEM_DISTANCE, hashSetDesiredPos(), SCIP_HashSet::nelements, NULL, SCIP_OKAY, SCIPhashsetExists(), SCIPhashsetGetNSlots(), SCIP_HashSet::slots, and TRUE.

Referenced by mod2colUnlinkRow(), and SCIPrealHashCode().

◆ SCIPhashsetPrintStatistics()

SCIP_EXPORT void SCIPhashsetPrintStatistics ( SCIP_HASHSET hashset,
SCIP_MESSAGEHDLR messagehdlr 
)

prints statistics about hash set usage

Parameters
hashsethash set
messagehdlrmessage handler

Definition at line 3750 of file misc.c.

References hashSetDesiredPos(), MAX, SCIP_HashSet::nelements, NULL, SCIP_Real, SCIPhashsetGetNSlots(), SCIPmessagePrintInfo(), and SCIP_HashSet::slots.

Referenced by SCIPrealHashCode().

◆ SCIPhashsetIsEmpty()

SCIP_EXPORT SCIP_Bool SCIPhashsetIsEmpty ( SCIP_HASHSET hashset)

indicates whether a hash set has no entries

Parameters
hashsethash set

Definition at line 3801 of file misc.c.

References SCIP_HashSet::nelements.

Referenced by SCIPrealHashCode().

◆ SCIPhashsetGetNElements()

SCIP_EXPORT int SCIPhashsetGetNElements ( SCIP_HASHSET hashset)

gives the number of elements in a hash set

Parameters
hashsethash set

Definition at line 3809 of file misc.c.

References SCIP_HashSet::nelements.

Referenced by mod2matrixPreprocessColumns(), SCIP_DECL_HASHKEYEQ(), and SCIPrealHashCode().

◆ SCIPhashsetGetNSlots()

◆ SCIPhashsetGetSlots()

SCIP_EXPORT void** SCIPhashsetGetSlots ( SCIP_HASHSET hashset)

gives the array of hash set slots; contains all elements in indetermined order and may contain NULL values

Parameters
hashsethash set

Definition at line 3825 of file misc.c.

References SCIP_HashSet::slots.

Referenced by doSeparation(), mod2colUnlinkRow(), mod2matrixPreprocessColumns(), mod2matrixRemoveCol(), SCIP_DECL_HASHKEYEQ(), SCIP_DECL_HASHKEYVAL(), and SCIPrealHashCode().

◆ SCIPhashsetRemoveAll()

SCIP_EXPORT void SCIPhashsetRemoveAll ( SCIP_HASHSET hashset)

removes all entries in a hash set.

Parameters
hashsethash set

Definition at line 3833 of file misc.c.

References BMSclearMemoryArray, SCIP_HashSet::nelements, SCIPhashsetGetNSlots(), and SCIP_HashSet::slots.

Referenced by SCIPrealHashCode().