|
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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*/
54 #define PRESOL_PRIORITY 20000000 /**< priority of the presolver (>= 0: before, < 0: after constraint handlers) */
55 #define PRESOL_MAXROUNDS -1 /**< maximal number of presolving rounds the presolver participates in (-1: no limit) */
56 #define PRESOL_DELAY TRUE /**< should presolver be delayed, if other presolvers found reductions? */
75 SCIP_Bool predbndstr; /**< flag indicating if predictive bound strengthening should be applied */
76 SCIP_Bool singcolstuffing; /**< flag indicating if singleton columns stuffing should be applied */
132 /** transforms given variables, scalars, and constant to the corresponding active variables, scalars, and constant */
152 SCIP_CALL( SCIPgetProbvarLinearSum(scip, *vars, *scalars, nvars, *nvars, constant, &requiredsize, TRUE) );
160 SCIP_CALL( SCIPgetProbvarLinearSum(scip, *vars, *scalars, nvars, requiredsize, constant, &requiredsize, TRUE) );
546 SCIPdebugMessage("unsupported constraint type <%s>: aborting domcol presolver\n", conshdlrname);
564 * this counts nonzeros in equalities twice, but can be at most two times as high as the exact number
694 SCIP_CALL( addConstraint(scip, matrix, SCIPconsGetName(cons), SCIPgetVarsSetppc(scip, cons), NULL,
748 SCIP_CALL( addConstraint(scip, matrix, SCIPconsGetName(cons), SCIPgetVarsKnapsack(scip, cons), consvals,
783 SCIP_CALL( addConstraint(scip, matrix, SCIPconsGetName(cons), consvars, consvals, 2, SCIPgetLhsVarbound(scip, cons),
933 SCIPdebugPrintf("\n(L:%g) [%c] %g <=", (matrix->minactivityposinf[row] + matrix->minactivityneginf[row] > 0) ? -SCIPinfinity(scip) : matrix->minactivity[row], relation, matrix->lhs[row]);
942 SCIPdebugPrintf(" <= %g (U:%g)", (matrix->maxactivityposinf[row] + matrix->maxactivityneginf[row] > 0) ? SCIPinfinity(scip) : matrix->rhs[row], matrix->maxactivity[row]);
1018 SCIPdebugPrintf("\n\n### [%c], obj:%g->%g,\t%s[idx:%d](nrows:%d)->%s[idx:%d](nrows:%d)\twclb=%g, ub'=%g, ub=%g",
1031 /** get minimum/maximum residual activity for the specified variable and with another variable set to its upper bound */
1086 /* first, adjust min and max activity such that upperboundvar is always set to its upper bound */
1107 tmpminact = tmpminact - (upperboundcoef * lbupperboundvar) + (upperboundcoef * ubupperboundvar);
1121 tmpmaxact = tmpmaxact - (upperboundcoef * lbupperboundvar) + (upperboundcoef * ubupperboundvar);
1128 /* the coefficient is positive, so the upper bound contributed to the maxactivity and the lower bound to the minactivity */
1167 /* the coefficient is negative, so the lower bound contributed to the maxactivity and the upper bound to the minactivity */
1208 /** get minimum/maximum residual activity for the specified variable and with another variable set to its lower bound */
1217 SCIP_Real lowerboundcoef, /**< coefficient in this row of the column to be set to its lower bound */
1263 /* first, adjust min and max activity such that lowerboundvar is always set to its lower bound */
1284 tmpmaxact = tmpmaxact - (lowerboundcoef * ublowerboundvar) + (lowerboundcoef * lblowerboundvar);
1298 tmpminact = tmpminact - (lowerboundcoef * ublowerboundvar) + (lowerboundcoef * lblowerboundvar);
1305 /* the coefficient is positive, so the upper bound contributed to the maxactivity and the lower bound to the minactivity */
1344 /* the coefficient is negative, so the lower bound contributed to the maxactivity and the upper bound to the minactivity */
1386 * We use a special kind of predictive rowbound analysis by first setting the dominating variable to its upper bound.
1436 /* no rowbound analysis for multiaggregated variables, which should not exist, because the matrix only consists of
1448 getActivityResidualsUpperBound(scip, matrix, row, coldominated, valdominated, coldominating, valdominating,
1561 * We use a special kind of predictive rowbound analysis by first setting the dominated variable to its lower bound.
1611 /* no rowbound analysis for multiaggregated variables, which should not exist, because the matrix only consists of
1623 getActivityResidualsLowerBound(scip, matrix, row, coldominating, valdominating, coldominated, valdominated,
1735 /** try to find new variable bounds and update them when they are better then the old bounds */
1745 SCIP_Bool predictdominating, /**< flag indicating if bounds of dominating or dominated variable are predicted */
2009 (SCIPvarGetType(dominatingvar) == SCIP_VARTYPE_INTEGER && SCIPvarGetType(dominatedvar) == SCIP_VARTYPE_IMPLINT) ||
2010 (SCIPvarGetType(dominatedvar) == SCIP_VARTYPE_INTEGER && SCIPvarGetType(dominatingvar) == SCIP_VARTYPE_IMPLINT)) )
2038 SCIPdebugMessage("[ub]\tupper bound for dominating variable <%s> changed: [%.17f,%.17f] -> [%.17f,%.17f]\n",
2066 SCIPdebugMessage("[lb]\tlower bound of dominating variable <%s> changed: [%.17f,%.17f] -> [%.17f,%.17f]\n",
2080 if( !SCIPisInfinity(scip, dominatingwcub) && SCIPisNegative(scip, SCIPvarGetObj(dominatingvar)))
2095 SCIPdebugMessage("[wcub]\tlower bound of dominating variable <%s> changed: [%.17f,%.17f] -> [%.17f,%.17f]\n",
2122 SCIPdebugMessage("[ub]\tupper bound of dominated variable <%s> changed: [%.17f,%.17f] -> [%.17f,%.17f]\n",
2136 if( !SCIPisInfinity(scip, -dominatedwclb) && SCIPisPositive(scip, SCIPvarGetObj(dominatedvar)) )
2151 SCIPdebugMessage("[wclb]\tupper bound of dominated variable <%s> changed: [%.17f,%.17f] -> [%.17f,%.17f]\n",
2175 SCIPdebugMessage("[lb]\tlower bound of dominated variable <%s> changed: [%.17f,%.17f] -> [%.17f,%.17f]\n",
2201 SCIP_Bool onlyoneone, /**< when onlybinvars is TRUE, flag indicates if both binary variables are in clique */
2208 (SCIPvarGetType(dominatingvar) == SCIP_VARTYPE_INTEGER && SCIPvarGetType(dominatedvar) == SCIP_VARTYPE_IMPLINT) ||
2209 (SCIPvarGetType(dominatedvar) == SCIP_VARTYPE_INTEGER && SCIPvarGetType(dominatingvar) == SCIP_VARTYPE_IMPLINT)) )
2296 if( varstofix[dominatedidx] == NOFIX && (onlyoneone || SCIPvarsHaveCommonClique(dominatingvar, TRUE, dominatedvar, TRUE, TRUE)) )
2307 if( varstofix[dominatingidx] == NOFIX && SCIPvarsHaveCommonClique(dominatingvar, FALSE, dominatedvar, FALSE, TRUE) )
2334 FIXINGDIRECTION* varstofix, /**< array holding information for later upper/lower bound fixing */
2559 if( !onlyoneone && (matrix->minactivityposinf[rows1[r1]] + matrix->minactivityneginf[rows1[r1]] == 0)
2560 && SCIPisFeasGE(scip, matrix->minactivity[rows1[r1]] + MIN(vals1[r1], vals2[r2]), matrix->rhs[rows1[r1]]) )
2653 if( SCIPisGE(scip, SCIPvarGetUbGlobal(matrix->vars[col1]), SCIPvarGetUbGlobal(matrix->vars[col2])) )
2760 if( matrix->colmatcnt[col] == 1 && SCIPvarGetType(matrix->vars[col]) == SCIP_VARTYPE_CONTINUOUS )
2853 if( matrix->colmatcnt[idx] == 1 && SCIPvarGetType(matrix->vars[idx]) == SCIP_VARTYPE_CONTINUOUS )
2967 if( matrix->colmatcnt[idx] == 1 && SCIPvarGetType(matrix->vars[idx]) == SCIP_VARTYPE_CONTINUOUS )
3010 /** presolving deinitialization method of presolver (called after presolving has been finished) */
3072 * @todo SCIPisNLPEnabled() always returns FALSE during presolve, since the necessary flag is set after presolve (in exitpre, currently)
3074 if( (SCIPgetStage(scip) != SCIP_STAGE_PRESOLVING) || SCIPinProbing(scip) || SCIPisNLPEnabled(scip) )
3161 SCIP_CALL( singletonColumnStuffing(scip, matrix, varsprocessed, varstofix, &nfixingsstuffing) );
3192 /* we only regard variables which were not processed yet and are present within equalities or ranged rows */
3206 assert(SCIPvarGetType(matrix->vars[varidx]) == SCIP_VARTYPE_INTEGER || SCIPvarGetType(matrix->vars[varidx]) == SCIP_VARTYPE_IMPLINT);
3318 assert(SCIPvarGetType(matrix->vars[varidx]) == SCIP_VARTYPE_INTEGER || SCIPvarGetType(matrix->vars[varidx]) == SCIP_VARTYPE_IMPLINT);
3396 SCIPdebugMessage("fixing dominated variable <%s> to its lower bound %g\n", SCIPvarGetName(var), lb);
3421 assert(SCIPvarGetType(var) == SCIP_VARTYPE_INTEGER || SCIPvarGetType(var) == SCIP_VARTYPE_IMPLINT);
3434 SCIPdebugMessage("fixing dominated variable <%s> to its upper bound %g\n", SCIPvarGetName(var), ub);
3460 assert(SCIPvarGetType(var) == SCIP_VARTYPE_INTEGER || SCIPvarGetType(var) == SCIP_VARTYPE_IMPLINT);
3485 SCIPdebugMessage("### %d vars [%lld dom] ===>>> fixed [cont: %d, int: %d, bin: %d], %scutoff detected\n",
3486 matrix->ncols, ndomrelations, nconvarsfixed, nintvarsfixed, nbinvarsfixed, (*result != SCIP_CUTOFF) ? "no " : "");
3512 SCIP_CALL( SCIPincludePresolBasic(scip, &presol, PRESOL_NAME, PRESOL_DESC, PRESOL_PRIORITY, PRESOL_MAXROUNDS,
3531 &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:20784 void SCIPsortRealInt(SCIP_Real *realarray, int *intarray, int len) void SCIPpresolSetData(SCIP_PRESOL *presol, SCIP_PRESOLDATA *presoldata) Definition: presol.c:474 Definition: cons_setppc.h:54 Definition: struct_presol.h:36 Definition: type_result.h:33 SCIP_RETCODE SCIPchgVarLb(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound) Definition: scip.c:17929 SCIP_RETCODE SCIPgetProbvarLinearSum(SCIP *scip, SCIP_VAR **vars, SCIP_Real *scalars, int *nvars, int varssize, SCIP_Real *constant, int *requiredsize, SCIP_Bool mergemultiples) Definition: scip.c:15614 Definition: struct_scip.h:52 Constraint handler for variable bound constraints . Definition: presol_domcol.c:87 static void freeMatrix(SCIP *scip, CONSTRAINTMATRIX **matrix) Definition: presol_domcol.c:822 Definition: presol_domcol.c:86 Definition: type_result.h:49 SCIP_RETCODE SCIPsetPresolCopy(SCIP *scip, SCIP_PRESOL *presol, SCIP_DECL_PRESOLCOPY((*presolcopy))) Definition: scip.c:5948 SCIP_Longint SCIPgetCapacityKnapsack(SCIP *scip, SCIP_CONS *cons) Definition: cons_knapsack.c:13190 Definition: struct_var.h:196 dominated column presolver static SCIP_RETCODE updateBounds(SCIP *scip, CONSTRAINTMATRIX *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:1737 SCIP_Real SCIPgetLhsVarbound(SCIP *scip, SCIP_CONS *cons) Definition: cons_varbound.c:4598 int SCIPgetNVarsLinear(SCIP *scip, SCIP_CONS *cons) Definition: cons_linear.c:15400 Definition: type_var.h:53 SCIP_Longint * SCIPgetWeightsKnapsack(SCIP *scip, SCIP_CONS *cons) Definition: cons_knapsack.c:13285 static SCIP_RETCODE singletonColumnStuffing(SCIP *scip, CONSTRAINTMATRIX *matrix, SCIP_Bool *varsprocessed, FIXINGDIRECTION *varstofix, int *nfixings) Definition: presol_domcol.c:2711 static SCIP_RETCODE detectParallelCols(SCIP *scip, CONSTRAINTMATRIX *matrix, int *pclass, SCIP_Bool *varineq) Definition: presol_domcol.c:1820 Definition: cons_setppc.h:55 static SCIP_RETCODE findDominancePairs(SCIP *scip, CONSTRAINTMATRIX *matrix, SCIP_PRESOLDATA *presoldata, int *searchcols, int searchsize, SCIP_Bool onlybinvars, FIXINGDIRECTION *varstofix, int *nfixings, SCIP_Longint *ndomrelations, int *nchgbds) Definition: presol_domcol.c:2327 void SCIPsortIntIntReal(int *intarray1, int *intarray2, SCIP_Real *realarray, int len) Constraint handler for the set partitioning / packing / covering constraints . SCIP_VAR ** SCIPgetVarsKnapsack(SCIP *scip, SCIP_CONS *cons) Definition: cons_knapsack.c:13264 void SCIPsortRealRealIntInt(SCIP_Real *realarray1, SCIP_Real *realarray2, int *intarray1, int *intarray2, int len) 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:3388 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:3414 static SCIP_RETCODE addRow(SCIP *scip, CONSTRAINTMATRIX *matrix, SCIP_VAR **vars, SCIP_Real *vals, int nvars, SCIP_Real lhs, SCIP_Real rhs) Definition: presol_domcol.c:169 SCIP_RETCODE SCIPsetPresolExitpre(SCIP *scip, SCIP_PRESOL *presol, SCIP_DECL_PRESOLEXITPRE((*presolexitpre))) Definition: scip.c:6028 Constraint handler for knapsack constraints of the form , x binary and . Definition: type_result.h:35 Definition: struct_cons.h:36 void SCIPsortIntInt(int *intarray1, int *intarray2, int len) int SCIPgetNVarsLogicor(SCIP *scip, SCIP_CONS *cons) Definition: cons_logicor.c:5157 Definition: struct_cons.h:116 Constraint handler for logicor constraints (equivalent to set covering, but algorithms are suited fo... SCIP_VAR ** SCIPgetVarsSetppc(SCIP *scip, SCIP_CONS *cons) Definition: cons_setppc.c:9111 static SCIP_RETCODE calcVarBoundsDominated(SCIP *scip, CONSTRAINTMATRIX *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:1389 static SCIP_RETCODE initMatrix(SCIP *scip, CONSTRAINTMATRIX **matrixptr, SCIP_Bool *initialized) Definition: presol_domcol.c:494 SCIP_Real SCIPgetRhsLinear(SCIP *scip, SCIP_CONS *cons) Definition: cons_linear.c:15337 Definition: cons_setppc.h:53 static SCIP_RETCODE findFixings(SCIP *scip, CONSTRAINTMATRIX *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:2188 Definition: type_retcode.h:33 SCIP_Real SCIPgetRhsVarbound(SCIP *scip, SCIP_CONS *cons) Definition: cons_varbound.c:4619 SCIP_Bool SCIPvarsHaveCommonClique(SCIP_VAR *var1, SCIP_Bool value1, SCIP_VAR *var2, SCIP_Bool value2, SCIP_Bool regardimplics) Definition: var.c:10713 SCIP_Real SCIPgetVbdcoefVarbound(SCIP *scip, SCIP_CONS *cons) Definition: cons_varbound.c:4682 Definition: type_retcode.h:34 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:1990 SCIP_RETCODE SCIPchgVarUb(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound) Definition: scip.c:18008 Definition: type_var.h:55 SCIP_RETCODE SCIPsetPresolFree(SCIP *scip, SCIP_PRESOL *presol, SCIP_DECL_PRESOLFREE((*presolfree))) Definition: scip.c:5964 Definition: type_var.h:54 static SCIP_RETCODE calcVarBoundsDominating(SCIP *scip, CONSTRAINTMATRIX *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:1564 Definition: type_set.h:38 Definition: type_var.h:45 SCIP_VAR * SCIPgetVbdvarVarbound(SCIP *scip, SCIP_CONS *cons) Definition: cons_varbound.c:4661 static SCIP_RETCODE addConstraint(SCIP *scip, CONSTRAINTMATRIX *matrix, SCIP_VAR **vars, SCIP_Real *vals, int nvars, SCIP_Real lhs, SCIP_Real rhs) Definition: presol_domcol.c:272 Constraint handler for linear constraints in their most general form, . static SCIP_RETCODE getActiveVariables(SCIP *scip, SCIP_VAR ***vars, SCIP_Real **scalars, int *nvars, SCIP_Real *constant) Definition: presol_domcol.c:134 static void getActivityResidualsLowerBound(SCIP *scip, CONSTRAINTMATRIX *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:1210 SCIP_VAR ** SCIPgetVarsLogicor(SCIP *scip, SCIP_CONS *cons) Definition: cons_logicor.c:5178 int SCIPgetNVarsKnapsack(SCIP *scip, SCIP_CONS *cons) Definition: cons_knapsack.c:13243 #define SCIPduplicateBufferArray(scip, ptr, source, num) Definition: scip.h:19217 int SCIPconshdlrGetNCheckConss(SCIP_CONSHDLR *conshdlr) Definition: cons.c:4259 SCIP_Bool SCIPisFeasGE(SCIP *scip, SCIP_Real val1, SCIP_Real val2) Definition: scip.c:38724 SCIP_Real SCIPgetLhsLinear(SCIP *scip, SCIP_CONS *cons) Definition: cons_linear.c:15313 static SCIP_RETCODE calcActivityBounds(SCIP *scip, CONSTRAINTMATRIX *matrix) Definition: presol_domcol.c:418 SCIP_SETPPCTYPE SCIPgetTypeSetppc(SCIP *scip, SCIP_CONS *cons) Definition: cons_setppc.c:9132 static SCIP_RETCODE setColumnMajorFormat(SCIP *scip, CONSTRAINTMATRIX *matrix) Definition: presol_domcol.c:351 SCIP_VAR ** SCIPgetVarsLinear(SCIP *scip, SCIP_CONS *cons) Definition: cons_linear.c:15424 SCIP_RETCODE SCIPincludePresolDomcol(SCIP *scip) Definition: presol_domcol.c:3501 Definition: presol_domcol.c:88 Definition: type_retcode.h:43 SCIP_VAR * SCIPgetVarVarbound(SCIP *scip, SCIP_CONS *cons) Definition: cons_varbound.c:4640 SCIP_CONS ** SCIPconshdlrGetCheckConss(SCIP_CONSHDLR *conshdlr) Definition: cons.c:4229 SCIP_RETCODE SCIPincludePresolBasic(SCIP *scip, SCIP_PRESOL **presolptr, const char *name, const char *desc, int priority, int maxrounds, SCIP_Bool delay, SCIP_DECL_PRESOLEXEC((*presolexec)), SCIP_PRESOLDATA *presoldata) Definition: scip.c:5913 static void getActivityResidualsUpperBound(SCIP *scip, CONSTRAINTMATRIX *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:1033 SCIP_Real * SCIPgetValsLinear(SCIP *scip, SCIP_CONS *cons) Definition: cons_linear.c:15448 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:3970 Definition: type_result.h:39 Definition: type_var.h:56 |