class_seeed.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-2018 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 
34 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
35 
36 #ifndef GCG_CLASS_SEEED_H__
37 #define GCG_CLASS_SEEED_H__
38 
39 #include "objscip/objscip.h"
40 #include "struct_detector.h"
41 #include "cons_decomp.h"
42 
43 #include <vector>
44 #include <string>
45 
46 #include "class_consclassifier.h"
47 #include "class_varclassifier.h"
48 #include "graph/graph_gcg.h"
49 #include "graph/graph.h"
50 
51 namespace gcg {
52 
53 
58 {
59  NOT = 0,
60  PARTIAL = - 1,
61  COMPLETE = - 2,
63 };
64 
65 class Seeedpool;
66 
67 
71 class Seeed
72 {
73 private:
74  SCIP* scip;
75  int id;
76  int nBlocks;
77  int nVars;
78  int nConss;
79  std::vector<int> masterConss;
80  std::vector<int> masterVars;
81  std::vector<std::vector<int>> conssForBlocks;
83  std::vector<std::vector<int>> varsForBlocks;
85  std::vector<int> linkingVars;
86  std::vector<std::vector<int>> stairlinkingVars;
89  std::vector<int> openVars;
91  std::vector<int> openConss;
93  std::vector<bool> isvaropen;
94  std::vector<bool> isconsopen;
95  std::vector<bool> isvarmaster;
96  std::vector<bool> isconsmaster;
98  std::vector<int> ncoeffsforblock;
100  SCIP_Bool calculatedncoeffsforblock;
101  int ncoeffsformaster;
102  std::vector<std::vector<int>> ncoeffsforblockformastercons;
104  bool varsforblocksorted;
105  bool stairlinkingvarsforblocksorted;
106  bool conssforblocksorted;
107  bool linkingvarssorted;
108  bool mastervarssorted;
109  bool masterconsssorted;
112  std::vector<int> bookedAsMasterConss;
114  std::vector<std::pair<int, int>> bookedAsBlockConss;
116  std::vector<int> bookedAsLinkingVars;
118  std::vector<int> bookedAsMasterVars;
120  std::vector<std::pair<int, int>> bookedAsBlockVars;
122  std::vector<std::pair<int, int>> bookedAsStairlinkingVars;
125  long hashvalue;
126  bool changedHashvalue;
129  bool isselected;
131  bool isagginfoalreadytoexpensive;
133  const static int primes[];
134  const static int nPrimes;
136  bool isFinishedByFinisher;
139  SCIP_Bool agginfocalculated;
140  int nrepblocks;
141  std::vector<std::vector<int>> reptoblocks;
142  std::vector<int> blockstorep;
143  std::vector<std::vector<std::vector<int> > > pidtopidvarmaptofirst;
146  std::vector<DEC_DETECTOR*> detectorChain;
147  std::vector<std::string> detectorchaininfo;
148  std::vector<SCIP_Bool> detectorChainFinishingUsed;
150  std::vector<SCIP_Real> detectorClockTimes;
151  std::vector<SCIP_Real> pctVarsToBorder;
153  std::vector<SCIP_Real> pctVarsToBlock;
155  std::vector<SCIP_Real> pctVarsFromFree;
157  std::vector<SCIP_Real> pctConssToBorder;
159  std::vector<SCIP_Real> pctConssToBlock;
161  std::vector<SCIP_Real> pctConssFromFree;
163  std::vector<int> nNewBlocks;
165  std::vector<IndexClassifier*> usedClassifier;
168  std::vector<std::vector<int>> classesToMaster;
171  std::vector<std::vector<int>> classesToLinking;
175  std::vector<int> listofancestorids;
178  USERGIVEN usergiven;
179  bool isfromlegacymode;
180  SCIP_Real score;
181  SCIP_Real maxwhitescore;
182  SCIP_Real bendersscore;
183  SCIP_Real benderareascore;
185  SCIP_Real strongdecompositionscore;
187  SCIP_Real borderareascore;
190  SCIP_Real maxwhitescoreagg;
192  SCIP_Real blockareascore;
193  SCIP_Real blockareascoreagg;
196  SCIP_Real maxforeseeingwhitescore;
197  SCIP_Real maxforeseeingwhitescoreagg;
199  SCIP_Real setpartfwhitescore;
200  SCIP_Real setpartfwhitescoreagg;
203  char* detectorchainstring;
206  bool stemsFromUnpresolved;
207  bool isfromunpresolved;
208  bool isFinishedByFinisherUnpresolved;
210  DEC_DETECTOR* finishedUnpresolvedBy;
211  Seeedpool* seeedpool;
222  void checkIdenticalBlocksBliss(
223  int b1,
224  int b2,
225  std::vector<int>& varmap,
226  SCIP_HASHMAP* varmap2,
227  SCIP_Bool* identical
228  );
229 
230 
239  void checkIdenticalBlocksBrute(
240  int b1,
241  int b2,
242  std::vector<int>& varmap,
243  SCIP_HASHMAP* varmap2,
244  SCIP_Bool* identical
245  );
246 
247 
255  SCIP_RETCODE checkIdenticalBlocksTrivial(
256  int b1,
257  int b2,
258  SCIP_Bool* notidentical
259  );
260 
261 public:
262 
269  Seeed(
270  SCIP* scip,
271  int id,
272  Seeedpool* seeedpool
273  );
274 
279  Seeed(
280  const Seeed *seeedToCopy
281  );
282 
286  ~Seeed();
287 
288 
293  int addBlock();
294 
295 
300  void addClockTime(
301  SCIP_Real clocktime
302  );
303 
309  Seeed* ancestor
310  );
311 
317  const char* decinfo
318  );
319 
325  void addNNewBlocks(
326  int nnewblocks
327  );
328 
333  void addPctConssFromFree(
334  SCIP_Real pct
335  );
336 
341  void addPctConssToBlock(
342  SCIP_Real pct
343  );
344 
349  void addPctConssToBorder(
350  SCIP_Real pct
351  );
352 
357  void addPctVarsFromFree(
358  SCIP_Real pct
359  );
360 
361 
366  void addPctVarsToBlock(
367  SCIP_Real pct
368  );
369 
374  void addPctVarsToBorder(
375  SCIP_Real pct
376  );
377 
383 
384 
395  SCIP_RETCODE assignBorderFromConstoblock(
396  SCIP_HASHMAP* constoblock,
398  int givenNBlocks
399  );
400 
401 
407  );
408 
417  SCIP_RETCODE assignSeeedFromConstoblock(
418  SCIP_HASHMAP* constoblock,
420  int additionalNBlocks
421  );
422 
431  std::vector<int> constoblock,
433  int additionalNBlocks
434  );
435 
443  SCIP_RETCODE bookAsBlockCons(
444  int consToBlock,
445  int block
446  );
447 
455  SCIP_RETCODE bookAsBlockVar(
456  int varToBlock,
457  int block
458  );
459 
466  SCIP_RETCODE bookAsMasterCons(
467  int consToMaster /*< this index can be computed by the function Seeedpool::getIndexForCons */
468  );
469 
476  SCIP_RETCODE bookAsMasterVar(
477  int varToMaster
478  );
479 
486  SCIP_RETCODE bookAsLinkingVar(
487  int varToLinking
488  );
489 
498  SCIP_RETCODE bookAsStairlinkingVar(
499  int varToStairlinking,
500  int firstBlock
501  );
502 
507 
511  void calcHashvalue();
512 
521  );
522 
527  );
528 
529 
537  GraphGCG* g
539  );
540 
541 
549  GraphGCG* g
551  );
552 
557  void changeBlockOrder(
558  std::vector<int> oldToNewBlockIndex
559  );
560 
565  bool checkAllConssAssigned();
566 
567 
568 
584  bool checkConsistency(
585  );
586 
593  SCIP_RETCODE completeByConnected(
594  );
595 
596 
604  );
605 
606 
612  SCIP_RETCODE postprocessMasterToBlocks(
613  SCIP_Bool* success
614  );
615 
616 
623  SCIP_Bool* success
624  );
625 
635  );
636 
643  SCIP_RETCODE completeGreedily(
644  );
645 
651  bool consClassifierUsed(
652  int detectorchainindex
653  );
654 
664  SCIP_RETCODE considerImplicits(
665  );
666 
667 
673  SCIP_RETCODE copyClassifierStatistics(
674  const Seeed* otherseeed
675  );
676 
682  SCIP_RETCODE deleteEmptyBlocks(
683  bool variables
684  );
685 
691  SCIP_RETCODE deleteOpencons(
692  int opencons
693  );
694 
701  SCIP_RETCODE deleteOpenvar(
702  int openvar
703  );
704 
709  SCIP_RETCODE displayAggregationInformation();
710 
715  SCIP_RETCODE displayConss();
716 
717 
726  SCIP_RETCODE displayInfo(
727  int detailLevel
728  );
729 
734  SCIP_RETCODE displaySeeed(
735  );
736 
741  SCIP_RETCODE displayVars(
742  );
743 
751  SCIP_Real evaluate(
752  SCORETYPE type
753  );
754 
764  SCIP_RETCODE filloutBorderFromConstoblock(
765  SCIP_HASHMAP* constoblock,
767  int givenNBlocks
768  );
769 
770 
781  SCIP_RETCODE filloutSeeedFromConstoblock(
782  SCIP_HASHMAP* constoblock,
784  int givenNBlocks
785  );
786 
787 
792  SCIP_RETCODE findVarsLinkingToMaster(
793  );
794 
795 
801  SCIP_RETCODE findVarsLinkingToStairlinking(
802  );
803 
809  std::vector< std::pair< int, std::vector< int > > > findLinkingVarsPotentiallyStairlinking(
810  );
811 
816  SCIP_RETCODE flushBooked();
817 
818 
824  int getAncestorID(
825  int ancestorindex
826  );
827 
828 
829 
834  std::vector<int> getAncestorList(
835  );
836 
837 
842  void setAncestorList(
843  std::vector<int> newlist
844  );
845 
846 
851  void addAncestorID(
852  int ancestor
853  );
854 
855 
861  const std::vector<int> & getBlocksForRep(
862  int repid
863  );
864 
865 
870  char* getDetectorChainString();
871 
872 
878  std::string getDetectorchainInfo(
879  int detectorchainindex
880  );
881 
882 
888  SCIP_Real getDetectorClockTime(
889  int detectorchainindex
890  );
891 
896  std::vector<SCIP_Real> getDetectorClockTimes();
897 
898 
906  std::string getComponentInformation(
907  );
908 
916  SCIP_RETCODE getConsClassifierData(
917  int detectorchainindex,
918  ConsClassifier** classifier,
919  std::vector<int>& consclassesmaster
920  );
921 
927  const int* getConssForBlock(
928  int block
929  );
930 
931 
937 
938 
943  std::vector<DEC_DETECTOR*> getDetectorchainVector();
944 
945 
952  std::string getDetectorStatistics(
953  int detectorchainindex
954  );
955 
956 
963  std::string getDetectorClassifierInfo(
964  int detectorchainindex,
965  bool displayConssVars
966  );
967 
968 
969 
974  bool getFinishedByFinisher();
975 
976 
982 
983 
990 
991 
997  long getHashValue();
998 
999 
1004  int getID();
1005 
1006 
1012  const int* getLinkingvars();
1013 
1014 
1020  const int* getMasterconss();
1021 
1022 
1027  const int* getMastervars();
1028 
1029 
1035  SCIP_Real getMaxWhiteScore();
1036 
1037 
1051  SCIP_Real getBendersScore();
1052 
1053 
1059  int getNCoeffsForBlock(
1060  int blockid
1061  );
1062 
1063 
1068  int getNCoeffsForMaster(
1069  );
1070 
1071 
1078  SCIP_Real getScore(
1079  SCORETYPE type
1080  );
1081 
1082 
1087  SCIP_Bool hasSetppccardMaster(
1088  );
1089 
1090 
1095  SCIP_Bool hasSetppcMaster(
1096  );
1097 
1098 
1103  SCIP_Bool hasSetppMaster(
1104  );
1105 
1106 
1113 
1114 
1119  int getNAncestors();
1120 
1121 
1126  int getNBlocks();
1127 
1128 
1133  int getNConss();
1134 
1135 
1141  int getNConssForBlock(
1142  int block
1143  );
1144 
1145 
1150  int getNDetectorchainInfo();
1151 
1156  int getNDetectors();
1157 
1162  int getNUsedClassifier();
1163 
1168  int getNLinkingvars();
1169 
1170 
1175  int getNMasterconss();
1176 
1177 
1182  int getNMastervars();
1183 
1184 
1190  int getNNewBlocks(
1191  int detectorchainindex
1192  );
1193 
1194 
1199  std::vector<int> getNNewBlocksVector();
1200 
1201 
1207 
1208 
1213  int getNOpenconss();
1214 
1215 
1220  int getNOpenvars();
1221 
1222 
1227  int getNReps();
1228 
1229 
1230 
1237  int block
1238  );
1239 
1240 
1245  int getNVars();
1246 
1247 
1248 
1254  int getNVarsForBlock(
1255  int block
1256  );
1257 
1258 
1263  const int* getOpenconss();
1264 
1265 
1270  std::vector<int> getOpenconssVec();
1271 
1272 
1273 
1278  const int* getOpenvars();
1279 
1284  std::vector<int> getOpenvarsVec();
1285 
1286 
1292  SCIP_Real getPctVarsToBorder(
1293  int detectorchainindex
1294  );
1295 
1296 
1297 
1302  std::vector<SCIP_Real> getPctVarsToBorderVector();
1303 
1304 
1310  SCIP_Real getPctVarsToBlock(
1311  int detectorchainindex
1312  );
1313 
1314 
1319  std::vector<SCIP_Real> getPctVarsToBlockVector();
1320 
1321 
1327  SCIP_Real getPctVarsFromFree(
1328  int detectorchainindex
1329  );
1330 
1331 
1336  std::vector<SCIP_Real> getPctVarsFromFreeVector();
1337 
1338 
1345  SCIP_Real getPctConssToBorder(
1346  int detectorchainindex
1347  );
1348 
1349 
1354  std::vector<SCIP_Real> getPctConssToBorderVector();
1355 
1356 
1362  SCIP_Real getPctConssToBlock(
1363  int detectorchainindex
1364  );
1365 
1366 
1371  std::vector<SCIP_Real> getPctConssToBlockVector();
1372 
1373 
1379  SCIP_Real getPctConssFromFree(
1380  int detectorchainindex
1381  );
1382 
1383 
1388  std::vector<SCIP_Real> getPctConssFromFreeVector();
1389 
1390 
1396  int getRepForBlock(
1397  int blockid
1398  );
1399 
1407  std::vector<int> & getRepVarmap(
1408  int repid,
1409  int blockrepid
1410  );
1411 
1412 
1418 
1419 
1426  const int* getStairlinkingvars(
1427  int block
1428  );
1429 
1430 
1435  bool getStemsFromUnpresolved();
1436 
1437 
1446  SCIP_RETCODE getVarClassifierData(
1447  int detectorchainindex,
1448  VarClassifier** classifier,
1449  std::vector<int>& varclasseslinking,
1450  std::vector<int>& varclassesmaster
1451  );
1452 
1453 
1459  const int* getVarsForBlock(
1460  int block
1461  );
1462 
1463 
1471  int varid,
1472  int block
1473  );
1474 
1475 
1482  void initOnlyBinMaster();
1483 
1488  SCIP_Bool isAgginfoToExpensive();
1489 
1490 
1491 
1497  bool isComplete();
1498 
1499 
1508  int cons,
1509  int block
1510  );
1511 
1517  bool isConsMastercons(
1518  int cons
1519  );
1520 
1521 
1527  bool isConsOpencons(
1528  int cons
1529  );
1530 
1531 
1536  bool isFromLegacymode();
1537 
1538 
1543  bool isFromUnpresolved();
1544 
1545 
1550  bool isSelected();
1551 
1552 
1560  SCIP_RETCODE isEqual(
1561  Seeed* otherseeed,
1562  SCIP_Bool* isequal,
1563  bool sortseeeds
1564  );
1565 
1571  bool isEqual(
1572  Seeed* other
1573  );
1574 
1580  bool isPropagatedBy(
1581  DEC_DETECTOR* detectorID
1582  );
1583 
1584 
1590  bool isTrivial();
1591 
1592 
1599  bool isVarBlockvarOfBlock(
1600  int var,
1601  int block
1602  );
1603 
1604 
1610  bool isVarLinkingvar(
1611  int var
1612  );
1613 
1614 
1620  bool isVarMastervar(
1621  int var
1622  );
1623 
1624 
1625 
1632  bool isVarOpenvar(
1633  int var
1634  );
1635 
1636 
1642  bool isVarStairlinkingvar(
1643  int var
1644  );
1645 
1646 
1654  int var,
1655  int block
1656  );
1657 
1658 
1665  SCIP_RETCODE printClassifierInformation(
1666  SCIP* scip,
1667  FILE* file);
1668 
1669 
1670 
1676  SCIP_RETCODE refineToBlocks(
1677  );
1678 
1685  SCIP_RETCODE refineToMaster(
1686  );
1687 
1688 
1696  int detectorchainindex,
1697  ConsClassifier* classifier,
1698  std::vector<int> consclassesmaster
1699  );
1700 
1701 
1708  SCIP_RETCODE setConsToBlock(
1709  int consToBlock,
1710  int block
1711  );
1712 
1713 
1719  SCIP_RETCODE setConsToMaster(
1720  int consToMaster
1721  );
1722 
1723 
1728  void setDetectorchain(
1729  std::vector<DEC_DETECTOR*> detectorChain
1730  );
1731 
1732 
1738  SCIP_RETCODE setDetectorPropagated(
1739  DEC_DETECTOR* detector
1740  );
1741 
1742 
1748  SCIP_RETCODE setFinishingDetectorPropagated(
1749  DEC_DETECTOR* detector
1750  );
1751 
1752 
1757  void setFinishedByFinisher(
1758  bool finished
1759  );
1760 
1761 
1768  bool finishedByFinisherUnpresolved
1769  );
1770 
1776  DEC_DETECTOR* detector
1777  );
1778 
1779 
1784  void setLegacymode(
1785  bool legacymode
1786  );
1787 
1788 
1794  SCIP_RETCODE setNBlocks(
1795  int nBlocks
1796  );
1797 
1803  SCIP_RETCODE setID(
1804  int id
1805  );
1806 
1807 
1812  void setIsFromUnpresolved(
1813  bool unpresolved
1814  );
1815 
1816 
1822  void setSelected(
1823  bool selected
1824  );
1825 
1826 
1831  void setSeeedpool(
1832  Seeedpool* seeedpool
1833  );
1834 
1835 
1841  bool stemsfromunpresolved
1842  );
1843 
1844 
1849  void setUsergiven(
1850  USERGIVEN usergiven
1851  );
1852 
1853 
1863  int detectorchainindex,
1864  VarClassifier* classifier,
1865  std::vector<int> varclasseslinking,
1866  std::vector<int> varclassesmaster
1867  );
1868 
1869 
1876  SCIP_RETCODE setVarToBlock(
1877  int varToBlock,
1878  int block
1879  );
1880 
1881 
1887  SCIP_RETCODE setVarToLinking(
1888  int varToLinking
1889  );
1890 
1891 
1892 
1895  SCIP_RETCODE setVarToMaster(
1896  int varToMaster
1897  );
1898 
1907  SCIP_RETCODE setVarToStairlinking(
1908  int varToStairLinking,
1909  int block1,
1910  int block2
1911  );
1912 
1913 
1918  void showVisualisation();
1919 
1920 
1925  SCIP_Bool shouldCompletedByConsToMaster();
1926 
1927 
1931  void sort();
1932 
1933 
1938  const char* getShortCaption();
1939 
1940 
1941 
1947  SCIP_RETCODE setDetectorChainString(
1948  char* detectorchainstring
1949  );
1950 
1951 
1956  void setNNewBlocksVector(
1957  std::vector<int> newvector
1958 );
1959 
1960 
1966  std::vector<SCIP_Real> newvector
1967  );
1968 
1969 
1975  std::vector<SCIP_Real> newvector
1976  );
1977 
1983  std::vector<SCIP_Real> newvector
1984  );
1985 
1986 
1992  std::vector<SCIP_Real> newvector
1993  );
1994 
1995 
2001  std::vector<SCIP_Real> newvector
2002  );
2003 
2004 
2005 
2011  std::vector<SCIP_Real> newvector
2012  );
2013 
2018  void setDetectorClockTimes(
2019  std::vector<SCIP_Real> newvector
2020  );
2021 
2022 
2028  bool varClassifierUsed(
2029  int detectorchainindex
2030  );
2031 
2032 
2040  SCIP_RETCODE writeAsDec(
2041  FILE* file,
2042  Seeedpool* seeedpooltowriteto,
2043  SCIP_RESULT* result
2044  );
2045 
2046 
2047 
2053  SCIP_RETCODE buildDecChainString();
2054 
2055 private:
2056 
2057 
2061  void addEmptyClassifierStatistics();
2062 
2063 
2073  bool assignHittingOpenconss(
2074  );
2075 
2076 
2077 
2083  bool assignHittingOpenvars(
2084  );
2085 
2086 
2094  SCIP_RETCODE assignOpenPartialHittingConsToMaster(
2095  );
2096 
2097 
2098 
2103  SCIP_RETCODE assignOpenPartialHittingToMaster(
2104  );
2105 
2106 
2107 
2114  SCIP_RETCODE assignOpenPartialHittingVarsToMaster(
2115  );
2116 
2117 
2122  SCIP_RETCODE calcNCoeffsForBlocks(
2123  );
2124 
2125 
2126 
2131  void calcmaxwhitescore();
2132 
2133 
2146  void calcbendersscore();
2147 
2157  SCIP_RETCODE calcclassicscore();
2158 
2163  void calcborderareascore();
2164 
2170  void calcmaxforeseeingwhitescore();
2171 
2172 
2177  void calcmaxforeseeingwhitescoreagg();
2178 
2186  void calcsetpartfwhitescore();
2187 
2188 
2193  void calcsetpartfwhitescoreagg();
2194 
2205  void calcbenderareascore();
2206 
2211  void calcblockareascore();
2212 
2213 
2218  void calcblockareascoreagg();
2219 
2220 };
2221 
2222 } /* namespace gcg */
2223 #endif /* GCG_CLASS_Seeed_H__ */
SCIP_RETCODE displayAggregationInformation()
prints out the aggregation information that is calculated yet, i.e. if there has been identified iden...
SCIP_RETCODE considerImplicits()
: assigns every open cons/var in the following manner:
void calcStairlinkingVars()
reassigns linking vars to stairlinkingvars if possible potentially reorders blocks for making a maxim...
void setFinishedByFinisher(bool finished)
sets whether this seeed was finished by a finishing detector
std::vector< int > getOpenconssVec()
returns a vector containing constraint ids not assigned yet as vector
void addDecChangesFromAncestor(Seeed *ancestor)
incorporates the changes from ancestor seeed into the statistical data structures ...
SCIP_RETCODE buildDecChainString()
creates and sets a detector chain short string for this seeed, is built from detector chain ...
int getAncestorID(int ancestorindex)
gets seeed id of given ancestor id
SCIP_Real evaluate(SCORETYPE type)
computes and returns the score of the given type of the seeed
SCIP_RETCODE completeByConnected()
assigns all open constraints and open variables strategy: assigns all conss and vars to the same bloc...
void addAncestorID(int ancestor)
SCIP_RETCODE filloutBorderFromConstoblock(SCIP_HASHMAP *constoblock, int givenNBlocks)
every constraint is either assigned to master or open according to the cons assignment information gi...
void setFinishedUnpresolvedBy(DEC_DETECTOR *detector)
sets the detector that finished the seeed in the unpresolved problem
struct DEC_Detector DEC_DETECTOR
Definition: type_detector.h:46
void setPctVarsToBorderVector(std::vector< SCIP_Real > newvector)
set statistical vector of fraction sof variables assigned to the border per involved detector ...
SCIP_RETCODE getConsClassifierData(int detectorchainindex, ConsClassifier **classifier, std::vector< int > &consclassesmaster)
returns the data of the consclassifier that the given detector made use of
const int * getOpenconss()
returns array containing constraints not assigned yet
void setNNewBlocksVector(std::vector< int > newvector)
set statistical vector of numbers of newly assigned blocks per involved detector
SCIP_Real getPctVarsToBorder(int detectorchainindex)
returns fraction of variables assigned to the border for a detector
bool isVarBlockvarOfBlock(int var, int block)
returns true if the var is assigned to the block
int getNNewBlocks(int detectorchainindex)
returns number of blocks a detector added
SCIP_RETCODE bookAsBlockVar(int varToBlock, int block)
books a variable to be added to the block constraints of the given block (by calling flushBooked all ...
void sort()
sorts the vars and conss datat structures by their indices
int addBlock()
adds a block, returns the number of the new block
int getNConssForBlock(int block)
returns size of the vector containing conss assigned to a block
bool getFinishedByFinisher()
returns true iff this seeed was finished by finishSeeed() method of a detector
void setPctVarsFromFreeVector(std::vector< SCIP_Real > newvector)
set statistical vector of variables that are not longer open per involved detector ...
bool isFromUnpresolved()
returns true if the seeed is from the unpresolved problem
SCIP_RETCODE writeAsDec(FILE *file, Seeedpool *seeedpooltowriteto, SCIP_RESULT *result)
write this seeed to file in dec format for the corresponding seeedpool
std::vector< DEC_DETECTOR * > getDetectorchainVector()
returns the detectorchain as a vector of detector pointers
void setConsClassifierStatistics(int detectorchainindex, ConsClassifier *classifier, std::vector< int > consclassesmaster)
registers statistics for a used consclassifier
SCIP_RETCODE setFinishingDetectorPropagated(DEC_DETECTOR *detector)
sets seeed to be finished by a detector
int getNLinkingvars()
returns size of the vector containing linking vars
const int * getMasterconss()
SCIP_RETCODE displayVars()
displays the assignments of the vars
SCIP_Real getPctConssToBlock(int detectorchainindex)
returns fraction of constraints assigned to a block for a detector
std::vector< SCIP_Real > getPctVarsToBorderVector()
returns fraction of variables assigned to the border for detectors in detectorchain ...
void setUsergiven(USERGIVEN usergiven)
sets whether this seeed is usergiven
void setPctConssFromFreeVector(std::vector< SCIP_Real > newvector)
set statistical vector of fractions of constraints that are not longer open per involved detector ...
int getNVars()
returns number of vars
void changeBlockOrderStaircase(GraphGCG *g)
changes the block order in a way such that all linking vars that are potentially stairlinking may be ...
bool isFromLegacymode()
returns true if the seeed is from a detector operating in legacymode
void addPctConssToBorder(SCIP_Real pct)
bookkeeping information: adds fraction of constraints assigned to the border for a detector added to ...
SCIP_RETCODE setVarToMaster(int varToMaster)
int getNConss()
returns the number of constraints
int getNAncestors()
returns number of ancestor seeeds
enum scoretype SCORETYPE
Definition: cons_decomp.h:66
SCIP_RETCODE setConsToMaster(int consToMaster)
adds a constraint to the master constraints, does not delete this cons from list of open conss ...
bool isVarStairlinkingvarOfBlock(int var, int block)
returns true if the var is a stairlinkingvar of a speciefied block
std::string getDetectorClassifierInfo(int detectorchainindex, bool displayConssVars)
returns a string displaying classifier information if such a classifier was used
SCIP_RETCODE postprocessMasterToBlocks(SCIP_Bool *success)
try to reassign each mastercons to one block without inducing conflicts
const std::vector< int > & getBlocksForRep(int repid)
get a vector of block ids that are identical to block with id repid
class for classifying constraints
SCIP_Bool isAgginfoToExpensive()
checks if calculation of aggregation information is considered to be to expansive ...
bool isVarStairlinkingvar(int var)
returns true if the var is a stairlinking var
Seeedpool * getSeeedpool()
returns the corresponding seeedpool
SCIP_RETCODE setConsToBlock(int consToBlock, int block)
adds a constraint to a block, does not delete this cons from list of open conss
SCIP_RETCODE setVarToBlock(int varToBlock, int block)
adds a variable to the linking variables, does not delete this var from list of open vars ...
SCIP_Real getPctConssFromFree(int detectorchainindex)
returns fraction of constraints that are not longer open for a detector
std::vector< int > getOpenvarsVec()
bool assignCurrentStairlinking()
assigns open vars to stairlinking if they can be found in exactly two consecutive blocks...
int getNOpenvars()
returns size of vector containing variables not assigned yet
USERGIVEN getUsergiven()
returns the USERGIVEN status of this seeeds
SCIP_RETCODE completeGreedily()
assigns all open constraints and open variables strategy: assigns a cons (and related vars) to a new ...
void setSeeedpool(Seeedpool *seeedpool)
set the corresponding seeedpool of this seeeds
void setStemsFromUnpresolved(bool stemsfromunpresolved)
sets whether this seeed stems from an unpresolved problem seeed
void setPctConssToBlockVector(std::vector< SCIP_Real > newvector)
set statistical vector of fractions of constraints set to blocks per involved detector ...
SCIP_RETCODE refineToMaster()
refine seeed with focus on master: do obvious (
int getNTotalStairlinkingvars()
returns total number of stairlinking vars
std::string getComponentInformation()
returns a string containing statistical data of the numbers of constraints and variables in the compo...
std::vector< int > & getRepVarmap(int repid, int blockrepid)
returns the represenation varmap as vector for represenative repid and the blockrepid-th block that i...
const int * getLinkingvars()
returns array containing all linking vars indices
SCIP_RETCODE copyClassifierStatistics(const Seeed *otherseeed)
copies the given seeed&#39;s classifier statistics
const int * getVarsForBlock(int block)
returns array containing vars of a block
SCIP_RETCODE setNBlocks(int nBlocks)
sets number of blocks, only increasing number allowed
DEC_DETECTOR ** getDetectorchain()
returns detector chain as array of detector pointers
void setLegacymode(bool legacymode)
sets whether this seeed stems from a detector operating in legacymode
bool isVarOpenvar(int var)
returns true if the var is an open var
int getNReps()
returns the number of blockrepresentatives
SCIP_RETCODE flushBooked()
assigns all booked constraints and variables and deletes them from list of open cons and open vars ...
SCIP_RETCODE deleteOpencons(int opencons)
deletes a cons from list of open conss
bool getStemsFromUnpresolved()
returns true if this seeed stems from the unpresolved problem
Implementation of the graph which supports both node and edge weights.
void addPctVarsToBorder(SCIP_Real pct)
bookkeeping information: adds fraction of variables assigned to the border for a detector added to de...
bool alreadyAssignedConssToBlocks()
method to check if at leas one constraint is assigned to some block
void setPctConssToBorderVector(std::vector< SCIP_Real > newvector)
set statistical vector of fractions of constraints assigned to the border per involved detector ...
bool consClassifierUsed(int detectorchainindex)
returns true if the given detector used a consclassifier
void setIsFromUnpresolved(bool unpresolved)
sets whether this seeed is from the unpresolved problem
bool checkAllConssAssigned()
returns true iff all constraints are assigned and deletes the vector open conss if so ...
void calcAggregationInformation()
checks if aggregation of sub problems is possible and stores the corresponding aggregation informatio...
class to manage partial decompositions (aka seeed), each seeed corresponds to one seeedpool which con...
Definition: class_seeed.h:71
void initOnlyBinMaster()
prepare the seeed such that all predecessors have the folloing property: all variables in the master ...
void addPctVarsToBlock(SCIP_Real pct)
bookkeeping information: adds fraction of variables assigned to a block for a detector added to detec...
SCIP_Real getScore(SCORETYPE type)
returns the score of the seeed (depending on used scoretype)
void setPctVarsToBlockVector(std::vector< SCIP_Real > newvector)
set statistical vector of fractions of variables assigned to a block per involved detector ...
SCIP_RETCODE setDetectorPropagated(DEC_DETECTOR *detector)
sets seeed to be propagated by a detector
SCIP_RETCODE setDetectorChainString(char *detectorchainstring)
sets the detector chain short string
std::vector< SCIP_Real > getPctConssToBorderVector()
returns fraction of constraints assigned to the border for detectors in detectorchain ...
int getID()
returns the unique id of the seeed
SCIP_RETCODE assignSeeedFromConstoblock(SCIP_HASHMAP *constoblock, int additionalNBlocks)
adds blocks and assigns open conss to such a new block or to master according to the cons assignment ...
SCIP_RETCODE assignSeeedFromConstoblockVector(std::vector< int > constoblock, int additionalNBlocks)
adds blocks and assigns open conss to such a new block or to master according to the cons assignment ...
SCIP_RETCODE setVarToLinking(int varToLinking)
adds a variable to the linking variables, does not delete this var from list of open vars ...
void addDetectorChainInfo(const char *decinfo)
adds a detectorchain information string to the corresponding vector (that carries information for eac...
void addPctVarsFromFree(SCIP_Real pct)
bookkeeping information: adds fraction of variables that are not longer open for a detector added to ...
SCIP_RETCODE getVarClassifierData(int detectorchainindex, VarClassifier **classifier, std::vector< int > &varclasseslinking, std::vector< int > &varclassesmaster)
returns the data of the varclassifier that the given detector made use of
SCIP_RETCODE displayConss()
displays the assignments of the conss to blocks and master
int getNCoeffsForMaster()
SCIP_Bool hasSetppcMaster()
checks iff all master constraints set partitioning, set packing, or set cover constraints ...
std::vector< std::pair< int, std::vector< int > > > findLinkingVarsPotentiallyStairlinking()
calculates potential stair linking variables with their blocks
bool isTrivial()
returns true if this seeed is considered to be trivial, i.e. all conss are in one block...
SCIP_RETCODE isEqual(Seeed *otherseeed, SCIP_Bool *isequal, bool sortseeeds)
method to check whether this seeed is equal to a given other seeed (
void setDetectorClockTimes(std::vector< SCIP_Real > newvector)
set statistical vector of the times that the detectors needed for detecting per involved detector ...
SCIP_RETCODE completeByConnectedConssAdjacency()
assigns all open constraints and open variables strategy: assigns all conss and vars to the same bloc...
SCIP_Real getPctConssToBorder(int detectorchainindex)
returns fraction of constraints assigned to the border for a detector
int getNDetectorchainInfo()
returns size of the detectorchain info vector
bool isComplete()
returns true if this seeed is complete, i.e. it has no more open constraints and variables ...
void setFinishedByFinisherUnpresolved(bool finishedByFinisherUnpresolved)
sets whether this seeed is finished by a finisher in the unpresolved problem
SCIP_RETCODE deleteEmptyBlocks(bool variables)
deletes empty blocks and sets nblocks accordingly, a block is considered to be empty if no constraint...
Seeed(SCIP *scip, int id, Seeedpool *seeedpool)
Definition: class_seeed.cpp:87
SCIP_RETCODE setID(int id)
sets the id of the seeed
bool isVarMastervar(int var)
returns true if the var is a master var
SCIP_RETCODE printClassifierInformation(SCIP *scip, FILE *file)
prints classifier information as described in
SCIP_RETCODE postprocessMasterToBlocksConssAdjacency(SCIP_Bool *success)
try to reassign each mastercons to one block without inducing conflicts using the cons adjacency data...
int getNBlocks()
returns the number of blocks
SCIP_Bool hasSetppMaster()
checks iff all master constraints set partitioning, or set packing constraints
int getRepForBlock(int blockid)
returns index of the representative block for a block, this might be blockid itself ...
void changeBlockOrder(std::vector< int > oldToNewBlockIndex)
changes the order of the blocks according to the given mapping
void calcNCoeffsForBlockForMastercons()
counts for each pair of block and master constraint, how many nonzero entries the variables of the bl...
DEC_DETECTOR * getFinishedUnpresolvedBy()
returns the detector that finished this seeed in the unpresolved problem if there exists one...
miscellaneous graph methods for structure detection
const int * getConssForBlock(int block)
returns array containing constraints assigned to a block
SCIP_RETCODE deleteOpenvar(int openvar)
deletes a var from the list of open vars
std::vector< SCIP_Real > getPctConssFromFreeVector()
returns fraction of constraints that are not longer open for detectors in detectorchain ...
std::vector< int > getNNewBlocksVector()
number of blocks the detectors in the detectorchain added
bool isPropagatedBy(DEC_DETECTOR *detectorID)
returns true if this seeed was propagated by specified detector
SCIP_RETCODE bookAsBlockCons(int consToBlock, int block)
books a constraint to be added to the block constraints of the given block (by calling flushBooked al...
std::vector< SCIP_Real > getPctVarsToBlockVector()
returns fraction of variables assigned to a block for detectors in detectorchain
SCIP_Bool shouldCompletedByConsToMaster()
returns true if this seeed is a userseeed that should be completed by setting unspecified constraints...
SCIP_RETCODE displayInfo(int detailLevel)
displays the relevant information of the seeed
bool getFinishedByFinisherUnpresolved()
returns true if the seeed is finished by a finisher in the unpresolved problem
USERGIVEN
enumeration to display if a decomposition was given by the user and if so, how it was processed after...
Definition: class_seeed.h:57
class for classifying variables
const int * getOpenvars()
returns array containing variables not assigned yet
bool isConsMastercons(int cons)
returns true if the cons is a master cons
void changeBlockOrderGreedily(GraphGCG *g)
changes the block order in a way such that some linking vars that are potentially stairlinking may be...
std::string getDetectorStatistics(int detectorchainindex)
returns a string displaying all detector-related information, i.e. clock times and assignment data ...
void calcHashvalue()
calculates the hash value of the seeed for comparing
void showVisualisation()
generates and opens a gp visualization of the seeed
SCIP_RETCODE bookAsStairlinkingVar(int varToStairlinking, int firstBlock)
books a variable to be added to the stairlinking variables of the given block and the following block...
int getNUsedClassifier()
returns the number used classifiers
SCIP_Real getMaxWhiteScore()
returns the "maximum white score"
const char * getShortCaption()
returns a short caption for this seeed
bool isConsBlockconsOfBlock(int cons, int block)
returns true if the cons is a cons of the block
int getNDetectors()
returns the number of detectors the seeed is propagated by
char * getDetectorChainString()
the detectorchainstring contains the chars of all detectors that worked on this seeed in this order ...
void setSelected(bool selected)
set if selection status of this seeeds
bool isConsOpencons(int cons)
returns true if the cons is an open cons
void addPctConssToBlock(SCIP_Real pct)
bookkeeping information: adds fraction of constraints assigned to a block for a detector added to det...
SCIP_Bool hasSetppccardMaster()
checks if all master constraints set partitioning, set packing, set cover, or cardinality constraints...
int getNStairlinkingvars(int block)
returns size of the vector containing stairlinking vars
int getNMasterconss()
returns size of the vector containing master conss
int getNVarsForBlock(int block)
returns size of the vector containing vars assigned to a block
void setDetectorchain(std::vector< DEC_DETECTOR * > detectorChain)
bool varClassifierUsed(int detectorchainindex)
returns true if the given detector used a varclassifier
int getNOpenconss()
returns size of vector containing constraints not assigned yet
SCIP_RETCODE displaySeeed()
displays the relevant information of the seeed
SCIP_RETCODE assignSmallestComponentsButOneConssAdjacency()
computes components corresponding to connectedness of conss and vars as in
void setAncestorList(std::vector< int > newlist)
SCIP_Real getPctVarsToBlock(int detectorchainindex)
returns fraction of variables assigned to a block for a detector
SCIP_Real getDetectorClockTime(int detectorchainindex)
returns the time that the detector related to the given detectorchainindex needed for detecting ...
SCIP_RETCODE assignBorderFromConstoblock(SCIP_HASHMAP *constoblock, int givenNBlocks)
assigns open conss to master according to the cons assignment information given in constoblock hashma...
SCIP_RETCODE bookAsMasterCons(int consToMaster)
books a constraint to be added to the master constraints (by calling flushBooked all bookings are in ...
const int * getMastervars()
bool isVarLinkingvar(int var)
returns true if the var is a linking var
bool checkConsistency()
returns true if the assignments in the seeed are consistent the following checks are performed: 1) ch...
int getVarProbindexForBlock(int varid, int block)
returns index in variables array of a block for a variable
const int * getStairlinkingvars(int block)
returns array containing stairlinking vars,
SCIP_Real getBendersScore()
returns the experimental benders score in detail: bendersscore = max ( 0., 1 - ( 1 - blockareascore +...
void addNNewBlocks(int nnewblocks)
bookkeeping information: adds number of new blocks created by a detector added to detector chain ...
std::vector< SCIP_Real > getPctConssToBlockVector()
returns fraction of constraints assigned to a block for detectors in detectorchain ...
void addClockTime(SCIP_Real clocktime)
incorporates the needed time of a certain detector in the detector chain
SCIP_RETCODE filloutSeeedFromConstoblock(SCIP_HASHMAP *constoblock, int givenNBlocks)
assigns all conss to master or a block according to the cons assignment information given in constobl...
void setVarClassifierStatistics(int detectorchainindex, VarClassifier *classifier, std::vector< int > varclasseslinking, std::vector< int > varclassesmaster)
registers statistics for a used varclassifier
constraint handler for structure detection
SCIP_RETCODE findVarsLinkingToStairlinking()
reassigns variables classified as linking to stairlinking if the variable hits conss in exactly two c...
int getNCoeffsForBlock(int blockid)
returns the number of nonzero coeffs in a certain block
SCIP_RETCODE bookAsLinkingVar(int varToLinking)
books a variable to be added to the linking variables (by calling flushBooked all bookings are in fac...
int getNMastervars()
returns size of the vector containing master vars (hitting only constraints in the master) ...
bool isSelected()
long getHashValue()
returns the calculated hash value of this seeed
std::vector< SCIP_Real > getDetectorClockTimes()
returns a vector of the clock times that each detector needed that was involved in this seeed ...
std::string getDetectorchainInfo(int detectorchainindex)
returns detectorchain info of detector related to given detectorchain index
SCIP_RETCODE bookAsMasterVar(int varToMaster)
books a variable to be added to the master variables (by calling flushBooked all bookings are in fact...
void addPctConssFromFree(SCIP_Real pct)
bookkeeping information: fraction of constraints that are not longer open for a detector added to det...
SCIP_RETCODE findVarsLinkingToMaster()
reassigns variables classified as linking to master if the variable only hits master conss ...
SCIP_RETCODE setVarToStairlinking(int varToStairLinking, int block1, int block2)
adds a variable to the stairlinking variabl, does not delete this var from list of open vars ...
SCIP_RETCODE refineToBlocks()
refine seeed with focus on blocks: assigns open conss and vars if they can be found in blocks (withou...
std::vector< SCIP_Real > getPctVarsFromFreeVector()
returns fraction of variables that are not longer open for detectors in detectorchain ...
SCIP_Real getPctVarsFromFree(int detectorchainindex)
returns fraction of variables that are not longer open for a detector
std::vector< int > getAncestorList()
get ancestor ids as vector