Scippy

SCIP

Solving Constraint Integer Programs

pub_dcmp.h
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /* */
3 /* This file is part of the program and library */
4 /* SCIP --- Solving Constraint Integer Programs */
5 /* */
6 /* Copyright (c) 2002-2023 Zuse Institute Berlin (ZIB) */
7 /* */
8 /* Licensed under the Apache License, Version 2.0 (the "License"); */
9 /* you may not use this file except in compliance with the License. */
10 /* You may obtain a copy of the License at */
11 /* */
12 /* http://www.apache.org/licenses/LICENSE-2.0 */
13 /* */
14 /* Unless required by applicable law or agreed to in writing, software */
15 /* distributed under the License is distributed on an "AS IS" BASIS, */
16 /* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
17 /* See the License for the specific language governing permissions and */
18 /* limitations under the License. */
19 /* */
20 /* You should have received a copy of the Apache-2.0 license */
21 /* along with SCIP; see the file LICENSE. If not visit scipopt.org. */
22 /* */
23 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
24 
25 /**@file pub_dcmp.h
26  * @ingroup DecompMethods
27  * @brief public methods for decompositions
28  * @author Gregor Hendel
29  */
30 
31 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
32 
33 #ifndef SCIP_PUB_DECOMP_H_
34 #define SCIP_PUB_DECOMP_H_
35 
36 
37 #include "blockmemshell/memory.h"
38 #include "scip/type_cons.h"
39 #include "scip/type_dcmp.h"
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 
45 /**@addtogroup DecompMethods
46  *
47  * @{
48  */
49 
50 /** creates a decomposition */
51 SCIP_EXPORT
53  SCIP_DECOMP** decomp, /**< pointer to store the decomposition data structure */
54  BMS_BLKMEM* blkmem, /**< block memory */
55  int nblocks, /**< the number of blocks (without the linking block) */
56  SCIP_Bool original, /**< is this a decomposition in the original (TRUE) or transformed space? */
57  SCIP_Bool benderslabels /**< should the variables be labeled for the application of Benders' decomposition */
58  );
59 
60 /** frees a decomposition */
61 SCIP_EXPORT
62 void SCIPdecompFree(
63  SCIP_DECOMP** decomp, /**< pointer to store the decomposition data structure */
64  BMS_BLKMEM* blkmem /**< block memory */
65  );
66 
67 /** returns TRUE if decomposition is in the original space */
68 SCIP_EXPORT
70  SCIP_DECOMP* decomp /**< decomposition data structure */
71  );
72 
73 /** sets the parameter that indicates whether the variables must be labeled for the application of Benders'
74  * decomposition
75  */
76 SCIP_EXPORT
78  SCIP_DECOMP* decomp, /**< decomposition data structure */
79  SCIP_Bool benderslabels /**< whether Benders' variable labels should be used */
80  );
81 
82 /** returns TRUE if the variables must be labeled for the application of Benders' decomposition */
83 SCIP_EXPORT
85  SCIP_DECOMP* decomp /**< decomposition data structure */
86  );
87 
88 /** gets number of blocks of this decomposition */
89 SCIP_EXPORT
91  SCIP_DECOMP* decomp /**< decomposition data structure */
92  );
93 
94 /** gets area score of this decomposition */
95 SCIP_EXPORT
97  SCIP_DECOMP* decomp /**< decomposition data structure */
98  );
99 
100 /** gets modularity of this decomposition */
101 SCIP_EXPORT
103  SCIP_DECOMP* decomp /**< decomposition data structure */
104  );
105 
106 /** gets variable size for each block, sorted by increasing block label
107  *
108  * To get all variable sizes, set nlabels to SCIPdecompGetNBlocks() + 1.
109  * The first entry corresponds to the number of border variables.
110  *
111  * @note Ensure that SCIPcomputeDecompStats() has been called before.
112  * If the decomposition was read from a file, this was done automatically.
113  */
114 SCIP_EXPORT
116  SCIP_DECOMP* decomp, /**< decomposition data structure */
117  int* varssize, /**< array to store variable sizes of blocks*/
118  int nblocks /**< length of variable sizes array */
119  );
120 
121 /** gets constraint size for each block, sorted by increasing block label
122  *
123  * To get all constraint sizes, set nlabels to SCIPdecompGetNBlocks() + 1.
124  * The first entry corresponds to the number of border constraints.
125  *
126  * @note Ensure that SCIPcomputeDecompStats() has been called before.
127  * If the decomposition was read from a file, this was done automatically.
128  */
129 SCIP_EXPORT
131  SCIP_DECOMP* decomp, /**< decomposition data structure */
132  int* consssize, /**< array to store constraint sizes of blocks*/
133  int nblocks /**< length of constraint sizes array */
134  );
135 
136 /** gets number of border variables of this decomposition
137  *
138  * @note Ensure that SCIPcomputeDecompStats() has been called before.
139  * If the decomposition was read from a file, this was done automatically.
140  */
141 SCIP_EXPORT
143  SCIP_DECOMP* decomp /**< decomposition data structure */
144  );
145 
146 /** gets number of border constraints of this decomposition
147  *
148  * @note Ensure that SCIPcomputeDecompStats() has been called before.
149  * If the decomposition was read from a file, this was done automatically.
150  */
151 SCIP_EXPORT
153  SCIP_DECOMP* decomp /**< decomposition data structure */
154  );
155 
156 /** gets number of edges in the block-decomposition graph of this decomposition */
157 SCIP_EXPORT
159  SCIP_DECOMP* decomp /**< decomposition data structure */
160  );
161 
162 /** gets number of connected components in the block-decomposition graph of this decomposition */
163 SCIP_EXPORT
165  SCIP_DECOMP* decomp /**< decomposition data structure */
166  );
167 
168 /** gets number of articulation points in the block-decomposition graph of this decomposition */
169 SCIP_EXPORT
171  SCIP_DECOMP* decomp /**< decomposition data structure */
172  );
173 
174 /** gets the maximum degree of the block-decomposition graph of this decomposition */
175 SCIP_EXPORT
177  SCIP_DECOMP* decomp /**< decomposition data structure */
178  );
179 
180 /** gets the minimum degree of the block-decomposition graph of this decomposition */
181 SCIP_EXPORT
183  SCIP_DECOMP* decomp /**< decomposition data structure */
184  );
185 
186 /** sets labels for an array of variables */
187 SCIP_EXPORT
189  SCIP_DECOMP* decomp, /**< decomposition data structure */
190  SCIP_VAR** vars, /**< array of variables */
191  int* labels, /**< array of labels, one per variable */
192  int nvars /**< length of variables array */
193  );
194 
195 /** queries labels for an array of variables */
196 SCIP_EXPORT
198  SCIP_DECOMP* decomp, /**< decomposition data structure */
199  SCIP_VAR** vars, /**< array of variables */
200  int* labels, /**< buffer to store labels, one per variable */
201  int nvars /**< length of variables array */
202  );
203 
204 /** sets labels for an array of constraints */
205 SCIP_EXPORT
207  SCIP_DECOMP* decomp, /**< decomposition data structure */
208  SCIP_CONS** conss, /**< array of constraints */
209  int* labels, /**< array of labels, one per constraint */
210  int nconss /**< length of constraints array */
211  );
212 
213 /** queries labels for an array of constraints */
214 SCIP_EXPORT
216  SCIP_DECOMP* decomp, /**< decomposition data structure */
217  SCIP_CONS** conss, /**< array of constraints */
218  int* labels, /**< array of labels, one per constraint */
219  int nconss /**< length of constraints array */
220  );
221 
222 /** clears the corresponding labeling (constraints, variables, or both) of this decomposition */
223 SCIP_EXPORT
225  SCIP_DECOMP* decomp, /**< decomposition data structure */
226  SCIP_Bool clearvarlabels, /**< should the variable labels be cleared? */
227  SCIP_Bool clearconslabels /**< should the constraint labels be cleared? */
228  );
229 
230 /** prints decomposition statistics into string buffer */
231 SCIP_EXPORT
233  SCIP_DECOMP* decomp, /**< decomposition data structure */
234  char* strbuf /**< string buffer storage */
235  );
236 
237 /** @} */
238 
239 #ifdef __cplusplus
240 }
241 #endif
242 
243 #endif
void SCIPdecompGetConsLabels(SCIP_DECOMP *decomp, SCIP_CONS **conss, int *labels, int nconss)
Definition: dcmp.c:197
int SCIPdecompGetNBorderVars(SCIP_DECOMP *decomp)
Definition: dcmp.c:378
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:63
int SCIPdecompGetBlockGraphMaxDegree(SCIP_DECOMP *decomp)
Definition: dcmp.c:434
void SCIPdecompGetVarsLabels(SCIP_DECOMP *decomp, SCIP_VAR **vars, int *labels, int nvars)
Definition: dcmp.c:148
SCIP_RETCODE SCIPdecompSetVarsLabels(SCIP_DECOMP *decomp, SCIP_VAR **vars, int *labels, int nvars)
Definition: dcmp.c:123
SCIP_Bool SCIPdecompIsOriginal(SCIP_DECOMP *decomp)
Definition: dcmp.c:245
SCIP_RETCODE SCIPdecompGetVarsSize(SCIP_DECOMP *decomp, int *varssize, int nblocks)
Definition: dcmp.c:315
int SCIPdecompGetNBlockGraphComponents(SCIP_DECOMP *decomp)
Definition: dcmp.c:414
int SCIPdecompGetNBlocks(SCIP_DECOMP *decomp)
Definition: dcmp.c:278
SCIP_RETCODE SCIPdecompSetConsLabels(SCIP_DECOMP *decomp, SCIP_CONS **conss, int *labels, int nconss)
Definition: dcmp.c:172
#define SCIP_Bool
Definition: def.h:93
SCIP_RETCODE SCIPdecompClear(SCIP_DECOMP *decomp, SCIP_Bool clearvarlabels, SCIP_Bool clearconslabels)
Definition: dcmp.c:223
SCIP_Real SCIPdecompGetAreaScore(SCIP_DECOMP *decomp)
Definition: dcmp.c:288
int SCIPdecompGetNBlockGraphEdges(SCIP_DECOMP *decomp)
Definition: dcmp.c:404
SCIP_RETCODE SCIPdecompCreate(SCIP_DECOMP **decomp, BMS_BLKMEM *blkmem, int nblocks, SCIP_Bool original, SCIP_Bool benderslabels)
Definition: dcmp.c:56
int SCIPdecompGetBlockGraphMinDegree(SCIP_DECOMP *decomp)
Definition: dcmp.c:444
char * SCIPdecompPrintStats(SCIP_DECOMP *decomp, char *strbuf)
Definition: dcmp.c:454
SCIP_Real SCIPdecompGetModularity(SCIP_DECOMP *decomp)
Definition: dcmp.c:298
#define SCIP_Real
Definition: def.h:186
type definitions for decompositions and the decomposition store
void SCIPdecompSetUseBendersLabels(SCIP_DECOMP *decomp, SCIP_Bool benderslabels)
Definition: dcmp.c:257
void SCIPdecompFree(SCIP_DECOMP **decomp, BMS_BLKMEM *blkmem)
Definition: dcmp.c:98
SCIP_Bool SCIPdecompUseBendersLabels(SCIP_DECOMP *decomp)
Definition: dcmp.c:268
SCIP_RETCODE SCIPdecompGetConssSize(SCIP_DECOMP *decomp, int *consssize, int nblocks)
Definition: dcmp.c:348
struct BMS_BlkMem BMS_BLKMEM
Definition: memory.h:439
int SCIPdecompGetNBorderConss(SCIP_DECOMP *decomp)
Definition: dcmp.c:393
int SCIPdecompGetNBlockGraphArticulations(SCIP_DECOMP *decomp)
Definition: dcmp.c:424
type definitions for constraints and constraint handlers
memory allocation routines