1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* This file is part of the program */
/* GCG --- Generic Column Generation */
/* a Dantzig-Wolfe decomposition based extension */
/* of the branch-cut-and-price framework */
/* SCIP --- Solving Constraint Integer Programs */
/* */
/* Copyright (C) 2010-2022 Operations Research, RWTH Aachen University */
/* Zuse Institute Berlin (ZIB) */
/* */
/* This program is free software; you can redistribute it and/or */
/* modify it under the terms of the GNU Lesser General Public License */
/* as published by the Free Software Foundation; either version 3 */
/* of the License, or (at your option) any later version. */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU Lesser General Public License for more details. */
/* */
/* You should have received a copy of the GNU Lesser General Public License */
/* along with this program; if not, write to the Free Software */
/* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.*/
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/**@file cons_decomp.h
* @ingroup DECOMP
* @brief constraint handler for structure detection
* @author Martin Bergner
* @author Michael Bastubbe
* @author Hanna Franzen
*
* This constraint handler manages the structure detection process. It will run all registered structure detectors in an
* iterative refinement scheme. Afterwards some post-processing detectors might be called.
*/
/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
#ifndef GCG_CONS_DECOMP_H__
#define GCG_CONS_DECOMP_H__
#include "scip/scip.h"
#include "type_detector.h"
#include "type_varclassifier.h"
#include "type_consclassifier.h"
#include "type_scoretype.h"
#ifdef __cplusplus
extern "C" {
#endif
/** forward declarations */
struct Partialdecomp_Wrapper;
typedef struct Partialdecomp_Wrapper PARTIALDECOMP_WRAPPER;
struct Detprobdata_Wrapper;
/**
* @brief returns the data of the provided consclassifier
* @returns data of the provided consclassifier
*/
extern
DEC_CLASSIFIERDATA* DECconsClassifierGetData(
DEC_CONSCLASSIFIER* classifier /**< Classifier data structure */
);
/**
* @brief returns the name of the provided classifier
* @returns name of the given classifier
*/
extern
const char* DECconsClassifierGetName(
DEC_CONSCLASSIFIER* classifier /**< classifier data structure */
);
/**
* @brief returns the data of the provided varclassifier
* @returns data of the provided varclassifier
*/
extern
DEC_CLASSIFIERDATA* DECvarClassifierGetData(
DEC_VARCLASSIFIER* classifier /**< Classifier data structure */
);
/**
* @brief returns the name of the provided classifier
* @returns name of the given classifier
*/
extern
const char* DECvarClassifierGetName(
DEC_VARCLASSIFIER* classifier /**< classifier data structure */
);
/** @brief Gets the character of the detector
* @returns detector character */
extern
char DECdetectorGetChar(
DEC_DETECTOR* detector /**< pointer to detector */
);
/**
* @brief returns the data of the provided detector
* @returns data of the provided detector
*/
extern
DEC_DETECTORDATA* DECdetectorGetData(
DEC_DETECTOR* detector /**< Detector data structure */
);
/**
* @brief returns the name of the provided detector
* @returns name of the given detector
*/
extern
const char* DECdetectorGetName(
DEC_DETECTOR* detector /**< detector data structure */
);
/** @brief interface method to detect the structure including presolving
* @returns SCIP return code */
extern
SCIP_RETCODE DECdetectStructure(
SCIP* scip, /**< SCIP data structure */
SCIP_RESULT* result /**< Result pointer to indicate whether some structure was found */
);
/**
* @brief searches for the consclassifier with the given name and returns it or NULL if classifier is not found
* @returns consclassifier pointer or NULL if consclassifier with given name is not found
*/
extern
DEC_CONSCLASSIFIER* DECfindConsClassifier(
SCIP* scip, /**< SCIP data structure */
const char* name /**< the name of the searched consclassifier */
);
/**
* @brief searches for the varclassifier with the given name and returns it or NULL if classifier is not found
* @returns varclassifier pointer or NULL if varclassifier with given name is not found
*/
extern
DEC_VARCLASSIFIER* DECfindVarClassifier(
SCIP* scip, /**< SCIP data structure */
const char* name /**< the name of the searched varclassifier */
);
/**
* @brief searches for the detector with the given name and returns it or NULL if detector is not found
* @returns detector pointer or NULL if detector with given name is not found
*/
extern
DEC_DETECTOR* DECfindDetector(
SCIP* scip, /**< SCIP data structure */
const char* name /**< the name of the searched detector */
);
/** @brief Gets the best known decomposition
*
* @note caller has to free returned DEC_DECOMP
* @returns the decomposition if available and NULL otherwise */
extern
DEC_DECOMP* DECgetBestDecomp(
SCIP* scip, /**< SCIP data structure */
SCIP_Bool printwarnings /**< should warnings pre printed */
);
/** @brief Gets the currently considered best partialdec
*
* If there is a partialdec marked to be returned (e.g. by /DECwriteAllDecomps), it is written.
* Else, the currently "best" decomp is returned.
*
* @returns partialdec to write if one can be found, or partialdecwrapper->partialdec = NULL otherwise */
extern
SCIP_RETCODE DECgetPartialdecToWrite(
SCIP* scip, /**< SCIP data structure */
SCIP_Bool transformed, /**< is the problem transformed yet */
PARTIALDECOMP_WRAPPER* partialdecwrapper /**< partialdec wrapper to output */
);
/**
* @brief returns the remaining time of scip that the decomposition may use
* @returns remaining time that the decompositon may use
*/
extern
SCIP_Real DECgetRemainingTime(
SCIP* scip /**< SCIP data structure */
);
/**
* @brief includes one constraint classifier
* @returns scip return code
*/
extern
SCIP_RETCODE DECincludeConsClassifier(
SCIP* scip, /**< scip data structure */
const char* name, /**< name of the classifier */
const char* description, /**< describing main idea of this classifier */
int priority, /**< priority of the classifier */
SCIP_Bool enabled, /**< whether the classifier should be enabled by default */
DEC_CLASSIFIERDATA* classifierdata, /**< classifierdata the associated classifier data (or NULL) */
DEC_DECL_FREECONSCLASSIFIER((*freeClassifier)), /**< destructor of classifier (or NULL) */
DEC_DECL_CONSCLASSIFY((*classify)) /**< the method that will classify constraints or variables (must not be NULL) */
);
/**
* @brief includes one detector
* @returns scip return code
*/
extern
SCIP_RETCODE DECincludeDetector(
SCIP* scip, /**< scip data structure */
const char* name, /**< name of the detector */
const char decchar, /**< char that is used in detector chain history for this detector */
const char* description, /**< describing main idea of this detector */
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 */
int maxCallRound, /**< last detection round the detector gets called */
int minCallRound, /**< first round the detector gets called (offset in detection loop) */
int freqCallRoundOriginal, /**< frequency the detector gets called in detection loop while detecting of the original problem */
int maxCallRoundOriginal, /**< last round the detector gets called while detecting of the original problem */
int minCallRoundOriginal, /**< first round the detector gets called (offset in detection loop) while detecting of the original problem */
int priority, /**< priority of the detector */
SCIP_Bool enabled, /**< whether the detector should be enabled by default */
SCIP_Bool enabledFinishing, /**< whether the finishing should be enabled */
SCIP_Bool enabledPostprocessing, /**< whether the postprocessing should be enabled */
SCIP_Bool skip, /**< whether the detector should be skipped if others found structure */
SCIP_Bool usefulRecall, /**< is it useful to call this detector on a descendant of the propagated partialdec */
DEC_DETECTORDATA *detectordata, /**< the associated detector data (or NULL) */
DEC_DECL_FREEDETECTOR((*freeDetector)), /**< destructor of detector (or NULL) */
DEC_DECL_INITDETECTOR((*initDetector)), /**< initialization method of detector (or NULL) */
DEC_DECL_EXITDETECTOR((*exitDetector)), /**< deinitialization method of detector (or NULL) */
DEC_DECL_PROPAGATEPARTIALDEC((*propagatePartialdecDetector)), /**< method to refine a partial decomposition inside detection loop (or NULL) */
DEC_DECL_FINISHPARTIALDEC((*finishPartialdecDetector)), /**< method to complete a partial decomposition when called in detection loop (or NULL) */
DEC_DECL_POSTPROCESSPARTIALDEC((*postprocessPartialdecDetector)), /**< method to postprocess a complete decomposition, called after detection loop (or NULL) */
DEC_DECL_SETPARAMAGGRESSIVE((*setParamAggressiveDetector)), /**< method that is called if the detection emphasis setting aggressive is chosen */
DEC_DECL_SETPARAMDEFAULT((*setParamDefaultDetector)), /**< method that is called if the detection emphasis setting default is chosen */
DEC_DECL_SETPARAMFAST((*setParamFastDetector)) /**< method that is called if the detection emphasis setting fast is chosen */
);
/**
* @brief includes one variable classifier
* @returns scip return code
*/
extern
SCIP_RETCODE DECincludeVarClassifier(
SCIP* scip, /**< scip data structure */
const char* name, /**< name of the classifier */
const char* description, /**< description of the classifier */
int priority, /**< priority how early classifier is invoked */
SCIP_Bool enabled, /**< whether the classifier should be enabled by default */
DEC_CLASSIFIERDATA* classifierdata,/**< classifierdata the associated classifier data (or NULL) */
DEC_DECL_FREEVARCLASSIFIER((*freeClassifier)), /**< destructor of classifier (or NULL) */
DEC_DECL_VARCLASSIFY((*classify)) /**< method that will classify variables (must not be NULL) */
);
/** @brief writes out a list of all detectors */
extern
void DECprintListOfDetectors(
SCIP* scip /**< SCIP data structure */
);
/** @brief write out all known decompositions
* @returns SCIP return code */
extern
SCIP_RETCODE DECwriteAllDecomps(
SCIP* scip, /**< SCIP data structure */
char* directory, /**< directory for decompositions */
char* extension, /**< the file extension for the export */
SCIP_Bool original, /**< should decomps for original problem be written */
SCIP_Bool presolved /**< should decomps for preoslved problem be written */
);
/** @brief writes all selected decompositions
* @returns scip return code
*/
extern
SCIP_RETCODE DECwriteSelectedDecomps(
SCIP* scip, /**< SCIP data structure */
char* directory, /**< directory for decompositions */
char* extension /**< extension for decompositions */
);
/** @brief adds a candidate for block number and counts how often a candidate is added */
extern
void GCGconshdlrDecompAddCandidatesNBlocks(
SCIP* scip, /**< SCIP data structure */
SCIP_Bool origprob, /**< which DETPROBDATA that should be modified */
int candidate /**< proposed amount of blocks */
);
/**
* @brief adds the given decomposition structure
* @returns scip return code
*/
extern
SCIP_RETCODE GCGconshdlrDecompAddDecomp(
SCIP* scip, /**< SCIP data structure */
DEC_DECOMP* decomp, /**< DEC_DECOMP data structure */
SCIP_Bool select /**< select the decomposition as candidate */
);
/**
* @brief creates and adds a basic partialdecomp (all cons/vars are assigned to master)
*
* @returns id of partialdec
*/
extern
int GCGconshdlrDecompAddBasicPartialdec(
SCIP* scip, /**< SCIP data structure */
SCIP_Bool presolved /**< create basic partialdecomp for presolved if true, otherwise for original */
);
/**
* @brief creates a pure matrix partialdecomp (i.e. all cons/vars to one single block)
*
* matrix is added to list of all partialdecs
* @returns id of matrix partialdec
*/
extern
int GCGconshdlrDecompAddMatrixPartialdec(
SCIP* scip, /**< SCIP data structure */
SCIP_Bool presolved /**< create matrix for presolved if true, otherwise for original */
);
/**
* @brief adds a decomp that exists before the detection is called
* @note this method should only be called if there is no partialdec for this decomposition
* @returns scip return code
*/
extern
SCIP_RETCODE GCGconshdlrDecompAddPreexistingDecomp(
SCIP* scip, /**< SCIP data structure */
DEC_DECOMP* decomp /**< decomposition data structure */
);
/**
* @brief adds given time to total score calculation time
* @return scip return code
*/
extern
SCIP_RETCODE GCGconshdlrDecompAddScoreTime(
SCIP* scip, /**< SCIP data structure */
SCIP_Real time /**< time to add */
);
/** @brief adds a candidate for block size given by the user */
extern
void GCGconshdlrDecompAddUserCandidatesNBlocks(
SCIP* scip, /**< SCIP data structure */
int candidate /**< candidate for block size */
);
/**
* @brief checks if two pricing problems are identical based on information from detection
* @returns scip return code
*/
extern
SCIP_RETCODE GCGconshdlrDecompArePricingprobsIdenticalForPartialdecid(
SCIP* scip, /**< scip scip data structure */
int partialdecid, /**< partialdecid id of the partial decompostion for which the pricing problems are checked for identity */
int probnr1, /**< index of first block to check */
int probnr2, /**< index of second block to check */
SCIP_Bool* identical /**< bool pointer to score the result of the check*/
);
/**
* @brief calculates the benders score of a partialdec
*
* in detail:
* bendersscore = max ( 0., 1 - ( 1 - blockareascore + (1 - borderareascore - bendersareascore ) ) ) with
* blockareascore = blockarea / totalarea
* borderareascore = borderarea / totalarea
* bendersareascore = bendersarea /totalarea with
* bendersarea = A + B - PENALTY with
* A = nmasterconshittingonlyblockvars * nblockvarshittngNOmasterconss
* B = nlinkingvarshittingonlyblockconss * nblockconsshittingonlyblockvars
* PENALTY = \f$\sum_{b=1}^(\text{nblocks}) \sum_{\text{blockvars }bv\text{ of block }b\text{ hitting a master constraint}} \sum_{\text{all blocks }b2 != b} \text{nblockcons}(b2)\f$
*
* @note experimental feature
* @return scip return code
*/
extern
SCIP_RETCODE GCGconshdlrDecompCalcBendersScore(
SCIP* scip, /**< SCIP data structure */
int partialdecid, /**< id of partialdec the score is calculated for */
SCIP_Real* score /**< score pointer to store the calculated score */
);
/**
* @brief calculates the border area score of a partialdec
*
* 1 - fraction of border area to complete area
* @return scip return code
*/
extern
SCIP_RETCODE GCGconshdlrDecompCalcBorderAreaScore(
SCIP* scip, /**< SCIP data structure */
int partialdecid, /**< id of partialdec the score is calculated for */
SCIP_Real* score /**< score pointer to store the calculated score */
);
/**
* @brief calculates and adds block size candidates using constraint classifications and variable classifications
*/
extern
void GCGconshdlrDecompCalcCandidatesNBlocks(
SCIP* scip, /**< SCIP data structure */
SCIP_Bool transformed /**< whether to find the candidates for the transformed problem, otherwise the original */
);
/**
* @brief calculates the classic score of a partialdec
*
* @return scip return code
*/
extern
SCIP_RETCODE GCGconshdlrDecompCalcClassicScore(
SCIP* scip, /**< SCIP data structure */
int partialdecid, /**< id of partialdec the score is calculated for */
SCIP_Real* score /**< score pointer to store the calculated score */
);
/**
* @brief calculates the maxforeseeingwhiteagg score of a partialdec
*
* maximum foreseeing white area score with respect to aggregatable blocks
* (i.e. maximize fraction of white area score considering problem with copied linking variables
* and corresponding master constraints;
* white area is nonblock and nonborder area, stairlinking variables count as linking)
* @return scip return code
*/
extern
SCIP_RETCODE GCGconshdlrDecompCalcMaxForeseeingWhiteAggScore(
SCIP* scip, /**< SCIP data structure */
int partialdecid, /**< id of partialdec the score is calculated for */
SCIP_Real* score /**< score pointer to store the calculated score */
);
/**
* @brief calculates the maximum foreseeing white area score of a partialdec
*
* maximum foreseeing white area score
* (i.e. maximize fraction of white area score considering problem with copied linking variables and
* corresponding master constraints; white area is nonblock and nonborder area, stairlinking variables count as linking)
* @return scip return code
*/
extern
SCIP_RETCODE GCGconshdlrDecompCalcMaxForseeingWhiteScore(
SCIP* scip, /**< SCIP data structure */
int partialdecid, /**< id of partialdec the score is calculated for */
SCIP_Real* score /**< score pointer to store the calculated score */
);
/**
* @brief calculates the maximum white area score of a partialdec
*
* score corresponding to the max white measure according to aggregated blocks
* @return scip return code
*/
extern
SCIP_RETCODE GCGconshdlrDecompCalcMaxWhiteScore(
SCIP* scip, /**< SCIP data structure */
int partialdecid, /**< id of partialdec the score is calculated for */
SCIP_Real* score /**< score pointer to store the calculated score */
);
/**
* @brief calculates the setpartitioning maximum foreseeing white area score of a partialdec
*
* setpartitioning maximum foreseeing white area score
* (i.e. convex combination of maximum foreseeing white area score and
* a boolean score rewarding a master containing only setppc and cardinality constraints)
* @return scip return code
*/
extern
SCIP_RETCODE GCGconshdlrDecompCalcSetPartForseeingWhiteScore(
SCIP* scip, /**< SCIP data structure */
int partialdecid, /**< id of partialdec the score is calculated for */
SCIP_Real* score /**< score pointer to store the calculated score */
);
/**
* @brief calculates the setpartfwhiteagg score of a partialdec
*
* setpartitioning maximum foreseeing white area score with respect to aggregateable
* (i.e. convex combination of maximum foreseeing white area score and a boolean score
* rewarding a master containing only setppc and cardinality constraints)
* @return scip return code
*/
extern
SCIP_RETCODE GCGconshdlrDecompCalcSetPartForWhiteAggScore(
SCIP* scip, /**< SCIP data structure */
int partialdecid, /**< id of partialdec the score is calculated for */
SCIP_Real* score /**< score pointer to store the calculated score */
);
/**
* @brief calculates the strong decomposition score of a partialdec
* @return scip return code
*/
extern
SCIP_RETCODE GCGconshdlrDecompCalcStrongDecompositionScore(
SCIP* scip, /**< SCIP data structure */
int partialdecid, /**< id of partialdec the score is calculated for */
SCIP_Real* score /**< score pointer to store the calculated score */
);
/**
* @brief check whether partialdecs are consistent
*
* Checks whether
* 1) the predecessors of all finished partialdecs in both detprobdatas can be found
* 2) selected list is synchron with selected information in partialdecs
* 3) selected exists is synchronized with selected list
*
* @returns true if partialdec information is consistent */
extern
SCIP_Bool GCGconshdlrDecompCheckConsistency(
SCIP* scip /**< SCIP data structure **/
);
/**
* @brief run classification of vars and cons
*
* @returns scip return code
*/
extern
SCIP_RETCODE GCGconshdlrDecompClassify(
SCIP* scip, /**< SCIP data structure */
SCIP_Bool transformed /**< whether to classify the transformed problem, otherwise the original */
);
/**
* @brief for two identical pricing problems a corresponding varmap is created
* @param scip scip data structure
* @param hashorig2pricingvar mapping from orig to pricingvar
* @param partialdecid id of the partial decompostion for which the pricing problems are checked for identity
* @param probnr1 index of first block
* @param probnr2 index of second block
* @param scip1 subscip of first block
* @param scip2 subscip of second block
* @param varmap mapping from orig to pricingvar
* @returns scip return code
*/
extern
SCIP_RETCODE GCGconshdlrDecompCreateVarmapForPartialdecId(
SCIP* scip,
SCIP_HASHMAP** hashorig2pricingvar,
int partialdecid,
int probnr1,
int probnr2,
SCIP* scip1,
SCIP* scip2,
SCIP_HASHMAP* varmap
);
/**
* @brief decreases the counter for created decompositions and returns it
* @returns number of created decompositions that was recently decreased
*/
extern
int GCGconshdlrDecompDecreaseNCallsCreateDecomp(
SCIP* scip /**< SCIP data structure **/
);
/** @brief deregisters partialdecs in the conshdlr
*
* Use this function for deletion of ALL the partialdecs.
*/
extern
void GCGconshdlrDecompDeregisterPartialdecs(
SCIP* scip, /**< SCIP data structure */
SCIP_Bool original /**< iff TRUE the status with respect to the original problem is returned */
);
/** @brief Frees Detprobdata of the original and transformed/presolved problem.
*
* @note Does not free Detprobdata of the original problem if GCGconshdlrDecompFreeOrigOnExit is set to false.
*/
void GCGconshdlrDecompFreeDetprobdata(
SCIP* scip /**< SCIP data structure */
);
/**
* @brief sets freeing of detection data of original problem during exit to true
*
* used before calling SCIPfreeTransform(),
* set to true to revoke presolving
* (e.g. if unpresolved decomposition is used, and transformation is not successful)
*/
extern
void GCGconshdlrDecompFreeOrigOnExit(
SCIP* scip, /**< SCIP data structure */
SCIP_Bool free /**< whether to free orig data */
);
/**
* @brief returns block number user candidate with given index
* @param scip SCIP data structure
* @param index index of block number user candidate that should be returned
* @returns block number user candidate with given index
*/
extern
int GCGconshdlrDecompGetBlockNumberCandidate(
SCIP* scip,
int index
);
/**
* @brief returns the total detection time
* @param scip SCIP data structure
* @returns total detection time
*/
extern
SCIP_Real GCGconshdlrDecompGetCompleteDetectionTime(
SCIP* scip
);
/** @brief returns an array containing all decompositions
*
* Updates the decomp decomposition structure by converting all finished partialdecs into decompositions and replacing the
* old list in the conshdlr.
*
* @returns decomposition array
* */
extern
DEC_DECOMP** GCGconshdlrDecompGetDecomps(
SCIP* scip /**< SCIP data structure */
);
/** @brief Gets an array of all detectors
*
* @returns array of detectors */
extern
DEC_DETECTOR** GCGconshdlrDecompGetDetectors(
SCIP* scip /**< SCIP data structure */
);
/** @brief Gets a list of ids of the current partialdecs that are finished
*
* @note recommendation: when in doubt plan for as many ids as partialdecs
* @see GCGconshdlrDecompGetNPartialdecs
* @returns scip return code */
extern
SCIP_RETCODE GCGconshdlrDecompGetFinishedPartialdecsList(
SCIP* scip, /**< SCIP data structure */
int** idlist, /**< id list to output to */
int* listlength /**< length of output list */
);
/** @brief Gets a list of ids of the current partialdecs
*
* @note recommendation: when in doubt plan for as many ids as partialdecs
* @see GCGconshdlrDecompGetNPartialdecs
* @returns scip return code */
extern
SCIP_RETCODE GCGconshdlrDecompGetPartialdecsList(
SCIP* scip, /**< SCIP data structure */
int** idlist, /**< id list to output to */
int* listlength /**< length of output list */
);
/**
* @brief returns the number of block candidates given by the user
* @returns number of block candidates given by the user
*/
extern
int GCGconshdlrDecompGetNBlockNumberCandidates(
SCIP* scip /**< SCIP data structure */
);
/** @brief gets block number of partialdec with given id
* @returns block number of partialdec
*/
extern
int GCGconshdlrDecompGetNBlocksByPartialdecId(
SCIP* scip, /**< SCIP data structure */
int id /**< id of partialdec */
);
/** @brief gets the number of decompositions (= amount of finished partialdecs)
*
* @returns number of decompositions */
extern
int GCGconshdlrDecompGetNDecomps(
SCIP* scip /**< SCIP data structure */
);
/** @brief Gets the number of all detectors
* @returns number of detectors */
extern
int GCGconshdlrDecompGetNDetectors(
SCIP* scip /**< SCIP data structure */
);
/** @brief Gets the next partialdec id managed by cons_decomp
* @returns the next partialdec id managed by cons_decomp */
extern
int GCGconshdlrDecompGetNextPartialdecID(
SCIP* scip /**< SCIP data structure **/
);
/** @brief gets number of active constraints during the detection of the decomp with given id
*
* Gets the number of constraints that were active while detecting the decomposition originating from the partialdec with the
* given id, this method is used to decide if the problem has changed since detection, if so the aggregation information
* needs to be recalculated
*
* @note if the partialdec is not complete the function returns -1
*
* @returns number of constraints that were active while detecting the decomposition
*/
extern
int GCGconshdlrDecompGetNFormerDetectionConssForID(
SCIP* scip, /**< SCIP data structure */
int id /**< id of the partialdec the information is asked for */
);
/** @brief gets number of linking variables of partialdec with given id
* @returns number of linking variables of partialdec
*/
extern
int GCGconshdlrDecompGetNLinkingVarsByPartialdecId(
SCIP* scip, /**< SCIP data structure */
int id /**< id of partialdec */
);
/** @brief gets number of master constraints of partialdec with given id
* @returns number of master constraints of partialdec
*/
extern
int GCGconshdlrDecompGetNMasterConssByPartialdecId(
SCIP* scip, /**< SCIP data structure */
int id /**< id of partialdec */
);
/** @brief gets number of master variables of partialdec with given id
* @returns number of master variables of partialdec
*/
extern
int GCGconshdlrDecompGetNMasterVarsByPartialdecId(
SCIP* scip, /**< SCIP data structure */
int id /**< id of partialdec */
);
/** @brief gets number of open constraints of partialdec with given id
* @returns total number of open constraints of partialdec
*/
extern
int GCGconshdlrDecompGetNOpenConssByPartialdecId(
SCIP* scip, /**< SCIP data structure */
int id /**< id of partialdec */
);
/** @brief gets number of open variables of partialdec with given id
* @returns total number of open variables of partialdec
*/
extern
int GCGconshdlrDecompGetNOpenVarsByPartialdecId(
SCIP* scip, /**< SCIP data structure */
int id /**< id of partialdec */
);
/** @brief Gets the number of finished partialdecs available for the original problem
* @returns number of partialdecs */
extern
unsigned int GCGconshdlrDecompGetNFinishedPartialdecsOrig(
SCIP* scip /**< SCIP data structure */
);
/** @brief Gets the number of finished partialdecs available for the transformed problem
* @returns number of partialdecs */
extern
unsigned int GCGconshdlrDecompGetNFinishedPartialdecsTransformed(
SCIP* scip /**< SCIP data structure */
);
/** @brief Gets the number of open partialdecs available for the original problem
* @returns number of partialdecs */
extern
unsigned int GCGconshdlrDecompGetNOpenPartialdecsOrig(
SCIP* scip /**< SCIP data structure */
);
/** @brief Gets the number of open partialdecs available for the transformed problem
* @returns number of partialdecs */
extern
unsigned int GCGconshdlrDecompGetNOpenPartialdecsTransformed(
SCIP* scip /**< SCIP data structure */
);
/** @brief Gets the number of all partialdecs
* @returns number of Partialdecs */
extern
unsigned int GCGconshdlrDecompGetNPartialdecs(
SCIP* scip /**< SCIP data structure */
);
/** @brief Gets the number of partialdecs available for the original problem
* @returns number of partialdecs */
extern
unsigned int GCGconshdlrDecompGetNPartialdecsOrig(
SCIP* scip /**< SCIP data structure */
);
/** @brief Gets the number of partialdecs available for the transformed problem
* @returns number of partialdecs */
extern
unsigned int GCGconshdlrDecompGetNPartialdecsTransformed(
SCIP* scip /**< SCIP data structure */
);
/** @brief gets number of stairlinking variables of partialdec with given id
* @returns total number of stairlinking variables of partialdec
*/
extern
int GCGconshdlrDecompGetNStairlinkingVarsByPartialdecId(
SCIP* scip, /**< SCIP data structure */
int id /**< id of partialdec */
);
/** @brief Gets wrapped PARTIALDECOMP with given id
*
* @returns SCIP return code */
extern
SCIP_RETCODE GCGconshdlrDecompGetPartialdecFromID(
SCIP* scip, /**< SCIP data structure */
int partialdecid, /**< id of PARTIALDECOMP */
PARTIALDECOMP_WRAPPER* pwr /**< wrapper for output PARTIALDECOMP */
);
/** @brief gets score of partialdec with given id
* @returns score in respect to current score type
*/
extern
float GCGconshdlrDecompGetScoreByPartialdecId(
SCIP* scip, /**< SCIP data structure */
int id /**< id of partialdec */
);
/** @brief gets total score computation time
* @returns total score computation time
*/
extern
SCIP_Real GCGconshdlrDecompGetScoreTotalTime(
SCIP* scip /**< SCIP data structure */
);
/**
* @brief Gets the currently selected scoretype
* @returns the currently selected scoretype
*/
extern
SCORETYPE GCGconshdlrDecompGetScoretype(
SCIP* scip /**< SCIP data structure */
);
/** @brief Gets a list of ids of all currently selected partialdecs
* @returns list of partialdecs */
extern
SCIP_RETCODE GCGconshdlrDecompGetSelectedPartialdecs(
SCIP* scip, /**< SCIP data structure */
int** idlist, /**< id list to output to */
int* listlength /**< length of output list */
);
/**
* @brief counts up the counter for created decompositions and returns it
* @returns number of created decompositions that was recently increased
*/
extern
int GCGconshdlrDecompIncreaseNCallsCreateDecomp(
SCIP* scip /**< SCIP data structure **/
);
/** @brief gets whether partialdec with given id is presolved
* @returns true iff partialdec is presolved
*/
extern
SCIP_Bool GCGconshdlrDecompIsPresolvedByPartialdecId(
SCIP* scip, /**< SCIP data structure */
int id /**< id of partialdec */
);
/** @brief gets whether partialdec with given id is selected
* @returns true iff partialdec is selected
*/
extern
SCIP_Bool GCGconshdlrDecompIsSelectedByPartialdecId(
SCIP* scip, /**< SCIP data structure */
int id /**< id of partialdec */
);
/**
* @brief returns whether or not a detprobdata structure for the original problem exists
* @returns true iff an original detprobdata exists
*/
extern
SCIP_Bool GCGconshdlrDecompOrigDetprobdataExists(
SCIP* scip /**< SCIP data structure */
);
/**
* @brief returns whether or not an original decompositions exists in the data structures
* @returns true iff an origial decomposition exist
*/
extern
SCIP_Bool GCGconshdlrDecompOrigPartialdecExists(
SCIP* scip /**< SCIP data structure */
);
/**
* @brief returns whether or not a detprobdata structure for the presolved problem exists
* @returns true iff a presolved detprobdata exists
*/
extern
SCIP_Bool GCGconshdlrDecompPresolvedDetprobdataExists(
SCIP* scip /**< SCIP data structure */
);
/** @brief display statistics about detectors
* @returns SCIP return code */
extern
SCIP_RETCODE GCGconshdlrDecompPrintDetectorStatistics(
SCIP* scip, /**< SCIP data structure */
FILE* file /**< output file or NULL for standard output */
);
/**
* @brief selects/unselects a partialdecomp
*
* @returns SCIP return code
*/
extern
SCIP_RETCODE GCGconshdlrDecompSelectPartialdec(
SCIP* scip, /**< SCIP data structure */
int partialdecid, /**< id of partialdecomp */
SCIP_Bool select /**< select/unselect */
);
/** @brief sets detector parameters values
*
* sets detector parameters values to
*
* - SCIP_PARAMSETTING_DEFAULT which are the default values of all detector parameters
* - SCIP_PARAMSETTING_FAST such that the time spend for detection is decreased
* - SCIP_PARAMSETTING_AGGRESSIVE such that the detectors produce more decompositions
* - SCIP_PARAMSETTING_OFF which turns off all detection
*
* @returns SCIP return code
*/
extern
SCIP_RETCODE GCGconshdlrDecompSetDetection(
SCIP* scip, /**< SCIP data structure */
SCIP_PARAMSETTING paramsetting, /**< parameter settings */
SCIP_Bool quiet /**< should the parameter be set quiet (no output) */
);
/**
* @brief Sets the currently used scoretype
*/
extern
void GCGconshdlrDecompSetScoretype(
SCIP* scip, /**< SCIP data structure */
SCORETYPE sctype /**< new scoretype */
);
/**
* @brief translates n best unpresolved partialdec to a complete presolved one
* @param scip SCIP data structure
* @param n number of partialdecs that should be translated
* @param completeGreedily whether or not to complete the decomposition greedily
* @returns SCIP return code
*/
extern
SCIP_RETCODE GCGconshdlrDecompTranslateNBestOrigPartialdecs(
SCIP* scip,
int n,
SCIP_Bool completeGreedily
);
/**
* @brief translates unpresolved partialdec to a complete presolved one
* @param scip SCIP data structure
* @returns SCIP return code
*/
extern
SCIP_RETCODE GCGconshdlrDecompTranslateOrigPartialdecs(
SCIP* scip
);
/** Gets whether the detection already took place
* @returns true if detection took place, false otherwise */
extern
SCIP_Bool GCGdetectionTookPlace(
SCIP* scip, /**< SCIP data structure */
SCIP_Bool original /**< iff TRUE the status with respect to the original problem is returned */
);
/**
* method to eliminate duplicate constraint names and name unnamed constraints
* @return SCIP return code
*/
extern
SCIP_RETCODE SCIPconshdlrDecompRepairConsNames(
SCIP* scip /**< SCIP data structure */
);
/**
* @brief creates the constraint handler for decomp and includes it in SCIP
* @returns scip return code
*/
extern
SCIP_RETCODE SCIPincludeConshdlrDecomp(
SCIP* scip /**< SCIP data structure */
);
#ifdef __cplusplus
}
#endif
#endif