Priority Queue

Detailed Description

Functions

EXTERN SCIP_RETCODE GCGpqueueCreate (GCG_PQUEUE **pqueue, int initsize, SCIP_Real sizefac, SCIP_DECL_SORTPTRCOMP((*ptrcomp)))
 
EXTERN void GCGpqueueFree (GCG_PQUEUE **pqueue)
 
EXTERN void GCGpqueueClear (GCG_PQUEUE *pqueue)
 
EXTERN SCIP_RETCODE GCGpqueueInsert (GCG_PQUEUE *pqueue, void *elem)
 
EXTERN void * GCGpqueueRemove (GCG_PQUEUE *pqueue)
 
EXTERN SCIP_RETCODE GCGpqueueResort (GCG_PQUEUE *pqueue)
 
SCIP_RETCODE GCGpqueueSetComperator (GCG_PQUEUE *pqueue, SCIP_DECL_SORTPTRCOMP((*ptrcomp)))
 
SCIP_RETCODE GCGpqueueDelete (GCG_PQUEUE *pqueue, int pos, void **elem)
 
EXTERN void * GCGpqueueFirst (GCG_PQUEUE *pqueue)
 
EXTERN int GCGpqueueNElems (GCG_PQUEUE *pqueue)
 
EXTERN void ** GCGpqueueElems (GCG_PQUEUE *pqueue)
 

Function Documentation

EXTERN void GCGpqueueClear ( GCG_PQUEUE pqueue)

clears the priority queue, but doesn't free the data elements themselves

Parameters
pqueuepriority queue

Definition at line 152 of file gcgpqueue.c.

EXTERN SCIP_RETCODE GCGpqueueCreate ( GCG_PQUEUE **  pqueue,
int  initsize,
SCIP_Real  sizefac,
SCIP_DECL_SORTPTRCOMP((*ptrcomp))   
)

creates priority queue

Parameters
pqueuepointer to a priority queue
initsizeinitial number of available element slots
sizefacmemory growing factor applied, if more element slots are needed

Definition at line 116 of file gcgpqueue.c.

References pqueueResize().

SCIP_RETCODE GCGpqueueDelete ( GCG_PQUEUE pqueue,
int  pos,
void **  elem 
)

< delete item at position pos and insert last item at this position and resort pqueue

Parameters
pqueuepriority queue
posposition of item that should be deleted
elempointer to store element that was deleted from pqueue

Definition at line 273 of file gcgpqueue.c.

References PQ_LEFTCHILD, PQ_PARENT, and PQ_RIGHTCHILD.

EXTERN void** GCGpqueueElems ( GCG_PQUEUE pqueue)

returns the elements of the queue; changing the returned array may destroy the queue's ordering!

Parameters
pqueuepriority queue

Definition at line 337 of file gcgpqueue.c.

EXTERN void* GCGpqueueFirst ( GCG_PQUEUE pqueue)

returns the best element of the queue without removing it

Parameters
pqueuepriority queue

Definition at line 312 of file gcgpqueue.c.

EXTERN void GCGpqueueFree ( GCG_PQUEUE **  pqueue)

frees priority queue, but not the data elements themselves

Parameters
pqueuepointer to a priority queue

Definition at line 141 of file gcgpqueue.c.

EXTERN SCIP_RETCODE GCGpqueueInsert ( GCG_PQUEUE pqueue,
void *  elem 
)

inserts element into priority queue

Parameters
pqueuepriority queue
elemelement to be inserted

Definition at line 162 of file gcgpqueue.c.

References PQ_PARENT, and pqueueResize().

EXTERN int GCGpqueueNElems ( GCG_PQUEUE pqueue)

returns the number of elements in the queue

Parameters
pqueuepriority queue

Definition at line 326 of file gcgpqueue.c.

EXTERN void* GCGpqueueRemove ( GCG_PQUEUE pqueue)

removes and returns best element from the priority queue

Parameters
pqueuepriority queue

Definition at line 192 of file gcgpqueue.c.

References PQ_LEFTCHILD, PQ_PARENT, and PQ_RIGHTCHILD.

Referenced by gcg::Pricingcontroller::getNextPricingjob().

EXTERN SCIP_RETCODE GCGpqueueResort ( GCG_PQUEUE pqueue)

resorts priority queue after changing the key values

Parameters
pqueuepriority queue

Definition at line 233 of file gcgpqueue.c.

References PQ_PARENT, and pqueueHeapify().

SCIP_RETCODE GCGpqueueSetComperator ( GCG_PQUEUE pqueue,
SCIP_DECL_SORTPTRCOMP((*ptrcomp))   
)

set the comperator of the priority queue delete item at position pos and insert last item at this position and resort pqueue

set the comperator of the priority queue

Parameters
pqueuepriority queue

Definition at line 260 of file gcgpqueue.c.