Scippy

GCG

Branch-and-Price & Column Generation for Everyone

cons_decomp.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 cons_decomp.h
30 * @ingroup CONSHDLRS-GCG
31 * @brief constraint handler for structure detection
32 * @author Martin Bergner
33 * @author Michael Bastubbe
34 * @author Hanna Franzen
35 * @author Erik Muehmer
36 *
37 * This constraint handler manages the structure detection process. It will run all registered structure detectors in an
38 * iterative refinement scheme. Afterwards some post-processing detectors might be called.
39 */
40
41/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
42
43#ifndef GCG_CONS_DECOMP_H__
44#define GCG_CONS_DECOMP_H__
45
46#include "scip/scip.h"
47#include "scip/type_retcode.h"
48
49#include "gcg/gcg.h"
50
51
52#ifdef __cplusplus
53extern "C" {
54#endif
55
56/*
57 * incomplete type used in C code
58 */
60
61/** @brief Gets the character of the detector
62 * @returns detector character */
65 GCG_DETECTOR* detector /**< pointer to detector */
66 );
67
68/**
69 * @brief returns the data of the provided detector
70 * @returns data of the provided detector
71 */
74 GCG_DETECTOR* detector /**< Detector data structure */
75 );
76
77/**
78 * @brief returns the name of the provided detector
79 * @returns name of the given detector
80 */
82const char* GCGdetectorGetName(
83 GCG_DETECTOR* detector /**< detector data structure */
84 );
85
86/** @brief interface method to detect the structure including presolving
87 * @returns SCIP return code */
90 GCG* gcg, /**< GCG data structure */
91 SCIP_RESULT* result /**< Result pointer to indicate whether some structure was found */
92 );
93
94/**
95 * @brief searches for the consclassifier with the given name and returns it or NULL if classifier is not found
96 * @returns consclassifier pointer or NULL if consclassifier with given name is not found
97 */
100 GCG* gcg, /**< GCG data structure */
101 const char* name /**< the name of the searched consclassifier */
102 );
103
104/**
105 * @brief searches for the varclassifier with the given name and returns it or NULL if classifier is not found
106 * @returns varclassifier pointer or NULL if varclassifier with given name is not found
107 */
110 GCG* gcg, /**< GCG data structure */
111 const char* name /**< the name of the searched varclassifier */
112 );
113
114
115/**
116 * @brief searches for the detector with the given name and returns it or NULL if detector is not found
117 * @returns detector pointer or NULL if detector with given name is not found
118 */
121 GCG* gcg, /**< GCG data structure */
122 const char* name /**< the name of the searched detector */
123 );
124
125/** @brief method to adapt score for orig decomps
126 * @todo: change score for some parameter settings
127 *
128 * @returns new score */
131 GCG* gcg, /**< GCG data structure */
132 SCIP_Real oldscore /**< current score (to be updated) */
133 );
134
135/**
136 * @brief searches for the score with the given name and returns it or NULL if score is not found
137 * @returns score pointer or NULL if score with given name is not found
138 */
140 GCG* gcg,
141 const char* name
142 );
143
144/**
145 * @brief searches for the score with the given shortname and returns it or NULL if score is not found
146 * @returns score pointer or NULL if score with given shortname is not found
147 */
149 GCG* gcg,
150 const char* shortname
151 );
152
153/** @brief Gets the best known decomposition
154 *
155 * @note caller has to free returned GCG_DECOMP
156 * @returns the decomposition if available and NULL otherwise */
159 GCG* gcg, /**< GCG data structure */
160 SCIP_Bool printwarnings /**< should warnings pre printed */
161 );
162
163/**
164 * @brief returns the remaining time of scip that the decomposition may use
165 * @returns remaining time that the decompositon may use
166 */
169 GCG* gcg /**< GCG data structure */
170 );
171
172/**
173 * @brief includes one constraint classifier
174 * @returns scip return code
175 */
178 GCG* gcg, /**< GCG data structure */
179 const char* name, /**< name of the classifier */
180 const char* description, /**< describing main idea of this classifier */
181 int priority, /**< priority of the classifier */
182 SCIP_Bool enabled, /**< whether the classifier should be enabled by default */
183 GCG_CLASSIFIERDATA* classifierdata, /**< classifierdata the associated classifier data (or NULL) */
184 GCG_DECL_FREECONSCLASSIFIER((*freeClassifier)), /**< destructor of classifier (or NULL) */
185 GCG_DECL_CONSCLASSIFY((*classify)) /**< the method that will classify constraints or variables (must not be NULL) */
186 );
187
188/**
189 * @brief includes one detector
190 * @returns scip return code
191 */
194 GCG* gcg, /**< GCG data structure */
195 const char* name, /**< name of the detector */
196 const char decchar, /**< char that is used in detector chain history for this detector */
197 const char* description, /**< describing main idea of this detector */
198 int freqCallRound, /**< frequency the detector gets called in detection loop, i.e. it is called in round r if and only if minCallRound <= r <= maxCallRound AND (r - minCallRound) mod freqCallRound == 0 */
199 int maxCallRound, /**< last detection round the detector gets called */
200 int minCallRound, /**< first round the detector gets called (offset in detection loop) */
201 int freqCallRoundOriginal, /**< frequency the detector gets called in detection loop while detecting of the original problem */
202 int maxCallRoundOriginal, /**< last round the detector gets called while detecting of the original problem */
203 int minCallRoundOriginal, /**< first round the detector gets called (offset in detection loop) while detecting of the original problem */
204 int priority, /**< priority of the detector */
205 SCIP_Bool enabled, /**< whether the detector should be enabled by default */
206 SCIP_Bool enabledFinishing, /**< whether the finishing should be enabled */
207 SCIP_Bool enabledPostprocessing, /**< whether the postprocessing should be enabled */
208 SCIP_Bool skip, /**< whether the detector should be skipped if others found structure */
209 SCIP_Bool usefulRecall, /**< is it useful to call this detector on a descendant of the propagated partialdec */
210 GCG_DETECTORDATA *detectordata, /**< the associated detector data (or NULL) */
211 GCG_DECL_FREEDETECTOR((*freeDetector)), /**< destructor of detector (or NULL) */
212 GCG_DECL_INITDETECTOR((*initDetector)), /**< initialization method of detector (or NULL) */
213 GCG_DECL_EXITDETECTOR((*exitDetector)), /**< deinitialization method of detector (or NULL) */
214 GCG_DECL_PROPAGATEPARTIALDEC((*propagatePartialdecDetector)), /**< method to refine a partial decomposition inside detection loop (or NULL) */
215 GCG_DECL_FINISHPARTIALDEC((*finishPartialdecDetector)), /**< method to complete a partial decomposition when called in detection loop (or NULL) */
216 GCG_DECL_POSTPROCESSPARTIALDEC((*postprocessPartialdecDetector)), /**< method to postprocess a complete decomposition, called after detection loop (or NULL) */
217 GCG_DECL_SETPARAMAGGRESSIVE((*setParamAggressiveDetector)), /**< method that is called if the detection emphasis setting aggressive is chosen */
218 GCG_DECL_SETPARAMDEFAULT((*setParamDefaultDetector)), /**< method that is called if the detection emphasis setting default is chosen */
219 GCG_DECL_SETPARAMFAST((*setParamFastDetector)) /**< method that is called if the detection emphasis setting fast is chosen */
220 );
221
222/**
223 * @brief includes one variable classifier
224 * @returns scip return code
225 */
228 GCG* gcg, /**< GCG data structure */
229 const char* name, /**< name of the classifier */
230 const char* description, /**< description of the classifier */
231 int priority, /**< priority how early classifier is invoked */
232 SCIP_Bool enabled, /**< whether the classifier should be enabled by default */
233 GCG_CLASSIFIERDATA* classifierdata,/**< classifierdata the associated classifier data (or NULL) */
234 GCG_DECL_FREEVARCLASSIFIER((*freeClassifier)), /**< destructor of classifier (or NULL) */
235 GCG_DECL_VARCLASSIFY((*classify)) /**< method that will classify variables (must not be NULL) */
236 );
237
238/**
239 * @brief includes one score
240 * @returns scip return code
241 */
243 GCG* gcg, /**< GCG data structure */
244 const char* name, /**< name of the score */
245 const char* shortname, /**< shortname of the score */
246 const char* description, /**< description of the score */
247 GCG_SCOREDATA* scoredata, /**< scoredata the associated score data (or NULL) */
248 GCG_DECL_SCOREFREE ((*scorefree)), /**< destructor of score (or NULL) */
249 GCG_DECL_SCORECALC ((*scorecalc)) /**< method that will calculate the scorevalue (must not be NULL) */
250 );
251
252/** @brief writes out a list of all detectors */
255 GCG* gcg /**< GCG data structure */
256 );
257
258/** @brief write out all known decompositions
259 * @returns SCIP return code */
262 GCG* gcg, /**< GCG data structure */
263 char* directory, /**< directory for decompositions */
264 char* extension, /**< the file extension for the export */
265 SCIP_Bool original, /**< should decomps for original problem be written */
266 SCIP_Bool presolved /**< should decomps for preoslved problem be written */
267 );
268
269/** @brief writes all selected decompositions
270 * @returns scip return code
271*/
274 GCG* gcg, /**< GCG data structure */
275 char* directory, /**< directory for decompositions */
276 char* extension /**< extension for decompositions */
277 );
278
279/** @brief adds a candidate for block number and counts how often a candidate is added */
282 GCG* gcg, /**< GCG data structure */
283 SCIP_Bool origprob, /**< which DETPROBDATA that should be modified */
284 int candidate /**< proposed amount of blocks */
285);
286
287/**
288 * @brief creates and adds a basic partialdecomp (all cons/vars are assigned to master)
289 *
290 * @returns SCIP_RETCODE
291 */
294 GCG* gcg, /**< GCG data structure */
295 SCIP_Bool presolved, /**< create basic partialdecomp for presolved if true, otherwise for original */
296 PARTIALDECOMP_C** partialdecomp /**< pointer to the C pointer of the created partialdecomp */
297 );
298
299/**
300 * @brief creates a pure matrix partialdecomp (i.e. all cons/vars to one single block)
301 *
302 * matrix is added to list of all partialdecs
303 * @returns id of matrix partialdec
304 */
307 GCG* gcg, /**< GCG data structure */
308 SCIP_Bool presolved /**< create matrix for presolved if true, otherwise for original */
309 );
310
311/**
312 * @brief adds a decomp that exists before the detection is called
313 * @note this method should only be called if there is no partialdec for this decomposition
314 * @returns scip return code
315 */
318 GCG* gcg, /**< GCG data structure */
319 GCG_DECOMP* decomp /**< decomposition data structure */
320 );
321
322/** @brief adds a candidate for block size given by the user */
325 GCG* gcg, /**< GCG data structure */
326 int candidate /**< candidate for block size */
327 );
328
329/**
330 * @brief checks if two pricing problems are identical based on information from detection
331 * @returns scip return code
332 */
335 GCG* gcg, /**< GCG data structure */
336 PARTIALDECOMP_C* partialdecomp, /**< partial decompostion for which the pricing problems are checked for identity */
337 int probnr1, /**< index of first block to check */
338 int probnr2, /**< index of second block to check */
339 SCIP_Bool* identical /**< bool pointer to score the result of the check*/
340 );
341
342/**
343 * @brief calculates and adds block size candidates using constraint classifications and variable classifications
344 */
347 GCG* gcg, /**< GCG data structure */
348 SCIP_Bool transformed /**< whether to find the candidates for the transformed problem, otherwise the original */
349);
350
351/**
352 * @brief check whether partialdecs are consistent
353 *
354 * Checks whether
355 * 1) the predecessors of all finished partialdecs in both detprobdatas can be found
356 * 2) selected list is synchron with selected information in partialdecs
357 * 3) selected exists is synchronized with selected list
358 *
359 * @returns true if partialdec information is consistent */
362 GCG* gcg /**< GCG data structure **/
363 );
364
365/**
366 * @brief run classification of vars and cons
367 *
368 * @returns scip return code
369 */
372 GCG* gcg, /**< GCG data structure */
373 SCIP_Bool transformed /**< whether to classify the transformed problem, otherwise the original */
374);
375
376/**
377 * @brief for two identical pricing problems a corresponding varmap is created
378 * @param scip scip data structure
379 * @param hashorig2pricingvar mapping from orig to pricingvar
380 * @param partialdecomp partial decompostion for which the pricing problems are checked for identity
381 * @param probnr1 index of first block
382 * @param probnr2 index of second block
383 * @param scip1 subscip of first block
384 * @param scip2 subscip of second block
385 * @param varmap mapping from orig to pricingvar
386 * @returns scip return code
387 */
390 GCG* gcg,
391 SCIP_HASHMAP** hashorig2pricingvar,
392 PARTIALDECOMP_C* partialdecomp,
393 int probnr1,
394 int probnr2,
395 SCIP* scip1,
396 SCIP* scip2,
397 SCIP_HASHMAP* varmap
398 );
399
400/**
401 * @brief decreases the counter for created decompositions and returns it
402 * @returns number of created decompositions that was recently decreased
403 */
406 GCG* gcg /**< GCG data structure **/
407 );
408
409/** @brief deregisters partialdecs in the conshdlr
410 *
411 * Use this function for deletion of ALL the partialdecs.
412 */
415 GCG* gcg, /**< GCG data structure */
416 SCIP_Bool original /**< iff TRUE the status with respect to the original problem is returned */
417 );
418
419/** @brief Frees Detprobdata of the original and transformed/presolved problem.
420 *
421 * @note Does not free Detprobdata of the original problem if GCGconshdlrDecompFreeOrigOnExit is set to false.
422 */
424 GCG* gcg /**< GCG data structure */
425 );
426
427/**
428 * @brief sets freeing of detection data of original problem during exit to true
429 *
430 * used before calling SCIPfreeTransform(),
431 * set to true to revoke presolving
432 * (e.g. if unpresolved decomposition is used, and transformation is not successful)
433 */
436 GCG* gcg, /**< GCG data structure */
437 SCIP_Bool free /**< whether to free orig data */
438 );
439
440/**
441 * @brief returns block number user candidate with given index
442 * @param scip SCIP data structure
443 * @param index index of block number user candidate that should be returned
444 * @returns block number user candidate with given index
445 */
448 GCG* gcg,
449 int index
450 );
451
452/**
453 * @brief returns the total detection time
454 * @param scip SCIP data structure
455 * @returns total detection time
456 */
459 GCG* gcg
460 );
461
462/** @brief returns an array containing all decompositions
463 *
464 * Updates the decomp decomposition structure by converting all finished partialdecs into decompositions and replacing the
465 * old list in the conshdlr.
466 *
467 * @returns decomposition array
468 * */
471 GCG* gcg /**< GCG data structure */
472 );
473
474/** @brief Gets an array of all detectors
475 *
476 * @returns array of detectors */
479 GCG* gcg /**< GCG data structure */
480 );
481
482/** @brief Gets an array of all scores
483 *
484 * @returns array of scores */
486 GCG* gcg
487 );
488
489/**
490 * @brief Gets the shortname of the currently enabled score
491 * @returns the shortname of the currently enabled score
492 */
495 GCG* gcg
496 );
497
498/**
499 * @brief Gets the currently enabled score
500 * @returns the currently enabled score
501 */
504 GCG* gcg
505 );
506
507/** @brief gets an array of all constraint classifier
508 *
509 * @returns array of constraint classifier */
512 GCG* gcg /**< GCG data structure */
513 );
514
515/** @brief gets an array of all variable classifier
516 *
517 * @returns array of variable classifier */
520 GCG* gcg
521 );
522
523/** @brief Gets a list of ids of the current partialdecs that are finished
524 *
525 * @note recommendation: when in doubt plan for as many ids as partialdecs
526 * @see GCGconshdlrDecompGetNPartialdecs
527 * @returns scip return code */
530 GCG* gcg, /**< GCG data structure */
531 int** idlist, /**< id list to output to */
532 int* listlength /**< length of output list */
533 );
534
535/** @brief Gets a list of ids of the current partialdecs
536 *
537 * @note recommendation: when in doubt plan for as many ids as partialdecs
538 * @see GCGconshdlrDecompGetNPartialdecs
539 * @returns scip return code */
542 GCG* gcg, /**< GCG data structure */
543 int** idlist, /**< id list to output to */
544 int* listlength /**< length of output list */
545);
546
547/**
548 * @brief returns the number of block candidates given by the user
549 * @returns number of block candidates given by the user
550 */
553 GCG* gcg /**< GCG data structure */
554 );
555
556/** @brief gets block number of partialdec
557 * @returns block number of partialdec
558 */
561 PARTIALDECOMP_C* partialdecomp /**< partialdec */
562 );
563
564/** @brief gets the number of decompositions (= amount of finished partialdecs)
565 *
566 * @returns number of decompositions */
569 GCG* gcg /**< GCG data structure */
570 );
571
572/** @brief Gets the number of all detectors
573 * @returns number of detectors */
576 GCG* gcg /**< GCG data structure */
577 );
578
579/** @brief Gets the number of all scores
580 * @returns number of scores */
582 GCG* gcg /**< GCG data structure */
583 );
584
585/** @brief Gets the number of all constraint classifiers
586 * @returns number of constraint classifiers */
589 GCG* gcg /**< GCG data structure */
590 );
591
592/** @brief Gets the number of all variable classifiers
593 * @returns number of variable classifiers */
596 GCG* gcg
597 );
598
599/** @brief Gets the next partialdec id managed by cons_decomp
600 * @returns the next partialdec id managed by cons_decomp */
603 GCG* gcg /**< GCG data structure **/
604 );
605
606/** @brief gets number of active constraints during the detection of the decomp with given id
607 *
608 * Gets the number of constraints that were active while detecting the decomposition originating from the partialdec with the
609 * given id, this method is used to decide if the problem has changed since detection, if so the aggregation information
610 * needs to be recalculated
611 *
612 * @note if the partialdec is not complete the function returns -1
613 *
614 * @returns number of constraints that were active while detecting the decomposition
615 */
618 GCG* gcg, /**< GCG data structure */
619 int id /**< id of the partialdec the information is asked for */
620 );
621
622/** @brief returns whether aggregation information has been calculated for a partialdec
623 * @returns bool that indicates whether aggregation information has been calculated
624 */
627 PARTIALDECOMP_C* partialdecomp /**< partialdec */
628 );
629
630/** @brief calculates aggregation information for a partialdec
631 */
634 PARTIALDECOMP_C* partialdecomp, /**< partialdec */
635 SCIP_Bool ignoreDetectionLimits /**< Set to true if computation should ignore detection limits. This parameter is ignored if the patched bliss version is not present. */
636 );
637
638/** @brief gets number of equivalence classes of partialdec
639 * @returns number of equivalence classes of partialdec
640 */
643 PARTIALDECOMP_C* partialdecomp /**< partialdec */
644 );
645
646/** @brief gets the representative block of a equivalence class of partialdec
647 * @returns representative block
648 */
651 PARTIALDECOMP_C* partialdecomp, /**< partialdec */
652 int eqclass /**< id of the equivalence class */
653 );
654
655/** @brief gets the blocks of a equivalence class of partialdec
656 * @returns representative block
657 */
660 PARTIALDECOMP_C* partialdecomp, /**< partialdec */
661 int eqclass /**< id of the equivalence class */
662 );
663
664/** @brief gets the number of blocks of a equivalence class of partialdec
665 * @returns representative block
666 */
669 PARTIALDECOMP_C* partialdecomp, /**< partialdec */
670 int eqclass /**< id of the equivalence class */
671 );
672
673/** @brief Returns a vector that maps probvar indices of a block contained in an equivalence class to the probvar indices of the representative block of the class
674 * @returns representative block
675 */
678 PARTIALDECOMP_C* partialdecomp, /**< partialdec */
679 int eqclass, /**< id of the equivalence class */
680 int eqclassblock /** index of block (with respect to eqclass) */
681 );
682
683/** @brief gets number of linking variables of partialdec
684 * @returns number of linking variables of partialdec
685 */
688 PARTIALDECOMP_C* partialdecomp /**< partialdec */
689 );
690
691/** @brief gets number of master constraints of partialdec
692 * @returns number of master constraints of partialdec
693 */
696 PARTIALDECOMP_C* partialdecomp /**< partialdec */
697 );
698
699/** @brief gets number of master variables of partialdec
700 * @returns number of master variables of partialdec
701 */
704 PARTIALDECOMP_C* partialdecomp /**< partialdec */
705 );
706
707/** @brief gets number of open constraints of partialdec
708 * @returns total number of open constraints of partialdec
709 */
712 PARTIALDECOMP_C* partialdecomp /**< partialdec */
713 );
714
715/** @brief gets number of open variables of partialdec
716 * @returns total number of open variables of partialdec
717 */
720 PARTIALDECOMP_C* partialdecomp /**< partialdec */
721 );
722
723/** @brief returns the original variable for a block and index
724 * @returns corresponding original variable
725 */
728 PARTIALDECOMP_C* partialdecomp, /**< partialdec */
729 int block, /**< id of the block */
730 int blockvarindex /**< index of var in block */
731 );
732
733/** @brief gets the number of variables of a block
734 * @returns representative block
735 */
738 PARTIALDECOMP_C* partialdecomp, /**< partialdec */
739 int block /**< id of the block */
740);
741
742/** @brief Gets the number of finished partialdecs available for the original problem
743 * @returns number of partialdecs */
746 GCG* gcg /**< GCG data structure */
747 );
748
749/** @brief Gets the number of finished partialdecs available for the transformed problem
750 * @returns number of partialdecs */
753 GCG* gcg /**< GCG data structure */
754 );
755
756/** @brief Gets the number of open partialdecs available for the original problem
757 * @returns number of partialdecs */
760 GCG* gcg /**< GCG data structure */
761);
762
763/** @brief Gets the number of open partialdecs available for the transformed problem
764 * @returns number of partialdecs */
767 GCG* gcg /**< GCG data structure */
768);
769
770/** @brief Gets the number of all partialdecs
771 * @returns number of Partialdecs */
774 GCG* gcg /**< GCG data structure */
775 );
776
777/** @brief Gets the number of partialdecs available for the original problem
778 * @returns number of partialdecs */
781 GCG* gcg /**< GCG data structure */
782 );
783
784/** @brief Gets the number of partialdecs available for the transformed problem
785 * @returns number of partialdecs */
788 GCG* gcg /**< GCG data structure */
789 );
790
791/** @brief gets number of stairlinking variables of partialdec
792 * @returns total number of stairlinking variables of partialdec
793 */
796 PARTIALDECOMP_C* partialdecomp /**< partialdec */
797 );
798
799/** @brief Gets wrapped PARTIALDECOMP with given id
800 *
801 * @returns SCIP return code */
804 GCG* gcg, /**< GCG data structure */
805 int partialdecid, /**< id of PARTIALDECOMP */
806 PARTIALDECOMP_C** partialdecomp /**< pointer to C wrapper pointer for PARTIALDECOMP */
807 );
808
809/** @brief gets score of partialdec
810 * @returns score in respect to current score type
811 */
814 PARTIALDECOMP_C* partialdecomp /**< partialdec */
815 );
816
817/** @brief gets the clock tracking the score computation time
818 * @returns pointer to a clock object
819 */
822 GCG* gcg /**< GCG data structure */
823 );
824
825/** @brief gets total score computation time
826 * @returns total score computation time
827 */
830 GCG* gcg /**< GCG data structure */
831 );
832
833/** @brief Gets a list of ids of all currently selected partialdecs
834 * @returns list of partialdecs */
837 GCG* gcg, /**< GCG data structure */
838 int** idlist, /**< id list to output to */
839 int* listlength /**< length of output list */
840 );
841
842/**
843 * @brief counts up the counter for created decompositions and returns it
844 * @returns number of created decompositions that was recently increased
845 */
848 GCG* gcg /**< GCG data structure **/
849 );
850
851/** @brief gets whether partialdec is presolved
852 * @returns true iff partialdec is presolved
853 */
856 PARTIALDECOMP_C* partialdecomp /**< partialdec */
857 );
858
859/** @brief gets whether partialdec is selected
860 * @returns true iff partialdec is selected
861 */
864 PARTIALDECOMP_C* partialdececomp /**< partialdec */
865 );
866
867/**
868 * @brief returns whether or not a detprobdata structure for the original problem exists
869 * @returns true iff an original detprobdata exists
870 */
873 GCG* gcg /**< GCG data structure */
874 );
875
876/**
877 * @brief returns whether or not an original decompositions exists in the data structures
878 * @returns true iff an origial decomposition exist
879 */
882 GCG* gcg /**< GCG data structure */
883 );
884
885/**
886 * @brief returns whether or not a detprobdata structure for the presolved problem exists
887 * @returns true iff a presolved detprobdata exists
888 */
891 GCG* gcg /**< GCG data structure */
892 );
893
894/** @brief display statistics about detectors
895 * @returns SCIP return code */
898 GCG* gcg, /**< GCG data structure */
899 FILE* file /**< output file or NULL for standard output */
900 );
901
902/** @brief display statistics about scores
903 * @returns SCIP return code */
906 GCG* gcg, /**< GCG data structure */
907 FILE* file /**< output file or NULL for standard output */
908 );
909
910/**
911 * @brief selects/unselects a partialdecomp
912 *
913 * @returns SCIP return code
914 */
917 PARTIALDECOMP_C* partialdecomp, /**< partialdecomp */
918 SCIP_Bool select /**< select/unselect */
919 );
920
921/** @brief sets detector parameters values
922 *
923 * sets detector parameters values to
924 *
925 * - SCIP_PARAMSETTING_DEFAULT which are the default values of all detector parameters
926 * - SCIP_PARAMSETTING_FAST such that the time spend for detection is decreased
927 * - SCIP_PARAMSETTING_AGGRESSIVE such that the detectors produce more decompositions
928 * - SCIP_PARAMSETTING_OFF which turns off all detection
929 *
930 * @returns SCIP return code
931 */
934 GCG* gcg, /**< GCG data structure */
935 SCIP_PARAMSETTING paramsetting, /**< parameter settings */
936 SCIP_Bool quiet /**< should the parameter be set quiet (no output) */
937 );
938
939/**
940 * @brief translates n best unpresolved partialdec to a complete presolved one
941 * @param scip SCIP data structure
942 * @param n number of partialdecs that should be translated
943 * @param completeGreedily whether or not to complete the decomposition greedily
944 * @param translateSymmetry whether or not to translate symmetry information
945 * @returns SCIP return code
946 */
949 GCG* gcg,
950 int n,
951 SCIP_Bool completeGreedily,
952 SCIP_Bool translateSymmetry
953);
954
955/**
956 * @brief translates unpresolved partialdec to a complete presolved one
957 * @param gcg GCG data structure
958 * @returns SCIP return code
959 */
962 GCG* gcg
963 );
964
965/** Gets whether the detection already took place
966 * @returns true if detection took place, false otherwise */
969 GCG* gcg, /**< GCG data structure */
970 SCIP_Bool original /**< iff TRUE the status with respect to the original problem is returned */
971 );
972
973/**
974 * method to eliminate duplicate constraint names and name unnamed constraints
975 * @return SCIP return code
976 */
979 GCG* gcg /**< GCG data structure */
980 );
981
982/**
983 * @brief creates the constraint handler for decomp and includes it in SCIP
984 * @returns scip return code
985 */
988 GCG* gcg /**< GCG data structure */
989 );
990
991#ifdef __cplusplus
992}
993#endif
994
995#endif
GCG_EXPORT const int * GCGconshdlrDecompPartialdecGetRepVarMap(PARTIALDECOMP_C *partialdecomp, int eqclass, int eqclassblock)
Returns a vector that maps probvar indices of a block contained in an equivalence class to the probva...
GCG_EXPORT SCIP_RETCODE GCGconshdlrDecompArePricingprobsIdenticalForPartialdec(GCG *gcg, PARTIALDECOMP_C *partialdecomp, int probnr1, int probnr2, SCIP_Bool *identical)
checks if two pricing problems are identical based on information from detection
GCG_EXPORT SCIP_VAR * GCGconshdlrDecompPartialdecGetOrigVarForBlock(PARTIALDECOMP_C *partialdecomp, int block, int blockvarindex)
returns the original variable for a block and index
GCG_EXPORT void GCGconshdlrDecompAddCandidatesNBlocks(GCG *gcg, SCIP_Bool origprob, int candidate)
adds a candidate for block number and counts how often a candidate is added
GCG_EXPORT int GCGconshdlrDecompPartialdecGetNMasterVars(PARTIALDECOMP_C *partialdecomp)
gets number of master variables of partialdec
GCG_EXPORT char * GCGgetCurrentScoreShortname(GCG *gcg)
Gets the shortname of the currently enabled score.
GCG_EXPORT SCIP_CLOCK * GCGconshdlrDecompGetScoreClock(GCG *gcg)
gets the clock tracking the score computation time
GCG_EXPORT void GCGconshdlrDecompPartialdecCalcAggregationInformation(PARTIALDECOMP_C *partialdecomp, SCIP_Bool ignoreDetectionLimits)
calculates aggregation information for a partialdec
GCG_EXPORT unsigned int GCGconshdlrDecompGetNOpenPartialdecsTransformed(GCG *gcg)
Gets the number of open partialdecs available for the transformed problem.
GCG_EXPORT SCIP_Bool GCGconshdlrDecompPartialdecAggregationInformationCalculated(PARTIALDECOMP_C *partialdecomp)
returns whether aggregation information has been calculated for a partialdec
GCG_EXPORT SCIP_RETCODE GCGincludeDetector(GCG *gcg, const char *name, const char decchar, const char *description, int freqCallRound, int maxCallRound, int minCallRound, int freqCallRoundOriginal, int maxCallRoundOriginal, int minCallRoundOriginal, int priority, SCIP_Bool enabled, SCIP_Bool enabledFinishing, SCIP_Bool enabledPostprocessing, SCIP_Bool skip, SCIP_Bool usefulRecall, GCG_DETECTORDATA *detectordata, GCG_DECL_FREEDETECTOR((*freeDetector)), GCG_DECL_INITDETECTOR((*initDetector)), GCG_DECL_EXITDETECTOR((*exitDetector)), GCG_DECL_PROPAGATEPARTIALDEC((*propagatePartialdecDetector)), GCG_DECL_FINISHPARTIALDEC((*finishPartialdecDetector)), GCG_DECL_POSTPROCESSPARTIALDEC((*postprocessPartialdecDetector)), GCG_DECL_SETPARAMAGGRESSIVE((*setParamAggressiveDetector)), GCG_DECL_SETPARAMDEFAULT((*setParamDefaultDetector)), GCG_DECL_SETPARAMFAST((*setParamFastDetector)))
includes one detector
GCG_EXPORT int GCGconshdlrDecompPartialdecGetNLinkingVars(PARTIALDECOMP_C *partialdecomp)
gets number of linking variables of partialdec
GCG_EXPORT void GCGconshdlrDecompDeregisterPartialdecs(GCG *gcg, SCIP_Bool original)
deregisters partialdecs in the conshdlr
GCG_EXPORT SCIP_RETCODE GCGconshdlrDecompGetSelectedPartialdecs(GCG *gcg, int **idlist, int *listlength)
Gets a list of ids of all currently selected partialdecs.
GCG_EXPORT SCIP_Bool GCGconshdlrDecompOrigPartialdecExists(GCG *gcg)
returns whether or not an original decompositions exists in the data structures
GCG_EXPORT int GCGconshdlrDecompPartialdecGetNMasterConss(PARTIALDECOMP_C *partialdecomp)
gets number of master constraints of partialdec
GCG_EXPORT int GCGconshdlrDecompGetNVarClassifiers(GCG *gcg)
Gets the number of all variable classifiers.
GCG_EXPORT unsigned int GCGconshdlrDecompGetNPartialdecs(GCG *gcg)
Gets the number of all partialdecs.
GCG_EXPORT int GCGconshdlrDecompGetNextPartialdecID(GCG *gcg)
Gets the next partialdec id managed by cons_decomp.
GCG_SCORE ** GCGconshdlrDecompGetScores(GCG *gcg)
Gets an array of all scores.
GCG_EXPORT SCIP_Real GCGconshdlrDecompGetPartialdecScore(PARTIALDECOMP_C *partialdecomp)
gets score of partialdec
GCG_EXPORT int GCGconshdlrDecompAddMatrixPartialdec(GCG *gcg, SCIP_Bool presolved)
creates a pure matrix partialdecomp (i.e. all cons/vars to one single block)
GCG_EXPORT char GCGdetectorGetChar(GCG_DETECTOR *detector)
Gets the character of the detector.
GCG_EXPORT SCIP_RETCODE GCGconshdlrDecompPrintDetectorStatistics(GCG *gcg, FILE *file)
display statistics about detectors
SCIP_RETCODE GCGconshdlrDecompIncludeScore(GCG *gcg, const char *name, const char *shortname, const char *description, GCG_SCOREDATA *scoredata, GCG_DECL_SCOREFREE((*scorefree)), GCG_DECL_SCORECALC((*scorecalc)))
includes one score
GCG_EXPORT SCIP_Bool GCGconshdlrDecompOrigDetprobdataExists(GCG *gcg)
returns whether or not a detprobdata structure for the original problem exists
GCG_EXPORT int GCGconshdlrDecompGetNDecomps(GCG *gcg)
gets the number of decompositions (= amount of finished partialdecs)
GCG_EXPORT SCIP_Bool GCGdetectionTookPlace(GCG *gcg, SCIP_Bool original)
GCG_EXPORT SCIP_RETCODE GCGincludeVarClassifier(GCG *gcg, const char *name, const char *description, int priority, SCIP_Bool enabled, GCG_CLASSIFIERDATA *classifierdata, GCG_DECL_FREEVARCLASSIFIER((*freeClassifier)), GCG_DECL_VARCLASSIFY((*classify)))
includes one variable classifier
GCG_EXPORT int GCGconshdlrDecompPartialdecGetNVarsForBlock(PARTIALDECOMP_C *partialdecomp, int block)
gets the number of variables of a block
GCG_EXPORT SCIP_Bool GCGconshdlrDecompPartialdecIsPresolved(PARTIALDECOMP_C *partialdecomp)
gets whether partialdec is presolved
GCG_EXPORT SCIP_RETCODE GCGconshdlrDecompSelectPartialdec(PARTIALDECOMP_C *partialdecomp, SCIP_Bool select)
selects/unselects a partialdecomp
GCG_EXPORT int GCGconshdlrDecompDecreaseNCallsCreateDecomp(GCG *gcg)
decreases the counter for created decompositions and returns it
GCG_SCORE * GCGconshdlrDecompFindScoreByShortname(GCG *gcg, const char *shortname)
searches for the score with the given shortname and returns it or NULL if score is not found
GCG_EXPORT void GCGconshdlrDecompCalcCandidatesNBlocks(GCG *gcg, SCIP_Bool transformed)
calculates and adds block size candidates using constraint classifications and variable classificatio...
GCG_EXPORT SCIP_Real GCGconshdlrDecompGetCompleteDetectionTime(GCG *gcg)
returns the total detection time
GCG_EXPORT unsigned int GCGconshdlrDecompGetNOpenPartialdecsOrig(GCG *gcg)
Gets the number of open partialdecs available for the original problem.
GCG_EXPORT int GCGconshdlrDecompPartialdecGetNStairlinkingVars(PARTIALDECOMP_C *partialdecomp)
gets number of stairlinking variables of partialdec
GCG_EXPORT SCIP_RETCODE GCGwriteAllDecomps(GCG *gcg, char *directory, char *extension, SCIP_Bool original, SCIP_Bool presolved)
write out all known decompositions
GCG_EXPORT SCIP_RETCODE GCGdetectStructure(GCG *gcg, SCIP_RESULT *result)
interface method to detect the structure including presolving
GCG_EXPORT GCG_DECOMP * GCGgetBestDecomp(GCG *gcg, SCIP_Bool printwarnings)
Gets the best known decomposition.
GCG_EXPORT SCIP_RETCODE GCGconshdlrDecompGetPartialdecFromID(GCG *gcg, int partialdecid, PARTIALDECOMP_C **partialdecomp)
Gets wrapped PARTIALDECOMP with given id.
GCG_EXPORT SCIP_RETCODE GCGconshdlrDecompCreateVarmapForPartialdec(GCG *gcg, SCIP_HASHMAP **hashorig2pricingvar, PARTIALDECOMP_C *partialdecomp, int probnr1, int probnr2, SCIP *scip1, SCIP *scip2, SCIP_HASHMAP *varmap)
for two identical pricing problems a corresponding varmap is created
GCG_EXPORT void GCGconshdlrDecompAddUserCandidatesNBlocks(GCG *gcg, int candidate)
adds a candidate for block size given by the user
GCG_EXPORT SCIP_RETCODE SCIPconshdlrDecompRepairConsNames(GCG *gcg)
GCG_EXPORT SCIP_RETCODE GCGconshdlrDecompSetDetection(GCG *gcg, SCIP_PARAMSETTING paramsetting, SCIP_Bool quiet)
sets detector parameters values
GCG_EXPORT SCIP_Bool GCGconshdlrDecompPartialdecIsSelected(PARTIALDECOMP_C *partialdececomp)
gets whether partialdec is selected
GCG_EXPORT int GCGconshdlrDecompIncreaseNCallsCreateDecomp(GCG *gcg)
counts up the counter for created decompositions and returns it
GCG_EXPORT int GCGconshdlrDecompGetBlockNumberCandidate(GCG *gcg, int index)
returns block number user candidate with given index
GCG_EXPORT SCIP_RETCODE GCGincludeConsClassifier(GCG *gcg, const char *name, const char *description, int priority, SCIP_Bool enabled, GCG_CLASSIFIERDATA *classifierdata, GCG_DECL_FREECONSCLASSIFIER((*freeClassifier)), GCG_DECL_CONSCLASSIFY((*classify)))
includes one constraint classifier
GCG_EXPORT int GCGconshdlrDecompPartialdecGetNOpenVars(PARTIALDECOMP_C *partialdecomp)
gets number of open variables of partialdec
GCG_EXPORT SCIP_RETCODE GCGconshdlrDecompAddPreexistingDecomp(GCG *gcg, GCG_DECOMP *decomp)
adds a decomp that exists before the detection is called
void GCGconshdlrDecompFreeDetprobdata(GCG *gcg)
Frees Detprobdata of the original and transformed/presolved problem.
GCG_EXPORT SCIP_Real GCGgetRemainingTime(GCG *gcg)
returns the remaining time of scip that the decomposition may use
GCG_EXPORT int GCGconshdlrDecompGetNConsClassifiers(GCG *gcg)
Gets the number of all constraint classifiers.
GCG_EXPORT SCIP_Bool GCGconshdlrDecompPresolvedDetprobdataExists(GCG *gcg)
returns whether or not a detprobdata structure for the presolved problem exists
GCG_EXPORT unsigned int GCGconshdlrDecompGetNFinishedPartialdecsTransformed(GCG *gcg)
Gets the number of finished partialdecs available for the transformed problem.
GCG_EXPORT void GCGprintListOfDetectors(GCG *gcg)
writes out a list of all detectors
GCG_EXPORT const int * GCGconshdlrDecompPartialdecGetBlocksForEqClass(PARTIALDECOMP_C *partialdecomp, int eqclass)
gets the blocks of a equivalence class of partialdec
GCG_EXPORT int GCGconshdlrDecompGetNBlockNumberCandidates(GCG *gcg)
returns the number of block candidates given by the user
GCG_EXPORT unsigned int GCGconshdlrDecompGetNPartialdecsTransformed(GCG *gcg)
Gets the number of partialdecs available for the transformed problem.
GCG_EXPORT int GCGconshdlrDecompPartialdecGetNBlocks(PARTIALDECOMP_C *partialdecomp)
gets block number of partialdec
GCG_EXPORT SCIP_Real GCGconshdlrDecompAdaptScore(GCG *gcg, SCIP_Real oldscore)
method to adapt score for orig decomps
GCG_EXPORT int GCGconshdlrDecompPartialdecGetReprBlockForEqClass(PARTIALDECOMP_C *partialdecomp, int eqclass)
gets the representative block of a equivalence class of partialdec
GCG_EXPORT GCG_DETECTOR * GCGfindDetector(GCG *gcg, const char *name)
searches for the detector with the given name and returns it or NULL if detector is not found
GCG_EXPORT SCIP_RETCODE GCGconshdlrDecompPrintScoreStatistics(GCG *gcg, FILE *file)
display statistics about scores
GCG_EXPORT GCG_VARCLASSIFIER * GCGfindVarClassifier(GCG *gcg, const char *name)
searches for the varclassifier with the given name and returns it or NULL if classifier is not found
GCG_EXPORT unsigned int GCGconshdlrDecompGetNFinishedPartialdecsOrig(GCG *gcg)
Gets the number of finished partialdecs available for the original problem.
struct PARTIALDECOMP_C PARTIALDECOMP_C
Definition: cons_decomp.h:59
GCG_EXPORT int GCGconshdlrDecompPartialdecGetNOpenConss(PARTIALDECOMP_C *partialdecomp)
gets number of open constraints of partialdec
GCG_EXPORT GCG_DETECTOR ** GCGconshdlrDecompGetDetectors(GCG *gcg)
Gets an array of all detectors.
GCG_EXPORT SCIP_Real GCGconshdlrDecompGetScoreTotalTime(GCG *gcg)
gets total score computation time
GCG_EXPORT SCIP_RETCODE GCGconshdlrDecompClassify(GCG *gcg, SCIP_Bool transformed)
run classification of vars and cons
GCG_EXPORT int GCGconshdlrDecompPartialdecGetNEquivalenceClasses(PARTIALDECOMP_C *partialdecomp)
gets number of equivalence classes of partialdec
GCG_EXPORT SCIP_RETCODE GCGconshdlrDecompAddBasicPartialdec(GCG *gcg, SCIP_Bool presolved, PARTIALDECOMP_C **partialdecomp)
creates and adds a basic partialdecomp (all cons/vars are assigned to master)
GCG_EXPORT SCIP_RETCODE GCGwriteSelectedDecomps(GCG *gcg, char *directory, char *extension)
writes all selected decompositions
GCG_EXPORT SCIP_Bool GCGconshdlrDecompCheckConsistency(GCG *gcg)
check whether partialdecs are consistent
GCG_EXPORT SCIP_RETCODE GCGconshdlrDecompTranslateNBestOrigPartialdecs(GCG *gcg, int n, SCIP_Bool completeGreedily, SCIP_Bool translateSymmetry)
translates n best unpresolved partialdec to a complete presolved one
GCG_EXPORT const char * GCGdetectorGetName(GCG_DETECTOR *detector)
returns the name of the provided detector
int GCGconshdlrDecompGetNScores(GCG *gcg)
Gets the number of all scores.
GCG_EXPORT GCG_VARCLASSIFIER ** GCGconshdlrDecompGetVarClassifiers(GCG *gcg)
gets an array of all variable classifier
GCG_EXPORT SCIP_RETCODE GCGconshdlrDecompTranslateOrigPartialdecs(GCG *gcg)
translates unpresolved partialdec to a complete presolved one
GCG_EXPORT void GCGconshdlrDecompFreeOrigOnExit(GCG *gcg, SCIP_Bool free)
sets freeing of detection data of original problem during exit to true
GCG_EXPORT SCIP_RETCODE GCGincludeConshdlrDecomp(GCG *gcg)
creates the constraint handler for decomp and includes it in SCIP
GCG_EXPORT SCIP_RETCODE GCGconshdlrDecompGetPartialdecsList(GCG *gcg, int **idlist, int *listlength)
Gets a list of ids of the current partialdecs.
GCG_EXPORT int GCGconshdlrDecompGetNFormerDetectionConssForID(GCG *gcg, int id)
gets number of active constraints during the detection of the decomp with given id
GCG_EXPORT GCG_CONSCLASSIFIER ** GCGconshdlrDecompGetConsClassifiers(GCG *gcg)
gets an array of all constraint classifier
GCG_EXPORT SCIP_RETCODE GCGconshdlrDecompGetFinishedPartialdecsList(GCG *gcg, int **idlist, int *listlength)
Gets a list of ids of the current partialdecs that are finished.
GCG_EXPORT GCG_SCORE * GCGgetCurrentScore(GCG *gcg)
Gets the currently enabled score.
GCG_EXPORT GCG_DETECTORDATA * GCGdetectorGetData(GCG_DETECTOR *detector)
returns the data of the provided detector
GCG_EXPORT int GCGconshdlrDecompPartialdecGetNBlocksForEqClass(PARTIALDECOMP_C *partialdecomp, int eqclass)
gets the number of blocks of a equivalence class of partialdec
GCG_EXPORT int GCGconshdlrDecompGetNDetectors(GCG *gcg)
Gets the number of all detectors.
GCG_SCORE * GCGconshdlrDecompFindScore(GCG *gcg, const char *name)
searches for the score with the given name and returns it or NULL if score is not found
GCG_EXPORT GCG_CONSCLASSIFIER * GCGfindConsClassifier(GCG *gcg, const char *name)
searches for the consclassifier with the given name and returns it or NULL if classifier is not found
GCG_EXPORT GCG_DECOMP ** GCGconshdlrDecompGetDecomps(GCG *gcg)
returns an array containing all decompositions
GCG_EXPORT unsigned int GCGconshdlrDecompGetNPartialdecsOrig(GCG *gcg)
Gets the number of partialdecs available for the original problem.
GCG_DECL_PROPAGATEPARTIALDEC(detectorPropagatePartialdecIsomorph)
GCG_DECL_FREEDETECTOR(freeNeighborhoodmaster)
#define GCG_EXPORT
Definition: def.h:59
#define SCIP_Bool
#define SCIP_Real
GCG interface methods.
Definition: struct_gcg.h:55
#define GCG_DECL_CONSCLASSIFY(x)
#define GCG_DECL_FREECONSCLASSIFIER(x)
#define GCG_DECL_INITDETECTOR(x)
Definition: type_detector.h:72
#define GCG_DECL_SETPARAMFAST(x)
#define GCG_DECL_SETPARAMDEFAULT(x)
#define GCG_DECL_EXITDETECTOR(x)
Definition: type_detector.h:82
#define GCG_DECL_SETPARAMAGGRESSIVE(x)
#define GCG_DECL_POSTPROCESSPARTIALDEC(x)
#define GCG_DECL_FINISHPARTIALDEC(x)
enum SCIP_ParamSetting SCIP_PARAMSETTING
enum SCIP_Result SCIP_RESULT
enum SCIP_Retcode SCIP_RETCODE
#define GCG_DECL_SCOREFREE(x)
Definition: type_score.h:55
#define GCG_DECL_SCORECALC(x)
Definition: type_score.h:66
#define GCG_DECL_FREEVARCLASSIFIER(x)
#define GCG_DECL_VARCLASSIFY(x)