Scippy

GCG

Branch-and-Price & Column Generation for Everyone

gcgsort.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 gcgsort.h
30 * @brief sorting functions, adapted from SCIP's sorttpl to include userdata
31 * @author Tobias Oelschlegel
32 **/
33
34/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
35
36#ifndef GCG_SORT_H__
37#define GCG_SORT_H__
38
39#include "gcg/def.h"
40#include "scip/scip.h"
41
42#ifdef __cplusplus
43extern "C" {
44#endif
45
46/** compares two element indices
47 * result:
48 * < 0: ind1 comes before (is better than) ind2
49 * = 0: both indices have the same value
50 * > 0: ind2 comes after (is worse than) ind2
51 **/
52#define GCG_DECL_SORTINDCOMP(x) int x (void* userdata, void* dataptr, int ind1, int ind2)
53
54/** compares two data element pointers
55 * result:
56 * < 0: elem1 comes before (is better than) elem2
57 * = 0: both elements have the same value
58 * > 0: elem2 comes after (is worse than) elem2
59 **/
60#define GCG_DECL_SORTPTRCOMP(x) int x (void* userdata, void* elem1, void* elem2)
61
64 void** ptrarray, /**< pointer array to be sorted */
65 GCG_DECL_SORTPTRCOMP((*ptrcomp)), /**< data element comparator */
66 void* userdata, /**< userdata that is supplied to the comparator function */
67 int len /**< length of array */
68 );
69
70/** sort of two joint arrays of pointers/pointers, sorted by first array in non-decreasing order */
73 void** ptrarray1, /**< first pointer array to be sorted */
74 void** ptrarray2, /**< second pointer array to be permuted in the same way */
75 GCG_DECL_SORTPTRCOMP((*ptrcomp)), /**< data element comparator */
76 void* userdata, /**< userdata that is supplied to the comparator function */
77 int len /**< length of arrays */
78 );
79
80#ifdef __cplusplus
81}
82#endif
83
84#endif
common defines and data types used in all packages of GCG
#define GCG_EXPORT
Definition: def.h:59
#define GCG_DECL_SORTPTRCOMP(x)
Definition: gcgsort.h:60
GCG_EXPORT void GCGsortPtrPtr(void **ptrarray1, void **ptrarray2, GCG_DECL_SORTPTRCOMP((*ptrcomp)), void *userdata, int len)
GCG_EXPORT void GCGsortPtr(void **ptrarray, GCG_DECL_SORTPTRCOMP((*ptrcomp)), void *userdata, int len)