GCG 4.1.1 (dev)

Generic Column Generation

Loading...
Searching...
No Matches
gcgpqueue.c File Reference

Detailed Description

methods for working with priority queue

Author
Jonas Witt

Various methods to work with the priority queue

Definition in file gcgpqueue.c.

#include "gcg/gcgpqueue.h"
#include "gcg/pub_gcgpqueue.h"
#include "gcg/gcg.h"
#include "scip/def.h"
#include "scip/scip.h"
#include "blockmemshell/memory.h"
#include <assert.h>

Go to the source code of this file.

Macros

#define PQ_PARENT(q)
#define PQ_LEFTCHILD(p)
#define PQ_RIGHTCHILD(p)

Functions

static SCIP_RETCODE pqueueResize (GCG_PQUEUE *pqueue, int minsize)
static SCIP_RETCODE pqueueHeapify (GCG_PQUEUE *pqueue, int pos)
SCIP_RETCODE GCGpqueueCreate (SCIP *scip, GCG_PQUEUE **pqueue, int initsize, SCIP_DECL_SORTPTRCOMP((*ptrcomp)), GCG_LOCK *memorylock)
void GCGpqueueFree (GCG_PQUEUE **pqueue)
void GCGpqueueClear (GCG_PQUEUE *pqueue)
SCIP_RETCODE GCGpqueueInsert (GCG_PQUEUE *pqueue, void *elem)
void * GCGpqueueRemove (GCG_PQUEUE *pqueue)
SCIP_RETCODE GCGpqueueResort (GCG_PQUEUE *pqueue)
SCIP_RETCODE GCGpqueueSetComperator (GCG_PQUEUE *pqueue,)
SCIP_RETCODE GCGpqueueDelete (GCG_PQUEUE *pqueue, int pos, void **elem)
void * GCGpqueueFirst (GCG_PQUEUE *pqueue)
int GCGpqueueNElems (GCG_PQUEUE *pqueue)
void ** GCGpqueueElems (GCG_PQUEUE *pqueue)

Macro Definition Documentation

◆ PQ_PARENT

#define PQ_PARENT ( q)
Value:
(((q)+1)/2-1)

Definition at line 55 of file gcgpqueue.c.

Referenced by GCGpqueueDelete(), GCGpqueueInsert(), GCGpqueueRemove(), GCGpqueueResort(), and pqueueHeapify().

◆ PQ_LEFTCHILD

#define PQ_LEFTCHILD ( p)
Value:
(2*(p)+1)

Definition at line 56 of file gcgpqueue.c.

Referenced by GCGpqueueDelete(), GCGpqueueRemove(), and pqueueHeapify().

◆ PQ_RIGHTCHILD

#define PQ_RIGHTCHILD ( p)
Value:
(2*(p)+2)

Definition at line 57 of file gcgpqueue.c.

Referenced by GCGpqueueDelete(), GCGpqueueRemove(), and pqueueHeapify().

Function Documentation

◆ pqueueResize()

SCIP_RETCODE pqueueResize ( GCG_PQUEUE * pqueue,
int minsize )
static

resizes element memory to hold at least the given number of elements

Parameters
pqueuepointer to a priority queue
minsizeminimal number of storable elements

Definition at line 62 of file gcgpqueue.c.

References assert(), GCG_SET_LOCK, GCG_UNSET_LOCK, pqueueResize(), retcode, GCG_PQueue::scip, GCG_PQueue::size, and GCG_PQueue::slots.

Referenced by GCGpqueueCreate(), GCGpqueueInsert(), and pqueueResize().

◆ pqueueHeapify()

SCIP_RETCODE pqueueHeapify ( GCG_PQUEUE * pqueue,
int pos )
static

heapifies element at position pos into corresponding subtrees

Parameters
pqueuepointer to a priority queue
posheapify element at position pos into corresponding subtrees

Definition at line 87 of file gcgpqueue.c.

References assert(), GCG_PQueue::len, PQ_LEFTCHILD, PQ_PARENT, PQ_RIGHTCHILD, pqueueHeapify(), and GCG_PQueue::slots.

Referenced by GCGpqueueResort(), and pqueueHeapify().