Scippy

GCG

Branch-and-Price & Column Generation for Everyone

pub_gcgpqueue.h
Go to the documentation of this file.
1/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2/* */
3/* This file is part of the program and library */
4/* GCG --- Generic Column Generation */
5/* a Dantzig-Wolfe decomposition based extension */
6/* of the branch-cut-and-price framework */
7/* SCIP --- Solving Constraint Integer Programs */
8/* */
9/* Copyright (C) 2010-2026 Operations Research, RWTH Aachen University */
10/* Zuse Institute Berlin (ZIB) */
11/* */
12/* Licensed under the Apache License, Version 2.0 (the "License"); */
13/* you may not use this file except in compliance with the License. */
14/* You may obtain a copy of the License at */
15/* */
16/* http://www.apache.org/licenses/LICENSE-2.0 */
17/* */
18/* Unless required by applicable law or agreed to in writing, software */
19/* distributed under the License is distributed on an "AS IS" BASIS, */
20/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
21/* See the License for the specific language governing permissions and */
22/* limitations under the License. */
23/* */
24/* You should have received a copy of the Apache-2.0 license */
25/* along with GCG; see the file LICENSE. If not visit gcg.or.rwth-aachen.de.*/
26/* */
27/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
28
29/**@file pub_decomp.h
30 * @ingroup PUBLICCOREAPI
31 * @ingroup DATASTRUCTURES
32 * @brief public methods for working with priority queues
33 * @author Jonas Witt
34 */
35
36/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
37#ifndef GCG_PUB_GCGPQUEUE_H__
38#define GCG_PUB_GCGPQUEUE_H__
39
40
41#include "scip/type_scip.h"
42#include "scip/type_retcode.h"
43#include "scip/type_var.h"
44#include "scip/type_cons.h"
45#include "scip/type_misc.h"
46#include "gcg/type_locks.h"
47#include "gcg/def.h"
48
49#ifdef __cplusplus
50extern "C" {
51#endif
52
53/*
54 * Priority Queue
55 */
56
57/**@defgroup PriorityQueue Priority Queue
58 * @ingroup DATASTRUCTURES
59 * @{
60 */
61
62/** creates priority queue */
65 SCIP* scip, /** SCIP data structure */
66 GCG_PQUEUE** pqueue, /**< pointer to a priority queue */
67 int initsize, /**< initial number of available element slots */
68 SCIP_DECL_SORTPTRCOMP((*ptrcomp)), /**< data element comparator */
69 GCG_LOCK* memorylock /**< memory lock */
70 );
71
72/** frees priority queue, but not the data elements themselves */
74void GCGpqueueFree(
75 GCG_PQUEUE** pqueue /**< pointer to a priority queue */
76 );
77
78/** clears the priority queue, but doesn't free the data elements themselves */
81 GCG_PQUEUE* pqueue /**< priority queue */
82 );
83
84/** inserts element into priority queue */
87 GCG_PQUEUE* pqueue, /**< priority queue */
88 void* elem /**< element to be inserted */
89 );
90
91/** removes and returns best element from the priority queue */
93void* GCGpqueueRemove(
94 GCG_PQUEUE* pqueue /**< priority queue */
95 );
96
97/** resorts priority queue after changing the key values */
100 GCG_PQUEUE* pqueue /**< priority queue */
101 );
102
103/** set the comperator of the priority queue */
106 GCG_PQUEUE* pqueue, /**< priority queue */
107 SCIP_DECL_SORTPTRCOMP((*ptrcomp)) /**< data element comparator */
108 );
109
110/**< delete item at position pos and insert last item at this position and resort pqueue */
113 GCG_PQUEUE* pqueue, /**< priority queue */
114 int pos, /**< position of item that should be deleted */
115 void** elem /**< pointer to store element that was deleted from pqueue */
116);
117
118/** returns the best element of the queue without removing it */
120void* GCGpqueueFirst(
121 GCG_PQUEUE* pqueue /**< priority queue */
122 );
123
124/** returns the number of elements in the queue */
127 GCG_PQUEUE* pqueue /**< priority queue */
128 );
129
130/** returns the elements of the queue; changing the returned array may destroy the queue's ordering! */
132void** GCGpqueueElems(
133 GCG_PQUEUE* pqueue /**< priority queue */
134 );
135
136/**@} */
137
138
139#ifdef __cplusplus
140}
141#endif
142#endif
static SCIP_DECL_SORTPTRCOMP(ptrilocomp)
common defines and data types used in all packages of GCG
#define GCG_EXPORT
Definition: def.h:59
GCG_EXPORT int GCGpqueueNElems(GCG_PQUEUE *pqueue)
Definition: gcgpqueue.c:337
GCG_EXPORT SCIP_RETCODE GCGpqueueDelete(GCG_PQUEUE *pqueue, int pos, void **elem)
Definition: gcgpqueue.c:284
GCG_EXPORT void * GCGpqueueRemove(GCG_PQUEUE *pqueue)
Definition: gcgpqueue.c:203
GCG_EXPORT void ** GCGpqueueElems(GCG_PQUEUE *pqueue)
Definition: gcgpqueue.c:348
GCG_EXPORT SCIP_RETCODE GCGpqueueInsert(GCG_PQUEUE *pqueue, void *elem)
Definition: gcgpqueue.c:173
GCG_EXPORT SCIP_RETCODE GCGpqueueCreate(SCIP *scip, GCG_PQUEUE **pqueue, int initsize, SCIP_DECL_SORTPTRCOMP((*ptrcomp)), GCG_LOCK *memorylock)
Definition: gcgpqueue.c:124
GCG_EXPORT void * GCGpqueueFirst(GCG_PQUEUE *pqueue)
Definition: gcgpqueue.c:323
GCG_EXPORT void GCGpqueueClear(GCG_PQUEUE *pqueue)
Definition: gcgpqueue.c:163
GCG_EXPORT SCIP_RETCODE GCGpqueueResort(GCG_PQUEUE *pqueue)
Definition: gcgpqueue.c:244
GCG_EXPORT void GCGpqueueFree(GCG_PQUEUE **pqueue)
Definition: gcgpqueue.c:152
GCG_EXPORT SCIP_RETCODE GCGpqueueSetComperator(GCG_PQUEUE *pqueue, SCIP_DECL_SORTPTRCOMP((*ptrcomp)))
Definition: gcgpqueue.c:271
priority queue data structure
type definitions for locks data structure
#define GCG_LOCK
Definition: type_locks.h:64
enum SCIP_Retcode SCIP_RETCODE