Loading...
Searching...
No Matches
dec_mst.cpp
Go to the documentation of this file.
39/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
60#define DEC_FREQCALLROUND 1 /**< 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 */
63#define DEC_FREQCALLROUNDORIGINAL 1 /**< frequency the detector gets called in detection loop while detecting the original problem */
64#define DEC_MAXCALLROUNDORIGINAL INT_MAX /**< last round the detector gets called while detecting the original problem */
65#define DEC_MINCALLROUNDORIGINAL 0 /**< first round the detector gets called while detecting the original problem */
71#define DEC_USEFULRECALL FALSE /**< is it useful to call this detector on a descendant of the propagated partialdec */
192/** are there conss and vars to be included by the graph and have the conss common vars included by the graph */
295 SCIP_CALL( g->createFromPartialMatrix(partialdecdetectiondata->detprobdata, partialdec, gcg::DISTANCE_MEASURE::JOHNSON, gcg::WEIGHT_TYPE::DIST));
307 SCIP_CALL( g->createFromPartialMatrix(partialdecdetectiondata->detprobdata, partialdec, gcg::DISTANCE_MEASURE::INTERSECTION, gcg::WEIGHT_TYPE::DIST));
319 SCIP_CALL( g->createFromPartialMatrix(partialdecdetectiondata->detprobdata, partialdec, gcg::DISTANCE_MEASURE::JACCARD, gcg::WEIGHT_TYPE::DIST));
331 SCIP_CALL( g->createFromPartialMatrix(partialdecdetectiondata->detprobdata, partialdec,gcg::DISTANCE_MEASURE::COSINE, gcg::WEIGHT_TYPE::DIST));
343 SCIP_CALL( g->createFromPartialMatrix(partialdecdetectiondata->detprobdata, partialdec,gcg::DISTANCE_MEASURE::SIMPSON, gcg::WEIGHT_TYPE::DIST));
367 epsLists[i] = getEpsList(detectordata->n_iterations, mids[i], false); // case for all except intersection
380 SCIP_CALL( SCIPallocMemoryArray(origprob, &(partialdecdetectiondata->newpartialdecs), 2 * nMaxPartialdecs) );
412 SCIP_CALL( graph->computePartitionMSTForPartialGraph(partialdecdetectiondata->detprobdata, partialdec, eps, detectordata->postprocenable) );
419 // skip the case if we have too many blocks (it means we must increase eps) or if the clustering is the same as the last one
420 if( n_blocks > max_blocks || n_blocks == 0 || (n_blocks == old_n_blocks && non_cl == old_non_cl) )
429 SCIPverbMessage(origprob, SCIP_VERBLEVEL_NORMAL, NULL, "\n Blocks: %d, Master Conss: %d/%d, ", n_blocks, non_cl, SCIPgetNConss(origprob));
433 SCIP_CALL( graph->createPartialdecFromPartition(partialdec, &decomp1, &decomp2, partialdecdetectiondata->detprobdata));
453 createddecomps[j]->addClockTime(clockTimes1[i] / ncreateddecomps + clockTimes2[i] / ncreateddecomps + epstime / 2.0);
462 SCIP_CALL( SCIPreallocMemoryArray(origprob, &(partialdecdetectiondata->newpartialdecs), nnewpartialdecs) );
472 SCIPverbMessage(origprob, SCIP_VERBLEVEL_NORMAL, NULL, " done, %d similarities used, %d decompositions found.\n", detectordata->n_similarities, nnewpartialdecs);
473 SCIPverbMessage(origprob, SCIP_VERBLEVEL_NORMAL, NULL, "MST runtime: graphs: %.2lf, mst: %.2lf. \n", elapsed_graphs, elapsed_mst);
559 SCIP_CALL( GCGincludeDetector(gcg, DEC_NAME, DEC_DECCHAR, DEC_DESC, DEC_FREQCALLROUND, DEC_MAXCALLROUND, DEC_MINCALLROUND, DEC_FREQCALLROUNDORIGINAL, DEC_MAXCALLROUNDORIGINAL, DEC_MINCALLROUNDORIGINAL, DEC_PRIORITY, DEC_ENABLED, DEC_ENABLEDFINISHING, DEC_ENABLEDPOSTPROCESSING, DEC_SKIP, DEC_USEFULRECALL,
560 detectordata, freeMST, initMST, exitMST, propagatePartialdecMST, finishPartialdecMST, detectorPostprocessPartialdecMST, setParamAggressiveMST, setParamDefaultMST, setParamFastMST) );
563 SCIP_CALL( SCIPaddIntParam(origprob, "detection/detectors/mst/niterations", "Number of iterations to run mst with different eps.", &detectordata->n_iterations, FALSE, DEFAULT_N_ITERATIONS, 11, 1001, NULL, NULL) );
564 SCIP_CALL( SCIPaddBoolParam(origprob, "detection/detectors/mst/johson", "Enable johson distance measure.", &detectordata->johnsonenable, FALSE, DEFAULT_JOHNSON_ENABLE, NULL, NULL ) );
565 SCIP_CALL( SCIPaddBoolParam(origprob, "detection/detectors/mst/intersection", "Enable intersection distance measure.", &detectordata->intersectionenable, FALSE, DEFAULT_INTERSECTION_ENABLE, NULL, NULL ) );
566 SCIP_CALL( SCIPaddBoolParam(origprob, "detection/detectors/mst/jaccard", "Enable jaccard distance measure.", &detectordata->jaccardenable, FALSE, DEFAULT_JACCARD_ENABLE, NULL, NULL) );
567 SCIP_CALL( SCIPaddBoolParam(origprob, "detection/detectors/mst/cosine", "Enable cosine distance measure.", &detectordata->cosineenable, FALSE, DEFAULT_COSINE_ENABLE, NULL, NULL) );
568 SCIP_CALL( SCIPaddBoolParam(origprob, "detection/detectors/mst/simpson", "Enable simpson distance measure.", &detectordata->simpsonenable, FALSE, DEFAULT_SIMPSON_ENABLE, NULL, NULL ) );
569 SCIP_CALL( SCIPaddBoolParam(origprob, "detection/detectors/mst/postprocenable", "Enable post-processing step.", &detectordata->postprocenable, FALSE, DEFAULT_POSTPROC_ENABLE, NULL, NULL ) );
SCIP_VAR * w
RowGraphWeighted(GCG *gcg, Weights w)
Definition rowgraph_weighted_def.h:58
Definition class_detprobdata.h:110
GCG_EXPORT int getNVarsForCons(int consIndex)
returns the number of variables for a given constraint
Definition class_detprobdata.cpp:908
GCG_EXPORT std::vector< int > & getVarsForCons(int consIndex)
returns the variable indices of the coefficient matrix for a constraint
Definition class_detprobdata.cpp:1023
Definition graph_gcg.h:59
GCG_EXPORT int getNOpenvars()
Gets size of vector containing variables not assigned yet.
Definition class_partialdecomp.cpp:4509
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 void refineToBlocks()
refine partialdec with focus on blocks
Definition class_partialdecomp.cpp:5167
GCG_EXPORT std::vector< int > & getOpenconss()
Gets vector containing constraints not assigned yet.
Definition class_partialdecomp.cpp:4558
GCG_EXPORT std::vector< int > & getOpenvars()
Gets vector containing variables not assigned yet.
Definition class_partialdecomp.cpp:4564
Definition rowgraph_weighted.h:65
virtual SCIP_RETCODE nonClustered(int &_non_cl)
Definition rowgraph_weighted_def.h:1310
virtual SCIP_RETCODE createFromPartialMatrix(DETPROBDATA *detprobdata, PARTIALDECOMP *partialdec, DISTANCE_MEASURE dist, WEIGHT_TYPE w_type)
Definition rowgraph_weighted_def.h:222
virtual SCIP_RETCODE getNBlocks(int &_n_blocks)
Definition rowgraph_weighted_def.h:1303
virtual SCIP_RETCODE computePartitionMSTForPartialGraph(gcg::DETPROBDATA *detprobdata, gcg::PARTIALDECOMP *partialdec, double eps, bool postprocenable)
virtual SCIP_RETCODE createPartialdecFromPartition(PARTIALDECOMP *oldpartialdec, PARTIALDECOMP **firstpartialdec, PARTIALDECOMP **secondpartialdec, DETPROBDATA *detprobdata)
Definition rowgraph_def.h:134
Definition weights.h:43
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 bool graphCompletible(gcg::DETPROBDATA *detprobdata, gcg::PARTIALDECOMP *partialdec)
Definition dec_mst.cpp:194
static std::vector< double > getEpsList(int length, double mid, bool isintersection)
Definition dec_mst.cpp:107
detector for diagonal (bordered) structures via Minimum Spanning Tree clustering algorithm
#define SCIP_MAXSTRLEN
#define SCIP_Bool
#define SCIP_Real
#define SCIP_CALL_ABORT(x)
#define TRUE
#define FALSE
Implementation of the graph which supports both node and edge weights.
int SCIPgetNConss(SCIP *scip)
void SCIPverbMessage(SCIP *scip, SCIP_VERBLEVEL msgverblevel, FILE *file, const char *formatstr,...)
SCIP_RETCODE SCIPaddIntParam(SCIP *scip, const char *name, const char *desc, int *valueptr, SCIP_Bool isadvanced, int defaultvalue, int minvalue, int maxvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
SCIP_RETCODE SCIPaddBoolParam(SCIP *scip, const char *name, const char *desc, SCIP_Bool *valueptr, SCIP_Bool isadvanced, SCIP_Bool defaultvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
SCIP_RETCODE SCIPsetBoolParam(SCIP *scip, const char *name, SCIP_Bool value)
#define SCIPfreeMemoryArrayNull(scip, ptr)
#define SCIPreallocMemoryArray(scip, ptr, newnum)
#define SCIPallocMemoryArray(scip, ptr, num)
#define SCIPallocMemory(scip, ptr)
SCIP_RETCODE SCIPcreateClock(SCIP *scip, SCIP_CLOCK **clck)
SCIP_RETCODE SCIPresetClock(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)
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))
#define NULL
miscellaneous matrixgraph methods for structure detection
Definition class_conspartition.cpp:44
INLINE Rational & abs(Rational &r)
real eps
A row graph where each row is a node and rows are adjacent if they share a variable....
Definition dec_compgreedily.cpp:75
struct SCIP_Clock SCIP_CLOCK
SCIP_VERBLEVEL_NORMAL
SCIP_DIDNOTFIND
SCIP_SUCCESS
enum SCIP_Result SCIP_RESULT
enum SCIP_Retcode SCIP_RETCODE
struct Scip SCIP