presolve.c
Go to the documentation of this file.
21 /* all general presolving methods (not working on any specific kind of data(, e.g. consdata) should be implemented here */ 23 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/ 36 /** collect variable bound information for a variable set reduction and global implication; only variable which have the 50 SCIP_Real* newbounds, /**< array of implied bounds(, size is two times number of variables, first 145 /* @todo if implvars[x] is aggregated, we could transform the variable into the active representation */ 146 if( idx < 0 || SCIPisFeasEQ(scip, SCIPvarGetLbGlobal(implvars[w]), SCIPvarGetUbGlobal(implvars[w])) ) 168 /* set variable 'var' with bound implies other set variable 'implvars[w]' with corresponding bound 199 else if( SCIPisFeasLT(scip, implcoefs[w] * SCIPvarGetUbGlobal(implvars[w]) + implconsts[w], bounds[pos]) ) 205 /* set variable 'var' with bound implies other set variable 'implvars[w]' with corresponding bound so 211 SCIPvarGetName(var), ">=", bounds[pos], SCIPvarGetName(implvars[w]), "<=", newub, bounds[issetvar[idx] - 1] ); 260 /* set variable 'var' with bound implies other set variable 'implvars[w]' with corresponding bound 291 else if( SCIPisFeasLT(scip, implcoefs[w]*SCIPvarGetLbGlobal(implvars[w]) + implconsts[w], bounds[pos]) ) 297 /* set variable 'var' with bound implies other set variable 'implvars[w]' with corresponding bound so 303 SCIPvarGetName(var), ">=", bounds[pos], SCIPvarGetName(implvars[w]), ">=", newlb, bounds[issetvar[idx] - 1] ); 375 /* @todo if implvars[x] is aggregated, we could transform the variable into the active representation */ 376 if( idx < 0 || SCIPisFeasEQ(scip, SCIPvarGetLbGlobal(implvars[w]), SCIPvarGetUbGlobal(implvars[w])) ) 426 else if( SCIPisFeasGT(scip, implcoefs[w]*SCIPvarGetLbGlobal(implvars[w]) + implconsts[w], bounds[pos]) ) 435 SCIPvarGetName(var), "<=", bounds[pos], SCIPvarGetName(implvars[w]), ">=", newlb, bounds[issetvar[idx] - 1]); 514 else if( SCIPisFeasGT(scip, implcoefs[w]*SCIPvarGetUbGlobal(implvars[w]) + implconsts[w], bounds[pos]) ) 523 SCIPvarGetName(var), "<=", bounds[pos], SCIPvarGetName(implvars[w]), "<=", newub, bounds[issetvar[idx] - 1]); 559 /** collect non-binary implication data for variable set reduction and global bound implications; only variable which 560 * have the vartype SCIP_VARTYPE_BINARY have implications, otherwise the implications are saved as variable bounds 574 SCIP_Real* newbounds, /**< array of implied bounds(, size is two times number of variables, first 582 int* ncountnonzeros, /**< pointer to store the number of non-zero entries in the counts array */ 649 /* @todo if implvars[x] is aggregated, we could transform the variable into the active representation */ 650 if( idx < 0 || SCIPisFeasEQ(scip, SCIPvarGetLbGlobal(implvars[w]), SCIPvarGetUbGlobal(implvars[w])) ) 659 /* set variable 'var' with bound implies other set variable 'implvars[w]' with a non-worse bound than the 679 /* the implied upper bound on a binary variable should not be trivial, otherwise we might globally fix 724 /* set variable 'var' with bound implies other set variable 'implvars[w]' with a non-worse bound than the 744 /* the implied lower bound on a binary variable should not be trivial, otherwise we might globally fix 747 * @note is is possible that the implied bound is greater than one, when the implied variable has 789 /** collect clique data on binary variables for variable set reduction and global bound implications */ 801 SCIP_Real* newbounds, /**< array of implied bounds(, size is two times number of variables, first 809 int* ncountnonzeros, /**< pointer to store the number of non-zero entries in the counts array */ 817 int* foundbin, /**< pointer to store the lowest index of a binary implication variable when found */ 880 if( clqvars[w] == var || SCIPvarGetLbGlobal(clqvars[w]) > 0.5 || SCIPvarGetUbGlobal(clqvars[w]) < 0.5 ) 891 /* set variable 'var' with bound implies other set variable 'clqvars[w]' with corresponding set bound so we can 932 /** try to reduce the necessary variable in a set of variables with corresponding bounds and boundtypes for which one 941 * by (global) implication data (cliques, implications, and variable bounds) we have also the following implications 948 * Because of the last implication x4 is redundant, because x1 >= 1 would also be fulfilled in the variable set, so we 950 * Also, the both other implications and x3 >= 1 (in the given variable set) all imply exactly x3 >= 1, so we tighten 958 SCIP_Bool* boundtypes, /**< boundtypes array (TRUE == SCIP_BOUNDTYPE_UPPER, FALSE == SCIP_BOUNDTYPE_LOWER) 960 SCIP_Bool* redundants, /**< array which be filled and then indicate if a variable in the set is redundant */ 965 SCIP_Bool* setredundant, /**< pointer to store if we found a global reduction on a variable which was part 968 SCIP_Bool fullshortening /**< do we want to try the shortening procedure over the whole set (which might be expensive) */ 971 SCIP_Real* newbounds; /* array saving all overall implied global bounds, first nprobvars for lower bound, second 974 SCIP_Real* lastbounds;/* temporary array to remember last implied bounds before taken the current variable into 980 int* issetvar; /* array for mapping from a problem variable to the position in the variable set (,pos + 1 in 984 int* counts; /* array saving number of implication by set variables, first nprobvars for lower bound, second 987 int* implidx; /* temporary array to remember all indices of implied variables by the current set variable 1055 /* check if implied binary variables exist, because for these variables the implications can be stored in the 1093 collectBinaryCliqueData(var, varidx, v, *nredvars, value, bounds, boundtypes, newbounds, counts, countnonzeros, 1098 /* only variable which have the vartype SCIP_VARTYPE_BINARY have implications, otherwise the implications are 1101 * we only check binary to non-binary implications if we can detect further implications which either lead to 1104 if( SCIPvarGetType(var) == SCIP_VARTYPE_BINARY && ((usebin && implbinvarsexist) || usenonbin) ) 1106 collectNonBinaryImplicationData(scip, var, varidx, v, *nredvars, value, bounds, boundtypes, newbounds, counts, 1107 countnonzeros, &ncountnonzeros, issetvar, nprobvars, &foundbin, &foundnonbin, implidx, &nimplidx, lastbounds); 1111 * we only check the variable bounds if we can detect further implications which either lead to global reductions 1114 else if( SCIPvarGetType(var) != SCIP_VARTYPE_BINARY && ((usebin && implbinvarsexist) || usenonbin) ) 1116 collectNonBinaryVBoundData(scip, var, varidx, v, *nredvars, bounds, boundtypes, newbounds, counts, countnonzeros, 1117 &ncountnonzeros, issetvar, nprobvars, &foundbin, &foundnonbin, implidx, &nimplidx, lastbounds); 1120 /* reduce implication counters on all variables which are implied by a variable now marked as redundant */ 1125 SCIPdebugMessage("marked variable <%s> as redundant variable in variable set\n", SCIPvarGetName(var)); 1130 /* correct implication counters and bounds, if the redundant variable implies other variables we need to reduce 1151 if( !SCIPvarIsBinary(probvars[implidx[w] - nprobvars]) && lastbounds[w] != SCIP_INVALID )/*lint !e777*/ 1160 /* check if we want to shorten the whole set of variables, or terminate early if we did not find any further 1221 SCIPdebugMessage("mark redundant variable <%s> to be removed from variable set\n", SCIPvarGetName(var)); 1238 SCIPdebugMessage("variable set led to global reductions (in %s)\n", SCIPprobGetName(scip->transprob)); 1277 SCIPdebugMessage("can tighten lower bound variable %s [%g, %g] to %g\n", SCIPvarGetName(probvar), 1280 /* the new lower bound is greater than the global upper bound => the problem is global infeasible */ 1313 scip->transprob, scip->origprob, scip->tree, scip->reopt, scip->lp, scip->branchcand, scip->eventqueue, 1328 SCIPdebugMessage("can tighten upper bound variable %s [%g, %g] to %g\n", SCIPvarGetName(probvar), 1331 /* the new upper bound is small than the global upper bound => the problem is global infeasible */ 1344 scip->transprob, scip->origprob, scip->tree, scip->reopt, scip->lp, scip->branchcand, scip->eventqueue, SCIP_VAR ** SCIPvarGetImplVars(SCIP_VAR *var, SCIP_Bool varfixing) Definition: var.c:17352 static void collectNonBinaryVBoundData(SCIP *scip, SCIP_VAR *var, int varidx, int pos, int nredvars, SCIP_Real *bounds, SCIP_Bool *boundtypes, SCIP_Real *newbounds, int *counts, int *countnonzeros, int *ncountnonzeros, int *issetvar, int nvars, int *foundbin, int *foundnonbin, int *implidx, int *nimplidx, SCIP_Real *lastbounds) Definition: presolve.c:40 internal methods for branch and bound tree Definition: struct_scip.h:53 SCIP_Bool SCIPisFeasLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2) Definition: scip.c:41920 SCIP_CLIQUE ** SCIPvarGetCliques(SCIP_VAR *var, SCIP_Bool varfixing) Definition: var.c:17420 Definition: struct_var.h:196 Definition: type_var.h:53 SCIP_RETCODE SCIPcleanupCliques(SCIP *scip, SCIP_Bool *infeasible) Definition: scip.c:22065 SCIP_RETCODE SCIPshrinkDisjunctiveVarSet(SCIP *scip, SCIP_VAR **vars, SCIP_Real *bounds, SCIP_Bool *boundtypes, SCIP_Bool *redundants, int nvars, int *nredvars, int *nglobalred, SCIP_Bool *setredundant, SCIP_Bool *glbinfeas, SCIP_Bool fullshortening) Definition: presolve.c:953 internal methods for storing and manipulating the main problem methods for block memory pools and memory buffers Definition: type_lp.h:47 SCIP_Bool SCIPisFeasEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2) Definition: scip.c:41907 SCIP_BOUNDTYPE * SCIPvarGetImplTypes(SCIP_VAR *var, SCIP_Bool varfixing) Definition: var.c:17367 Definition: type_retcode.h:33 SCIP main data structure. SCIP_Bool SCIPisFeasGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2) Definition: scip.c:41946 internal methods for presolving internal methods for main solving loop and node processing SCIP_RETCODE SCIPnodeAddBoundchg(SCIP_NODE *node, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *transprob, SCIP_PROB *origprob, SCIP_TREE *tree, SCIP_REOPT *reopt, SCIP_LP *lp, SCIP_BRANCHCAND *branchcand, SCIP_EVENTQUEUE *eventqueue, SCIP_CLIQUETABLE *cliquetable, SCIP_VAR *var, SCIP_Real newbound, SCIP_BOUNDTYPE boundtype, SCIP_Bool probingchange) Definition: tree.c:1978 Definition: type_lp.h:48 SCIP_Bool SCIPisFeasLE(SCIP *scip, SCIP_Real val1, SCIP_Real val2) Definition: scip.c:41933 Definition: struct_implics.h:64 SCIP_Bool SCIPisFeasGE(SCIP *scip, SCIP_Real val1, SCIP_Real val2) Definition: scip.c:41959 static void collectNonBinaryImplicationData(SCIP *scip, SCIP_VAR *var, int varidx, int pos, int nredvars, SCIP_Bool value, SCIP_Real *bounds, SCIP_Bool *boundtypes, SCIP_Real *newbounds, int *counts, int *countnonzeros, int *ncountnonzeros, int *issetvar, int nvars, int *foundbin, int *foundnonbin, int *implidx, int *nimplidx, SCIP_Real *lastbounds) Definition: presolve.c:563 SCIP_Real * SCIPvarGetImplBounds(SCIP_VAR *var, SCIP_Bool varfixing) Definition: var.c:17381 Definition: objbranchrule.h:33 static void collectBinaryCliqueData(SCIP_VAR *var, int varidx, int pos, int nredvars, SCIP_Bool value, SCIP_Real *bounds, SCIP_Bool *boundtypes, SCIP_Real *newbounds, int *counts, int *countnonzeros, int *ncountnonzeros, int *issetvar, int nvars, int *foundbin, int *implidx, int *nimplidx) Definition: presolve.c:791 |