Scippy

GCG

Branch-and-Price & Column Generation for Everyone

struct_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 struct_gcgpqueue.h
30 * @ingroup DATASTRUCTURES
31 * @brief data structure for priority queue
32 * @author Jonas Witt
33 */
34
35/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
36
37#ifndef GCG_STRUCT_GCGPQUEUE_H_
38#define GCG_STRUCT_GCGPQUEUE_H_
39
40#include "scip/def.h"
41#include "scip/type_misc.h"
42#include "scip/scip.h"
43
44#include "gcg/type_gcgpqueue.h"
45#include "gcg/type_locks.h"
46
47#ifdef __cplusplus
48extern "C" {
49#endif
50
51/** @brief priority queue data structure
52 *
53 * Elements are stored in an array, which grows dynamically in size as new elements are added to the queue.
54 * The ordering is done through a pointer comparison function.
55 * The array is organized as follows. The root element (that is the "best" element $r$ with $r <= x$ for all $x$)
56 * is stored in position 0. The children of an element at position $p$ are stored at positions $q_1 = 2*p+1$ and
57 * $q_2 = 2*p+2$. That means, the parent of the element at position $q$ is at position $p = (q-1)/2$.
58 * At any time, the condition holds that $p <= q$ for each parent $p$ and its children $q$.
59 * Insertion and removal of single elements needs time $O(log n)$.
60 */
62{
63 SCIP* scip; /**< SCIP data structure */
64 SCIP_DECL_SORTPTRCOMP((*ptrcomp)); /**< compares two data elements */
65 void** slots; /**< array of element slots */
66 int len; /**< number of used element slots */
67 int size; /**< total number of available element slots */
68#ifdef _OPENMP
69 GCG_LOCK* memorylock; /**< memory lock */
70#endif
71};
72
73#ifdef __cplusplus
74}
75#endif
76
77#endif /* STRUCT_GCGPQUEUE_H_ */
priority queue data structure
SCIP_DECL_SORTPTRCOMP((*ptrcomp))
type definitions for priority queue
type definitions for locks data structure
#define GCG_LOCK
Definition: type_locks.h:64