presol_symbreak.c
Go to the documentation of this file.
26 * @note It is important to control the order of presolvers within SCIP in order to avoid contraditions. First, one needs
27 * to take care of presolvers that have an effect on symmetry, e.g., presol_domcol. If symmetry is computed on the
28 * original formulation, we perform this presolver at the very beginning. Otherwise, we try to compute symmetry as late
31 * @note Currently, we only allocate memory for pointers to symresack constraints for group generators. If further
35 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
59 #define PRESOL_PRIORITY -10000000 /**< priority of the presolver (>= 0: before, < 0: after constraint handlers) */
60 #define PRESOL_MAXROUNDS -1 /**< maximal number of presolving rounds the presolver participates in (-1: no limit) */
64 #define DEFAULT_CONSSADDLP TRUE /**< Should the symmetry breaking constraints be added to the LP? */
67 #define DEFAULT_DETECTORBITOPES FALSE /**< Should we check whether the components of the symmetry group can be handled by orbitopes? */
68 #define DEFAULT_ADDCONSSTIMING 2 /**< timing of adding constraints (0 = before presolving, 1 = during presolving, 2 = after presolving) */
88 int addconsstiming; /**< timing of adding constraints (0 = before presolving, 1 = during presolving, 2 = after presolving) */
92 SCIP_Bool detectorbitopes; /**< Should we check whether the components of the symmetry group can be handled by orbitopes? */
97 int* orbitbegins; /**< array containing in i-th position the first position of orbit i in orbits array */
101 SCIP_Shortbool* componentblocked; /**< array to store whether a component is blocked to be considered by symmetry handling techniques */
226 /* find number of permutations in current component and detect first perm in another permutation */
231 /* only store other component if it has the same identifier as its node (mark that new component starts) */
242 SCIP_CALL( SCIPallocBlockMemoryArray(scip, &(presoldata->components[componentcnt]), npermsincomponent) );
293 /** check whether a permutation is a composition of 2-cycles of binary variables and in this case determines the number of 2-cycles */
299 SCIP_Bool* iscompoftwocycles, /**< pointer to store whether permutation is a composition of 2-cycles */
301 SCIP_Bool* allvarsbinary /**< pointer to store whether perm is acting on binary variables only */
347 /** Given a matrix with nrows and \#perms + 1 columns whose first nfilledcols columns contain entries of variables, this routine
348 * checks whether the 2-cycles of perm intersect each row of column coltoextend in exactly one position. In this case,
362 int** nusedelems, /**< pointer to array storing how often an element was used in the orbitope */
364 SCIP_Bool* infeasible /**< pointer to store if the number of intersecting cycles is too small */
481 int** orbitopevaridx, /**< permuted index table of variables in permvars that are contained in orbitope */
484 SCIP_Bool* infeasible /**< pointer to store whether the potential orbitope is not an orbitope */
529 /* Either we are in case 1) or case 3), or all columns should have been added to vars in case 2) */
656 SCIP_CALL( getPermProperties(perms[components[i][j]], permvars, npermvars, &iscompoftwocycles, &ntwocyclesperm, &allvarsbinary) );
662 /* no or different number of 2-cycles or not all vars binary: permutations cannot generate orbitope */
689 SCIP_CALL( SCIPallocBufferArray(scip, &orbitopevaridx[j], npermsincomponent[i] + 1) ); /*lint !e866*/
810 SCIP_CALL( generateOrbitopeVarsMatrix(&vars, ntwocyclescomp, npermsincomponent[i] + 1, permvars, npermvars,
815 SCIP_CALL( SCIPcreateConsOrbitope(scip, &cons, "orbitope", vars, SCIP_ORBITOPETYPE_FULL, ntwocyclescomp, npermsincomponent[i] + 1, TRUE,
1001 SCIP_CALL( SCIPgetGeneratorsSymmetry(scip, SYM_SPEC_BINARY | SYM_SPEC_INTEGER | SYM_SPEC_REAL, 0, FALSE,
1002 &(presoldata->npermvars), &(presoldata->permvars), &(presoldata->nperms), &(presoldata->perms),
1009 SCIPdebugMsg(scip, "Symmetry breaking presolver: no symmetry on binary variables has been found, turning presolver off.\n");
1024 SCIP_CALL( SCIPcomputeGroupOrbitsSymbreak(scip, presoldata->permvars, presoldata->npermvars, presoldata->perms, presoldata->nperms, NULL,
1179 /** presolving initialization method of presolver (called when presolving is about to begin) */
1214 /** presolving deinitialization method of presolver (called after presolving has been finished) */
1229 /* guarantee that symmetries are computed (and handled) if the solving process hat not been interrupted
1232 if ( presoldata->enabled && ! presoldata->addedconss && SCIPgetStatus(scip) == SCIP_STATUS_UNKNOWN )
1286 SCIPdebugMsg(scip, "Added symmetry breaking constraints: %d.\n", presoldata->ngenconss - noldngenconns);
1291 SCIP_CALL( SCIPpresolCons(scip, presoldata->genconss[i], nrounds, SCIP_PRESOLTIMING_ALWAYS, nnewfixedvars, nnewaggrvars, nnewchgvartypes,
1292 nnewchgbds, nnewholes, nnewdelconss, nnewaddconss, nnewupgdconss, nnewchgcoefs, nnewchgsides, nfixedvars, naggrvars,
1293 nchgvartypes, nchgbds, naddholes, ndelconss, naddconss, nupgdconss, nchgcoefs, nchgsides, result) );
1298 SCIPdebugMsg(scip, "Presolving constraint <%s> detected cutoff or unboundedness.\n", SCIPconsGetName(presoldata->genconss[i]));
1302 SCIPdebugMsg(scip, "Presolved %d constraints generated by symbreak.\n", presoldata->ngenconss);
1345 SCIP_CALL( SCIPincludePresolBasic(scip, &presol, PRESOL_NAME, PRESOL_DESC, PRESOL_PRIORITY, PRESOL_MAXROUNDS, PRESOL_TIMING,
1378 "timing of adding constraints (0 = before presolving, 1 = during presolving, 2 = after presolving)",
1387 * The non-tivial orbits of the group action are stored in the array orbits of length npermvars. This array contains
1388 * the indices of variables from the permvars array such that variables that are contained in the same orbit appear
SCIP_RETCODE SCIPsetPresolInitpre(SCIP *scip, SCIP_PRESOL *presol, SCIP_DECL_PRESOLINITPRE((*presolinitpre)))
Definition: scip_presol.c:193
Definition: struct_presol.h:37
Definition: type_result.h:33
public methods for SCIP parameter handling
Definition: struct_scip.h:58
public methods for memory management
int SCIPdisjointsetFind(SCIP_DISJOINTSET *djset, int element)
Definition: misc.c:10656
static SCIP_DECL_PRESOLEXIT(presolExitSymbreak)
Definition: presol_symbreak.c:1106
static SCIP_RETCODE tryAddSymmetryHandlingConss(SCIP *scip, SCIP_PRESOL *presol)
Definition: presol_symbreak.c:973
Definition: type_result.h:49
Definition: type_result.h:38
Definition: struct_var.h:198
static SCIP_DECL_PRESOLINIT(presolInitSymbreak)
Definition: presol_symbreak.c:1078
public methods for presolving plugins
static SCIP_RETCODE getPermProperties(int *perm, SCIP_VAR **vars, int nvars, SCIP_Bool *iscompoftwocycles, int *ntwocyclesperm, SCIP_Bool *allvarsbinary)
Definition: presol_symbreak.c:295
SCIP_RETCODE SCIPcomputeGroupOrbitsSymbreak(SCIP *scip, SCIP_VAR **permvars, int npermvars, int **perms, int nperms, SCIP_Shortbool *activeperms, int *orbits, int *orbitbegins, int *norbits)
Definition: presol_symbreak.c:1393
public methods for problem variables
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)
Definition: scip_param.c:47
SCIP_RETCODE SCIPsetPresolExit(SCIP *scip, SCIP_PRESOL *presol, SCIP_DECL_PRESOLEXIT((*presolexit)))
Definition: scip_presol.c:177
presolver for adding symmetry breaking constraints
SCIP_RETCODE SCIPcreateDisjointset(SCIP *scip, SCIP_DISJOINTSET **djset, int ncomponents)
Definition: scip_datastructures.c:644
static SCIP_RETCODE detectOrbitopes(SCIP *scip, SCIP_PRESOLDATA *presoldata)
Definition: presol_symbreak.c:590
void SCIPfreeDisjointset(SCIP *scip, SCIP_DISJOINTSET **djset)
Definition: scip_datastructures.c:659
constraint handler for (partitioning/packing/full) orbitope constraints w.r.t. the full symmetric gro...
constraint handler for symresack constraints
SCIP_RETCODE SCIPcreateConsOrbitope(SCIP *scip, SCIP_CONS **cons, const char *name, SCIP_VAR ***vars, SCIP_ORBITOPETYPE orbitopetype, int nspcons, int nblocks, SCIP_Bool resolveprop, SCIP_Bool initial, SCIP_Bool separate, SCIP_Bool enforce, SCIP_Bool check, SCIP_Bool propagate, SCIP_Bool local, SCIP_Bool modifiable, SCIP_Bool dynamic, SCIP_Bool removable, SCIP_Bool stickingatnode)
Definition: cons_orbitope.c:3161
public methods for managing constraints
Definition: type_result.h:35
Definition: struct_cons.h:37
void SCIPdisjointsetUnion(SCIP_DISJOINTSET *djset, int p, int q, SCIP_Bool forcerepofp)
Definition: misc.c:10683
static SCIP_DECL_PRESOLEXEC(presolExecSymbreak)
Definition: presol_symbreak.c:1243
SCIP_RETCODE SCIPgetGeneratorsSymmetry(SCIP *scip, SYM_SPEC symspecrequire, SYM_SPEC symspecrequirefixed, SCIP_Bool recompute, int *npermvars, SCIP_VAR ***permvars, int *nperms, int ***perms, SCIP_Real *log10groupsize, SCIP_Bool *binvaraffected)
Definition: presol_symmetry.c:1712
static SCIP_RETCODE generateOrbitopeVarsMatrix(SCIP_VAR ****vars, int nrows, int ncols, SCIP_VAR **permvars, int npermvars, int **orbitopevaridx, int *columnorder, int *nusedelems, SCIP_Bool *infeasible)
Definition: presol_symbreak.c:475
Definition: type_retcode.h:33
Definition: type_stat.h:33
static SCIP_DECL_PRESOLFREE(presolFreeSymbreak)
Definition: presol_symbreak.c:1060
public methods for constraint handler plugins and constraints
SCIP_RETCODE SCIPgetIntParam(SCIP *scip, const char *name, int *value)
Definition: scip_param.c:259
static SCIP_DECL_PRESOLINITPRE(presolInitpreSymbreak)
Definition: presol_symbreak.c:1181
public data structures and miscellaneous methods
static SCIP_RETCODE extendSubOrbitope(int **suborbitope, int nrows, int nfilledcols, int coltoextend, int *perm, SCIP_Bool leftextension, int **nusedelems, SCIP_Bool *success, SCIP_Bool *infeasible)
Definition: presol_symbreak.c:355
SCIP_RETCODE SCIPsetPresolInit(SCIP *scip, SCIP_PRESOL *presol, SCIP_DECL_PRESOLINIT((*presolinit)))
Definition: scip_presol.c:161
Definition: type_set.h:40
static SCIP_RETCODE addSymmetryBreakingConstraints(SCIP *scip, SCIP_PRESOL *presol)
Definition: presol_symbreak.c:945
static SCIP_RETCODE computeComponents(SCIP *scip, SCIP_PRESOLDATA *presoldata)
Definition: presol_symbreak.c:113
static SCIP_RETCODE addSymresackConss(SCIP *scip, SCIP_PRESOL *presol)
Definition: presol_symbreak.c:848
static SCIP_DECL_PRESOLEXITPRE(presolExitpreSymbreak)
Definition: presol_symbreak.c:1216
SCIP_RETCODE SCIPsetPresolFree(SCIP *scip, SCIP_PRESOL *presol, SCIP_DECL_PRESOLFREE((*presolfree)))
Definition: scip_presol.c:145
SCIP_RETCODE SCIPcreateSymbreakCons(SCIP *scip, SCIP_CONS **cons, const char *name, int *perm, SCIP_VAR **vars, int nvars, SCIP_Bool initial, SCIP_Bool separate, SCIP_Bool enforce, SCIP_Bool check, SCIP_Bool propagate, SCIP_Bool local, SCIP_Bool modifiable, SCIP_Bool dynamic, SCIP_Bool removable, SCIP_Bool stickingatnode)
Definition: cons_symresack.c:1314
public methods for presolvers
Definition: cons_orbitope.h:78
general public methods
presolver for storing symmetry information about current problem
public methods for message output
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)
Definition: scip_param.c:73
SCIP_RETCODE SCIPincludePresolBasic(SCIP *scip, SCIP_PRESOL **presolptr, const char *name, const char *desc, int priority, int maxrounds, SCIP_PRESOLTIMING timing, SCIP_DECL_PRESOLEXEC((*presolexec)), SCIP_PRESOLDATA *presoldata)
Definition: scip_presol.c:94
public methods for message handling
Definition: struct_misc.h:264
#define SCIPfreeBlockMemoryArrayNull(scip, ptr, num)
Definition: scip_mem.h:98
SCIP_RETCODE SCIPreleaseCons(SCIP *scip, SCIP_CONS **cons)
Definition: scip_cons.c:1109
Definition: objbenders.h:33
public methods for global and local (sub)problems
SCIP_RETCODE SCIPincludePresolSymbreak(SCIP *scip)
Definition: presol_symbreak.c:1315
SCIP_RETCODE SCIPsetIntParam(SCIP *scip, const char *name, int value)
Definition: scip_param.c:496
Definition: type_result.h:39
SCIP_RETCODE SCIPpresolCons(SCIP *scip, SCIP_CONS *cons, int nrounds, SCIP_PRESOLTIMING presoltiming, int nnewfixedvars, int nnewaggrvars, int nnewchgvartypes, int nnewchgbds, int nnewholes, int nnewdelconss, int nnewaddconss, int nnewupgdconss, int nnewchgcoefs, int nnewchgsides, int *nfixedvars, int *naggrvars, int *nchgvartypes, int *nchgbds, int *naddholes, int *ndelconss, int *naddconss, int *nupgdconss, int *nchgcoefs, int *nchgsides, SCIP_RESULT *result)
Definition: scip_cons.c:2342
SCIP_RETCODE SCIPsetPresolExitpre(SCIP *scip, SCIP_PRESOL *presol, SCIP_DECL_PRESOLEXITPRE((*presolexitpre)))
Definition: scip_presol.c:209
memory allocation routines