Scippy

GCG

Branch-and-Price & Column Generation for Everyone

pub_decomp.h
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /* */
3 /* This file is part of the program */
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-2021 Operations Research, RWTH Aachen University */
10 /* Zuse Institute Berlin (ZIB) */
11 /* */
12 /* This program is free software; you can redistribute it and/or */
13 /* modify it under the terms of the GNU Lesser General Public License */
14 /* as published by the Free Software Foundation; either version 3 */
15 /* of the License, or (at your option) any later version. */
16 /* */
17 /* This program is distributed in the hope that it will be useful, */
18 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
19 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
20 /* GNU Lesser General Public License for more details. */
21 /* */
22 /* You should have received a copy of the GNU Lesser General Public License */
23 /* along with this program; if not, write to the Free Software */
24 /* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.*/
25 /* */
26 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
27 
28 /**@file pub_decomp.h
29  * @ingroup PUBLICCOREAPI
30  * @brief public methods for working with decomposition structures
31  * @author Martin Bergner
32  */
33 
34 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
35 #ifndef GCG_PUB_DECOMP_H__
36 #define GCG_PUB_DECOMP_H__
37 
38 #include "type_decomp.h"
39 #include "scip/type_scip.h"
40 #include "scip/type_retcode.h"
41 #include "scip/type_var.h"
42 #include "scip/type_cons.h"
43 #include "scip/type_misc.h"
44 #include "type_detector.h"
45 
46 #ifdef __cplusplus
47 extern "C" {
48 #endif
49 
50 /**
51  * @ingroup DECOMP
52  * @{
53  */
54 
55 /** score data structure
56  * @ingroup DATASTRUCTURES
57 **/
58 struct Dec_Scores
59 {
60  SCIP_Real borderscore; /**< score of the border */
61  SCIP_Real densityscore; /**< score of block densities */
62  SCIP_Real linkingscore; /**< score related to interlinking blocks */
63  SCIP_Real totalscore; /**< accumulated score */
64  SCIP_Real maxwhitescore; /**< score related to max white measure (i.e. fraction of white (nonblock and nonborder) matrix area ) */
65 };
66 typedef struct Dec_Scores DEC_SCORES;
67 
68 /** converts the DEC_DECTYPE enum to a string */
69 const char *DECgetStrType(
70  DEC_DECTYPE type /**< decomposition type */
71  );
72 
73 /** initializes the decomposition to absolutely nothing */
74 extern
75 SCIP_RETCODE DECdecompCreate(
76  SCIP* scip, /**< SCIP data structure */
77  DEC_DECOMP** decomp /**< pointer to the decomposition data structure */
78  );
79 
80 /** frees the decomposition */
81 extern
82 SCIP_RETCODE DECdecompFree(
83  SCIP* scip, /**< SCIP data structure */
84  DEC_DECOMP** decomp /**< pointer to the decomposition data structure */
85  );
86 
87 /** sets the type of the decomposition */
88 extern
89 SCIP_RETCODE DECdecompSetType(
90  DEC_DECOMP* decomp, /**< decomposition data structure */
91  DEC_DECTYPE type /**< type of the decomposition */
92  );
93 
94 /** gets the type of the decomposition */
95 extern
97  DEC_DECOMP* decomp /**< decomposition data structure */
98  );
99 
100 extern
101 SCIP_Real DECdecompGetMaxwhiteScore(
102  DEC_DECOMP* decomp /**< decomposition data structure */
103  );
104 
105 extern
107  SCIP* scip, /**< SCIP data structure */
108  DEC_DECOMP* decomp, /**< decomposition data structure */
109  SCIP_Real maxwhitescore /**< score related to max white measure (i.e. fraction of white (nonblock and nonborder) matrix area ) */
110  );
111 
112 /** sets the presolved flag for decomposition */
113 extern
115  DEC_DECOMP* decomp, /**< decomposition data structure */
116  SCIP_Bool presolved /**< presolved flag for decomposition */
117  );
118 
119 /** gets the presolved flag for decomposition */
120 extern
121 SCIP_Bool DECdecompGetPresolved(
122  DEC_DECOMP* decomp /**< decomposition data structure */
123  );
124 
125 /** sets the number of blocks for decomposition */
126 extern
128  DEC_DECOMP* decomp, /**< decomposition data structure */
129  int nblocks /**< number of blocks for decomposition */
130  );
131 
132 /** gets the number of blocks for decomposition */
133 extern
135  DEC_DECOMP* decomp /**< decomposition data structure */
136  );
137 
138 /** copies the input subscipvars array to the given decomposition */
139 extern
140 SCIP_RETCODE DECdecompSetSubscipvars(
141  SCIP* scip, /**< SCIP data structure */
142  DEC_DECOMP* decomp, /**< decomposition data structure */
143  SCIP_VAR*** subscipvars, /**< subscipvars array */
144  int* nsubscipvars /**< number of subscipvars per block */
145  );
146 
147 /** returns the subscipvars array of the given decomposition */
148 extern
149 SCIP_VAR*** DECdecompGetSubscipvars(
150  DEC_DECOMP* decomp /**< decomposition data structure */
151  );
152 
153 /** returns the nsubscipvars array of the given decomposition */
154 extern
156  DEC_DECOMP* decomp /**< decomposition data structure */
157  );
158 
159 /** copies the input subscipconss array to the given decomposition */
160 extern
161 SCIP_RETCODE DECdecompSetSubscipconss(
162  SCIP* scip, /**< SCIP data structure */
163  DEC_DECOMP* decomp, /**< decomposition data structure */
164  SCIP_CONS*** subscipconss, /**< subscipconss array */
165  int* nsubscipconss /**< number of subscipconss per block */
166  );
167 
168 /** returns the subscipconss array of the given decomposition */
169 extern
170 SCIP_CONS*** DECdecompGetSubscipconss(
171  DEC_DECOMP* decomp /**< decomposition data structure */
172  );
173 
174 /** returns the nsubscipconss array of the given decomposition */
175 extern
177  DEC_DECOMP* decomp /**< decomposition data structure */
178  );
179 
180 /** copies the input linkingconss array to the given decomposition */
181 extern
182 SCIP_RETCODE DECdecompSetLinkingconss(
183  SCIP* scip, /**< SCIP data structure */
184  DEC_DECOMP* decomp, /**< decomposition data structure */
185  SCIP_CONS** linkingconss, /**< linkingconss array */
186  int nlinkingconss /**< number of linkingconss per block */
187  );
188 
189 /** returns the linkingconss array of the given decomposition */
190 extern
191 SCIP_CONS** DECdecompGetLinkingconss(
192  DEC_DECOMP* decomp /**< decomposition data structure */
193  );
194 
195 /** returns the nlinkingconss array of the given decomposition */
196 extern
198  DEC_DECOMP* decomp /**< decomposition data structure */
199  );
200 
201 /** copies the input linkingvars array to the given decomposition */
202 extern
203 SCIP_RETCODE DECdecompSetLinkingvars(
204  SCIP* scip, /**< SCIP data structure */
205  DEC_DECOMP* decomp, /**< decomposition data structure */
206  SCIP_VAR** linkingvars, /**< linkingvars array */
207  int nlinkingvars, /**< number of linkingvars per block */
208  int nfixedlinkingvars, /**< number of linking variables that are fixed */
209  int nmastervars /**< number of linkingvars that are purely master variables */
210  );
211 
212 /** returns the linkingvars array of the given decomposition */
213 extern
214 SCIP_VAR** DECdecompGetLinkingvars(
215  DEC_DECOMP* decomp /**< decomposition data structure */
216  );
217 
218 /** returns the number of master variables of the given decomposition */
219 extern
221  DEC_DECOMP* decomp /**< decomposition data structure */
222  );
223 
224 
225 /** returns the nlinkingvars array of the given decomposition */
226 extern
228  DEC_DECOMP* decomp /**< decomposition data structure */
229  );
230 
231 /** returns the nlinkingvars array of the given decomposition */
232 extern
234  DEC_DECOMP* decomp /**< decomposition data structure */
235  );
236 
237 
238 /** copies the input stairlinkingvars array to the given decomposition */
239 extern
240 SCIP_RETCODE DECdecompSetStairlinkingvars(
241  SCIP* scip, /**< SCIP data structure */
242  DEC_DECOMP* decomp, /**< decomposition data structure */
243  SCIP_VAR*** stairlinkingvars, /**< stairlinkingvars array */
244  int* nstairlinkingvars /**< number of linkingvars per block */
245  );
246 
247 /** returns the stairlinkingvars array of the given decomposition */
248 extern
249 SCIP_VAR*** DECdecompGetStairlinkingvars(
250  DEC_DECOMP* decomp /**< decomposition data structure */
251  );
252 
253 /** returns the nstairlinkingvars array of the given decomposition */
254 extern
256  DEC_DECOMP* decomp /**< decomposition data structure */
257  );
258 
259 /** returns the total number of stairlinkingvars array of the given decomposition */
261  DEC_DECOMP* decomp /**< decomposition data structure */
262  );
263 
264 
265 /** sets the vartoblock hashmap of the given decomposition */
266 extern
268  DEC_DECOMP* decomp, /**< decomposition data structure */
269  SCIP_HASHMAP* vartoblock /**< Vartoblock hashmap */
270  );
271 
272 /** returns the vartoblock hashmap of the given decomposition */
273 extern
274 SCIP_HASHMAP* DECdecompGetVartoblock(
275  DEC_DECOMP* decomp /**< decomposition data structure */
276  );
277 
278 /** sets the constoblock hashmap of the given decomposition */
280  DEC_DECOMP* decomp, /**< decomposition data structure */
281  SCIP_HASHMAP* constoblock /**< Constoblock hashmap */
282  );
283 
284 /** returns the constoblock hashmap of the given decomposition */
285 extern
286 SCIP_HASHMAP* DECdecompGetConstoblock(
287  DEC_DECOMP* decomp /**< decomposition data structure */
288  );
289 
290 /** sets the varindex hashmap of the given decomposition */
292  DEC_DECOMP* decomp, /**< decomposition data structure */
293  SCIP_HASHMAP* varindex /**< Varindex hashmap */
294  );
295 
296 /** returns the varindex hashmap of the given decomposition */
297 SCIP_HASHMAP* DECdecompGetVarindex(
298  DEC_DECOMP* decomp /**< decomposition data structure */
299  );
300 
301 /** sets the consindex hashmap of the given decomposition */
302 extern
304  DEC_DECOMP* decomp, /**< decomposition data structure */
305  SCIP_HASHMAP* consindex /**< Consindex hashmap */
306  );
307 
308 /** returns the consindex hashmap of the given decomposition */
309 extern
310 SCIP_HASHMAP* DECdecompGetConsindex(
311  DEC_DECOMP* decomp /**< decomposition data structure */
312  );
313 
314 /** completely initializes decomposition structure from the values of the hashmaps */
315 extern
316 SCIP_RETCODE DECfilloutDecompFromHashmaps(
317  SCIP* scip, /**< SCIP data structure */
318  DEC_DECOMP* decomp, /**< decomposition data structure */
319  SCIP_HASHMAP* vartoblock, /**< variable to block hashmap */
320  SCIP_HASHMAP* constoblock, /**< constraint to block hashmap */
321  int nblocks, /**< number of blocks */
322  SCIP_Bool staircase /**< should the decomposition be a staircase structure */
323  );
324 
325 /** completely fills out decomposition structure from only the constraint partition */
326 extern
328  SCIP* scip, /**< SCIP data structure */
329  DEC_DECOMP* decomp, /**< decomposition data structure */
330  SCIP_HASHMAP* constoblock, /**< constraint to block hashmap, start with 1 for first block and nblocks+1 for linking constraints */
331  int nblocks, /**< number of blocks */
332  SCIP_Bool staircase /**< should the decomposition be a staircase structure */
333  );
334 
335 /** sets the detector for the given decomposition */
336 extern
338  DEC_DECOMP* decomp, /**< decomposition data structure */
339  DEC_DETECTOR* detector /**< detector data structure */
340  );
341 
342 /** gets the detector for the given decomposition */
343 extern
345  DEC_DECOMP* decomp /**< decomposition data structure */
346  );
347 
348 /** gets the detectors for the given decomposition */
349 extern
351  DEC_DECOMP* decomp /**< decomposition data structure */
352  );
353 
354 /** gets the number of detectors for the given decomposition */
355 extern
357  DEC_DECOMP* decomp /**< decomposition data structure */
358  );
359 
360 /** gets the id of the original partialdec */
361 extern
363  DEC_DECOMP* decomp /**< decomposition data structure */
364  );
365 
366 /** sets the detector clock times of the detectors of the detector chain */
367 extern
369  SCIP* scip, /**< SCIP data structure */
370  DEC_DECOMP* decomp, /**< decomposition data structure */
371  SCIP_Real* detectorClockTimes /**< time used by the detectors */
372  );
373 
374 /** gets the detector clock times of the detectors of the detector chain */
375 extern
377  DEC_DECOMP* decomp /**< decomposition data structure */
378  );
379 
380 /** sets the detector clock times of the detectors of the detector chain */
381 extern
383  SCIP* scip, /**< SCIP data structure */
384  DEC_DECOMP* decomp, /**< decomposition data structure */
385  const char* detectorchainstring /**< string for the detector information working on that decomposition */
386  );
387 
388 
389 extern
391  SCIP* scip, /**< SCIP data structure */
392  DEC_DECOMP* decomp /**< decomposition data structure */
393  );
394 
395 
396 /** sets the percentages of variables assigned to the border of the corresponding detectors (of the detector chain) on this decomposition */
397 extern
399  SCIP* scip, /**< SCIP data structure */
400  DEC_DECOMP* decomp, /**< decomposition data structure */
401  SCIP_Real* pctVarsToBorder
402  );
403 
404 /** gets the percentages of variables assigned to the border of the corresponding detectors (of the detector chain) on this decomposition */
405 extern
407  DEC_DECOMP* decomp /**< decomposition data structure */
408  );
409 
410 /** sets the percentages of constraints assigned to the border of the corresponding detectors (of the detector chain) on this decomposition */
411 extern
413  SCIP* scip, /**< SCIP data structure */
414  DEC_DECOMP* decomp, /**< decomposition data structure */
415  SCIP_Real* pctConssToBorder
416  );
417 
418 /** gets the percentages of constraints assigned to the border of the corresponding detectors (of the detector chain) on this decomposition */
419 extern
421  DEC_DECOMP* decomp /**< decomposition data structure */
422  );
423 
424 /** sets the percentages of variables assigned to some block of the corresponding detectors (of the detector chain) on this decomposition */
425 extern
427  SCIP* scip, /**< SCIP data structure */
428  DEC_DECOMP* decomp, /**< decomposition data structure */
429  SCIP_Real* pctVarsToBlock
430  );
431 
432 /** gets the percentages of variables assigned to some block of the corresponding detectors (of the detector chain) on this decomposition */
433 extern
435  DEC_DECOMP* decomp /**< decomposition data structure */
436  );
437 
438 /** sets the percentages of constraints assigned to some block of the corresponding detectors (of the detector chain) on this decomposition */
439 extern
441  SCIP* scip, /**< SCIP data structure */
442  DEC_DECOMP* decomp, /**< decomposition data structure */
443  SCIP_Real* pctConssToBlock
444  );
445 
446 /** gets the percentages of constraints assigned to some block of the corresponding detectors (of the detector chain) on this decomposition */
447 extern
449  DEC_DECOMP* decomp /**< decomposition data structure */
450  );
451 
452 
453 /** sets the percentages of variables assigned to some block of the corresponding detectors (of the detector chain) on this decomposition */
454 extern
456  SCIP* scip, /**< SCIP data structure */
457  DEC_DECOMP* decomp, /**< decomposition data structure */
458  SCIP_Real* pctVarsFromOpen
459  );
460 
461 /** gets the percentages of variables assigned to some block of the corresponding detectors (of the detector chain) on this decomposition */
462 extern
464  DEC_DECOMP* decomp /**< decomposition data structure */
465  );
466 
467 /** sets the percentages of constraints assigned to some block of the corresponding detectors (of the detector chain) on this decomposition */
468 extern
470  SCIP* scip, /**< SCIP data structure */
471  DEC_DECOMP* decomp, /**< decomposition data structure */
472  SCIP_Real* pctConssToBorder
473  );
474 
475 /** gets the percentages of constraints assigned to some block of the corresponding detectors (of the detector chain) on this decomposition */
476 extern
478  DEC_DECOMP* decomp /**< decomposition data structure */
479  );
480 
481 /** sets the number of new blocks of the corresponding detectors (of the detector chain) on this decomposition */
482 extern
484  SCIP* scip, /**< SCIP data structure */
485  DEC_DECOMP* decomp, /**< decomposition data structure */
486  int* nNewBlocks /**< number of new blocks on this decomposition */
487  );
488 
489 /** gets the number of new blocks corresponding detectors (of the detector chain) on this decomposition */
490 extern
492  DEC_DECOMP* decomp /**< decomposition data structure */
493  );
494 
495 /** transforms all constraints and variables, updating the arrays */
496 extern
497 SCIP_RETCODE DECdecompTransform(
498  SCIP* scip, /**< SCIP data structure */
499  DEC_DECOMP* decomp /**< decomposition data structure */
500  );
501 
502 /**
503  * Remove all those constraints that were removed from the problem after the decomposition had been created
504  */
505 extern
506 SCIP_RETCODE DECdecompRemoveDeletedConss(
507  SCIP* scip, /**< SCIP data structure */
508  DEC_DECOMP* decomp /**< decomposition data structure */
509  );
510 
511 /**
512  * Adds all those constraints that were added to the problem after the decomposition as created
513  */
514 extern
515 SCIP_RETCODE DECdecompAddRemainingConss(
516  SCIP* scip, /**< SCIP data structure */
517  DEC_DECOMP* decomp /**< decomposition data structure */
518  );
519 
520 /** checks the validity of the decomposition data structure */
521 extern
522 SCIP_RETCODE DECdecompCheckConsistency(
523  SCIP* scip, /**< SCIP data structure */
524  DEC_DECOMP* decomp /**< decomposition data structure */
525  );
526 
527 /** creates a decomposition with all constraints in the master */
528 extern
529 SCIP_RETCODE DECcreateBasicDecomp(
530  SCIP* scip, /**< SCIP data structure */
531  DEC_DECOMP** decomp, /**< decomposition data structure */
532  SCIP_Bool solveorigprob /**< is the original problem being solved? */
533  );
534 
535 /** creates a decomposition with provided constraints in the master
536  * The function will put the remaining constraints in one or more pricing problems
537  * depending on whether the subproblems decompose with no variables in common.
538  */
539 extern
540 SCIP_RETCODE DECcreateDecompFromMasterconss(
541  SCIP* scip, /**< SCIP data structure */
542  DEC_DECOMP** decomp, /**< decomposition data structure */
543  SCIP_CONS** conss, /**< constraints to be put in the master */
544  int nconss /**< number of constraints in the master */
545  );
546 
547 /** return the number of variables and binary, integer, implied integer, continuous variables of all subproblems */
548 extern
550  SCIP* scip, /**< SCIP data structure */
551  DEC_DECOMP* decomp, /**< decomposition data structure */
552  int* nvars, /**< pointer to array of size nproblems to store number of subproblem vars or NULL */
553  int* nbinvars, /**< pointer to array of size nproblems to store number of binary subproblem vars or NULL */
554  int* nintvars, /**< pointer to array of size nproblems to store number of integer subproblem vars or NULL */
555  int* nimplvars, /**< pointer to array of size nproblems to store number of implied subproblem vars or NULL */
556  int* ncontvars, /**< pointer to array of size nproblems to store number of continuous subproblem vars or NULL */
557  int nproblems /**< size of the arrays*/
558  );
559 
560 /** return the number of variables and binary, integer, implied integer, continuous variables of the master */
561 extern
563  SCIP* scip, /**< SCIP data structure */
564  DEC_DECOMP* decomp, /**< decomposition data structure */
565  int* nvars, /**< pointer to store number of linking vars or NULL */
566  int* nbinvars, /**< pointer to store number of binary linking vars or NULL */
567  int* nintvars, /**< pointer to store number of integer linking vars or NULL */
568  int* nimplvars, /**< pointer to store number of implied linking vars or NULL */
569  int* ncontvars /**< pointer to store number of continuous linking vars or NULL */
570  );
571 
572 /**
573  * returns the number of nonzeros of each column of the constraint matrix both in the subproblem and in the master
574  * @note For linking variables, the number of nonzeros in the subproblems corresponds to the number on nonzeros
575  * in the border
576  *
577  * @note The arrays have to be allocated by the caller
578  *
579  * @pre This function assumes that constraints are partitioned in the decomp structure, no constraint is present in more than one block
580  *
581  */
582 extern
583 SCIP_RETCODE DECgetDensityData(
584  SCIP* scip, /**< SCIP data structure */
585  DEC_DECOMP* decomp, /**< decomposition data structure */
586  SCIP_VAR** vars, /**< pointer to array store variables belonging to density */
587  int nvars, /**< number of variables */
588  SCIP_CONS** conss, /**< pointer to array to store constraints belonging to the density */
589  int nconss, /**< number of constraints */
590  int* varsubproblemdensity, /**< pointer to array to store the nonzeros for the subproblems */
591  int* varmasterdensity, /**< pointer to array to store the nonzeros for the master */
592  int* conssubproblemdensity, /**< pointer to array to store the nonzeros for the subproblems */
593  int* consmasterdensity /**< pointer to array to store the nonzeros for the master */
594 );
595 
596 /**
597  * calculates the number of up and down locks of variables for a given decomposition in both the original problem and the pricingproblems
598  *
599  * @note All arrays need to be allocated by the caller
600  *
601  * @warning This function needs a lot of memory (nvars*nblocks+1) array entries
602  */
603 SCIP_RETCODE DECgetVarLockData(
604  SCIP* scip, /**< SCIP data structure */
605  DEC_DECOMP* decomp, /**< decomposition data structure */
606  SCIP_VAR** vars, /**< pointer to array store variables belonging to density */
607  int nvars, /**< number of variables */
608  int nsubproblems, /**< number of sub problems */
609  int** subsciplocksdown, /**< pointer to two dimensional array to store the down locks for the subproblems */
610  int** subsciplocksup, /**< pointer to two dimensional array to store the down locks for the subproblems */
611  int* masterlocksdown, /**< pointer to array to store the down locks for the master */
612  int* masterlocksup /**< pointer to array to store the down locks for the master */
613  );
614 
615 /**
616  * returns the maximum white score ( if it is not calculated yet is decomp is evaluated)
617  */
618 SCIP_Real DECgetMaxWhiteScore(
619  SCIP* scip, /**< SCIP data structure */
620  DEC_DECOMP* decomp /**< decomposition data structure */
621  );
622 
623 
624 /** computes the score of the given decomposition based on the border, the average density score and the ratio of
625  * linking variables
626  */
627 extern
628 SCIP_RETCODE DECevaluateDecomposition(
629  SCIP* scip, /**< SCIP data structure */
630  DEC_DECOMP* decomp, /**< decomposition data structure */
631  DEC_SCORES* score /**< returns the score of the decomposition */
632  );
633 
634 /** returns the number of constraints saved in the decomposition */
636  DEC_DECOMP* decomp /**< decomposition data structure */
637  );
638 
639 /** display statistics about the decomposition */
640 extern
641 SCIP_RETCODE GCGprintDecompStatistics(
642  SCIP* scip, /**< SCIP data structure */
643  FILE* file, /**< output file or NULL for standard output */
644  DEC_DECOMP* decomp /**< decomp that should be evaluated */
645  );
646 
647 /** returns whether both structures lead to the same decomposition */
648 extern
649 SCIP_Bool DECdecompositionsAreEqual(
650  SCIP* scip, /**< SCIP data structure */
651  DEC_DECOMP* decomp1, /**< first decomp data structure */
652  DEC_DECOMP* decomp2 /**< second decomp data structure */
653 );
654 
655 
656 /** filters similar decompositions from a given list and moves them to the end
657  * @return the number of unique decompositions
658  */
659 extern
661  SCIP* scip, /**< SCIP data structure */
662  DEC_DECOMP** decs, /**< array of decompositions */
663  int ndecs /**< number of decompositions */
664 );
665 
666 /** returns the number of the block that the constraint is with respect to the decomposition */
667 extern
668 SCIP_RETCODE DECdetermineConsBlock(
669  SCIP* scip, /**< SCIP data structure */
670  DEC_DECOMP* decomp, /**< decomposition data structure */
671  SCIP_CONS* cons, /**< constraint to check */
672  int *block /**< block of the constraint (or nblocks for master) */
673 );
674 
675 /** move a master constraint to pricing problem */
676 extern
678  SCIP* scip, /**< SCIP data structure */
679  DEC_DECOMP* decomp, /**< decomposition data structure */
680  int consindex, /**< index of constraint to move */
681  int block /**< block of the pricing problem where to move */
682  );
683 
684 /** tries to assign masterconss to pricing problem */
685 extern
687  SCIP* scip, /**< SCIP data structure */
688  DEC_DECOMP* decomp, /**< decomposition data structure */
689  int* transferred /**< number of master constraints reassigned */
690  );
691 
692 /** tries to assign masterconss to new pricing problem */
693 extern
695  SCIP* scip, /**< SCIP data structure */
696  DEC_DECOMP* decomp, /**< decomposition data structure */
697  DEC_DECOMP** newdecomp, /**< new decomposition, if successful */
698  int* transferred /**< number of master constraints reassigned */
699  );
700 
701 /** polish the decomposition and try to greedily assign master constraints to pricing problem where useful */
702 extern
703 SCIP_RETCODE DECcreatePolishedDecomp(
704  SCIP* scip, /**< SCIP data structure */
705  DEC_DECOMP* decomp, /**< decomposition data structure */
706  DEC_DECOMP** newdecomp /**< new decomposition, if successful */
707  );
708 
709 /** permutes the decomposition according to the permutation seed */
710 extern
711 SCIP_RETCODE DECpermuteDecomp(
712  SCIP* scip, /**< SCIP data structure */
713  DEC_DECOMP* decomp, /**< decomposition data structure */
714  SCIP_RANDNUMGEN* randnumgen /**< random number generator */
715  );
716 
717 /** gets the number of existing decompositions
718  *
719  * @returns number of decompositions
720  */
721 extern
722 int DECgetNDecomps(
723  SCIP* scip /**< SCIP data structure */
724  );
725 
726 /** @} */
727 #ifdef __cplusplus
728 }
729 
730 #endif
731 #endif
void DECdecompSetNNewBlocks(SCIP *scip, DEC_DECOMP *decomp, int *nNewBlocks)
Definition: decomp.c:1944
int * DECdecompGetNStairlinkingvars(DEC_DECOMP *decomp)
Definition: decomp.c:1160
SCIP_RETCODE DECdecompTransform(SCIP *scip, DEC_DECOMP *decomp)
Definition: decomp.c:1982
void DECdecompSetDetectorPctConssFromOpen(SCIP *scip, DEC_DECOMP *decomp, SCIP_Real *pctConssToBorder)
Definition: decomp.c:1907
SCIP_RETCODE DECdecompSetDetectorChainString(SCIP *scip, DEC_DECOMP *decomp, const char *detectorchainstring)
Definition: decomp.c:1705
SCIP_RETCODE GCGprintDecompStatistics(SCIP *scip, FILE *file, DEC_DECOMP *decomp)
Definition: decomp.c:3778
SCIP_RETCODE DECdetermineConsBlock(SCIP *scip, DEC_DECOMP *decomp, SCIP_CONS *cons, int *block)
Definition: decomp.c:4047
const char * DECgetStrType(DEC_DECTYPE type)
Definition: decomp.c:462
void DECdecompSetPresolved(DEC_DECOMP *decomp, SCIP_Bool presolved)
Definition: decomp.c:712
type definitions for detectors in GCG projects
SCIP_RETCODE DECdecompAddRemainingConss(SCIP *scip, DEC_DECOMP *decomp)
Definition: decomp.c:2179
int DECfilterSimilarDecompositions(SCIP *scip, DEC_DECOMP **decs, int ndecs)
Definition: decomp.c:4004
char * DECdecompGetDetectorChainString(SCIP *scip, DEC_DECOMP *decomp)
Definition: decomp.c:1718
int DECdecompGetDetectorChainSize(DEC_DECOMP *decomp)
Definition: decomp.c:1637
void DECdecompSetConsindex(DEC_DECOMP *decomp, SCIP_HASHMAP *consindex)
Definition: decomp.c:1251
SCIP_Real * DECdecompGetDetectorPctConssFromOpen(DEC_DECOMP *decomp)
Definition: decomp.c:1936
int DECdecompGetNFixedLinkingvars(DEC_DECOMP *decomp)
Definition: decomp.c:1057
int DECgetNDecomps(SCIP *scip)
void DECgetSubproblemVarsData(SCIP *scip, DEC_DECOMP *decomp, int *nvars, int *nbinvars, int *nintvars, int *nimplvars, int *ncontvars, int nproblems)
Definition: decomp.c:2837
SCIP_HASHMAP * DECdecompGetVartoblock(DEC_DECOMP *decomp)
Definition: decomp.c:1199
SCIP_Real * DECdecompGetDetectorPctVarsToBlock(DEC_DECOMP *decomp)
Definition: decomp.c:1826
void DECgetLinkingVarsData(SCIP *scip, DEC_DECOMP *decomp, int *nvars, int *nbinvars, int *nintvars, int *nimplvars, int *ncontvars)
Definition: decomp.c:2886
SCIP_Real borderscore
Definition: pub_decomp.h:60
DEC_DECTYPE DECdecompGetType(DEC_DECOMP *decomp)
Definition: decomp.c:691
SCIP_RETCODE DECgetDensityData(SCIP *scip, DEC_DECOMP *decomp, SCIP_VAR **vars, int nvars, SCIP_CONS **conss, int nconss, int *varsubproblemdensity, int *varmasterdensity, int *conssubproblemdensity, int *consmasterdensity)
Definition: decomp.c:2936
SCIP_RETCODE DECcreatePolishedDecomp(SCIP *scip, DEC_DECOMP *decomp, DEC_DECOMP **newdecomp)
Definition: decomp.c:4276
int * DECdecompGetNSubscipconss(DEC_DECOMP *decomp)
Definition: decomp.c:917
int DECdecompGetNBlocks(DEC_DECOMP *decomp)
Definition: decomp.c:745
SCIP_VAR *** DECdecompGetSubscipvars(DEC_DECOMP *decomp)
Definition: decomp.c:823
SCIP_RETCODE DECgetVarLockData(SCIP *scip, DEC_DECOMP *decomp, SCIP_VAR **vars, int nvars, int nsubproblems, int **subsciplocksdown, int **subsciplocksup, int *masterlocksdown, int *masterlocksup)
Definition: decomp.c:3117
void DECdecompSetDetectorPctVarsToBlock(SCIP *scip, DEC_DECOMP *decomp, SCIP_Real *pctVarsToBlock)
Definition: decomp.c:1799
SCIP_RETCODE DECdecompMoveLinkingConsToPricing(SCIP *scip, DEC_DECOMP *decomp, int consindex, int block)
Definition: decomp.c:4137
SCIP_Real DECdecompGetMaxwhiteScore(DEC_DECOMP *decomp)
Definition: decomp.c:701
SCIP_VAR ** DECdecompGetLinkingvars(DEC_DECOMP *decomp)
Definition: decomp.c:1036
void DECdecompSetDetector(DEC_DECOMP *decomp, DEC_DETECTOR *detector)
Definition: decomp.c:1579
SCIP_Real * DECdecompGetDetectorPctConssToBlock(DEC_DECOMP *decomp)
Definition: decomp.c:1862
SCIP_RETCODE DECpermuteDecomp(SCIP *scip, DEC_DECOMP *decomp, SCIP_RANDNUMGEN *randnumgen)
Definition: decomp.c:4323
SCIP_RETCODE DECdecompFree(SCIP *scip, DEC_DECOMP **decomp)
Definition: decomp.c:530
SCIP_Real * DECdecompGetDetectorPctVarsToBorder(DEC_DECOMP *decomp)
Definition: decomp.c:1756
SCIP_RETCODE DECcreateBasicDecomp(SCIP *scip, DEC_DECOMP **decomp, SCIP_Bool solveorigprob)
Definition: decomp.c:2388
SCIP_Real totalscore
Definition: pub_decomp.h:63
int DECdecompGetNLinkingconss(DEC_DECOMP *decomp)
Definition: decomp.c:977
void DECdecompSetDetectorPctConssToBlock(SCIP *scip, DEC_DECOMP *decomp, SCIP_Real *pctConssToBlock)
Definition: decomp.c:1834
SCIP_Real linkingscore
Definition: pub_decomp.h:62
int * DECdecompGetNNewBlocks(DEC_DECOMP *decomp)
Definition: decomp.c:1970
int DECdecompGetPartialdecID(DEC_DECOMP *decomp)
Definition: decomp.c:1660
SCIP_RETCODE DECdecompSetLinkingconss(SCIP *scip, DEC_DECOMP *decomp, SCIP_CONS **linkingconss, int nlinkingconss)
Definition: decomp.c:926
int DECdecompGetNLinkingvars(DEC_DECOMP *decomp)
Definition: decomp.c:1046
SCIP_RETCODE DECdecompCheckConsistency(SCIP *scip, DEC_DECOMP *decomp)
Definition: decomp.c:2267
int DECdecompGetNMastervars(DEC_DECOMP *decomp)
Definition: decomp.c:1069
SCIP_CONS ** DECdecompGetLinkingconss(DEC_DECOMP *decomp)
Definition: decomp.c:967
SCIP_RETCODE DECdecompSetLinkingvars(SCIP *scip, DEC_DECOMP *decomp, SCIP_VAR **linkingvars, int nlinkingvars, int nfixedlinkingvars, int nmastervars)
Definition: decomp.c:989
int DECdecompGetNTotalStairlinkingvars(DEC_DECOMP *decomp)
Definition: decomp.c:1170
void DECdecompSetDetectorClockTimes(SCIP *scip, DEC_DECOMP *decomp, SCIP_Real *detectorClockTimes)
Definition: decomp.c:1671
SCIP_RETCODE DECdecompSetStairlinkingvars(SCIP *scip, DEC_DECOMP *decomp, SCIP_VAR ***stairlinkingvars, int *nstairlinkingvars)
Definition: decomp.c:1081
SCIP_Real * DECdecompGetDetectorClockTimes(DEC_DECOMP *decomp)
Definition: decomp.c:1696
void DECdecompSetVarindex(DEC_DECOMP *decomp, SCIP_HASHMAP *varindex)
Definition: decomp.c:1231
SCIP_RETCODE DECcreateDecompFromMasterconss(SCIP *scip, DEC_DECOMP **decomp, SCIP_CONS **conss, int nconss)
Definition: decomp.c:2715
SCIP_RETCODE DECdecompSetSubscipconss(SCIP *scip, DEC_DECOMP *decomp, SCIP_CONS ***subscipconss, int *nsubscipconss)
Definition: decomp.c:843
SCIP_Real densityscore
Definition: pub_decomp.h:61
SCIP_RETCODE DECdecompSetType(DEC_DECOMP *decomp, DEC_DECTYPE type)
Definition: decomp.c:647
SCIP_RETCODE DECevaluateDecomposition(SCIP *scip, DEC_DECOMP *decomp, DEC_SCORES *score)
Definition: decomp.c:3288
SCIP_Real DECgetMaxWhiteScore(SCIP *scip, DEC_DECOMP *decomp)
Definition: decomp.c:3270
enum Dectype DEC_DECTYPE
Definition: type_decomp.h:56
DEC_DETECTOR * DECdecompGetDetector(DEC_DECOMP *decomp)
Definition: decomp.c:1590
SCIP_RETCODE DECdecompRemoveDeletedConss(SCIP *scip, DEC_DECOMP *decomp)
Definition: decomp.c:2123
SCIP_RETCODE DECdecompSetSubscipvars(SCIP *scip, DEC_DECOMP *decomp, SCIP_VAR ***subscipvars, int *nsubscipvars)
Definition: decomp.c:755
void DECdecompSetDetectorPctVarsFromOpen(SCIP *scip, DEC_DECOMP *decomp, SCIP_Real *pctVarsFromOpen)
Definition: decomp.c:1871
SCIP_RETCODE DECtryAssignMasterconssToExistingPricing(SCIP *scip, DEC_DECOMP *decomp, int *transferred)
Definition: decomp.c:4172
SCIP_RETCODE DECfilloutDecompFromConstoblock(SCIP *scip, DEC_DECOMP *decomp, SCIP_HASHMAP *constoblock, int nblocks, SCIP_Bool staircase)
Definition: decomp.c:1455
SCIP_RETCODE DECfilloutDecompFromHashmaps(SCIP *scip, DEC_DECOMP *decomp, SCIP_HASHMAP *vartoblock, SCIP_HASHMAP *constoblock, int nblocks, SCIP_Bool staircase)
Definition: decomp.c:1271
DEC_DETECTOR ** DECdecompGetDetectorChain(DEC_DECOMP *decomp)
Definition: decomp.c:1600
int * DECdecompGetNSubscipvars(DEC_DECOMP *decomp)
Definition: decomp.c:833
int DECdecompGetNConss(DEC_DECOMP *decomp)
Definition: decomp.c:3650
SCIP_RETCODE DECdecompCreate(SCIP *scip, DEC_DECOMP **decomp)
Definition: decomp.c:471
SCIP_Bool DECdecompGetPresolved(DEC_DECOMP *decomp)
Definition: decomp.c:723
SCIP_VAR *** DECdecompGetStairlinkingvars(DEC_DECOMP *decomp)
Definition: decomp.c:1151
SCIP_Real * DECdecompGetDetectorPctConssToBorder(DEC_DECOMP *decomp)
Definition: decomp.c:1791
SCIP_Real * DECdecompGetDetectorPctVarsFromOpen(DEC_DECOMP *decomp)
Definition: decomp.c:1899
void DECsetMaxWhiteScore(SCIP *scip, DEC_DECOMP *decomp, SCIP_Real maxwhitescore)
Definition: decomp.c:3253
void DECdecompSetDetectorPctConssToBorder(SCIP *scip, DEC_DECOMP *decomp, SCIP_Real *pctConssToBorder)
Definition: decomp.c:1764
SCIP_RETCODE DECtryAssignMasterconssToNewPricing(SCIP *scip, DEC_DECOMP *decomp, DEC_DECOMP **newdecomp, int *transferred)
Definition: decomp.c:4220
void DECdecompSetConstoblock(DEC_DECOMP *decomp, SCIP_HASHMAP *constoblock)
Definition: decomp.c:1209
SCIP_HASHMAP * DECdecompGetConstoblock(DEC_DECOMP *decomp)
Definition: decomp.c:1221
SCIP_HASHMAP * DECdecompGetConsindex(DEC_DECOMP *decomp)
Definition: decomp.c:1262
SCIP_CONS *** DECdecompGetSubscipconss(DEC_DECOMP *decomp)
Definition: decomp.c:908
void DECdecompSetNBlocks(DEC_DECOMP *decomp, int nblocks)
Definition: decomp.c:733
SCIP_HASHMAP * DECdecompGetVarindex(DEC_DECOMP *decomp)
Definition: decomp.c:1242
void DECdecompSetDetectorPctVarsToBorder(SCIP *scip, DEC_DECOMP *decomp, SCIP_Real *pctVarsToBorder)
Definition: decomp.c:1728
SCIP_Bool DECdecompositionsAreEqual(SCIP *scip, DEC_DECOMP *decomp1, DEC_DECOMP *decomp2)
Definition: decomp.c:3939
type definitions for decomposition information in GCG projects
SCIP_Real maxwhitescore
Definition: pub_decomp.h:64
void DECdecompSetVartoblock(DEC_DECOMP *decomp, SCIP_HASHMAP *vartoblock)
Definition: decomp.c:1187