|
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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 implie exactly x3 >= 1, so we tighten
962 SCIP_Bool* redundants, /**< array initialized to all FALSE, which will be filled and then indicates
970 SCIP_Bool* setredundant, /**< pointer to store if we found a global reduction on a variable which
974 SCIP_Bool fullshortening /**< do we want to try the shortening procedure over the whole set (which
979 SCIP_Real* newbounds; /* array saving all overall implied global bounds, first nprobvars for lower bound, second
982 SCIP_Real* lastbounds;/* temporary array to remember last implied bounds before taken the current variable into
988 int* issetvar; /* array for mapping from a problem variable to the position in the variable set (,pos + 1 in
992 int* counts; /* array saving number of implication by set variables, first nprobvars for lower bound, second
995 int* implidx; /* temporary array to remember all indices of implied variables by the current set variable
1061 /* check if implied binary variables exist, because for these variables the implications can be stored in the
1099 collectBinaryCliqueData(var, varidx, v, *nredvars, value, bounds, boundtypes, newbounds, counts, countnonzeros,
1104 /* only variable which have the vartype SCIP_VARTYPE_BINARY have implications, otherwise the implications are
1107 * we only check binary to non-binary implications if we can detect further implications which either lead to
1110 if( SCIPvarGetType(var) == SCIP_VARTYPE_BINARY && ((usebin && implbinvarsexist) || usenonbin) )
1112 collectNonBinaryImplicationData(scip, var, varidx, v, *nredvars, value, bounds, boundtypes, newbounds, counts,
1113 countnonzeros, &ncountnonzeros, issetvar, nprobvars, &foundbin, &foundnonbin, implidx, &nimplidx, lastbounds);
1117 * we only check the variable bounds if we can detect further implications which either lead to global reductions
1120 else if( SCIPvarGetType(var) != SCIP_VARTYPE_BINARY && ((usebin && implbinvarsexist) || usenonbin) )
1122 collectNonBinaryVBoundData(scip, var, varidx, v, *nredvars, bounds, boundtypes, newbounds, counts, countnonzeros,
1123 &ncountnonzeros, issetvar, nprobvars, &foundbin, &foundnonbin, implidx, &nimplidx, lastbounds);
1126 /* reduce implication counters on all variables which are implied by a variable now marked as redundant */
1131 SCIPdebugMessage("marked variable <%s> as redundant variable in variable set\n", SCIPvarGetName(var));
1136 /* correct implication counters and bounds, if the redundant variable implies other variables we need to reduce
1157 if( !SCIPvarIsBinary(probvars[implidx[w] - nprobvars]) && lastbounds[w] != SCIP_INVALID )/*lint !e777*/
1166 /* check if we want to shorten the whole set of variables, or terminate early if we did not find any further
1227 SCIPdebugMessage("mark redundant variable <%s> to be removed from variable set\n", SCIPvarGetName(var));
1244 SCIPdebugMessage("variable set led to global reductions (in %s)\n", SCIPprobGetName(scip->transprob));
1283 SCIPdebugMessage("can tighten lower bound variable %s [%g, %g] to %g\n", SCIPvarGetName(probvar),
1309 scip->transprob, scip->origprob, scip->tree, scip->reopt, scip->lp, scip->branchcand, scip->eventqueue,
1324 SCIPdebugMessage("can tighten upper bound variable %s [%g, %g] to %g\n", SCIPvarGetName(probvar),
1330 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:17250 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:41528 SCIP_CLIQUE ** SCIPvarGetCliques(SCIP_VAR *var, SCIP_Bool varfixing) Definition: var.c:17318 Definition: struct_var.h:196 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 fullshortening) Definition: presolve.c:953 Definition: type_var.h:53 SCIP_RETCODE SCIPcleanupCliques(SCIP *scip, SCIP_Bool *infeasible) Definition: scip.c:22052 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:41515 SCIP_BOUNDTYPE * SCIPvarGetImplTypes(SCIP_VAR *var, SCIP_Bool varfixing) Definition: var.c:17265 Definition: type_retcode.h:33 SCIP main data structure. SCIP_Bool SCIPisFeasGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2) Definition: scip.c:41554 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:1979 Definition: type_lp.h:48 SCIP_Bool SCIPisFeasLE(SCIP *scip, SCIP_Real val1, SCIP_Real val2) Definition: scip.c:41541 Definition: struct_implics.h:64 SCIP_Bool SCIPisFeasGE(SCIP *scip, SCIP_Real val1, SCIP_Real val2) Definition: scip.c:41567 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:17279 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 |