Detailed Description
detector for staircase_lsp matrices
This detector detects staircase_lsp structures in the constraint matrix by searching for the longest shortest path in the row graph of the matrix.
Definition in file dec_staircase_lsp.cpp.
#include <assert.h>#include <string.h>#include <iostream>#include "gcg/dec_staircase_lsp.h"#include "gcg/cons_decomp.h"#include "gcg/scip_misc.h"#include "gcg/pub_decomp.h"#include "tclique/tclique.h"#include "gcg/class_partialdecomp.h"#include "gcg/class_detprobdata.h"#include "scip/clock.h"Go to the source code of this file.
Data Structures | |
| struct | GCG_DetectorData |
Macros | |
| #define | DEC_NAME "staircase_lsp" |
| #define | DEC_DESC "Staircase detection via shortest paths" |
| #define | DEC_PRIORITY 200 |
| #define | DEC_FREQCALLROUND 1 |
| #define | DEC_MAXCALLROUND INT_MAX |
| #define | DEC_MINCALLROUND 0 |
| #define | DEC_FREQCALLROUNDORIGINAL 1 |
| #define | DEC_MAXCALLROUNDORIGINAL INT_MAX |
| #define | DEC_MINCALLROUNDORIGINAL 0 |
| #define | DEC_DECCHAR 'S' |
| #define | DEC_ENABLED FALSE |
| #define | DEC_ENABLEDFINISHING FALSE |
| #define | DEC_ENABLEDPOSTPROCESSING FALSE |
| #define | DEC_SKIP FALSE |
| #define | DEC_USEFULRECALL FALSE |
| #define | TCLIQUE_CALL(x) |
| #define | detectorPostprocessPartialdecStaircaseLsp NULL |
Functions | |
| static SCIP_RETCODE | createGraphFromPartialMatrix (SCIP *scip, TCLIQUE_GRAPH **graph, gcg::PARTIALDECOMP *partialdec, gcg::DETPROBDATA *detprobdata, GCG_DETECTORDATA *detectordata) |
| static SCIP_RETCODE | findDiameter (SCIP *scip, GCG_DETECTORDATA *detectordata, int *maxdistance, int *ncomp, int *vertices, int *distances, int component) |
| static SCIP_RETCODE | findConnectedComponents (SCIP *scip, GCG_DETECTORDATA *detectordata) |
| static | GCG_DECL_FREEDETECTOR (detectorFreeStaircaseLsp) |
| static | GCG_DECL_INITDETECTOR (detectorInitStaircaseLsp) |
| static | GCG_DECL_EXITDETECTOR (detectorExitStaircaseLsp) |
| static SCIP_RETCODE | detection (SCIP *scip, GCG_DETECTORDATA *detectordata, Partialdec_Detection_Data *partialdecdetectiondata) |
| static | GCG_DECL_PROPAGATEPARTIALDEC (detectorPropagatePartialdecStaircaseLsp) |
| static | GCG_DECL_FINISHPARTIALDEC (detectorFinishPartialdecStaircaseLsp) |
| static | GCG_DECL_SETPARAMFAST (setParamAggressiveStaircaseLsp) |
| static | GCG_DECL_SETPARAMFAST (setParamDefaultStaircaseLsp) |
| static | GCG_DECL_SETPARAMFAST (setParamFastStaircaseLsp) |
| SCIP_RETCODE | GCGincludeDetectorStaircaseLsp (GCG *gcg) |
Macro Definition Documentation
◆ DEC_NAME
| #define DEC_NAME "staircase_lsp" |
name of detector
Definition at line 58 of file dec_staircase_lsp.cpp.
◆ DEC_DESC
| #define DEC_DESC "Staircase detection via shortest paths" |
description of detector
Definition at line 59 of file dec_staircase_lsp.cpp.
◆ DEC_PRIORITY
| #define DEC_PRIORITY 200 |
priority of the detector
Definition at line 60 of file dec_staircase_lsp.cpp.
◆ DEC_FREQCALLROUND
| #define DEC_FREQCALLROUND 1 |
frequency the detector gets called in detection loop ,ie it is called in round r if and only if minCallRound <= r <= maxCallRound AND (r - minCallRound) mod freqCallRound == 0
Definition at line 61 of file dec_staircase_lsp.cpp.
◆ DEC_MAXCALLROUND
| #define DEC_MAXCALLROUND INT_MAX |
last round the detector gets called
Definition at line 62 of file dec_staircase_lsp.cpp.
◆ DEC_MINCALLROUND
| #define DEC_MINCALLROUND 0 |
first round the detector gets called
Definition at line 63 of file dec_staircase_lsp.cpp.
◆ DEC_FREQCALLROUNDORIGINAL
| #define DEC_FREQCALLROUNDORIGINAL 1 |
frequency the detector gets called in detection loop while detecting the original problem
Definition at line 64 of file dec_staircase_lsp.cpp.
◆ DEC_MAXCALLROUNDORIGINAL
| #define DEC_MAXCALLROUNDORIGINAL INT_MAX |
last round the detector gets called while detecting the original problem
Definition at line 65 of file dec_staircase_lsp.cpp.
◆ DEC_MINCALLROUNDORIGINAL
| #define DEC_MINCALLROUNDORIGINAL 0 |
first round the detector gets called while detecting the original problem
Definition at line 66 of file dec_staircase_lsp.cpp.
◆ DEC_DECCHAR
| #define DEC_DECCHAR 'S' |
display character of detector
Definition at line 67 of file dec_staircase_lsp.cpp.
◆ DEC_ENABLED
| #define DEC_ENABLED FALSE |
should the detection be enabled
Definition at line 68 of file dec_staircase_lsp.cpp.
◆ DEC_ENABLEDFINISHING
| #define DEC_ENABLEDFINISHING FALSE |
should the finishing be enabled
Definition at line 69 of file dec_staircase_lsp.cpp.
◆ DEC_ENABLEDPOSTPROCESSING
| #define DEC_ENABLEDPOSTPROCESSING FALSE |
should the postprocessing be enabled
Definition at line 70 of file dec_staircase_lsp.cpp.
◆ DEC_SKIP
| #define DEC_SKIP FALSE |
should detector be skipped if others found detections
Definition at line 71 of file dec_staircase_lsp.cpp.
◆ DEC_USEFULRECALL
| #define DEC_USEFULRECALL FALSE |
is it useful to call this detector on a descendant of the propagated partialdec
Definition at line 72 of file dec_staircase_lsp.cpp.
◆ TCLIQUE_CALL
| #define TCLIQUE_CALL | ( | x | ) |
Definition at line 74 of file dec_staircase_lsp.cpp.
◆ detectorPostprocessPartialdecStaircaseLsp
| #define detectorPostprocessPartialdecStaircaseLsp NULL |
Definition at line 703 of file dec_staircase_lsp.cpp.
Function Documentation
◆ createGraphFromPartialMatrix()
|
static |
creates the graph from the constraint matrix
- Parameters
-
scip SCIP data structure graph Graph data structure partialdec partial decomposition to use for matrix detprobdata detection process information and data detectordata detector data data structure
Definition at line 111 of file dec_staircase_lsp.cpp.
References gcg::DETPROBDATA::getConssForVar(), gcg::DETPROBDATA::getNConss(), gcg::DETPROBDATA::getNConssForVar(), gcg::PARTIALDECOMP::getNOpenconss(), gcg::DETPROBDATA::getNVarsForCons(), gcg::PARTIALDECOMP::getOpenconss(), gcg::DETPROBDATA::getVarsForCons(), gcg::PARTIALDECOMP::isConsOpencons(), gcg::PARTIALDECOMP::isVarOpenvar(), GCG_DetectorData::newToOld, NULL, GCG_DetectorData::oldToNew, SCIP_OKAY, TCLIQUE_CALL, tcliqueAddEdge(), tcliqueAddNode(), tcliqueCreate(), and tcliqueFlush().
Referenced by detection().
◆ findDiameter()
|
static |
finds the diameter of a connected component of a graph and computes all distances from some vertex of maximum eccentricity to all other vertices
- Parameters
-
scip SCIP data structure detectordata constraint handler data structure maxdistance diameter of the graph ncomp number of vertices the component contains vertices vertices of the connected component (ordered by BFS) distances distances of vertices to some vertex of maximum eccentricity component connected component to investigate
Definition at line 185 of file dec_staircase_lsp.cpp.
References BMSclearMemoryArray, GCG_DetectorData::components, FALSE, GCG_DetectorData::graph, nnodes, NULL, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIPallocMemoryArray, SCIPdebugMessage, SCIPfreeMemoryArray, SCIPsortDownIntInt(), tcliqueGetDegrees(), tcliqueGetFirstAdjedge(), tcliqueGetLastAdjedge(), and TRUE.
Referenced by detection().
◆ findConnectedComponents()
|
static |
finds the connected components of the row graph. a staircase_lsp decomposition will be built for each component separately.
- Parameters
-
scip SCIP data structure detectordata constraint handler data structure
Definition at line 366 of file dec_staircase_lsp.cpp.
References GCG_DetectorData::components, GCG_DetectorData::graph, GCG_DetectorData::ncomponents, nnodes, NULL, SCIP_CALL, SCIP_OKAY, SCIPallocMemoryArray, SCIPdebugMessage, SCIPfreeMemoryArray, tcliqueGetFirstAdjedge(), and tcliqueGetLastAdjedge().
Referenced by detection().
◆ GCG_DECL_FREEDETECTOR()
|
static |
destructor of detector to free user data (called when GCG is exiting)
Definition at line 450 of file dec_staircase_lsp.cpp.
References DEC_NAME, GCGdetectorGetData(), GCGdetectorGetName(), GCGgetOrigprob(), GCG_DetectorData::newToOld, NULL, GCG_DetectorData::oldToNew, SCIP_OKAY, and SCIPfreeMemory.
◆ GCG_DECL_INITDETECTOR()
|
static |
detector initialization method (called after the problem has been transformed)
Definition at line 471 of file dec_staircase_lsp.cpp.
References GCG_DetectorData::components, GCG_DetectorData::constoblock, DEC_NAME, GCGdetectorGetData(), GCGdetectorGetName(), GCG_DetectorData::graph, GCG_DetectorData::nblocks, GCG_DetectorData::ncomponents, NULL, SCIP_OKAY, and GCG_DetectorData::vartoblock.
◆ GCG_DECL_EXITDETECTOR()
|
static |
detector deinitialization method (called before the transformed problem is freed)
Definition at line 495 of file dec_staircase_lsp.cpp.
References GCG_DetectorData::components, DEC_NAME, GCGdetectorGetData(), GCGdetectorGetName(), GCGgetOrigprob(), GCG_DetectorData::graph, NULL, SCIP_OKAY, SCIPfreeMemoryArray, and tcliqueFree().
◆ detection()
|
static |
detection function for partialdecs
- Parameters
-
scip SCIP data structure detectordata detectordata of the detector partialdecdetectiondata partialdecdetectiondata (including the detprobdata) where to store the new Partialdecs
Definition at line 522 of file dec_staircase_lsp.cpp.
References gcg::PARTIALDECOMP::addClockTime(), gcg::PARTIALDECOMP::addDetectorChainInfo(), gcg::PARTIALDECOMP::assignCurrentStairlinking(), gcg::PARTIALDECOMP::assignPartialdecFromConstoblock(), gcg::PARTIALDECOMP::checkConsistency(), GCG_DetectorData::components, GCG_DetectorData::constoblock, createGraphFromPartialMatrix(), Partialdec_Detection_Data::detectiontime, Partialdec_Detection_Data::detprobdata, findConnectedComponents(), findDiameter(), gcg::DETPROBDATA::getNConss(), GCG_DetectorData::graph, GCG_DetectorData::nblocks, GCG_DetectorData::ncomponents, Partialdec_Detection_Data::newpartialdecs, GCG_DetectorData::newToOld, Partialdec_Detection_Data::nnewpartialdecs, nnodes, NULL, gcg::PARTIALDECOMP::prepare(), gcg::PARTIALDECOMP::refineToMaster(), SCIP_CALL, SCIP_CALL_ABORT, SCIP_MAXSTRLEN, SCIP_OKAY, SCIPallocMemoryArray, SCIPblkmem(), SCIPcreateClock(), SCIPdebugMessage, SCIPfreeClock(), SCIPfreeMemoryArray, SCIPgetClockTime(), SCIPhashmapCreate(), SCIPhashmapFree(), SCIPhashmapInsert(), SCIPsnprintf(), SCIPstartClock(), SCIPstopClock(), gcg::PARTIALDECOMP::sort(), tcliqueFree(), GCG_DetectorData::vartoblock, and Partialdec_Detection_Data::workonpartialdec.
Referenced by GCG_DECL_FINISHPARTIALDEC(), and GCG_DECL_PROPAGATEPARTIALDEC().
◆ GCG_DECL_PROPAGATEPARTIALDEC()
|
static |
detector structure detection method, tries to detect a structure in the problem
Definition at line 641 of file dec_staircase_lsp.cpp.
References GCG_DetectorData::components, GCG_DetectorData::constoblock, detection(), GCGgetOrigprob(), GCG_DetectorData::graph, GCG_DetectorData::nblocks, GCG_DetectorData::ncomponents, GCG_DetectorData::newToOld, NULL, GCG_DetectorData::oldToNew, SCIP_CALL, SCIP_DIDNOTFIND, SCIP_OKAY, SCIP_SUCCESS, SCIPallocMemory, SCIPfreeMemory, and GCG_DetectorData::vartoblock.
◆ GCG_DECL_FINISHPARTIALDEC()
|
static |
Definition at line 672 of file dec_staircase_lsp.cpp.
References GCG_DetectorData::components, GCG_DetectorData::constoblock, detection(), GCGgetOrigprob(), GCG_DetectorData::graph, GCG_DetectorData::nblocks, GCG_DetectorData::ncomponents, GCG_DetectorData::newToOld, NULL, GCG_DetectorData::oldToNew, SCIP_CALL, SCIP_DIDNOTFIND, SCIP_OKAY, SCIP_SUCCESS, SCIPallocMemory, SCIPfreeMemory, and GCG_DetectorData::vartoblock.
◆ GCG_DECL_SETPARAMFAST() [1/3]
|
static |
Definition at line 707 of file dec_staircase_lsp.cpp.
References GCGdetectorGetName(), GCGgetOrigprob(), SCIP_CALL, SCIP_MAXSTRLEN, SCIP_OKAY, SCIPsetBoolParam(), SCIPsnprintf(), and TRUE.
◆ GCG_DECL_SETPARAMFAST() [2/3]
|
static |
Definition at line 724 of file dec_staircase_lsp.cpp.
References DEC_ENABLED, DEC_ENABLEDFINISHING, GCGdetectorGetName(), GCGgetOrigprob(), SCIP_CALL, SCIP_MAXSTRLEN, SCIP_OKAY, SCIPsetBoolParam(), and SCIPsnprintf().
◆ GCG_DECL_SETPARAMFAST() [3/3]
|
static |
Definition at line 743 of file dec_staircase_lsp.cpp.
References FALSE, GCGdetectorGetName(), GCGgetOrigprob(), SCIP_CALL, SCIP_MAXSTRLEN, SCIP_OKAY, SCIPsetBoolParam(), and SCIPsnprintf().
◆ GCGincludeDetectorStaircaseLsp()
| SCIP_RETCODE GCGincludeDetectorStaircaseLsp | ( | GCG * | gcg | ) |
creates the handler for staircase constraints and includes it in SCIP
- Parameters
-
gcg GCG data structure
Definition at line 765 of file dec_staircase_lsp.cpp.
References GCG_DetectorData::constoblock, DEC_DECCHAR, DEC_DESC, DEC_ENABLED, DEC_ENABLEDFINISHING, DEC_ENABLEDPOSTPROCESSING, DEC_FREQCALLROUND, DEC_FREQCALLROUNDORIGINAL, DEC_MAXCALLROUND, DEC_MAXCALLROUNDORIGINAL, DEC_MINCALLROUND, DEC_MINCALLROUNDORIGINAL, DEC_NAME, DEC_PRIORITY, DEC_SKIP, DEC_USEFULRECALL, detectorPostprocessPartialdecStaircaseLsp, GCGgetOrigprob(), GCGincludeDetector(), GCG_DetectorData::graph, GCG_DetectorData::nblocks, GCG_DetectorData::newToOld, NULL, GCG_DetectorData::oldToNew, SCIP_CALL, SCIP_OKAY, SCIPallocMemory, and GCG_DetectorData::vartoblock.
Referenced by GCGincludeGcgPlugins().