GCG 4.1.1 (dev)

Generic Column Generation

Loading...
Searching...
No Matches
dec_isomorph.cpp File Reference

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 "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

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.

Referenced by GCG_DECL_SETPARAMAGGRESSIVE(), GCG_DECL_SETPARAMDEFAULT(), GCG_DECL_SETPARAMFAST(), and GCGincludeDetectorIsomorphism().

◆ DEFAULT_MAXDECOMPSEXTEND

#define DEFAULT_MAXDECOMPSEXTEND   4

default maximum number of decompositions

Definition at line 82 of file dec_isomorph.cpp.

Referenced by GCG_DECL_SETPARAMAGGRESSIVE(), GCG_DECL_SETPARAMDEFAULT(), GCG_DECL_SETPARAMFAST(), and GCGincludeDetectorIsomorphism().

◆ 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.

Referenced by GCGincludeDetectorIsomorphism().

◆ detectorFinishPartialdecIsomorph

#define detectorFinishPartialdecIsomorph   NULL

Definition at line 1235 of file dec_isomorph.cpp.

Referenced by GCGincludeDetectorIsomorphism().

◆ detectorPostprocessPartialdecIsomorph

#define detectorPostprocessPartialdecIsomorph   NULL

Definition at line 1237 of file dec_isomorph.cpp.

Referenced by GCGincludeDetectorIsomorphism().

Typedef Documentation

◆ AUT_HOOK

typedef struct struct_hook AUT_HOOK

Definition at line 98 of file dec_isomorph.cpp.

Function Documentation

◆ gcd()

int gcd ( int a,
int b )
static

method to calculate the greatest common divisor

Definition at line 171 of file dec_isomorph.cpp.

References gcd().

Referenced by gcd(), and reorderPermutations().

◆ fhookForPartialdecs()

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 217 of file dec_isomorph.cpp.

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

Referenced by detectIsomorph(), and fhookForPartialdecs().

◆ allocMemory()

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 263 of file dec_isomorph.cpp.

References allocMemory(), nvars, and SCIP_CALL().

Referenced by allocMemory(), and setupArrays().

◆ freeMemory()

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

destructor for colorinfo

Parameters
scipSCIP data structure
colorinfostruct to save intermediate information

Definition at line 279 of file dec_isomorph.cpp.

References freeMemory(), and i.

Referenced by cmpGraphPair(), createGraph(), freeMemory(), and freeMemory().

◆ setupArrays()

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 309 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(), gcg::DETPROBDATA::getVar(), i, j, nvars, result, SCIP_CALL(), SCIPdebugMessage(), setupArrays(), and var.

Referenced by detectIsomorph(), and setupArrays().

◆ createGraph()

SCIP_RETCODE createGraph ( SCIP * scip,
AUT_COLOR colorinfo,
AUT_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 402 of file dec_isomorph.cpp.

References assert(), createGraph(), 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(), i, j, nnodes, nvars, result, SCIPdebugMessage(), and var.

Referenced by createGraph(), and 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
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 548 of file dec_isomorph.cpp.

References assert(), createPartialdecFromMasterconss(), gcg::DETPROBDATA::getCons(), gcg::DETPROBDATA::getNConss(), gcg::PARTIALDECOMP::getNOpenconss(), gcg::PARTIALDECOMP::getNVars(), gcg::DETPROBDATA::getNVarsForCons(), gcg::PARTIALDECOMP::getOpenconss(), gcg::DETPROBDATA::getVar(), gcg::DETPROBDATA::getVarsForCons(), i, j, nvars, SCIP_CALL(), SCIPdebugMessage(), and var.

Referenced by createPartialdecFromMasterconss(), and detectIsomorph().

◆ GCG_DECL_FREEDETECTOR()

GCG_DECL_FREEDETECTOR ( detectorFreeIsomorph )
static

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

Definition at line 811 of file dec_isomorph.cpp.

References assert(), DEC_NAME, GCG_DECL_FREEDETECTOR, GCGdetectorGetData(), GCGdetectorGetName(), GCGgetOrigprob(), and SCIPfreeMemory().

◆ GCG_DECL_INITDETECTOR()

GCG_DECL_INITDETECTOR ( detectorInitIsomorph )
static

detector initialization method (called after problem was transformed)

Definition at line 830 of file dec_isomorph.cpp.

References assert(), DEC_NAME, GCG_DECL_INITDETECTOR, GCGdetectorGetData(), GCGdetectorGetName(), and GCG_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 850 of file dec_isomorph.cpp.

References i, renumberPermutations(), and SCIPdebugMessage().

Referenced by detectIsomorph(), and renumberPermutations().

◆ collapsePermutation()

void collapsePermutation ( int * permutation,
int permsize )

collapses the permutation, if possible

Parameters
permutationthe permutation
permsizesize of the permutation

Definition at line 883 of file dec_isomorph.cpp.

References collapsePermutation(), i, and SCIPdebugMessage().

Referenced by collapsePermutation(), and detectIsomorph().

◆ getAllSubsets()

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

method to enumerate all subsets

Definition at line 904 of file dec_isomorph.cpp.

References getAllSubsets(), i, j, and set::size.

Referenced by getAllSubsets(), and 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
gcgGCG data structure
detprobdatadetection process information and data
permutationthe permutation
permsizesize of the permutation
npermsnumber of permutations

Definition at line 924 of file dec_isomorph.cpp.

References assert(), gcd(), GCGconshdlrDecompAddCandidatesNBlocks(), GCGgetOrigprob(), getAllSubsets(), i, gcg::DETPROBDATA::isAssignedToOrigProb(), j, reorderPermutations(), SCIP_CALL(), SCIPdebugMessage(), and SCIPfreeBufferArray().

Referenced by detectIsomorph(), and reorderPermutations().

◆ detectIsomorph()

◆ GCG_DECL_PROPAGATEPARTIALDEC()

◆ GCG_DECL_SETPARAMAGGRESSIVE()

GCG_DECL_SETPARAMAGGRESSIVE ( setParamAggressiveIsomorph )
static

◆ GCG_DECL_SETPARAMDEFAULT()

◆ GCG_DECL_SETPARAMFAST()

GCG_DECL_SETPARAMFAST ( setParamFastIsomorph )
static

◆ GCGincludeDetectorIsomorphism()