Scippy

GCG

Branch-and-Price & Column Generation for Everyone

Detailed Description

detector for pricing problems that can be aggregated (uses bliss)

Author
Martin Bergner
Daniel Peters
Jonas Witt
Michael Bastubbe
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 "dec_isomorph.h"
#include "pub_decomp.h"
#include "cons_decomp.h"
#include "scip_misc.h"
#include "gcg.h"
#include "class_partialdecomp.h"
#include "class_detprobdata.h"
#include "scip/clock.h"
#include "bliss/graph.hh"
#include "pub_gcgvar.h"
#include <cstring>
#include <cassert>
#include <algorithm>
#include <iostream>
#include "pub_bliss.h"

Go to the source code of this file.

Data Structures

struct  DEC_DetectorData
 
struct  struct_hook
 

Macros

#define DEC_DETECTORNAME   "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 fhook (void *user_param, unsigned int N, const unsigned int *aut)
 
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)
 
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, bliss::Graph *graph, SCIP_RESULT *result)
 
static SCIP_RETCODE createGraph (SCIP *scip, AUT_COLOR colorinfo, bliss::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 DEC_DECL_FREEDETECTOR (detectorFreeIsomorph)
 
static DEC_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 (SCIP *scip, gcg::DETPROBDATA *detprobdata, int *permutation, int permsize, int nperms)
 
static SCIP_RETCODE detectIsomorph (SCIP *scip, PARTIALDEC_DETECTION_DATA *detectiondata, DEC_DETECTORDATA *detectordata, SCIP_RESULT *result, SCIP_Bool onlysign, int maxdecomps)
 
 DEC_DECL_PROPAGATEPARTIALDEC (detectorPropagatePartialdecIsomorph)
 
static DEC_DECL_SETPARAMAGGRESSIVE (setParamAggressiveIsomorph)
 
static DEC_DECL_SETPARAMDEFAULT (setParamDefaultIsomorph)
 
static DEC_DECL_SETPARAMFAST (setParamFastIsomorph)
 
SCIP_RETCODE SCIPincludeDetectorIsomorphism (SCIP *scip)
 

Macro Definition Documentation

◆ DEC_DETECTORNAME

#define DEC_DETECTORNAME   "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 1513 of file dec_isomorph.cpp.

◆ detectorFinishPartialdecIsomorph

#define detectorFinishPartialdecIsomorph   NULL

Definition at line 1515 of file dec_isomorph.cpp.

◆ detectorPostprocessPartialdecIsomorph

#define detectorPostprocessPartialdecIsomorph   NULL

Definition at line 1517 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 int gcd ( int  a,
int  b 
)
static

method to calculate the greatest common divisor

Definition at line 171 of file dec_isomorph.cpp.

Referenced by reorderPermutations().

◆ fhook()

static void fhook ( void *  user_param,
unsigned int  N,
const unsigned int *  aut 
)
static

hook function to save the permutation of the graph

Parameters
user_paramdata structure to save hashmaps with permutation
Nnumber of permutations
autarray of permutations

Definition at line 216 of file dec_isomorph.cpp.

References struct_hook::conssperm, struct_hook::getScip(), and struct_hook::setBool().

◆ fhookForPartialdecs()

static void fhookForPartialdecs ( void *  user_param,
unsigned int  N,
const unsigned int *  aut 
)
static

hook function to save the permutation of the graph

Parameters
user_paramdata structure to save hashmaps with permutation
Nnumber of permutations
autarray of permutations

Definition at line 258 of file dec_isomorph.cpp.

References struct_hook::conssperm, gcg::DETPROBDATA::getCons(), struct_hook::getDetprobdata(), gcg::PARTIALDECOMP::getNOpenconss(), gcg::PARTIALDECOMP::getOpenconss(), struct_hook::getPartialdec(), and struct_hook::setBool().

Referenced by detectIsomorph().

◆ allocMemory()

static SCIP_RETCODE allocMemory ( SCIP *  scip,
AUT_COLOR colorinfo,
int  nconss,
int  nvars 
)
static
Parameters
scipSCIP data structure
colorinfostruct to save intermediate information
nconssnumber of constraints
nvarsnumber of variables

Definition at line 304 of file dec_isomorph.cpp.

Referenced by setupArrays().

◆ freeMemory()

static void freeMemory ( SCIP *  scip,
AUT_COLOR colorinfo 
)
static

destructor for colorinfo

Parameters
scipSCIP data structure
colorinfostruct to save intermediate information

Definition at line 320 of file dec_isomorph.cpp.

Referenced by createGraph().

◆ setupArrays() [1/2]

static SCIP_RETCODE setupArrays ( SCIP *  scip,
AUT_COLOR colorinfo,
SCIP_RESULT *  result 
)
static

set up a help structure for graph creation

Parameters
scipSCIP to compare
colorinfodata structure to save intermediate data
resultresult pointer to indicate success or failure

Definition at line 350 of file dec_isomorph.cpp.

References allocMemory(), GCGconsGetNVars(), GCGconsGetVals(), and GCGconsGetVars().

Referenced by detectIsomorph().

◆ setupArrays() [2/2]

static SCIP_RETCODE setupArrays ( SCIP *  scip,
AUT_COLOR colorinfo,
SCIP_RESULT *  result,
gcg::PARTIALDECOMP partialdec,
gcg::DETPROBDATA detprobdata 
)
static

set up a help structure for graph creation (for partialdecs)

Parameters
scipSCIP to compare
colorinfodata structure to save intermediate data
resultresult pointer to indicate success or failure
partialdecpartialdec to set up help structure for
detprobdatadetection process information and data

Definition at line 456 of file dec_isomorph.cpp.

References allocMemory(), gcg::DETPROBDATA::getCons(), gcg::PARTIALDECOMP::getNOpenconss(), gcg::PARTIALDECOMP::getNVars(), gcg::DETPROBDATA::getNVarsForCons(), gcg::PARTIALDECOMP::getOpenconss(), gcg::DETPROBDATA::getValsForCons(), and gcg::DETPROBDATA::getVar().

◆ createGraph() [1/2]

static SCIP_RETCODE createGraph ( SCIP *  scip,
AUT_COLOR  colorinfo,
bliss::Graph *  graph,
SCIP_RESULT *  result 
)
static

create a graph out of an array of scips

Parameters
scipSCIP to compare
colorinfodata structure to save intermediate data
graphgraph needed for discovering isomorphism
resultresult pointer to indicate success or failure

Definition at line 549 of file dec_isomorph.cpp.

References freeMemory(), GCGconsGetNVars(), GCGconsGetVals(), and GCGconsGetVars().

Referenced by detectIsomorph().

◆ createGraph() [2/2]

static SCIP_RETCODE createGraph ( SCIP *  scip,
AUT_COLOR  colorinfo,
bliss::Graph *  graph,
SCIP_RESULT *  result,
gcg::PARTIALDECOMP partialdec,
gcg::DETPROBDATA detprobdata 
)
static

create a graph out of an array of scips (for partialdecs)

Parameters
scipSCIP to compare
colorinfodata structure to save intermediate data
graphgraph needed for discovering isomorphism
resultresult pointer to indicate success or failure
partialdecpartialdec to create graph for
detprobdatadetection process information and data

Definition at line 690 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(), and gcg::DETPROBDATA::getVarsForCons().

◆ 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
scipSCIP data structure
newPartialdecpartialdec data structure
masterconssconstraints to be put in the master
nmasterconssnumber of constraints in the master
partialdecpartialdec to propagate
detprobdatadetection process information and data
exactdoes this partialdec stems from exact graph construction ( or was onlysign = TRUE ) was used

Definition at line 830 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(), and gcg::DETPROBDATA::getVarsForCons().

Referenced by detectIsomorph().

◆ DEC_DECL_FREEDETECTOR()

static DEC_DECL_FREEDETECTOR ( detectorFreeIsomorph  )
static

destructor of detector to free user data (called when GCG is exiting)

Definition at line 1093 of file dec_isomorph.cpp.

References DEC_DETECTORNAME, DECdetectorGetData(), and DECdetectorGetName().

◆ DEC_DECL_INITDETECTOR()

static DEC_DECL_INITDETECTOR ( detectorInitIsomorph  )
static

detector initialization method (called after problem was transformed)

Definition at line 1112 of file dec_isomorph.cpp.

References DEC_DETECTORNAME, DECdetectorGetData(), DECdetectorGetName(), and DEC_DetectorData::result.

◆ 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
permutationthe permutation
permsizesize of the permutation

Definition at line 1132 of file dec_isomorph.cpp.

Referenced by detectIsomorph().

◆ collapsePermutation()

void collapsePermutation ( int *  permutation,
int  permsize 
)

collapses the permutation, if possible

Parameters
permutationthe permutation
permsizesize of the permutation

Definition at line 1165 of file dec_isomorph.cpp.

Referenced by detectIsomorph().

◆ getAllSubsets()

static std::vector< std::vector<int> > getAllSubsets ( std::vector< int >  set)
static

method to enumerate all subsets

Definition at line 1186 of file dec_isomorph.cpp.

Referenced by reorderPermutations().

◆ reorderPermutations()

SCIP_RETCODE reorderPermutations ( SCIP *  scip,
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
scipSCIP data structure
detprobdatadetection process information and data
permutationthe permutation
permsizesize of the permutation
npermsnumber of permutations

Definition at line 1206 of file dec_isomorph.cpp.

References gcd(), GCGconshdlrDecompAddCandidatesNBlocks(), getAllSubsets(), and gcg::DETPROBDATA::isAssignedToOrigProb().

Referenced by detectIsomorph().

◆ detectIsomorph()

static SCIP_RETCODE detectIsomorph ( SCIP *  scip,
PARTIALDEC_DETECTION_DATA detectiondata,
DEC_DETECTORDATA detectordata,
SCIP_RESULT *  result,
SCIP_Bool  onlysign,
int  maxdecomps 
)
static

◆ DEC_DECL_PROPAGATEPARTIALDEC()

◆ DEC_DECL_SETPARAMAGGRESSIVE()

static DEC_DECL_SETPARAMAGGRESSIVE ( setParamAggressiveIsomorph  )
static

◆ DEC_DECL_SETPARAMDEFAULT()

static DEC_DECL_SETPARAMDEFAULT ( setParamDefaultIsomorph  )
static

◆ DEC_DECL_SETPARAMFAST()

static DEC_DECL_SETPARAMFAST ( setParamFastIsomorph  )
static

◆ SCIPincludeDetectorIsomorphism()