presol_domcol.c
Go to the documentation of this file.
27 * @todo Also run on general CIPs, if the number of locks of the investigated variables comes only from (upgraded) 30 * @todo Instead of choosing variables for comparison out of one row, we should try to use 'hashvalues' for columns that 31 * indicate in which constraint type (<=, >=, or ranged row / ==) they are existing. Then sort the variables (and 32 * corresponding data) after the ranged row/equation hashvalue and only try to derive dominance on variables with 33 * the same hashvalue on ranged row/equation and fitting hashvalues for the other constraint types. 37 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/ 48 #define PRESOL_PRIORITY -1000 /**< priority of the presolver (>= 0: before, < 0: after constraint handlers) */ 49 #define PRESOL_MAXROUNDS -1 /**< maximal number of presolving rounds the presolver participates in (-1: no limit) */ 50 #define PRESOL_TIMING SCIP_PRESOLTIMING_EXHAUSTIVE /* timing of the presolver (fast, medium, or exhaustive) */ 67 SCIP_Bool predbndstr; /**< flag indicating if predictive bound strengthening should be applied */ 132 SCIPdebugPrintf(" <= %g (U:%g)", (SCIPmatrixGetRowNMaxActPosInf(matrix, row) + SCIPmatrixGetRowNMaxActNegInf(matrix, row) > 0) ? 210 SCIPdebugPrintf("\n\n### [%c], obj:%g->%g,\t%s[idx:%d](nrows:%d)->%s[idx:%d](nrows:%d)\twclb=%g, ub'=%g, ub=%g", 223 /** get minimum/maximum residual activity for the specified variable and with another variable set to its upper bound */ 263 maxactinf = SCIPmatrixGetRowNMaxActPosInf(matrix, row) + SCIPmatrixGetRowNMaxActNegInf(matrix, row); 264 minactinf = SCIPmatrixGetRowNMinActPosInf(matrix, row) + SCIPmatrixGetRowNMinActNegInf(matrix, row); 278 /* first, adjust min and max activity such that upperboundvar is always set to its upper bound */ 299 tmpminact = tmpminact - (upperboundcoef * lbupperboundvar) + (upperboundcoef * ubupperboundvar); 313 tmpmaxact = tmpmaxact - (upperboundcoef * lbupperboundvar) + (upperboundcoef * ubupperboundvar); 320 /* the coefficient is positive, so the upper bound contributed to the maxactivity and the lower bound to the minactivity */ 359 /* the coefficient is negative, so the lower bound contributed to the maxactivity and the upper bound to the minactivity */ 400 /** get minimum/maximum residual activity for the specified variable and with another variable set to its lower bound */ 409 SCIP_Real lowerboundcoef, /**< coefficient in this row of the column to be set to its lower bound */ 440 maxactinf = SCIPmatrixGetRowNMaxActPosInf(matrix, row) + SCIPmatrixGetRowNMaxActNegInf(matrix, row); 441 minactinf = SCIPmatrixGetRowNMinActPosInf(matrix, row) + SCIPmatrixGetRowNMinActNegInf(matrix, row); 455 /* first, adjust min and max activity such that lowerboundvar is always set to its lower bound */ 476 tmpmaxact = tmpmaxact - (lowerboundcoef * ublowerboundvar) + (lowerboundcoef * lblowerboundvar); 490 tmpminact = tmpminact - (lowerboundcoef * ublowerboundvar) + (lowerboundcoef * lblowerboundvar); 497 /* the coefficient is positive, so the upper bound contributed to the maxactivity and the lower bound to the minactivity */ 536 /* the coefficient is negative, so the lower bound contributed to the maxactivity and the upper bound to the minactivity */ 578 * We use a special kind of predictive rowbound analysis by first setting the dominating variable to its upper bound. 628 /* no rowbound analysis for multiaggregated variables, which should not exist, because the matrix only consists of 640 getActivityResidualsUpperBound(scip, matrix, row, coldominated, valdominated, coldominating, valdominating, 753 * We use a special kind of predictive rowbound analysis by first setting the dominated variable to its lower bound. 803 /* no rowbound analysis for multiaggregated variables, which should not exist, because the matrix only consists of 815 getActivityResidualsLowerBound(scip, matrix, row, coldominating, valdominating, coldominated, valdominated, 937 SCIP_Bool predictdominating, /**< flag indicating if bounds of dominating or dominated variable are predicted */ 1197 (SCIPvarGetType(dominatingvar) == SCIP_VARTYPE_INTEGER && SCIPvarGetType(dominatedvar) == SCIP_VARTYPE_IMPLINT) || 1198 (SCIPvarGetType(dominatedvar) == SCIP_VARTYPE_INTEGER && SCIPvarGetType(dominatingvar) == SCIP_VARTYPE_IMPLINT)) ) 1226 SCIPdebugMessage("[ub]\tupper bound for dominating variable <%s> changed: [%.17f,%.17f] -> [%.17f,%.17f]\n", 1254 SCIPdebugMessage("[lb]\tlower bound of dominating variable <%s> changed: [%.17f,%.17f] -> [%.17f,%.17f]\n", 1268 if( !SCIPisInfinity(scip, dominatingwcub) && SCIPisNegative(scip, SCIPvarGetObj(dominatingvar))) 1283 SCIPdebugMessage("[wcub]\tlower bound of dominating variable <%s> changed: [%.17f,%.17f] -> [%.17f,%.17f]\n", 1310 SCIPdebugMessage("[ub]\tupper bound of dominated variable <%s> changed: [%.17f,%.17f] -> [%.17f,%.17f]\n", 1324 if( !SCIPisInfinity(scip, -dominatedwclb) && SCIPisPositive(scip, SCIPvarGetObj(dominatedvar)) ) 1339 SCIPdebugMessage("[wclb]\tupper bound of dominated variable <%s> changed: [%.17f,%.17f] -> [%.17f,%.17f]\n", 1363 SCIPdebugMessage("[lb]\tlower bound of dominated variable <%s> changed: [%.17f,%.17f] -> [%.17f,%.17f]\n", 1389 SCIP_Bool onlyoneone, /**< when onlybinvars is TRUE, flag indicates if both binary variables are in clique */ 1396 (SCIPvarGetType(dominatingvar) == SCIP_VARTYPE_INTEGER && SCIPvarGetType(dominatedvar) == SCIP_VARTYPE_IMPLINT) || 1397 (SCIPvarGetType(dominatedvar) == SCIP_VARTYPE_INTEGER && SCIPvarGetType(dominatingvar) == SCIP_VARTYPE_IMPLINT)) ) 1484 if( varstofix[dominatedidx] == NOFIX && (onlyoneone || SCIPvarsHaveCommonClique(dominatingvar, TRUE, dominatedvar, TRUE, TRUE)) ) 1495 if( varstofix[dominatingidx] == NOFIX && SCIPvarsHaveCommonClique(dominatingvar, FALSE, dominatedvar, FALSE, TRUE) ) 1520 SCIP_Bool onlybinvars, /**< flag indicating searchcols contains only binary variable indexes */ 1521 FIXINGDIRECTION* varstofix, /**< array holding information for later upper/lower bound fixing */ 1744 if( (SCIPmatrixGetRowNMaxActPosInf(matrix, rows1[r1]) + SCIPmatrixGetRowNMaxActNegInf(matrix, rows1[r1]) == 0) 1745 && SCIPisFeasLE(scip, SCIPmatrixGetRowMaxActivity(matrix, rows1[r1]) + MAX(vals1[r1], vals2[r2]), SCIPmatrixGetRowLhs(matrix, rows1[r1])) ) 1755 if( (SCIPmatrixGetRowNMinActPosInf(matrix, rows1[r1]) + SCIPmatrixGetRowNMinActNegInf(matrix, rows1[r1]) == 0) 1756 && SCIPisFeasGE(scip, SCIPmatrixGetRowMinActivity(matrix, rows1[r1]) + MIN(vals1[r1], vals2[r2]), SCIPmatrixGetRowRhs(matrix, rows1[r1])) ) 1988 if( (SCIPgetStage(scip) != SCIP_STAGE_PRESOLVING) || SCIPinProbing(scip) || SCIPisNLPEnabled(scip) ) 2114 assert(SCIPvarGetType(var) == SCIP_VARTYPE_INTEGER || SCIPvarGetType(var) == SCIP_VARTYPE_IMPLINT); 2228 assert(SCIPvarGetType(var) == SCIP_VARTYPE_INTEGER || SCIPvarGetType(var) == SCIP_VARTYPE_IMPLINT); 2372 SCIPdebugMessage("### %d vars [%" SCIP_LONGINT_FORMAT " dom] => fixed [cont: %d, int: %d, bin: %d], %scutoff detected\n", 2373 ncols, ndomrelations, nconvarsfixed, nintvarsfixed, nbinvarsfixed, (*result != SCIP_CUTOFF) ? "no " : ""); 2399 SCIP_CALL( SCIPincludePresolBasic(scip, &presol, PRESOL_NAME, PRESOL_DESC, PRESOL_PRIORITY, PRESOL_MAXROUNDS, 2412 &presoldata->nummaxpairs, FALSE, DEFAULT_NUMMAXPAIRS, DEFAULT_NUMMINPAIRS, 1000000000, NULL, NULL) ); SCIP_RETCODE SCIPfixVar(SCIP *scip, SCIP_VAR *var, SCIP_Real fixedval, SCIP_Bool *infeasible, SCIP_Bool *fixed) Definition: scip.c:22777 void SCIPsortRealInt(SCIP_Real *realarray, int *intarray, int len) void SCIPpresolSetData(SCIP_PRESOL *presol, SCIP_PRESOLDATA *presoldata) Definition: presol.c:476 Definition: struct_presol.h:36 Definition: type_result.h:33 SCIP_RETCODE SCIPchgVarLb(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound) Definition: scip.c:19748 static SCIP_RETCODE calcVarBoundsDominating(SCIP *scip, SCIP_MATRIX *matrix, int row, int coldominating, SCIP_Real valdominating, int coldominated, SCIP_Real valdominated, SCIP_Bool *ubcalculated, SCIP_Real *calculatedub, SCIP_Bool *wclbcalculated, SCIP_Real *calculatedwclb, SCIP_Bool *lbcalculated, SCIP_Real *calculatedlb, SCIP_Bool *wcubcalculated, SCIP_Real *calculatedwcub) Definition: presol_domcol.c:756 Definition: struct_scip.h:53 Definition: presol_domcol.c:74 Definition: presol_domcol.c:73 Definition: type_result.h:49 SCIP_RETCODE SCIPsetPresolCopy(SCIP *scip, SCIP_PRESOL *presol, SCIP_DECL_PRESOLCOPY((*presolcopy))) Definition: scip.c:6226 Definition: struct_var.h:196 static SCIP_RETCODE updateBounds(SCIP *scip, SCIP_MATRIX *matrix, int row, int col1, SCIP_Real val1, int col2, SCIP_Real val2, SCIP_Bool predictdominating, SCIP_Real *upperbound, SCIP_Real *wclowerbound, SCIP_Real *lowerbound, SCIP_Real *wcupperbound) Definition: presol_domcol.c:929 dominated column presolver Definition: type_var.h:53 void SCIPsortIntIntReal(int *intarray1, int *intarray2, SCIP_Real *realarray, int len) static SCIP_RETCODE findFixings(SCIP *scip, SCIP_MATRIX *matrix, SCIP_VAR *dominatingvar, int dominatingidx, SCIP_Real dominatingub, SCIP_Real dominatingwclb, SCIP_Real dominatinglb, SCIP_Real dominatingwcub, SCIP_VAR *dominatedvar, int dominatedidx, FIXINGDIRECTION *varstofix, SCIP_Bool onlybinvars, SCIP_Bool onlyoneone, int *nfixings) Definition: presol_domcol.c:1376 SCIP_Real SCIPmatrixGetRowMaxActivity(SCIP_MATRIX *matrix, int row) Definition: matrix.c:1465 SCIP_RETCODE SCIPmatrixCreate(SCIP *scip, SCIP_MATRIX **matrixptr, SCIP_Bool *initialized, SCIP_Bool *complete) Definition: matrix.c:430 int SCIPmatrixGetRowNNonzs(SCIP_MATRIX *matrix, int row) Definition: matrix.c:1373 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.c:3547 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.c:3573 SCIP_Real SCIPmatrixGetRowLhs(SCIP_MATRIX *matrix, int row) Definition: matrix.c:1407 SCIP_Real * SCIPmatrixGetColValPtr(SCIP_MATRIX *matrix, int col) Definition: matrix.c:1233 static void getActivityResidualsLowerBound(SCIP *scip, SCIP_MATRIX *matrix, int row, int col, SCIP_Real coef, int lowerboundcol, SCIP_Real lowerboundcoef, SCIP_Real *minresactivity, SCIP_Real *maxresactivity, SCIP_Bool *success) Definition: presol_domcol.c:402 Definition: type_result.h:35 void SCIPsortIntInt(int *intarray1, int *intarray2, int len) int SCIPmatrixGetRowNMaxActPosInf(SCIP_MATRIX *matrix, int row) Definition: matrix.c:1513 int * SCIPmatrixGetRowIdxPtr(SCIP_MATRIX *matrix, int row) Definition: matrix.c:1361 int SCIPmatrixGetRowNMaxActNegInf(SCIP_MATRIX *matrix, int row) Definition: matrix.c:1501 Definition: type_retcode.h:33 SCIP_Bool SCIPvarsHaveCommonClique(SCIP_VAR *var1, SCIP_Bool value1, SCIP_VAR *var2, SCIP_Bool value2, SCIP_Bool regardimplics) Definition: var.c:10742 SCIP_Real * SCIPmatrixGetRowValPtr(SCIP_MATRIX *matrix, int row) Definition: matrix.c:1349 static SCIP_RETCODE predBndStr(SCIP *scip, SCIP_VAR *dominatingvar, int dominatingidx, SCIP_Real dominatingub, SCIP_Real dominatinglb, SCIP_Real dominatingwcub, SCIP_VAR *dominatedvar, int dominatedidx, SCIP_Real dominatedub, SCIP_Real dominatedwclb, SCIP_Real dominatedlb, FIXINGDIRECTION *varstofix, int *nchgbds) Definition: presol_domcol.c:1178 static SCIP_RETCODE findDominancePairs(SCIP *scip, SCIP_MATRIX *matrix, SCIP_PRESOLDATA *presoldata, int *searchcols, int searchsize, SCIP_Bool onlybinvars, FIXINGDIRECTION *varstofix, int *nfixings, SCIP_Longint *ndomrelations, int *nchgbds) Definition: presol_domcol.c:1514 SCIP_RETCODE SCIPchgVarUb(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound) Definition: scip.c:19828 Definition: type_var.h:55 SCIP_RETCODE SCIPsetPresolFree(SCIP *scip, SCIP_PRESOL *presol, SCIP_DECL_PRESOLFREE((*presolfree))) Definition: scip.c:6242 Definition: type_var.h:54 int * SCIPmatrixGetColIdxPtr(SCIP_MATRIX *matrix, int col) Definition: matrix.c:1245 Definition: type_set.h:38 Definition: type_var.h:45 Definition: struct_matrix.h:37 static SCIP_RETCODE calcVarBoundsDominated(SCIP *scip, SCIP_MATRIX *matrix, int row, int coldominating, SCIP_Real valdominating, int coldominated, SCIP_Real valdominated, SCIP_Bool *ubcalculated, SCIP_Real *calculatedub, SCIP_Bool *wclbcalculated, SCIP_Real *calculatedwclb, SCIP_Bool *lbcalculated, SCIP_Real *calculatedlb, SCIP_Bool *wcubcalculated, SCIP_Real *calculatedwcub) Definition: presol_domcol.c:581 int SCIPmatrixGetRowNMinActNegInf(SCIP_MATRIX *matrix, int row) Definition: matrix.c:1477 public methods for matrix static void getActivityResidualsUpperBound(SCIP *scip, SCIP_MATRIX *matrix, int row, int col, SCIP_Real coef, int upperboundcol, SCIP_Real upperboundcoef, SCIP_Real *minresactivity, SCIP_Real *maxresactivity, SCIP_Bool *success) Definition: presol_domcol.c:225 SCIP_Real SCIPmatrixGetRowRhs(SCIP_MATRIX *matrix, int row) Definition: matrix.c:1419 SCIP_Bool SCIPmatrixIsRowRhsInfinity(SCIP_MATRIX *matrix, int row) Definition: matrix.c:1431 SCIP_Bool SCIPisFeasLE(SCIP *scip, SCIP_Real val1, SCIP_Real val2) Definition: scip.c:41933 static SCIP_RETCODE detectParallelCols(SCIP *scip, SCIP_MATRIX *matrix, int *pclass, SCIP_Bool *varineq) Definition: presol_domcol.c:1009 SCIP_Bool SCIPisFeasGE(SCIP *scip, SCIP_Real val1, SCIP_Real val2) Definition: scip.c:41959 SCIP_Real SCIPmatrixGetRowMinActivity(SCIP_MATRIX *matrix, int row) Definition: matrix.c:1453 int SCIPmatrixGetColNDownlocks(SCIP_MATRIX *matrix, int col) Definition: matrix.c:1313 int SCIPmatrixGetRowNMinActPosInf(SCIP_MATRIX *matrix, int row) Definition: matrix.c:1489 int SCIPmatrixGetColNUplocks(SCIP_MATRIX *matrix, int col) Definition: matrix.c:1301 SCIP_RETCODE SCIPincludePresolDomcol(SCIP *scip) Definition: presol_domcol.c:2388 Definition: presol_domcol.c:75 Definition: type_retcode.h:43 Definition: objbranchrule.h:33 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.c:6191 static SCIP_RETCODE printRow(SCIP *scip, FZNOUTPUT *fznoutput, const char *type, SCIP_VAR **vars, SCIP_Real *vals, int nvars, SCIP_Real rhs, SCIP_Bool hasfloats) Definition: reader_fzn.c:3969 Definition: type_result.h:39 int SCIPmatrixGetColNNonzs(SCIP_MATRIX *matrix, int col) Definition: matrix.c:1257 Definition: type_var.h:56 |