Scippy

GCG

Branch-and-Price & Column Generation for Everyone

dec_staircase_lsp.cpp File Reference

Detailed Description

detector for staircase_lsp matrices

Author
Martin Bergner
Michael Bastubbe

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)
Value:
do \
{ \
if((x) != TRUE ) \
{ \
SCIPerrorMessage("Error in function call\n"); \
return SCIP_ERROR; \
} \
} \
while( FALSE )
SCIP_ERROR

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 SCIP_RETCODE createGraphFromPartialMatrix ( SCIP *  scip,
TCLIQUE_GRAPH **  graph,
gcg::PARTIALDECOMP *  partialdec,
gcg::DETPROBDATA *  detprobdata,
GCG_DETECTORDATA *  detectordata 
)
static

creates the graph from the constraint matrix

Parameters
scipSCIP data structure
graphGraph data structure
partialdecpartial decomposition to use for matrix
detprobdatadetection process information and data
detectordatadetector 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 SCIP_RETCODE findDiameter ( SCIP *  scip,
GCG_DETECTORDATA *  detectordata,
int *  maxdistance,
int *  ncomp,
int *  vertices,
int *  distances,
int  component 
)
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
scipSCIP data structure
detectordataconstraint handler data structure
maxdistancediameter of the graph
ncompnumber of vertices the component contains
verticesvertices of the connected component (ordered by BFS)
distancesdistances of vertices to some vertex of maximum eccentricity
componentconnected 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 SCIP_RETCODE findConnectedComponents ( SCIP *  scip,
GCG_DETECTORDATA *  detectordata 
)
static

finds the connected components of the row graph. a staircase_lsp decomposition will be built for each component separately.

Parameters
scipSCIP data structure
detectordataconstraint 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 GCG_DECL_FREEDETECTOR ( detectorFreeStaircaseLsp  )
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 GCG_DECL_INITDETECTOR ( detectorInitStaircaseLsp  )
static

◆ GCG_DECL_EXITDETECTOR()

static GCG_DECL_EXITDETECTOR ( detectorExitStaircaseLsp  )
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 SCIP_RETCODE detection ( SCIP *  scip,
GCG_DETECTORDATA *  detectordata,
Partialdec_Detection_Data *  partialdecdetectiondata 
)
static

detection function for partialdecs

Parameters
scipSCIP data structure
detectordatadetectordata of the detector
partialdecdetectiondatapartialdecdetectiondata (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 GCG_DECL_PROPAGATEPARTIALDEC ( detectorPropagatePartialdecStaircaseLsp  )
static

◆ GCG_DECL_FINISHPARTIALDEC()

◆ GCG_DECL_SETPARAMFAST() [1/3]

static GCG_DECL_SETPARAMFAST ( setParamAggressiveStaircaseLsp  )
static

◆ GCG_DECL_SETPARAMFAST() [2/3]

static GCG_DECL_SETPARAMFAST ( setParamDefaultStaircaseLsp  )
static

◆ GCG_DECL_SETPARAMFAST() [3/3]

static GCG_DECL_SETPARAMFAST ( setParamFastStaircaseLsp  )
static

◆ GCGincludeDetectorStaircaseLsp()