1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* This file is part of the program */
/* GCG --- Generic Column Generation */
/* a Dantzig-Wolfe decomposition based extension */
/* of the branch-cut-and-price framework */
/* SCIP --- Solving Constraint Integer Programs */
/* */
/* Copyright (C) 2010-2022 Operations Research, RWTH Aachen University */
/* Zuse Institute Berlin (ZIB) */
/* */
/* This program is free software; you can redistribute it and/or */
/* modify it under the terms of the GNU Lesser General Public License */
/* as published by the Free Software Foundation; either version 3 */
/* of the License, or (at your option) any later version. */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU Lesser General Public License for more details. */
/* */
/* You should have received a copy of the GNU Lesser General Public License */
/* along with this program; if not, write to the Free Software */
/* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.*/
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/**@file pub_decomp.h
* @ingroup PUBLICCOREAPI
* @ingroup DATASTRUCTURES
* @brief public methods for working with priority queues
* @author Jonas Witt
*/
/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
#ifndef GCG_PUB_GCGPQUEUE_H__
#define GCG_PUB_GCGPQUEUE_H__
#include "scip/type_scip.h"
#include "scip/type_retcode.h"
#include "scip/type_var.h"
#include "scip/type_cons.h"
#include "scip/type_misc.h"
#ifdef __cplusplus
extern "C" {
#endif
/*
* Priority Queue
*/
/**@defgroup PriorityQueue Priority Queue
* @ingroup DATASTRUCTURES
* @{
*/
/** creates priority queue */
SCIP_EXPORT
SCIP_RETCODE GCGpqueueCreate(
SCIP* scip, /** SCIP data structure */
GCG_PQUEUE** pqueue, /**< pointer to a priority queue */
int initsize, /**< initial number of available element slots */
SCIP_DECL_SORTPTRCOMP((*ptrcomp)) /**< data element comparator */
);
/** frees priority queue, but not the data elements themselves */
SCIP_EXPORT
void GCGpqueueFree(
GCG_PQUEUE** pqueue /**< pointer to a priority queue */
);
/** clears the priority queue, but doesn't free the data elements themselves */
SCIP_EXPORT
void GCGpqueueClear(
GCG_PQUEUE* pqueue /**< priority queue */
);
/** inserts element into priority queue */
SCIP_EXPORT
SCIP_RETCODE GCGpqueueInsert(
GCG_PQUEUE* pqueue, /**< priority queue */
void* elem /**< element to be inserted */
);
/** removes and returns best element from the priority queue */
SCIP_EXPORT
void* GCGpqueueRemove(
GCG_PQUEUE* pqueue /**< priority queue */
);
/** resorts priority queue after changing the key values */
SCIP_EXPORT
SCIP_RETCODE GCGpqueueResort(
GCG_PQUEUE* pqueue /**< priority queue */
);
/** set the comperator of the priority queue */
SCIP_RETCODE GCGpqueueSetComperator(
GCG_PQUEUE* pqueue, /**< priority queue */
SCIP_DECL_SORTPTRCOMP((*ptrcomp)) /**< data element comparator */
);
/**< delete item at position pos and insert last item at this position and resort pqueue */
extern
SCIP_RETCODE GCGpqueueDelete(
GCG_PQUEUE* pqueue, /**< priority queue */
int pos, /**< position of item that should be deleted */
void** elem /**< pointer to store element that was deleted from pqueue */
);
/** returns the best element of the queue without removing it */
SCIP_EXPORT
void* GCGpqueueFirst(
GCG_PQUEUE* pqueue /**< priority queue */
);
/** returns the number of elements in the queue */
SCIP_EXPORT
int GCGpqueueNElems(
GCG_PQUEUE* pqueue /**< priority queue */
);
/** returns the elements of the queue; changing the returned array may destroy the queue's ordering! */
SCIP_EXPORT
void** GCGpqueueElems(
GCG_PQUEUE* pqueue /**< priority queue */
);
/**@} */
#ifdef __cplusplus
}
#endif
#endif