Loading...
Searching...
No Matches
dec_isomorph.cpp
Go to the documentation of this file.
39 * This detector finds subproblems that can be aggregated thus reducing the symmetry of the problem using color preserving
43/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
65#define DEC_DESC "detector for pricing problems suitable for aggregation" /**< description of detector */
66#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 */
69#define DEC_FREQCALLROUNDORIGINAL 1 /**< frequency the detector gets called in detection loop while detecting the original problem */
70#define DEC_MAXCALLROUNDORIGINAL 0 /**< last round the detector gets called while detecting the original problem */
71#define DEC_MINCALLROUNDORIGINAL 0 /**< first round the detector gets called while detecting the original problem */
79#define DEC_USEFULRECALL FALSE /**< is it useful to call this detector on a descendant of the propagated partialdec */
202 SCIP_CALL_ABORT( SCIPallocMemoryArray(scip, &conssperm, detprobdata_->getNConss() ) ); /*lint !e666*/
340 SCIPdebugMessage("%s color %d %d\n", SCIPvarGetName(var), colorinfo->get(*svar), colorinfo->color);
360 SCIPdebugMessage("%s color %d %d\n", SCIPconsGetName(cons), colorinfo->get(*scons), colorinfo->color);
365 //save the properties of variables of the constraints in a struct array and in a sorted pointer array
389 SCIPdebugMessage("%f color %d %d\n", scoef->getVal(), colorinfo->get(*scoef), colorinfo->color);
521 graph->setColor(currentnode, colorinfo.getLenCons() + colorinfo.getLenVar() + color); /*lint !e864 */
526 "nz: c <%s> (id: %d, colour: %d) -> nz (id: %d) (value: %f, colour: %d) -> var <%s> (id: %d, colour: %d) \n",
535 SCIPdebugMessage("Iteration 1: currentnode = %ud, Cons = %d, Vars = %d\n", currentnode, colorinfo.getLenCons(), colorinfo.getLenVar()); /*lint !e864 */
555 SCIP_Bool exact /** does this partialdec stems from exact graph construction ( or was onlysign = TRUE ) was used */
680 SCIPdebugMessage("Cons %s will be in block %d (next %d)\n", SCIPconsGetName(detprobdata->getCons(cons)), consblock, nextblock);
698 if( (blockrepresentative[oldblock] != -1) && (blockrepresentative[oldblock] > blockrepresentative[consblock]) )
702 SCIPdebugMessage("\t\tBlock representative from block %d changed from %d to %d.\n", oldblock, blockrepresentative[oldblock], consblock);
708 SCIPdebugMessage("\t\tBlock representative from block %d changed from %d to %d.\n", oldrepr, blockrepresentative[oldrepr], consblock);
723 SCIPdebugMessage("cons %s in block %d\n", SCIPconsGetName(detprobdata->getCons(cons)), consblock);
1081 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL, "Detecting almost aggregatable structure: ");
1084 SCIP_CALL( createGraph(scip, *colorinfo, &graph, &detectordata->result, partialdec, detprobdata) );
1112 SCIP_CALL( SCIPreallocMemoryArray(scip, &(detectiondata->newpartialdecs), detectiondata->nnewpartialdecs + MIN(maxdecomps, nperms)) ); /*lint !e506*/
1139 SCIP_CALL( createPartialdecFromMasterconss(scip, &(detectiondata->newpartialdecs[pos]), masterconss, nmasterconss, partialdec, detprobdata, !onlysign) );
1144 SCIP_CALL( detectiondata->newpartialdecs[pos]->isEqual(detectiondata->newpartialdecs[q], &isduplicate, TRUE) );
1170 SCIP_CALL( SCIPreallocMemoryArray(scip, &(detectiondata->newpartialdecs), detectiondata->nnewpartialdecs) );
1173 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL, "found %d (new) decompositions.\n", detectiondata->nnewpartialdecs);
1194 detectiondata->newpartialdecs[i]->addClockTime(detectiondata->detectiontime / detectiondata->nnewpartialdecs);
1221 SCIP_CALL( detectIsomorph(gcg, partialdecdetectiondata, detectordata, result, TRUE, detectordata->maxdecompsextend) );
1224 SCIP_CALL( detectIsomorph(gcg, partialdecdetectiondata, detectordata, result, FALSE, detectordata->maxdecompsexact) );
1282 modifier = ( (SCIP_Real)SCIPgetNConss(scip) + (SCIP_Real)SCIPgetNVars(scip) ) / SET_MULTIPLEFORSIZETRANSF;
1338 modifier = ( (SCIP_Real)SCIPgetNConss(scip) + (SCIP_Real)SCIPgetNVars(scip) ) / SET_MULTIPLEFORSIZETRANSF;
1392 newval = ( (SCIP_Real)SCIPgetNConss(scip) + (SCIP_Real)SCIPgetNVars(scip) > SET_MULTIPLEFORSIZETRANSF) ? 0 : 1;
1427 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,
1428 detectordata, detectorFreeIsomorph, detectorInitIsomorph, detectorExitIsomorph, detectorPropagatePartialdecIsomorph, detectorFinishPartialdecIsomorph, detectorPostprocessPartialdecIsomorph, setParamAggressiveIsomorph, setParamDefaultIsomorph, setParamFastIsomorph) );
1432 "Maximum number of solutions/decompositions with exact detection", &detectordata->maxdecompsexact, FALSE,
1436 "Maximum number of solutions/decompositions with extended detection", &detectordata->maxdecompsextend, FALSE,
SCIP_VAR * a
SCIP_VAR ** b
class storing partialdecs and the problem matrix
class storing (potentially incomplete) decompositions
Definition class_detprobdata.h:110
GCG_EXPORT std::vector< SCIP_Real > & getValsForCons(int consIndex)
returns the nonzero coefficients of the coefficient matrix for a constraint
Definition class_detprobdata.cpp:991
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 SCIP_VAR * getVar(int varIndex)
returns SCIP variable related to a variable index
Definition class_detprobdata.cpp:1015
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 SCIP_CONS * getCons(int consIndex)
returns the SCIP constraint related to a constraint index
Definition class_detprobdata.cpp:746
GCG_EXPORT SCIP_Bool isAssignedToOrigProb()
returns true if the matrix structure corresponds to the presolved problem
Definition class_detprobdata.cpp:1155
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 SCIP_RETCODE isEqual(PARTIALDECOMP *otherpartialdec, SCIP_Bool *isequal, bool sortpartialdecs)
method to check whether this partialdec is equal to a given other partialdec (
Definition class_partialdecomp.cpp:4847
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
void GCGconshdlrDecompAddCandidatesNBlocks(GCG *gcg, SCIP_Bool origprob, int candidate)
adds a candidate for block number and counts how often a candidate is added
Definition cons_decomp.cpp:3035
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
#define detectorFinishPartialdecIsomorph
Definition dec_isomorph.cpp:1235
#define detectorPostprocessPartialdecIsomorph
Definition dec_isomorph.cpp:1237
int renumberPermutations(int *permutation, int permsize)
Definition dec_isomorph.cpp:850
static void fhookForPartialdecs(void *user_param, unsigned int N, const unsigned int *aut)
Definition dec_isomorph.cpp:217
static std::vector< std::vector< int > > getAllSubsets(std::vector< int > set)
Definition dec_isomorph.cpp:904
SCIP_RETCODE GCGincludeDetectorIsomorphism(GCG *gcg)
Definition dec_isomorph.cpp:1414
static SCIP_RETCODE createGraph(SCIP *scip, AUT_COLOR colorinfo, AUT_GRAPH *graph, SCIP_RESULT *result, gcg::PARTIALDECOMP *partialdec, gcg::DETPROBDATA *detprobdata)
Definition dec_isomorph.cpp:402
static SCIP_RETCODE setupArrays(SCIP *scip, AUT_COLOR *colorinfo, SCIP_RESULT *result, gcg::PARTIALDECOMP *partialdec, gcg::DETPROBDATA *detprobdata)
Definition dec_isomorph.cpp:309
SCIP_RETCODE reorderPermutations(GCG *gcg, gcg::DETPROBDATA *detprobdata, int *permutation, int permsize, int nperms)
Definition dec_isomorph.cpp:924
SCIP_RETCODE createPartialdecFromMasterconss(SCIP *scip, gcg::PARTIALDECOMP **newPartialdec, int *masterconss, int nmasterconss, gcg::PARTIALDECOMP *partialdec, gcg::DETPROBDATA *detprobdata, SCIP_Bool exact)
Definition dec_isomorph.cpp:548
void collapsePermutation(int *permutation, int permsize)
Definition dec_isomorph.cpp:883
static SCIP_RETCODE detectIsomorph(GCG *gcg, PARTIALDEC_DETECTION_DATA *detectiondata, GCG_DETECTORDATA *detectordata, SCIP_RESULT *result, SCIP_Bool onlysign, int maxdecomps)
Definition dec_isomorph.cpp:1048
static SCIP_RETCODE allocMemory(SCIP *scip, AUT_COLOR *colorinfo, int nconss, int nvars)
Definition dec_isomorph.cpp:263
detector for pricing problems that can be aggregated (uses bliss)
#define SCIP_MAXSTRLEN
#define SCIP_Bool
#define MIN(x, y)
#define SCIP_Real
#define MAX(x, y)
#define SCIP_CALL_ABORT(x)
#define TRUE
#define FALSE
GCG interface methods.
SCIP_STAGE SCIPgetStage(SCIP *scip)
int SCIPgetNVars(SCIP *scip)
int SCIPgetNConss(SCIP *scip)
void SCIPinfoMessage(SCIP *scip, FILE *file, const char *formatstr,...)
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 SCIPsetIntParam(SCIP *scip, const char *name, int value)
SCIP_RETCODE SCIPgetIntParam(SCIP *scip, const char *name, int *value)
SCIP_RETCODE SCIPsetBoolParam(SCIP *scip, const char *name, SCIP_Bool value)
const char * SCIPconsGetName(SCIP_CONS *cons)
#define SCIPfreeMemoryArrayNull(scip, ptr)
#define SCIPreallocMemoryArray(scip, ptr, newnum)
#define SCIPallocMemoryArray(scip, ptr, num)
#define SCIPallocBufferArray(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)
SCIP_Bool SCIPisPositive(SCIP *scip, SCIP_Real val)
SCIP_Real SCIPfloor(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisNegative(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisZero(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisFeasPositive(SCIP *scip, SCIP_Real val)
int SCIPvarGetProbindex(SCIP_VAR *var)
const char * SCIPvarGetName(SCIP_VAR *var)
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)
SCIPfreeBufferArray(scip, &cycles)
#define NULL
#define BMSclearMemoryArray(ptr, num)
Definition class_conspartition.cpp:44
helper functions for automorphism detection
public methods for working with decomposition structures
public methods for GCG variables
#define SCIPdebugPrintf
various SCIP helper methods
Definition dec_compgreedily.cpp:75
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 size
Definition dec_isomorph.cpp:102
struct_hook(SCIP_Bool aut, unsigned int n, SCIP *scip)
Definition dec_isomorph.cpp:176
struct SCIP_Clock SCIP_CLOCK
struct SCIP_Cons SCIP_CONS
struct Partialdec_Detection_Data PARTIALDEC_DETECTION_DATA
Definition type_detector.h:53
SCIP_VERBLEVEL_NORMAL
SCIP_DIDNOTFIND
SCIP_SUCCESS
enum SCIP_Result SCIP_RESULT
enum SCIP_Retcode SCIP_RETCODE
struct Scip SCIP
SCIP_STAGE_PROBLEM
SCIP_STAGE_TRANSFORMED
struct SCIP_Var SCIP_VAR