Loading...
Searching...
No Matches
dec_staircase_lsp.cpp
Go to the documentation of this file.
35 * This detector detects staircase_lsp structures in the constraint matrix by searching for the longest shortest path
40/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
61#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 */
64#define DEC_FREQCALLROUNDORIGINAL 1 /**< frequency the detector gets called in detection loop while detecting the original problem */
65#define DEC_MAXCALLROUNDORIGINAL INT_MAX /**< last round the detector gets called while detecting the original problem */
66#define DEC_MINCALLROUNDORIGINAL 0 /**< first round the detector gets called while detecting the original problem */
72#define DEC_USEFULRECALL FALSE /**< is it useful to call this detector on a descendant of the propagated partialdec */
165 if( isNeighbor[otherCons] || alreadyConsidered[otherCons] || !partialdec->isConsOpencons(otherCons) )
169 TCLIQUE_CALL( tcliqueAddEdge(*graph, detectordata->oldToNew->at(cons), detectordata->oldToNew->at(otherCons)) );
183/** finds the diameter of a connected component of a graph and computes all distances from some vertex of maximum eccentricity to all other vertices */
204 int* dist = NULL; /* distances from some start vertex to all other vertices (gets updated in each BFS) */
210 int k = 50; /* number of low-degree vertices that are visited before high-degree vertices are visited */
212 /* This method computes the diameter of a connected component by starting BFS at each vertex and memorizing the depth of the search tree.
213 * If a tree has greater depth than any other tree that was computed before, the vertices itself and their distances to the root of the
216 * As these steps require $O(nm)$ time in the worst case, we apply a simple heuristic that stops BFS from vertices that do not have
218 * a) For each vertex 'v' there is an upper bound 'eccentricity[v]' on the actual eccentricity of 'v'. Initially, this is set to a very large number.
219 * b) Whenever a BFS with root 'v' has finished, 'eccentricity[v]' contains the actual eccentricity of 'v'.
220 * c) If during a BFS with root 'v' a vertex 'u' is discovered, then dist(v, u) + eccentricty[u] is an upper bound on the eccentricity of 'v',
221 * and therefore the BFS is stopped if dist(v, u) + eccentricity[u] <= diameter_lb, where diameter_lb is the greatest eccentricity known so far.
243 /* get degrees of vertices and initialize all eccentricities of vertices to values representing upper bounds */
250 eccentricity[i] = 2 * nnodes; /* do not use INT_MAX because it could lead to an overflow when adding values */
251 degree[ncompnodes] = origdegree[i]; /* we copy the degree array because we are going to sort it */
270 /* change order in which BFSes are performed: first start at 'k' low-degree vertices, then start BFS at high-degree vertices */
305 for( node = tcliqueGetFirstAdjedge(graph, currentnode); !pruned && (node <= lastneighbour); ++node )
339 SCIPdebugMessage("new incumbent in component %i: path of length %i starts at %i\n", component, eccent, startnode);
364/** finds the connected components of the row graph. a staircase_lsp decomposition will be built for each component separately. */
525 Partialdec_Detection_Data* partialdecdetectiondata /**< partialdecdetectiondata (including the detprobdata) where to store the new Partialdecs */
539 gcg::PARTIALDECOMP* currpartialdec = new gcg::PARTIALDECOMP(partialdecdetectiondata->workonpartialdec);
553 SCIP_CALL( createGraphFromPartialMatrix(scip, &(detectordata->graph), currpartialdec, detprobdata, detectordata) );
554 SCIP_CALL( SCIPhashmapCreate(&detectordata->constoblock, SCIPblkmem(scip), detprobdata->getNConss() ) );
560 /* find connected components of the graph. the result will be stored in 'detectordata->components' */
600 SCIP_CALL( SCIPhashmapInsert(detectordata->constoblock, (void*) (size_t) detectordata->newToOld->at(i), (void*) (size_t) (blocks[i] + 1)) );
610 SCIP_CALL( currpartialdec->assignPartialdecFromConstoblock(detectordata->constoblock, nblocks) );
630 partialdecdetectiondata->newpartialdecs[0]->addClockTime(SCIPgetClockTime(scip, temporaryClock));
785 DEC_MAXCALLROUND, DEC_MINCALLROUND, DEC_FREQCALLROUNDORIGINAL, DEC_MAXCALLROUNDORIGINAL, DEC_MINCALLROUNDORIGINAL, DEC_PRIORITY, DEC_ENABLED, DEC_ENABLEDFINISHING, DEC_ENABLEDPOSTPROCESSING, DEC_SKIP,
787 detectorInitStaircaseLsp, detectorExitStaircaseLsp, detectorPropagatePartialdecStaircaseLsp, detectorFinishPartialdecStaircaseLsp, detectorPostprocessPartialdecStaircaseLsp, setParamAggressiveStaircaseLsp, setParamDefaultStaircaseLsp, setParamFastStaircaseLsp) );
class storing partialdecs and the problem matrix
class storing (potentially incomplete) decompositions
Definition class_detprobdata.h:110
GCG_EXPORT std::vector< int > & getConssForVar(int varIndex)
returns the constraint indices of the coefficient matrix for a variable
Definition class_detprobdata.cpp:762
GCG_EXPORT int getNConss()
returns the number of variables considered in the detprobdata
Definition class_detprobdata.cpp:850
GCG_EXPORT int getNVarsForCons(int consIndex)
returns the number of variables for a given constraint
Definition class_detprobdata.cpp:908
GCG_EXPORT int getNConssForVar(int varIndex)
returns the number of constraints for a given variable where the var has a nonzero entry in
Definition class_detprobdata.cpp:864
GCG_EXPORT std::vector< int > & getVarsForCons(int consIndex)
returns the variable indices of the coefficient matrix for a constraint
Definition class_detprobdata.cpp:1023
GCG_EXPORT void refineToMaster()
refine partialdec with focus on master
Definition class_partialdecomp.cpp:5178
GCG_EXPORT bool checkConsistency()
Checks whether the assignments in the partialdec are consistent.
Definition class_partialdecomp.cpp:1722
GCG_EXPORT void addDetectorChainInfo(const char *decinfo)
add information about the detector chain
Definition class_partialdecomp.cpp:482
GCG_EXPORT int getNOpenconss()
Gets size of vector containing constraints not assigned yet.
Definition class_partialdecomp.cpp:4503
GCG_EXPORT bool isVarOpenvar(int var)
Checks whether the var is an open var.
Definition class_partialdecomp.cpp:5048
GCG_EXPORT SCIP_RETCODE assignPartialdecFromConstoblock(SCIP_HASHMAP *constoblock, int additionalNBlocks)
assigns conss structure according to given hashmap
Definition class_partialdecomp.cpp:1001
GCG_EXPORT void addClockTime(SCIP_Real clocktime)
adds detection time of one detector
Definition class_partialdecomp.cpp:453
GCG_EXPORT std::vector< int > & getOpenconss()
Gets vector containing constraints not assigned yet.
Definition class_partialdecomp.cpp:4558
GCG_EXPORT bool isConsOpencons(int cons)
Gets whether the cons is an open cons.
Definition class_partialdecomp.cpp:4826
GCG_EXPORT bool sort()
sorts the vars and conss data structures by their indices
Definition class_partialdecomp.cpp:5807
GCG_EXPORT bool assignCurrentStairlinking()
assigns open vars to stairlinking if appropriate
Definition class_partialdecomp.cpp:596
const char * GCGdetectorGetName(GCG_DETECTOR *detector)
returns the name of the provided detector
Definition cons_decomp.cpp:2084
GCG_DETECTORDATA * GCGdetectorGetData(GCG_DETECTOR *detector)
returns the data of the provided detector
Definition cons_decomp.cpp:2075
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)),)
includes one detector
Definition cons_decomp.cpp:2547
constraint handler for structure detection
static SCIP_RETCODE detection(SCIP *scip, Partialdec_Detection_Data *partialdecdetectiondata)
Definition dec_connected_noNewLinkingVars.cpp:103
static SCIP_RETCODE findDiameter(SCIP *scip, GCG_DETECTORDATA *detectordata, int *maxdistance, int *ncomp, int *vertices, int *distances, int component)
Definition dec_staircase_lsp.cpp:185
static SCIP_RETCODE createGraphFromPartialMatrix(SCIP *scip, TCLIQUE_GRAPH **graph, gcg::PARTIALDECOMP *partialdec, gcg::DETPROBDATA *detprobdata, GCG_DETECTORDATA *detectordata)
Definition dec_staircase_lsp.cpp:111
SCIP_RETCODE GCGincludeDetectorStaircaseLsp(GCG *gcg)
Definition dec_staircase_lsp.cpp:765
static SCIP_RETCODE findConnectedComponents(SCIP *scip, GCG_DETECTORDATA *detectordata)
Definition dec_staircase_lsp.cpp:366
#define detectorPostprocessPartialdecStaircaseLsp
Definition dec_staircase_lsp.cpp:703
staircase compontent detector
#define SCIP_MAXSTRLEN
#define SCIP_Bool
#define SCIP_CALL_ABORT(x)
#define TRUE
#define FALSE
void SCIPhashmapFree(SCIP_HASHMAP **hashmap)
SCIP_RETCODE SCIPhashmapInsert(SCIP_HASHMAP *hashmap, void *origin, void *image)
SCIP_RETCODE SCIPhashmapCreate(SCIP_HASHMAP **hashmap, BMS_BLKMEM *blkmem, int mapsize)
SCIP_RETCODE SCIPsetBoolParam(SCIP *scip, const char *name, SCIP_Bool value)
BMS_BLKMEM * SCIPblkmem(SCIP *scip)
#define SCIPallocMemoryArray(scip, ptr, num)
#define SCIPallocMemory(scip, ptr)
#define SCIPfreeMemoryArray(scip, ptr)
SCIP_RETCODE SCIPcreateClock(SCIP *scip, SCIP_CLOCK **clck)
SCIP_RETCODE SCIPstopClock(SCIP *scip, SCIP_CLOCK *clck)
SCIP_RETCODE SCIPfreeClock(SCIP *scip, SCIP_CLOCK **clck)
SCIP_Real SCIPgetClockTime(SCIP *scip, SCIP_CLOCK *clck)
SCIP_RETCODE SCIPstartClock(SCIP *scip, SCIP_CLOCK *clck)
void SCIPsortDownIntInt(int *intarray1, int *intarray2, int len)
int SCIPsnprintf(char *t, int len, const char *s,...)
SCIPfreeMemory(GCGgetOrigprob(gcg), &divingdata)
static assert(heur !=NULL)
SCIP_CALL(SCIPgetExternBranchCands(origprob, &lpcands, &lpcandssol, NULL, &nlpcands, NULL, NULL, NULL, NULL))
SCIPdebugMessage("feasibility pump finished [%d iterations done].\n", nloops)
#define NULL
#define BMSclearMemoryArray(ptr, num)
Definition class_conspartition.cpp:44
public methods for working with decomposition structures
various SCIP helper methods
Definition dec_compgreedily.cpp:75
interface data structure for the detector calling methods
Definition class_detprobdata.h:746
gcg::PARTIALDECOMP ** newpartialdecs
Definition class_detprobdata.h:749
gcg::PARTIALDECOMP * workonpartialdec
Definition class_detprobdata.h:748
gcg::DETPROBDATA * detprobdata
Definition class_detprobdata.h:747
int * tcliqueGetLastAdjedge(TCLIQUE_GRAPH *tcliquegraph, int node)
int * tcliqueGetDegrees(TCLIQUE_GRAPH *tcliquegraph)
void tcliqueFree(TCLIQUE_GRAPH **tcliquegraph)
int * tcliqueGetFirstAdjedge(TCLIQUE_GRAPH *tcliquegraph, int node)
TCLIQUE_Bool tcliqueFlush(TCLIQUE_GRAPH *tcliquegraph)
struct TCLIQUE_Graph TCLIQUE_GRAPH
TCLIQUE_Bool tcliqueCreate(TCLIQUE_GRAPH **tcliquegraph)
TCLIQUE_Bool tcliqueAddNode(TCLIQUE_GRAPH *tcliquegraph, int node, TCLIQUE_WEIGHT weight)
TCLIQUE_Bool tcliqueAddEdge(TCLIQUE_GRAPH *tcliquegraph, int node1, int node2)
struct SCIP_Clock SCIP_CLOCK
struct SCIP_HashMap SCIP_HASHMAP
SCIP_DIDNOTFIND
SCIP_SUCCESS
enum SCIP_Retcode SCIP_RETCODE
struct Scip SCIP