Detailed Description
detector for pricing problems that can be aggregated (uses bliss)
- Note
- requires package to be installed: BLISS, requires flag to be set:
BLISS=true
This detector finds subproblems that can be aggregated thus reducing the symmetry of the problem using color preserving automorphisms and bliss.
Definition in file dec_isomorph.cpp.
#include "gcg/dec_isomorph.h"#include "gcg/pub_decomp.h"#include "gcg/cons_decomp.h"#include "gcg/scip_misc.h"#include "gcg/gcg.h"#include "gcg/class_partialdecomp.h"#include "gcg/class_detprobdata.h"#include "scip/clock.h"#include "gcg/pub_gcgvar.h"#include <cstring>#include <cassert>#include <algorithm>#include <iostream>#include "symmetry/pub_automorphism.h"Go to the source code of this file.
Data Structures | |
| struct | GCG_DetectorData |
| struct | struct_hook |
Macros | |
| #define | DEC_NAME "isomorph" |
| #define | DEC_DESC "detector for pricing problems suitable for aggregation" |
| #define | DEC_FREQCALLROUND 1 |
| #define | DEC_MAXCALLROUND 0 |
| #define | DEC_MINCALLROUND 0 |
| #define | DEC_FREQCALLROUNDORIGINAL 1 |
| #define | DEC_MAXCALLROUNDORIGINAL 0 |
| #define | DEC_MINCALLROUNDORIGINAL 0 |
| #define | DEC_PRIORITY 100 |
| #define | DEC_DECCHAR 'I' |
| #define | DEC_ENABLED FALSE |
| #define | DEC_ENABLEDFINISHING FALSE |
| #define | DEC_ENABLEDPOSTPROCESSING FALSE |
| #define | DEC_SKIP TRUE |
| #define | DEC_USEFULRECALL FALSE |
| #define | DEFAULT_MAXDECOMPSEXACT 6 |
| #define | DEFAULT_MAXDECOMPSEXTEND 4 |
| #define | SET_MULTIPLEFORSIZETRANSF 12500 |
| #define | detectorExitIsomorph NULL |
| #define | detectorFinishPartialdecIsomorph NULL |
| #define | detectorPostprocessPartialdecIsomorph NULL |
Typedefs | |
| typedef struct struct_hook | AUT_HOOK |
Functions | |
| static int | gcd (int a, int b) |
| static void | fhookForPartialdecs (void *user_param, unsigned int N, const unsigned int *aut) |
| static SCIP_RETCODE | allocMemory (SCIP *scip, AUT_COLOR *colorinfo, int nconss, int nvars) |
| static void | freeMemory (SCIP *scip, AUT_COLOR *colorinfo) |
| static SCIP_RETCODE | setupArrays (SCIP *scip, AUT_COLOR *colorinfo, SCIP_RESULT *result, gcg::PARTIALDECOMP *partialdec, gcg::DETPROBDATA *detprobdata) |
| static SCIP_RETCODE | createGraph (SCIP *scip, AUT_COLOR colorinfo, AUT_GRAPH *graph, SCIP_RESULT *result, gcg::PARTIALDECOMP *partialdec, gcg::DETPROBDATA *detprobdata) |
| SCIP_RETCODE | createPartialdecFromMasterconss (SCIP *scip, gcg::PARTIALDECOMP **newPartialdec, int *masterconss, int nmasterconss, gcg::PARTIALDECOMP *partialdec, gcg::DETPROBDATA *detprobdata, SCIP_Bool exact) |
| static | GCG_DECL_FREEDETECTOR (detectorFreeIsomorph) |
| static | GCG_DECL_INITDETECTOR (detectorInitIsomorph) |
| int | renumberPermutations (int *permutation, int permsize) |
| void | collapsePermutation (int *permutation, int permsize) |
| static std::vector< std::vector< int > > | getAllSubsets (std::vector< int > set) |
| SCIP_RETCODE | reorderPermutations (GCG *gcg, gcg::DETPROBDATA *detprobdata, int *permutation, int permsize, int nperms) |
| static SCIP_RETCODE | detectIsomorph (GCG *gcg, PARTIALDEC_DETECTION_DATA *detectiondata, GCG_DETECTORDATA *detectordata, SCIP_RESULT *result, SCIP_Bool onlysign, int maxdecomps) |
| GCG_DECL_PROPAGATEPARTIALDEC (detectorPropagatePartialdecIsomorph) | |
| static | GCG_DECL_SETPARAMAGGRESSIVE (setParamAggressiveIsomorph) |
| static | GCG_DECL_SETPARAMDEFAULT (setParamDefaultIsomorph) |
| static | GCG_DECL_SETPARAMFAST (setParamFastIsomorph) |
| SCIP_RETCODE | GCGincludeDetectorIsomorphism (GCG *gcg) |
Macro Definition Documentation
◆ DEC_NAME
| #define DEC_NAME "isomorph" |
name of detector
Definition at line 64 of file dec_isomorph.cpp.
◆ DEC_DESC
| #define DEC_DESC "detector for pricing problems suitable for aggregation" |
description of detector
Definition at line 65 of file dec_isomorph.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 66 of file dec_isomorph.cpp.
◆ DEC_MAXCALLROUND
| #define DEC_MAXCALLROUND 0 |
last round the detector gets called
Definition at line 67 of file dec_isomorph.cpp.
◆ DEC_MINCALLROUND
| #define DEC_MINCALLROUND 0 |
first round the detector gets called
Definition at line 68 of file dec_isomorph.cpp.
◆ DEC_FREQCALLROUNDORIGINAL
| #define DEC_FREQCALLROUNDORIGINAL 1 |
frequency the detector gets called in detection loop while detecting the original problem
Definition at line 69 of file dec_isomorph.cpp.
◆ DEC_MAXCALLROUNDORIGINAL
| #define DEC_MAXCALLROUNDORIGINAL 0 |
last round the detector gets called while detecting the original problem
Definition at line 70 of file dec_isomorph.cpp.
◆ DEC_MINCALLROUNDORIGINAL
| #define DEC_MINCALLROUNDORIGINAL 0 |
first round the detector gets called while detecting the original problem
Definition at line 71 of file dec_isomorph.cpp.
◆ DEC_PRIORITY
| #define DEC_PRIORITY 100 |
priority of the constraint handler for separation
Definition at line 72 of file dec_isomorph.cpp.
◆ DEC_DECCHAR
| #define DEC_DECCHAR 'I' |
display character of detector
Definition at line 73 of file dec_isomorph.cpp.
◆ DEC_ENABLED
| #define DEC_ENABLED FALSE |
should the detection be enabled
Definition at line 75 of file dec_isomorph.cpp.
◆ DEC_ENABLEDFINISHING
| #define DEC_ENABLEDFINISHING FALSE |
should the finishing be enabled
Definition at line 76 of file dec_isomorph.cpp.
◆ DEC_ENABLEDPOSTPROCESSING
| #define DEC_ENABLEDPOSTPROCESSING FALSE |
should the postprocessing be enabled
Definition at line 77 of file dec_isomorph.cpp.
◆ DEC_SKIP
| #define DEC_SKIP TRUE |
should the detector be skipped if others found decompositions
Definition at line 78 of file dec_isomorph.cpp.
◆ DEC_USEFULRECALL
| #define DEC_USEFULRECALL FALSE |
is it useful to call this detector on a descendant of the propagated partialdec
Definition at line 79 of file dec_isomorph.cpp.
◆ DEFAULT_MAXDECOMPSEXACT
| #define DEFAULT_MAXDECOMPSEXACT 6 |
default maximum number of decompositions
Definition at line 81 of file dec_isomorph.cpp.
◆ DEFAULT_MAXDECOMPSEXTEND
| #define DEFAULT_MAXDECOMPSEXTEND 4 |
default maximum number of decompositions
Definition at line 82 of file dec_isomorph.cpp.
◆ SET_MULTIPLEFORSIZETRANSF
| #define SET_MULTIPLEFORSIZETRANSF 12500 |
Definition at line 84 of file dec_isomorph.cpp.
◆ detectorExitIsomorph
| #define detectorExitIsomorph NULL |
Definition at line 1233 of file dec_isomorph.cpp.
◆ detectorFinishPartialdecIsomorph
| #define detectorFinishPartialdecIsomorph NULL |
Definition at line 1235 of file dec_isomorph.cpp.
◆ detectorPostprocessPartialdecIsomorph
| #define detectorPostprocessPartialdecIsomorph NULL |
Definition at line 1237 of file dec_isomorph.cpp.
Typedef Documentation
◆ AUT_HOOK
| typedef struct struct_hook AUT_HOOK |
Definition at line 98 of file dec_isomorph.cpp.
Function Documentation
◆ gcd()
|
static |
method to calculate the greatest common divisor
Definition at line 171 of file dec_isomorph.cpp.
Referenced by gcd(), and reorderPermutations().
◆ fhookForPartialdecs()
|
static |
hook function to save the permutation of the graph
- Parameters
-
user_param data structure to save hashmaps with permutation N number of permutations aut array of permutations
Definition at line 217 of file dec_isomorph.cpp.
References struct_hook::conssperm, gcg::DETPROBDATA::getCons(), struct_hook::getDetprobdata(), gcg::PARTIALDECOMP::getNOpenconss(), gcg::PARTIALDECOMP::getOpenconss(), struct_hook::getPartialdec(), MIN, NULL, SCIPconsGetName(), SCIPdebugMessage, struct_hook::setBool(), and TRUE.
Referenced by detectIsomorph().
◆ allocMemory()
|
static |
- Parameters
-
scip SCIP data structure colorinfo struct to save intermediate information nconss number of constraints nvars number of variables
Definition at line 263 of file dec_isomorph.cpp.
References SCIP_CALL, SCIP_OKAY, and SCIPallocMemoryArray.
Referenced by setupArrays().
◆ freeMemory()
destructor for colorinfo
- Parameters
-
scip SCIP data structure colorinfo struct to save intermediate information
Definition at line 279 of file dec_isomorph.cpp.
References SCIPfreeMemoryArray.
Referenced by createGraph().
◆ setupArrays()
|
static |
set up a help structure for graph creation (for partialdecs)
- Parameters
-
scip SCIP to compare colorinfo data structure to save intermediate data result result pointer to indicate success or failure partialdec partialdec to set up help structure for detprobdata detection process information and data
Definition at line 309 of file dec_isomorph.cpp.
References allocMemory(), FALSE, gcg::DETPROBDATA::getCons(), gcg::PARTIALDECOMP::getNOpenconss(), gcg::PARTIALDECOMP::getNVars(), gcg::DETPROBDATA::getNVarsForCons(), gcg::PARTIALDECOMP::getOpenconss(), gcg::DETPROBDATA::getValsForCons(), gcg::DETPROBDATA::getVar(), SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIP_SUCCESS, SCIPconsGetName(), SCIPdebugMessage, SCIPisNegative(), SCIPisPositive(), SCIPisZero(), and SCIPvarGetName().
Referenced by detectIsomorph().
◆ createGraph()
|
static |
create a graph out of an array of scips (for partialdecs)
- Parameters
-
scip SCIP to compare colorinfo data structure to save intermediate data graph graph needed for discovering isomorphism result result pointer to indicate success or failure partialdec partialdec to create graph for detprobdata detection process information and data
Definition at line 402 of file dec_isomorph.cpp.
References freeMemory(), gcg::DETPROBDATA::getCons(), gcg::PARTIALDECOMP::getNOpenconss(), gcg::PARTIALDECOMP::getNVars(), gcg::DETPROBDATA::getNVarsForCons(), gcg::PARTIALDECOMP::getOpenconss(), gcg::DETPROBDATA::getValsForCons(), gcg::DETPROBDATA::getVar(), gcg::DETPROBDATA::getVarsForCons(), nnodes, SCIP_Bool, SCIP_DIDNOTFIND, SCIP_OKAY, SCIP_Real, SCIP_SUCCESS, SCIPconsGetName(), SCIPdebugMessage, SCIPisNegative(), SCIPisPositive(), SCIPvarGetName(), and SCIPvarGetProbindex().
Referenced by detectIsomorph().
◆ createPartialdecFromMasterconss()
| SCIP_RETCODE createPartialdecFromMasterconss | ( | SCIP * | scip, |
| gcg::PARTIALDECOMP ** | newPartialdec, | ||
| int * | masterconss, | ||
| int | nmasterconss, | ||
| gcg::PARTIALDECOMP * | partialdec, | ||
| gcg::DETPROBDATA * | detprobdata, | ||
| SCIP_Bool | exact | ||
| ) |
creates a partialdec with provided constraints in the master The function will put the remaining constraints in one or more pricing problems depending on whether the subproblems decompose with no variables in common.
- Parameters
-
scip SCIP data structure newPartialdec partialdec data structure masterconss constraints to be put in the master nmasterconss number of constraints in the master partialdec partialdec to propagate detprobdata detection process information and data exact does this partialdec stems from exact graph construction ( or was onlysign = TRUE ) was used
Definition at line 548 of file dec_isomorph.cpp.
References gcg::DETPROBDATA::getCons(), gcg::DETPROBDATA::getNConss(), gcg::PARTIALDECOMP::getNOpenconss(), gcg::PARTIALDECOMP::getNVars(), gcg::DETPROBDATA::getNVarsForCons(), gcg::PARTIALDECOMP::getOpenconss(), gcg::DETPROBDATA::getVar(), gcg::DETPROBDATA::getVarsForCons(), MIN, NULL, SCIP_Bool, SCIP_CALL, SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_STAGE_TRANSFORMED, SCIPallocMemoryArray, SCIPconsGetName(), SCIPdebugMessage, SCIPdebugPrintf, SCIPfreeMemoryArray, SCIPgetStage(), SCIPsnprintf(), and SCIPvarGetName().
Referenced by detectIsomorph().
◆ GCG_DECL_FREEDETECTOR()
|
static |
destructor of detector to free user data (called when GCG is exiting)
Definition at line 811 of file dec_isomorph.cpp.
References DEC_NAME, GCGdetectorGetData(), GCGdetectorGetName(), GCGgetOrigprob(), NULL, SCIP_OKAY, and SCIPfreeMemory.
◆ GCG_DECL_INITDETECTOR()
|
static |
detector initialization method (called after problem was transformed)
Definition at line 830 of file dec_isomorph.cpp.
References DEC_NAME, GCGdetectorGetData(), GCGdetectorGetName(), NULL, GCG_DetectorData::result, SCIP_OKAY, and SCIP_SUCCESS.
◆ renumberPermutations()
| int renumberPermutations | ( | int * | permutation, |
| int | permsize | ||
| ) |
renumbers the permutations from 0 to n-1 and returns the number of permutations
- Returns
- the number of permutations
- Parameters
-
permutation the permutation permsize size of the permutation
Definition at line 850 of file dec_isomorph.cpp.
References SCIPdebugMessage, and SCIPdebugPrintf.
Referenced by detectIsomorph().
◆ collapsePermutation()
| void collapsePermutation | ( | int * | permutation, |
| int | permsize | ||
| ) |
collapses the permutation, if possible
- Parameters
-
permutation the permutation permsize size of the permutation
Definition at line 883 of file dec_isomorph.cpp.
References SCIPdebugMessage.
Referenced by detectIsomorph().
◆ getAllSubsets()
|
static |
method to enumerate all subsets
Definition at line 904 of file dec_isomorph.cpp.
References set::size.
Referenced by reorderPermutations().
◆ reorderPermutations()
| SCIP_RETCODE reorderPermutations | ( | GCG * | gcg, |
| gcg::DETPROBDATA * | detprobdata, | ||
| int * | permutation, | ||
| int | permsize, | ||
| int | nperms | ||
| ) |
reorder such that the best permutation is represented by 0, the second best by 1, etc.
- Parameters
-
gcg GCG data structure detprobdata detection process information and data permutation the permutation permsize size of the permutation nperms number of permutations
Definition at line 924 of file dec_isomorph.cpp.
References BMSclearMemoryArray, gcd(), GCGconshdlrDecompAddCandidatesNBlocks(), GCGgetOrigprob(), getAllSubsets(), gcg::DETPROBDATA::isAssignedToOrigProb(), NULL, SCIP_CALL, SCIP_OKAY, SCIPallocBufferArray, SCIPdebugMessage, SCIPfreeBufferArray, and SCIPsortDownIntInt().
Referenced by detectIsomorph().
◆ detectIsomorph()
|
static |
detection function of isomorph detector for partialdecs
- Parameters
-
gcg GCG data structure detectiondata detection data detectordata detector data structure result pointer to store result onlysign use only sign of coefficients instead of coefficients? maxdecomps maximum number of new decompositions
Definition at line 1048 of file dec_isomorph.cpp.
References gcg::PARTIALDECOMP::addClockTime(), collapsePermutation(), struct_hook::conssperm, createGraph(), createPartialdecFromMasterconss(), Partialdec_Detection_Data::detectiontime, Partialdec_Detection_Data::detprobdata, FALSE, fhookForPartialdecs(), GCGgetOrigprob(), struct_hook::getBool(), gcg::DETPROBDATA::getCons(), gcg::PARTIALDECOMP::getNOpenconss(), gcg::PARTIALDECOMP::getOpenconss(), gcg::PARTIALDECOMP::isEqual(), MIN, Partialdec_Detection_Data::newpartialdecs, Partialdec_Detection_Data::nnewpartialdecs, NULL, renumberPermutations(), reorderPermutations(), GCG_DetectorData::result, SCIP_Bool, SCIP_CALL, SCIP_CALL_ABORT, SCIP_DIDNOTFIND, SCIP_OKAY, SCIP_SUCCESS, SCIP_VERBLEVEL_NORMAL, SCIPallocMemoryArray, SCIPconsGetName(), SCIPcreateClock(), SCIPdebugMessage, SCIPfreeClock(), SCIPfreeMemoryArray, SCIPfreeMemoryArrayNull, SCIPgetClockTime(), SCIPreallocMemoryArray, SCIPstartClock(), SCIPstopClock(), SCIPverbMessage(), setupArrays(), TRUE, and Partialdec_Detection_Data::workonpartialdec.
Referenced by GCG_DECL_PROPAGATEPARTIALDEC().
◆ GCG_DECL_PROPAGATEPARTIALDEC()
| GCG_DECL_PROPAGATEPARTIALDEC | ( | detectorPropagatePartialdecIsomorph | ) |
Definition at line 1205 of file dec_isomorph.cpp.
References detectIsomorph(), FALSE, GCGdetectorGetData(), gcg::PARTIALDECOMP::getNBlocks(), gcg::PARTIALDECOMP::getNOpenvars(), gcg::PARTIALDECOMP::getNVars(), GCG_DetectorData::maxdecompsexact, GCG_DetectorData::maxdecompsextend, NULL, SCIP_CALL, SCIP_DIDNOTFIND, SCIP_OKAY, SCIP_SUCCESS, and TRUE.
◆ GCG_DECL_SETPARAMAGGRESSIVE()
|
static |
Definition at line 1240 of file dec_isomorph.cpp.
References DEFAULT_MAXDECOMPSEXACT, DEFAULT_MAXDECOMPSEXTEND, FALSE, GCGdetectorGetName(), GCGgetOrigprob(), MAX, NULL, SCIP_CALL, SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_Real, SCIP_STAGE_PROBLEM, SCIPfloor(), SCIPgetIntParam(), SCIPgetNConss(), SCIPgetNVars(), SCIPgetStage(), SCIPinfoMessage(), SCIPisFeasPositive(), SCIPsetBoolParam(), SCIPsetIntParam(), SCIPsnprintf(), SET_MULTIPLEFORSIZETRANSF, and TRUE.
◆ GCG_DECL_SETPARAMDEFAULT()
|
static |
Definition at line 1307 of file dec_isomorph.cpp.
References DEC_ENABLED, DEC_ENABLEDFINISHING, DEFAULT_MAXDECOMPSEXACT, DEFAULT_MAXDECOMPSEXTEND, GCGdetectorGetName(), GCGgetOrigprob(), MAX, NULL, SCIP_CALL, SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_Real, SCIP_STAGE_PROBLEM, SCIPfloor(), SCIPgetNConss(), SCIPgetNVars(), SCIPgetStage(), SCIPinfoMessage(), SCIPisFeasPositive(), SCIPsetBoolParam(), SCIPsetIntParam(), SCIPsnprintf(), and SET_MULTIPLEFORSIZETRANSF.
◆ GCG_DECL_SETPARAMFAST()
|
static |
Definition at line 1362 of file dec_isomorph.cpp.
References DEFAULT_MAXDECOMPSEXACT, DEFAULT_MAXDECOMPSEXTEND, FALSE, GCGdetectorGetName(), GCGgetOrigprob(), MAX, NULL, SCIP_CALL, SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_Real, SCIP_STAGE_PROBLEM, SCIPgetNConss(), SCIPgetNVars(), SCIPgetStage(), SCIPinfoMessage(), SCIPsetBoolParam(), SCIPsetIntParam(), SCIPsnprintf(), and SET_MULTIPLEFORSIZETRANSF.
◆ GCGincludeDetectorIsomorphism()
| SCIP_RETCODE GCGincludeDetectorIsomorphism | ( | GCG * | gcg | ) |
creates the handler for isomorph subproblems and includes it in SCIP
- Parameters
-
gcg GCG data structure
Definition at line 1414 of file dec_isomorph.cpp.
References 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, DEFAULT_MAXDECOMPSEXACT, DEFAULT_MAXDECOMPSEXTEND, detectorExitIsomorph, detectorFinishPartialdecIsomorph, detectorPostprocessPartialdecIsomorph, FALSE, GCGgetOrigprob(), GCGincludeDetector(), GCG_DetectorData::maxdecompsexact, GCG_DetectorData::maxdecompsextend, NULL, SCIP_CALL, SCIP_OKAY, SCIPaddIntParam(), and SCIPallocMemory.
Referenced by GCGincludeGcgPlugins().