Scippy

SCIP

Solving Constraint Integer Programs

dcmp.c
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-2021 Konrad-Zuse-Zentrum */
7 /* fuer Informationstechnik Berlin */
8 /* */
9 /* SCIP is distributed under the terms of the ZIB Academic License. */
10 /* */
11 /* You should have received a copy of the ZIB Academic License */
12 /* along with SCIP; see the file COPYING. If not email to scip@zib.de. */
13 /* */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file dcmp.c
17  * @ingroup OTHER_CFILES
18  * @brief internal methods for decompositions and the decomposition store
19  * @author Gregor Hendel
20  */
21 
22 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
23 
24 #include <assert.h>
25 #include "scip/dcmp.h"
26 #include "scip/mem.h"
27 #include "scip/pub_cons.h"
28 #include "scip/pub_dcmp.h"
29 #include "scip/pub_misc.h"
30 #include "scip/pub_var.h"
31 #include "scip/scip_cons.h"
32 #include "scip/scip_dcmp.h"
33 #include "scip/scip_mem.h"
34 #include "scip/scip_prob.h"
35 #include "scip/scip_var.h"
36 #include "scip/scip_general.h"
37 #include "scip/scip_var.h"
39 #include "scip/scip_message.h"
40 #include "scip/struct_dcmp.h"
41 #include "scip/struct_scip.h"
42 
43 /* create and free a decomposition */
44 #define INIT_MAP_SIZE 2000
45 
46 /** creates a decomposition */
48  SCIP_DECOMP** decomp, /**< pointer to store the decomposition data structure */
49  BMS_BLKMEM* blkmem, /**< block memory */
50  int nblocks, /**< the number of blocks (without the linking block) */
51  SCIP_Bool original, /**< is this a decomposition in the original (TRUE) or transformed space? */
52  SCIP_Bool benderslabels /**< should the variables be labeled for the application of Benders' decomposition */
53  )
54 {
55  int memsize;
56 
57  assert(decomp != NULL);
58  assert(blkmem != NULL);
59 
60  SCIP_ALLOC( BMSallocBlockMemory(blkmem, decomp) );
61  SCIP_CALL( SCIPhashmapCreate(&(*decomp)->var2block, blkmem, INIT_MAP_SIZE) );
62  SCIP_CALL( SCIPhashmapCreate(&(*decomp)->cons2block, blkmem, INIT_MAP_SIZE) );
63 
64  /* we allocate one extra slot for the linking block */
65  memsize = nblocks + 1;
66  SCIP_ALLOC( BMSallocBlockMemoryArray(blkmem, &(*decomp)->varssize, memsize) );
67  SCIP_ALLOC( BMSallocBlockMemoryArray(blkmem, &(*decomp)->consssize, memsize) );
68  SCIP_ALLOC( BMSallocBlockMemoryArray(blkmem, &(*decomp)->labels, memsize) );
69 
70  (*decomp)->memsize = memsize;
71  (*decomp)->nblocks = nblocks;
72  (*decomp)->modularity = -1.0;
73  (*decomp)->idxsmallestblock = -1;
74  (*decomp)->idxlargestblock = -1;
75  (*decomp)->original = original;
76  (*decomp)->benderslabels = benderslabels;
77  (*decomp)->areascore = -1.0;
78  (*decomp)->nedges = 0;
79  (*decomp)->mindegree = 0;
80  (*decomp)->maxdegree = 0;
81  (*decomp)->ncomponents = 0;
82  (*decomp)->narticulations = 0;
83  (*decomp)->statscomplete = FALSE;
84 
85  return SCIP_OKAY;
86 }
87 
88 /** free a decomposition */
90  SCIP_DECOMP** decomp, /**< pointer to free the decomposition data structure */
91  BMS_BLKMEM* blkmem /**< block memory */
92  )
93 {
94  assert(decomp != NULL);
95  assert(blkmem != NULL);
96 
97  if( *decomp == NULL )
98  return;
99 
100  assert((*decomp)->var2block != NULL);
101  SCIPhashmapFree(&(*decomp)->var2block);
102  SCIPhashmapFree(&(*decomp)->cons2block);
103 
104  BMSfreeBlockMemoryArray(blkmem, &(*decomp)->varssize, (*decomp)->memsize);
105  BMSfreeBlockMemoryArray(blkmem, &(*decomp)->consssize, (*decomp)->memsize);
106  BMSfreeBlockMemoryArray(blkmem, &(*decomp)->labels, (*decomp)->memsize);
107 
108  BMSfreeBlockMemory(blkmem, decomp);
109 }
110 
111 /* getter and setter for variable labels */
112 
113 /** sets labels for an array of variables */
115  SCIP_DECOMP* decomp, /**< decomposition data structure */
116  SCIP_VAR** vars, /**< array of variables */
117  int* labels, /**< array of labels, one per variable */
118  int nvars /**< length of variables array */
119  )
120 {
121  int i;
122 
123  assert(decomp != NULL);
124  assert(vars != NULL);
125  assert(labels != NULL);
126 
127  /* store each label in hash map */
128  for( i = 0; i < nvars; ++i )
129  {
130  assert(labels[i] == SCIP_DECOMP_LINKVAR || labels[i] >= 0);
131 
132  SCIP_CALL( SCIPhashmapSetImageInt(decomp->var2block, (void *)vars[i], labels[i]) );
133  }
134 
135  return SCIP_OKAY;
136 }
137 
138 /** queries labels for an array of variables */
140  SCIP_DECOMP* decomp, /**< decomposition data structure */
141  SCIP_VAR** vars, /**< array of variables */
142  int* labels, /**< buffer to store labels, one per variable */
143  int nvars /**< length of variables array */
144  )
145 {
146  int i;
147 
148  assert(decomp != NULL);
149  assert(vars != NULL);
150  assert(labels != NULL);
151 
152  /* store variable labels in buffer array */
153  for( i = 0; i < nvars; ++i )
154  {
155  if( SCIPhashmapExists(decomp->var2block, (void *)vars[i]) )
156  labels[i] = SCIPhashmapGetImageInt(decomp->var2block, (void *)vars[i]);
157  else
158  labels[i] = SCIP_DECOMP_LINKVAR;
159  }
160 }
161 
162 /** sets labels for an array of constraints */
164  SCIP_DECOMP* decomp, /**< decomposition data structure */
165  SCIP_CONS** conss, /**< array of constraints */
166  int* labels, /**< array of labels, one per constraint */
167  int nconss /**< length of constraints array */
168  )
169 {
170  int i;
171 
172  assert(decomp != NULL);
173  assert(conss != NULL);
174  assert(labels != NULL);
175 
176  /* store each label in hash map */
177  for( i = 0; i < nconss; ++i )
178  {
179  assert(labels[i] == SCIP_DECOMP_LINKCONS || labels[i] >= 0);
180 
181  SCIP_CALL( SCIPhashmapSetImageInt(decomp->cons2block, (void *)conss[i], labels[i]) );
182  }
183 
184  return SCIP_OKAY;
185 }
186 
187 /** queries labels for an array of constraints */
189  SCIP_DECOMP* decomp, /**< decomposition data structure */
190  SCIP_CONS** conss, /**< array of constraints */
191  int* labels, /**< array of labels, one per constraint */
192  int nconss /**< length of constraints array */
193  )
194 {
195  int i;
196 
197  assert(decomp != NULL);
198  assert(conss != NULL);
199  assert(labels != NULL);
200 
201  /* store variable labels in buffer array */
202  for( i = 0; i < nconss; ++i )
203  {
204  if( SCIPhashmapExists(decomp->cons2block, (void *)conss[i]) )
205  {
206  labels[i] = SCIPhashmapGetImageInt(decomp->cons2block, (void *)conss[i]);
207  }
208  else
209  labels[i] = SCIP_DECOMP_LINKCONS;
210  }
211 }
212 
213 /** clears the corresponding labeling (constraints, variables, or both) of this decomposition */
215  SCIP_DECOMP* decomp, /**< decomposition data structure */
216  SCIP_Bool clearvarlabels, /**< should the variable labels be cleared? */
217  SCIP_Bool clearconslabels /**< should the constraint labels be cleared? */
218  )
219 {
220  assert(decomp != NULL);
221 
222  if( clearvarlabels )
223  {
225  }
226 
227  if( clearconslabels )
228  {
230  }
231 
232  return SCIP_OKAY;
233 }
234 
235 /** returns TRUE if decomposition is in the original space */
237  SCIP_DECOMP* decomp /**< decomposition data structure */
238  )
239 {
240  assert(decomp != NULL);
241 
242  return decomp->original;
243 }
244 
245 /** sets the parameter that indicates whether the variables must be labeled for the application of Benders'
246  * decomposition
247  */
249  SCIP_DECOMP* decomp, /**< decomposition data structure */
250  SCIP_Bool benderslabels /**< whether Benders' variable labels should be used */
251  )
252 {
253  assert(decomp != NULL);
254 
255  decomp->benderslabels = benderslabels;
256 }
257 
258 /** returns TRUE if the variables must be labeled for the application of Benders' decomposition */
260  SCIP_DECOMP* decomp /**< decomposition data structure */
261  )
262 {
263  assert(decomp != NULL);
264 
265  return decomp->benderslabels;
266 }
267 
268 /** gets number of blocks of this decomposition */
270  SCIP_DECOMP* decomp /**< decomposition data structure */
271  )
272 {
273  assert(decomp != NULL);
274 
275  return decomp->nblocks;
276 }
277 
278 /** gets area score of this decomposition */
280  SCIP_DECOMP* decomp /**< decomposition data structure */
281  )
282 {
283  assert(decomp != NULL);
284 
285  return decomp->areascore;
286 }
287 
288 /** gets modularity of this decomposition */
290  SCIP_DECOMP* decomp /**< decomposition data structure */
291  )
292 {
293  assert(decomp != NULL);
294 
295  return decomp->modularity;
296 }
297 
298 /** gets number of edges in the block-decomposition graph of this decomposition */
300  SCIP_DECOMP* decomp /**< decomposition data structure */
301  )
302 {
303  assert(decomp != NULL);
304 
305  return decomp->nedges;
306 }
307 
308 /** gets number of connected components in the block-decomposition graph of this decomposition */
310  SCIP_DECOMP* decomp /**< decomposition data structure */
311  )
312 {
313  assert(decomp != NULL);
314 
315  return decomp->ncomponents;
316 }
317 
318 /** gets number of articulation points in the block-decomposition graph of this decomposition */
320  SCIP_DECOMP* decomp /**< decomposition data structure */
321  )
322 {
323  assert(decomp != NULL);
324 
325  return decomp->narticulations;
326 }
327 
328 /** gets the maximum degree of the block-decomposition graph of this decomposition */
330  SCIP_DECOMP* decomp /**< decomposition data structure */
331  )
332 {
333  assert(decomp != NULL);
334 
335  return decomp->maxdegree;
336 }
337 
338 /** gets the minimum degree of the block-decomposition graph of this decomposition */
340  SCIP_DECOMP* decomp /**< decomposition data structure */
341  )
342 {
343  assert(decomp != NULL);
344 
345  return decomp->mindegree;
346 }
347 
348 /** prints decomposition statistics into string buffer */
350  SCIP_DECOMP* decomp, /**< decomposition data structure */
351  char* strbuf /**< string buffer storage */
352  )
353 {
354  char* ptr;
355 
356  assert(decomp != NULL);
357  assert(strbuf != NULL);
358 
359  ptr = strbuf;
360 
361  ptr += SCIPsnprintf(ptr, SCIP_MAXSTRLEN,
362  "Decomposition with %d blocks.\n",
363  decomp->nblocks);
364  ptr += SCIPsnprintf(ptr, SCIP_MAXSTRLEN,
365  "Largest block: Block %d with %d constraints and %d variables\n",
366  decomp->nblocks == 0 ? -1 : decomp->labels[decomp->idxlargestblock],
367  decomp->nblocks == 0 ? 0 : decomp->consssize[decomp->idxlargestblock],
368  decomp->nblocks == 0 ? 0 : decomp->varssize[decomp->idxlargestblock]);
369  ptr += SCIPsnprintf(ptr, SCIP_MAXSTRLEN,
370  "Smallest block: Block %d with %d constraints and %d variables\n",
371  decomp->nblocks == 0 ? 0 : decomp->labels[decomp->idxsmallestblock],
372  decomp->nblocks == 0 ? 0 : decomp->consssize[decomp->idxsmallestblock],
373  decomp->nblocks == 0 ? 0 : decomp->varssize[decomp->idxsmallestblock]);
374  ptr += SCIPsnprintf(ptr, SCIP_MAXSTRLEN,
375  "Border has %d constraints and %d variables\n",
376  decomp->labels[0] == SCIP_DECOMP_LINKVAR ? decomp->consssize[0] : 0,
377  decomp->labels[0] == SCIP_DECOMP_LINKVAR ? decomp->varssize[0] : 0
378  );
379 
380  ptr += SCIPsnprintf(ptr, SCIP_MAXSTRLEN,
381  "Modularity: %.3f, Area Score: %.3f\n",
382  decomp->modularity, decomp->areascore);
383 
384  (void) SCIPsnprintf(ptr, SCIP_MAXSTRLEN,
385  "Constraint Block Graph: %d edges, %d articulation points, %d connected components, %d min., %d max. degree%s\n",
386  decomp->nedges, decomp->narticulations, decomp->ncomponents, decomp->mindegree, decomp->maxdegree,
387  decomp->statscomplete ? "" :
388  "(approximately: graph construction hit size limit)");
389 
390  return strbuf;
391 }
392 
393 /** creates a decomposition storage */
395  SCIP_DECOMPSTORE** decompstore, /**< pointer to store decomposition storage */
396  BMS_BLKMEM* blkmem, /**< block memory data structure */
397  int nslots /**< maximum number of decomposition slots in storage */
398  )
399 {
400  assert(decompstore != NULL);
401  assert(blkmem != NULL);
402  assert(nslots > 0);
403 
404  SCIP_ALLOC( BMSallocBlockMemory(blkmem, decompstore) );
405 
406  (*decompstore)->ndecomps = 0;
407  (*decompstore)->norigdecomps = 0;
408  (*decompstore)->decompssize = nslots;
409 
410  SCIP_ALLOC( BMSallocBlockMemoryArray(blkmem, &(*decompstore)->decomps, nslots) );
411  SCIP_ALLOC( BMSallocBlockMemoryArray(blkmem, &(*decompstore)->origdecomps, nslots) );
412 
413  return SCIP_OKAY;
414 }
415 
416 /** frees array of decompositions */
417 static
419  BMS_BLKMEM* blkmem, /**< block memory data structure */
420  SCIP_DECOMP** decomps, /**< decomposition array */
421  int* ndecomps /**< pointer for initial number of decompositions, will be set to 0 */
422  )
423 {
424  int d;
425 
426  assert(decomps != NULL);
427  assert(ndecomps != NULL);
428 
429  /* delete all remaining decompositions from this store */
430  for( d = 0; d < *ndecomps; ++d )
431  SCIPdecompFree(&decomps[d], blkmem);
432 
433  *ndecomps = 0;
434 }
435 
436 /** frees all decompositions in transformed space */
438  SCIP* scip /**< SCIP data structure */
439  )
440 {
441  SCIP_DECOMPSTORE* decompstore = scip->decompstore;
442 
443  assert(decompstore != NULL);
444 
445  freeDecompositions(SCIPblkmem(scip), decompstore->decomps, &decompstore->ndecomps);
446 }
447 
448 /** frees a decomposition storage */
450  SCIP_DECOMPSTORE** decompstore, /**< pointer to store decomposition storage */
451  BMS_BLKMEM* blkmem /**< block memory data structure */
452  )
453 {
454  assert(decompstore != NULL);
455 
456  if( *decompstore == NULL )
457  return;
458 
459  freeDecompositions(blkmem, (*decompstore)->origdecomps, &(*decompstore)->norigdecomps);
460  freeDecompositions(blkmem, (*decompstore)->decomps, &(*decompstore)->ndecomps);
461 
462  BMSfreeBlockMemoryArray(blkmem, &(*decompstore)->decomps, (*decompstore)->decompssize);
463  BMSfreeBlockMemoryArray(blkmem, &(*decompstore)->origdecomps, (*decompstore)->decompssize);
464 
465  BMSfreeBlockMemory(blkmem, decompstore);
466 }
467 
468 /** adds decomposition to storage */
470  SCIP_DECOMPSTORE* decompstore, /**< decomposition storage */
471  SCIP_DECOMP* decomp /**< decomposition to add */
472  )
473 {
474  SCIP_DECOMP** decomps;
475  int* ndecompsptr;
476 
477  assert(decompstore != NULL);
478  assert(decomp != NULL);
479 
480  /* distinguish between storage for original or transformed decompositions */
481  if( SCIPdecompIsOriginal(decomp) )
482  {
483  decomps = decompstore->origdecomps;
484  ndecompsptr = &decompstore->norigdecomps;
485  }
486  else
487  {
488  decomps = decompstore->decomps;
489  ndecompsptr = &decompstore->ndecomps;
490  }
491 
492  /* ensure that storage capacity is not exceeded */
493  if( *ndecompsptr == decompstore->decompssize )
494  {
495  SCIPerrorMessage("Error: Decomposition storage size exceeded, maximum is %d decompositions\n", decompstore->decompssize);
496  return SCIP_ERROR;
497  }
498 
499  decomps[(*ndecompsptr)++] = decomp;
500 
501  return SCIP_OKAY;
502 }
503 
504 /** gets decompositions from storage */
506  SCIP_DECOMPSTORE* decompstore /**< decomposition storage */
507  )
508 {
509  assert(decompstore != NULL);
510 
511  return decompstore->decomps;
512 }
513 
514 /** gets number of decompositions in storage */
516  SCIP_DECOMPSTORE* decompstore /**< decomposition storage */
517  )
518 {
519  assert(decompstore != NULL);
520  return decompstore->ndecomps;
521 }
522 
523 /** gets decompositions from storage */
525  SCIP_DECOMPSTORE* decompstore /**< decomposition storage */
526  )
527 {
528  assert(decompstore != NULL);
529 
530  return decompstore->origdecomps;
531 }
532 
533 /** gets number of decompositions in storage */
535  SCIP_DECOMPSTORE* decompstore /**< decomposition storage */
536  )
537 {
538  assert(decompstore != NULL);
539  return decompstore->norigdecomps;
540 }
541 
542 /** transforms all available original decompositions into transformed space */
544  SCIP* scip /**< SCIP data structure */
545  )
546 {
547  int d;
548  int v;
549  SCIP_DECOMPSTORE* decompstore;
550  SCIP_VAR** vars;
551  SCIP_VAR** origvars;
552  SCIP_VAR** varssorted;
553  SCIP_CONS** conss;
554  int nconss;
555  int nvars;
556  int nvarsoriginal;
557  int nvarsintroduced;
558  int* varslabels;
559  SCIP_Bool original = FALSE;
560 
561  assert(scip != NULL);
562  assert(scip->decompstore != NULL);
563 
564  decompstore = scip->decompstore;
565  assert(decompstore->ndecomps == 0);
566 
567  assert(SCIPgetStage(scip) >= SCIP_STAGE_PRESOLVED);
568 
569  nvars = SCIPgetNVars(scip);
570  vars = SCIPgetVars(scip);
571 
572  SCIP_CALL( SCIPallocBufferArray(scip, &varssorted, nvars) );
573  SCIP_CALL( SCIPallocBufferArray(scip, &origvars, nvars) );
574  SCIP_CALL( SCIPallocBufferArray(scip, &varslabels, nvars) );
575 
576  /* determine if variable has an original counterpart or not, and put it into varssorted array at the front or back */
577  nvarsoriginal = nvarsintroduced = 0;
578  for( v = 0; v < nvars; ++v )
579  {
580  SCIP_Real scalar;
581  SCIP_Real constant;
582  SCIP_VAR* origvar;
583 
584  origvar = vars[v];
585  scalar = 1.0;
586  constant = 0.0;
587  SCIP_CALL( SCIPvarGetOrigvarSum(&origvar, &scalar, &constant) );
588 
589  /* the variable has no original counterpart and is therefore put at the end of the array */
590  if( origvar == NULL )
591  {
592  varssorted[nvars - 1 - nvarsintroduced] = vars[v];
593  ++nvarsintroduced;
594  }
595  else
596  {
597  varssorted[nvarsoriginal] = vars[v];
598  origvars[nvarsoriginal] = origvar;
599  ++nvarsoriginal;
600  }
601 
602  assert(nvarsoriginal + nvarsintroduced <= nvars);
603  }
604 
605  conss = SCIPgetConss(scip);
606  nconss = SCIPgetNConss(scip);
607 
608  /* loop over available, original decompositions, transform and add them to the storage */
609  for( d = 0; d < decompstore->norigdecomps; ++d )
610  {
611  SCIP_DECOMP* origdecomp = decompstore->origdecomps[d];
612  SCIP_DECOMP* decomp;
613  char strbuf[SCIP_MAXSTRLEN];
614 
615  /* 1. query the decomposition labels of the original variables and set them for the transformed variables
616  * that have original counterparts
617  */
618  SCIP_CALL( SCIPcreateDecomp(scip, &decomp, SCIPdecompGetNBlocks(origdecomp), original, SCIPdecompUseBendersLabels(origdecomp)) );
619 
620  SCIPdecompGetVarsLabels(origdecomp, origvars, varslabels, nvarsoriginal);
621 
622  SCIP_CALL( SCIPdecompSetVarsLabels(decomp, varssorted, varslabels, nvarsoriginal) );
623 
624  /* 2. compute the constraint labels based on the preliminary variable labels */
625  SCIP_CALL( SCIPcomputeDecompConsLabels(scip, decomp, conss, nconss) );
626 
627  /* 3. remove the variable labels now that we have constraint labels */
628  SCIP_CALL( SCIPdecompClear(decomp, TRUE, FALSE) );
629 
630  /* 4. use the constraint labels for the final variable labeling */
631  SCIP_CALL( SCIPcomputeDecompVarsLabels(scip, decomp, conss, nconss) );
632 
633  SCIP_CALL( SCIPcomputeDecompStats(scip, decomp, TRUE) );
634 
635  SCIP_CALL( SCIPdecompstoreAdd(decompstore, decomp) );
636 
637  SCIPverbMessage(scip, SCIP_VERBLEVEL_HIGH, NULL, "Transformed Decomposition statistics %d\n%s", d, SCIPdecompPrintStats(decomp, strbuf));
638  }
639 
640  SCIPfreeBufferArray(scip, &varslabels);
641  SCIPfreeBufferArray(scip, &origvars);
642  SCIPfreeBufferArray(scip, &varssorted);
643 
644  return SCIP_OKAY;
645 }
int SCIPdecompGetBlockGraphMaxDegree(SCIP_DECOMP *decomp)
Definition: dcmp.c:329
int SCIPdecompstoreGetNOrigDecomps(SCIP_DECOMPSTORE *decompstore)
Definition: dcmp.c:534
public methods for memory management
int SCIPdecompGetNBlockGraphComponents(SCIP_DECOMP *decomp)
Definition: dcmp.c:309
void SCIPdecompFree(SCIP_DECOMP **decomp, BMS_BLKMEM *blkmem)
Definition: dcmp.c:89
#define SCIP_MAXSTRLEN
Definition: def.h:279
SCIP_DECOMP ** SCIPdecompstoreGetDecomps(SCIP_DECOMPSTORE *decompstore)
Definition: dcmp.c:505
SCIP_Real areascore
Definition: struct_dcmp.h:40
SCIP_Real SCIPdecompGetModularity(SCIP_DECOMP *decomp)
Definition: dcmp.c:289
SCIP_DECOMP ** origdecomps
Definition: struct_dcmp.h:62
SCIP_RETCODE SCIPdecompClear(SCIP_DECOMP *decomp, SCIP_Bool clearvarlabels, SCIP_Bool clearconslabels)
Definition: dcmp.c:214
int SCIPgetNConss(SCIP *scip)
Definition: scip_prob.c:3036
int SCIPgetNVars(SCIP *scip)
Definition: scip_prob.c:1986
void SCIPverbMessage(SCIP *scip, SCIP_VERBLEVEL msgverblevel, FILE *file, const char *formatstr,...)
Definition: scip_message.c:216
#define FALSE
Definition: def.h:73
SCIP_Bool original
Definition: struct_dcmp.h:53
SCIP_RETCODE SCIPtransformDecompstore(SCIP *scip)
Definition: dcmp.c:543
#define TRUE
Definition: def.h:72
SCIP_CONS ** SCIPgetConss(SCIP *scip)
Definition: scip_prob.c:3082
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:54
public methods for problem variables
#define SCIP_DECOMP_LINKCONS
Definition: type_dcmp.h:36
SCIP_Bool SCIPdecompIsOriginal(SCIP_DECOMP *decomp)
Definition: dcmp.c:236
#define SCIPfreeBufferArray(scip, ptr)
Definition: scip_mem.h:123
public methods for SCIP variables
int SCIPdecompGetNBlockGraphEdges(SCIP_DECOMP *decomp)
Definition: dcmp.c:299
void SCIPdecompSetUseBendersLabels(SCIP_DECOMP *decomp, SCIP_Bool benderslabels)
Definition: dcmp.c:248
int SCIPhashmapGetImageInt(SCIP_HASHMAP *hashmap, void *origin)
Definition: misc.c:3221
SCIP_DECOMP ** SCIPdecompstoreGetOrigDecomps(SCIP_DECOMPSTORE *decompstore)
Definition: dcmp.c:524
SCIP_Real modularity
Definition: struct_dcmp.h:39
public methods for decompositions
SCIP_Bool SCIPhashmapExists(SCIP_HASHMAP *hashmap, void *origin)
Definition: misc.c:3363
public methods for managing constraints
int SCIPdecompstoreGetNDecomps(SCIP_DECOMPSTORE *decompstore)
Definition: dcmp.c:515
SCIP_RETCODE SCIPdecompCreate(SCIP_DECOMP **decomp, BMS_BLKMEM *blkmem, int nblocks, SCIP_Bool original, SCIP_Bool benderslabels)
Definition: dcmp.c:47
#define SCIPerrorMessage
Definition: pub_message.h:55
methods for block memory pools and memory buffers
SCIP_VAR ** SCIPgetVars(SCIP *scip)
Definition: scip_prob.c:1941
SCIP_RETCODE SCIPdecompstoreAdd(SCIP_DECOMPSTORE *decompstore, SCIP_DECOMP *decomp)
Definition: dcmp.c:469
static void freeDecompositions(BMS_BLKMEM *blkmem, SCIP_DECOMP **decomps, int *ndecomps)
Definition: dcmp.c:418
SCIP_Bool SCIPdecompUseBendersLabels(SCIP_DECOMP *decomp)
Definition: dcmp.c:259
BMS_BLKMEM * SCIPblkmem(SCIP *scip)
Definition: scip_mem.c:48
int * consssize
Definition: struct_dcmp.h:44
int ncomponents
Definition: struct_dcmp.h:51
#define NULL
Definition: lpi_spx1.cpp:155
int * varssize
Definition: struct_dcmp.h:43
int idxlargestblock
Definition: struct_dcmp.h:41
SCIP_RETCODE SCIPcomputeDecompStats(SCIP *scip, SCIP_DECOMP *decomp, SCIP_Bool uselimits)
Definition: scip_dcmp.c:1125
void SCIPdecompGetVarsLabels(SCIP_DECOMP *decomp, SCIP_VAR **vars, int *labels, int nvars)
Definition: dcmp.c:139
#define SCIP_CALL(x)
Definition: def.h:370
SCIP main data structure.
SCIP_DECOMPSTORE * decompstore
Definition: struct_scip.h:73
public methods for constraint handler plugins and constraints
#define SCIP_DECOMP_LINKVAR
Definition: type_dcmp.h:35
#define BMSfreeBlockMemory(mem, ptr)
Definition: memory.h:456
#define INIT_MAP_SIZE
Definition: dcmp.c:44
#define SCIPallocBufferArray(scip, ptr, num)
Definition: scip_mem.h:111
SCIP_HASHMAP * cons2block
Definition: struct_dcmp.h:38
public data structures and miscellaneous methods
#define SCIP_Bool
Definition: def.h:70
int SCIPdecompGetNBlocks(SCIP_DECOMP *decomp)
Definition: dcmp.c:269
int SCIPdecompGetBlockGraphMinDegree(SCIP_DECOMP *decomp)
Definition: dcmp.c:339
SCIP_RETCODE SCIPcomputeDecompConsLabels(SCIP *scip, SCIP_DECOMP *decomp, SCIP_CONS **conss, int nconss)
Definition: scip_dcmp.c:335
#define BMSallocBlockMemoryArray(mem, ptr, num)
Definition: memory.h:445
SCIP_RETCODE SCIPhashmapCreate(SCIP_HASHMAP **hashmap, BMS_BLKMEM *blkmem, int mapsize)
Definition: misc.c:3014
data structures for a decomposition and a decomposition store
#define BMSfreeBlockMemoryArray(mem, ptr, num)
Definition: memory.h:458
int SCIPdecompGetNBlockGraphArticulations(SCIP_DECOMP *decomp)
Definition: dcmp.c:319
void SCIPdecompstoreFree(SCIP_DECOMPSTORE **decompstore, BMS_BLKMEM *blkmem)
Definition: dcmp.c:449
SCIP_RETCODE SCIPhashmapRemoveAll(SCIP_HASHMAP *hashmap)
Definition: misc.c:3573
void SCIPexitSolveDecompstore(SCIP *scip)
Definition: dcmp.c:437
int idxsmallestblock
Definition: struct_dcmp.h:42
SCIP_RETCODE SCIPcreateDecomp(SCIP *scip, SCIP_DECOMP **decomp, int nblocks, SCIP_Bool original, SCIP_Bool benderslabels)
Definition: scip_dcmp.c:208
internal methods for decompositions and the decomposition store
general public methods
int * labels
Definition: struct_dcmp.h:45
SCIP_Real SCIPdecompGetAreaScore(SCIP_DECOMP *decomp)
Definition: dcmp.c:279
int SCIPsnprintf(char *t, int len, const char *s,...)
Definition: misc.c:10604
void SCIPhashmapFree(SCIP_HASHMAP **hashmap)
Definition: misc.c:3048
SCIP_Bool benderslabels
Definition: struct_dcmp.h:54
#define SCIP_Real
Definition: def.h:163
public methods for message handling
public methods for data structures
SCIP_EXPORT SCIP_RETCODE SCIPvarGetOrigvarSum(SCIP_VAR **var, SCIP_Real *scalar, SCIP_Real *constant)
Definition: var.c:12545
SCIP_RETCODE SCIPdecompSetVarsLabels(SCIP_DECOMP *decomp, SCIP_VAR **vars, int *labels, int nvars)
Definition: dcmp.c:114
SCIP_RETCODE SCIPdecompSetConsLabels(SCIP_DECOMP *decomp, SCIP_CONS **conss, int *labels, int nconss)
Definition: dcmp.c:163
char * SCIPdecompPrintStats(SCIP_DECOMP *decomp, char *strbuf)
Definition: dcmp.c:349
SCIP_RETCODE SCIPcomputeDecompVarsLabels(SCIP *scip, SCIP_DECOMP *decomp, SCIP_CONS **conss, int nconss)
Definition: scip_dcmp.c:444
SCIP_DECOMP ** decomps
Definition: struct_dcmp.h:61
#define BMSallocBlockMemory(mem, ptr)
Definition: memory.h:443
struct BMS_BlkMem BMS_BLKMEM
Definition: memory.h:429
SCIP_Bool statscomplete
Definition: struct_dcmp.h:55
public methods for decompositions
SCIP_STAGE SCIPgetStage(SCIP *scip)
Definition: scip_general.c:356
#define SCIP_ALLOC(x)
Definition: def.h:381
void SCIPdecompGetConsLabels(SCIP_DECOMP *decomp, SCIP_CONS **conss, int *labels, int nconss)
Definition: dcmp.c:188
public methods for global and local (sub)problems
int narticulations
Definition: struct_dcmp.h:52
SCIP_RETCODE SCIPdecompstoreCreate(SCIP_DECOMPSTORE **decompstore, BMS_BLKMEM *blkmem, int nslots)
Definition: dcmp.c:394
SCIP_HASHMAP * var2block
Definition: struct_dcmp.h:37
SCIP_RETCODE SCIPhashmapSetImageInt(SCIP_HASHMAP *hashmap, void *origin, int image)
Definition: misc.c:3297