All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
cons_logicor.c
Go to the documentation of this file.
23 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
38 #define CONSHDLR_ENFOPRIORITY -2000000 /**< priority of the constraint handler for constraint enforcing */
39 #define CONSHDLR_CHECKPRIORITY -2000000 /**< priority of the constraint handler for checking feasibility */
40 #define CONSHDLR_SEPAFREQ 0 /**< frequency for separating cuts; zero means to separate only in the root node */
41 #define CONSHDLR_PROPFREQ 1 /**< frequency for propagating domains; zero means only preprocessing propagation */
42 #define CONSHDLR_EAGERFREQ 100 /**< frequency for using all instead of only the useful constraints in separation,
44 #define CONSHDLR_MAXPREROUNDS -1 /**< maximal number of presolving rounds the constraint handler participates in (-1: no limit) */
45 #define CONSHDLR_DELAYSEPA FALSE /**< should separation method be delayed, if other separators found cuts? */
46 #define CONSHDLR_DELAYPROP FALSE /**< should propagation method be delayed, if other propagators found reductions? */
47 #define CONSHDLR_DELAYPRESOL FALSE /**< should presolving method be delayed, if other presolvers found reductions? */
48 #define CONSHDLR_NEEDSCONS TRUE /**< should the constraint handler be skipped, if no constraints are available? */
52 #define LINCONSUPGD_PRIORITY +800000 /**< priority of the constraint handler for upgrading of linear constraints */
61 #define DEFAULT_PRESOLPAIRWISE TRUE /**< should pairwise constraint comparison be performed in presolving? */
62 #define DEFAULT_STRENGTHEN TRUE /**< should pairwise constraint comparison try to strengthen constraints by removing superflous non-zeros? */
64 #define HASHSIZE_LOGICORCONS 131101 /**< minimal size of hash table in logicor constraint tables */
65 #define DEFAULT_PRESOLUSEHASHING TRUE /**< should hash table be used for detecting redundant constraints in advance */
67 #define DEFAULT_NEGATEDCLIQUE TRUE /**< should negated clique information be used in presolving */
68 #define DEFAULT_IMPLICATIONS TRUE /**< should we try to shrink the variables and derive global boundchanges by
79 /* @todo maybe use event SCIP_EVENTTYPE_VARUNLOCKED to decide for another dual-presolving run on a constraint */
89 SCIP_CONSHDLR* conshdlrlinear; /**< pointer to linear constraint handler or NULL if not included */
90 SCIP_Bool presolpairwise; /**< should pairwise constraint comparison be performed in presolving? */
91 SCIP_Bool presolusehashing; /**< should hash table be used for detecting redundant constraints in
95 SCIP_Bool useimplications; /**< should we try to shrink the variables and derive global boundchanges
97 SCIP_Bool usestrengthening; /**< should pairwise constraint comparison try to strengthen constraints by
103 /* @todo it might speed up exit-presolve to remember all positions for variables when catching the varfixed event, or we
104 * change catching and dropping the events like it is done in cons_setppc, which probably makes the code more
120 unsigned int presolved:1; /**< flag indicates if we have some fixed, aggregated or multi-aggregated
123 unsigned int impladded:1; /**< was the 2-variable logic or constraint already added as implication? */
125 unsigned int changed:1; /**< was constraint changed since last redundancy round in preprocessing? */
271 SCIP_CALL( SCIPgetTransformedVars(scip, (*consdata)->nvars, (*consdata)->vars, (*consdata)->vars) );
278 (*consdata)->existmultaggr = (*consdata)->existmultaggr || (SCIPvarGetStatus(var) == SCIP_VARSTATUS_MULTAGGR);
447 if( !consdata->existmultaggr && SCIPvarGetStatus(SCIPvarGetProbvar(var)) == SCIP_VARSTATUS_MULTAGGR )
461 if( SCIPgetStage(scip) == SCIP_STAGE_PRESOLVING || SCIPgetStage(scip) == SCIP_STAGE_INITPRESOLVE )
515 if( SCIPgetStage(scip) == SCIP_STAGE_PRESOLVING || SCIPgetStage(scip) == SCIP_STAGE_INITPRESOLVE )
561 /** in case a part (more than one variable) in the logic or constraint is independent of every else, we can perform dual
563 * - fix the variable with the smallest object coefficient to one if the constraint is not modifiable and all
568 * Note: the following dual reduction for logic or constraints is already performed by the presolver "dualfix"
569 * - if a variable in a set covering constraint is only locked by that constraint and has negative or zero
580 SCIP_RESULT* result /**< pointer to store the result SCIP_SUCCESS, if presolving was performed */
606 /* constraints for which the check flag is set to FALSE, did not contribute to the lock numbers; therefore, we cannot
607 * use the locks to decide for a dual reduction using this constraint; for example after a restart the cuts which are
620 /* we don't want to consider small constraints (note that the constraints can be modifiable, so we can't delete this
632 /* check if we can apply the dual reduction; therefore count the number of variables where the logic or has the only
640 /* variables with varstatus not equal to SCIP_VARSTATUS_FIXED can also have fixed bounds, but were not removed yet */
670 /* in case an other constraints has also locks on that variable we cannot perform a dual reduction on these
714 /* in case an other constraints has also locks on that variable we cannot perform a dual reduction on these
751 /* in case an other constraints has also locks on that variable we cannot perform a dual reduction on these
782 /* if all variable have our appreciated number of locks and the constraint is not modifiable, or if the bestobjval is
783 * less than or equal to zero, we can fix the variable with the smallest objective coefficient to one and the
803 /** deletes all zero-fixed variables, checks for variables fixed to one, replace all variables which are not active or
877 /* renew all variables, important that we do a backwards loop because deletion only affect rear items */
883 if( SCIPvarGetStatus(var) == SCIP_VARSTATUS_MULTAGGR || (SCIPvarGetStatus(var) == SCIP_VARSTATUS_NEGATED && SCIPvarGetStatus(SCIPvarGetNegatedVar(var)) == SCIP_VARSTATUS_MULTAGGR) )
900 SCIP_CALL( SCIPgetProbvarLinearSum(scip, consvars, consvals, &nconsvars, nconsvars, &constant, &requiredsize, TRUE) );
907 SCIP_CALL( SCIPgetProbvarLinearSum(scip, consvars, consvals, &nconsvars, requiredsize, &constant, &requiredsize, TRUE) );
922 SCIPerrorMessage("try to resolve a multi-aggregation with a non-binary variable <%s>\n", consvars[v2]);
946 assert(SCIPvarIsActive(consvars[v2]) || (SCIPvarGetStatus(consvars[v2]) == SCIP_VARSTATUS_NEGATED && SCIPvarIsActive(SCIPvarGetNegationVar(consvars[v2]))));
962 /* it might happen that there are more than one multi-aggregated variable, so we need to get the whole probvar sum over all variables */
966 /* memory needed is at least old number of variables - 1 + number of variables in first multi-aggregation */
982 SCIP_CALL( SCIPgetProbvarLinearSum(scip, consvars, consvals, &nconsvars, size, &constant, &requiredsize, TRUE) );
984 /* if space was not enough(we found another multi-aggregation), we need to resize the buffers */
990 SCIP_CALL( SCIPgetProbvarLinearSum(scip, consvars, consvals, &nconsvars, requiredsize, &constant, &requiredsize, TRUE) );
1032 SCIPwarningMessage(scip, "logicor constraint <%s> has a multi-aggregated variable, which was not resolved and therefore could lead to aborts\n", SCIPconsGetName(cons));
1058 /** analyzes conflicting assignment on given constraint, and adds conflict constraint to problem */
1069 if( (SCIPgetStage(scip) != SCIP_STAGE_SOLVING && !SCIPinProbing(scip)) || !SCIPisConflictAnalysisApplicable(scip) )
1075 /* initialize conflict analysis, and add all variables of infeasible constraint to conflict candidate queue */
1097 /* in case the logic or constraint is satisfied in the depth where it is also valid, we can delete it */
1104 SCIPdebugMessage("disabling constraint cons <%s> at depth %d\n", SCIPconsGetName(cons), SCIPgetDepth(scip));
1112 /** find sets of equal variables in constraint: multiple entries of variable can be replaced by single entry */
1118 unsigned char** entries, /**< array to store whether two positions in constraints represent the same variable */
1169 /* all variables should be active or negative active variables, otherwise something went wrong with applyFixings()
1179 /* all variables should be active or negative active variables, otherwise something went wrong with applyFixings()
1184 assert(SCIPvarIsActive(vars[v]) || (SCIPvarGetStatus(vars[v]) == SCIP_VARSTATUS_NEGATED && SCIPvarIsActive(SCIPvarGetNegationVar(vars[v]))));
1197 /* check variable type, either pure binary or an integer/implicit integer variable with 0/1 bounds */
1200 ((pos >= nbinvars && pos < nbinvars + nintvars && SCIPvarGetType(var) == SCIP_VARTYPE_INTEGER) ||
1208 /* check all vars for multiple entries, do necessary backwards loop because deletion only affect rear items */
1223 SCIPdebugMessage("logicor constraint <%s> redundant: variable <%s> and its negation are present\n",
1240 SCIPdebugMessage("logicor constraint <%s> redundant: variable <%s> and its negation are present\n",
1263 /** checks constraint for violation only looking at the watched variables, applies fixings if possible */
1272 SCIP_Bool* mustcheck /**< pointer to store whether this constraint must be checked for feasibility */
1308 SCIPdebugMessage(" -> disabling constraint <%s> (watchedvar1 fixed to 1.0)\n", SCIPconsGetName(cons));
1315 SCIPdebugMessage(" -> disabling constraint <%s> (watchedvar2 fixed to 1.0)\n", SCIPconsGetName(cons));
1412 * - a modifiable constraint must be added as a cut and further pricing must be performed in the LP solving loop
1435 * - an unmodifiable constraint is feasible and can be disabled after the remaining variable is fixed to one
1446 /* fixed remaining variable to one and disable constraint; make sure, the fixed-to-one variable is watched */
1462 SCIPdebugMessage(" -> new watched variables <%s> and <%s> of constraint <%s> are still unfixed\n",
1487 SCIP_Bool* violated /**< pointer to store whether the given solution violates the constraint */
1537 SCIP_CALL( SCIPcreateEmptyRowCons(scip, &consdata->row, SCIPconsGetHdlr(cons), SCIPconsGetName(cons), 1.0, SCIPinfinity(scip),
1540 SCIP_CALL( SCIPaddVarsToRowSameCoef(scip, consdata->row, consdata->nvars, consdata->vars, 1.0) );
1607 SCIP_CALL( processWatchedVars(scip, cons, eventhdlr, cutoff, reduceddom, &addcut, &mustcheck) );
1683 SCIP_CALL( processWatchedVars(scip, cons, eventhdlr, cutoff, reduceddom, &addcut, &mustcheck) );
1760 found = SCIPsortedvecFindPtr((void**)consdata->vars, SCIPvarComp, (void*)var1, consdata->nvars, &pos);
1771 found = SCIPsortedvecFindPtr((void**)consdata->vars, SCIPvarComp, (void*)var2, consdata->nvars, &pos);
1804 /** returns TRUE iff both keys are equal; two constraints are equal if they have the same variables */
1875 /** compares each constraint with all other constraints for a possible duplication and removes duplicates using a hash
1939 /* update flags of constraint which caused the redundancy s.t. nonredundant information doesn't get lost */
2007 signature |= ((unsigned int)1 << ((unsigned int)SCIPvarGetIndex(vars[v]) % (sizeof(unsigned int) * 8)));
2013 /** compute the constraint signature which is used to detect constraints, that contain potentially the same set of
2034 int* noccurlistentries, /**< arrray with number of constraints for each variable in the occurlist */
2095 int* noccurlistentries, /**< arrray with number of constraints for each variable in the occurlist */
2122 /* it might be that a variable is not yet put into the occurlist, then this constraint cannot cover another */
2143 /** run a pairwise comparison for detecting subset-constraints of other constraint while using a signature */
2150 int* noccurlistentries, /**< arrray with number of constraints for each variable in the occurlist */
2183 findShortestOccurlist(vars, consdata->nvars, varstopos, occurlist, noccurlistentries, occurlistlength, &nentries, &shortestlist);
2287 int* noccurlistentries, /**< arrray with number of constraints for each variable in the occurlist */
2320 assert(SCIPvarIsActive(var) || (SCIPvarGetNegatedVar(var) != NULL && SCIPvarIsActive(SCIPvarGetNegatedVar(var))));
2336 SCIP_CALL( SCIPallocBufferArray(scip, &(occurlist[pos]), occurlistsizes[pos]) ); /*lint !e866*/
2364 SCIP_CALL( SCIPreallocBufferArray(scip, &(occurlist[pos]), occurlistsizes[pos]) ); /*lint !e866*/
2377 /** run a pairwise comparison for the given variables against all constraits to detect redundant non-zeros in these
2439 findShortestOccurlist(vars, nvars, varstopos, occurlist, noccurlistentries, occurlistlength, &nentries, &shortestlist);
2533 /* cons1 is might be covered by the changed constraints cons, meaning that we might remove the artvar from
2540 /* if the artificial variable was not yet found, search over the rear variables in constraint cons1 */
2563 SCIPdebugMessage("variable %s in logicor constraint <%s> is redundant and will be removed (used constraint %s)\n", SCIPvarGetName(artvar), SCIPconsGetName(cons1), SCIPconsGetName(cons));
2593 SCIPdebugMessage("logicor constraint <%s> is redundant due to constraint <%s> after removing variable <%s>\n", SCIPconsGetName(cons), SCIPconsGetName(cons1), SCIPvarGetName(artvar));
2689 /* @todo: improve this algorithm by using the information that a constraint variables does not appaer in any
2690 * other constraint, which means that only this variable needs to be negated to check for redundant
2694 SCIP_CALL( removeRedundantNonZeros(scip, cons, artvar, v, varstopos, occurlist, noccurlistentries,
2719 unsigned char** entries, /**< array to store whether two positions in constraints represent the same variable */
2751 /* remove all variables that are fixed to zero, check redundancy due to fixed-to-one variable */
2809 * @see "Effective Preprocessing in SAT through Variable and Clause Elimination" by Niklas Eén and Armin Biere
2816 unsigned char** entries, /**< array to store whether two positions in constraints represent the same
2820 SCIP_Bool usestrengthening, /**< should we try to strengthen constraints by removing superflous
2860 SCIPdebugMessage("starting removeRedundantConssAndNonzeros(), pairwise comparison to detect covered logicor constraints\n");
2880 SCIP_CALL( prepareCons(scip, cons, eventhdlr, entries, nentries, &redundant, nfixedvars, nchgcoefs, ndelconss, cutoff) );
2911 /* we can stop if strengthening is disabled and all constraints have the same amount of variables */
2912 if( !usestrengthening && SCIPconsGetData(myconss[0])->nvars == SCIPconsGetData(myconss[nmyconss - 1])->nvars )
2919 /* @note: in the following we have at least number of nonzeros in logicor constraints + three times two the number of
2920 * binary variables memory consumption + a map for variables to positions, we need this to get a column base
2937 SCIP_CALL( SCIPhashmapCreate(&varstopos, SCIPblkmem(scip), SCIPcalcHashtableSize(HASHTABLESIZE_FACTOR * nmyconss)) );
2951 /* determine all constraints with the maximal number of variables and add them to the column representation */
2961 SCIP_CALL( addConsToOccurList(scip, cons, varstopos, occurlist, noccurlistentries, occurlistsizes, &occurlistlength, occurlistsize) );
2998 SCIP_CALL( removeRedundantConss(scip, cons, varstopos, occurlist, noccurlistentries, occurlistlength, ndelconss) );
3006 SCIP_CALL( addConsToOccurList(scip, cons, varstopos, occurlist, noccurlistentries, occurlistsizes, &occurlistlength, occurlistsize) );
3026 SCIP_CALL( strengthenConss(scip, myconss, nmyconss, varstopos, occurlist, noccurlistentries, occurlistlength, eventhdlr, ndelconss, nchgcoefs) );
3047 /** try to tighten constraints by reducing the number of variables in the constraints using implications and cliques,
3056 unsigned char** entries, /**< array to store whether two positions in constraints represent the same
3113 SCIP_CALL( prepareCons(scip, cons, eventhdlr, entries, nentries, &redundant, nfixedvars, nchgcoefs, ndelconss, cutoff) );
3138 assert(SCIPvarIsActive(var) || (SCIPvarGetStatus(var) == SCIP_VARSTATUS_NEGATED && SCIPvarIsActive(SCIPvarGetNegationVar(var))));
3154 /* use implications and cliques to derive global fixings and to shrink the number of variables in this constraints */
3155 SCIP_CALL( SCIPshrinkDisjunctiveVarSet(scip, probvars, bounds, boundtypes, redundants, consdata->nvars, &nredvars, nfixedvars, &redundant, TRUE) );
3210 /** try to find a negated clique in a constraint which makes this constraint redundant but we need to keep the negated
3220 unsigned char** entries, /**< array to store whether two positions in constraints represent the same
3262 if( SCIPgetNCliques(scip) == conshdlrdata->nlastcliques && SCIPgetNImplications(scip) == conshdlrdata->nlastimpls )
3287 SCIP_CALL( prepareCons(scip, cons, eventhdlr, entries, nentries, &redundant, nfixedvars, nchgcoefs, ndelconss, cutoff) );
3318 /* all variables should be active or negative active variables, otherwise something went wrong with applyFixings()
3323 assert(SCIPvarIsActive(repvars[v]) || (SCIPvarGetStatus(repvars[v]) == SCIP_VARSTATUS_NEGATED && SCIPvarIsActive(SCIPvarGetNegationVar(repvars[v]))));
3392 SCIPdebugMessage("logicor constraint <%s> is redundant, because variable <%s> and its negation <%s> exist\n", SCIPconsGetName(cons), SCIPvarGetName(var1), SCIPvarGetName(var2));
3403 SCIPdebugMessage("in logicor constraint <%s>, active variable of <%s> and active variable of <%s> are the same, removing the first\n", SCIPconsGetName(cons), SCIPvarGetName(consdata->vars[v]), SCIPvarGetName(consdata->vars[w]));
3409 /* delCoefPos replaces the variable on position v with the last one, so w also need to correct the
3410 * negated array the same way, and because of deletion the number of variables is already decreased
3425 /* this negated clique information could be created out of this logicor constraint even if there are more
3426 * than two variables left (, for example by probing), we need to keep this information by creating a
3452 SCIPdebugMessage("logicor constraint <%s> is redundant due to negated clique information and will be replaced by a setppc constraint \n", SCIPconsGetName(cons));
3453 SCIPdebugMessage("variable <%s> and variable <%s> are in a negated clique\n", SCIPvarGetName(consdata->vars[v]), SCIPvarGetName(consdata->vars[w]));
3483 * in case a constraint has two variables left, we will add the implication and upgrade it to a set-packing constraint
3523 /* if an unmodifiable logicor constraint has only two variables, we can add an implication and we will upgrade this
3537 /* a two-variable logicor constraint x + y >= 1 yields the implication x == 0 -> y == 1, and is represented
3540 SCIP_CALL( SCIPaddClique(scip, consdata->vars, values, consdata->nvars, &implinfeasible, &nimplbdchgs) );
3548 /* adding the above implication could lead to fixings, which render the constraint redundant */
3553 /* remove all variables that are fixed to zero, check redundancy due to fixed-to-one variable */
3592 SCIPdebugMessage("logicor constraint <%s> was upgraded to a set-packing constraint\n", SCIPconsGetName(cons));
3600 * if unmodifiable constraint has only one variable, this one can be fixed and the constraint deleted
3640 SCIPdebugMessage(" -> variable is multi-aggregated, upgrade to linear constraint <%s> == 1 \n",
3644 (void) SCIPsnprintf(consname, SCIP_MAXSTRLEN, "fixmaggr_%s_%s", SCIPconsGetName(cons),SCIPvarGetName(consdata->vars[0]) );
3645 SCIP_CALL( SCIPcreateConsLinear(scip, &conslinear, consname, 1, consdata->vars, &coef, 1.0, 1.0,
3697 SCIP_Bool removable, /**< should the relaxation be removed from the LP due to aging or cleanup?
3699 SCIP_Bool stickingatnode /**< should the constraint always be kept at the node where it was added, even
3728 initial, separate, enforce, check, propagate, local, modifiable, dynamic, removable, stickingatnode) );
3749 * - logic or constraints have left hand side of +1.0, and right hand side of +infinity: x(S) >= 1.0
3752 if( nvars > 2 && nposbin + nnegbin + nposimplbin + nnegimplbin == nvars && ncoeffspone + ncoeffsnone == nvars
3760 /* check, if we have to multiply with -1 (negate the positive vars) or with +1 (negate the negative vars) */
3763 /* create the logic or constraint (an automatically upgraded constraint is always unmodifiable) */
3765 SCIP_CALL( createNormalizedLogicor(scip, upgdcons, SCIPconsGetName(cons), nvars, vars, vals, mult,
3796 /** destructor of constraint handler to free constraint handler data (called when SCIP is exiting) */
3818 /** presolving initialization method of constraint handler (called when presolving is about to begin) */
3842 SCIP_CALL( SCIPcatchVarEvent(scip, consdata->vars[v], SCIP_EVENTTYPE_VARFIXED, conshdlrdata->eventhdlr,
3849 /** presolving deinitialization method of constraint handler (called after presolving has been finished) */
3872 SCIP_CALL( SCIPdropVarEvent(scip, consdata->vars[v], SCIP_EVENTTYPE_VARFIXED, conshdlrdata->eventhdlr,
3879 SCIP_CALL( applyFixings(scip, conss[c], conshdlrdata->eventhdlr, &redundant, &nchgcoefs, NULL, NULL) );
3887 /** solving process deinitialization method of constraint handler (called before branch and bound process data is freed) */
3919 if( SCIPgetStage(scip) == SCIP_STAGE_PRESOLVING || SCIPgetStage(scip) == SCIP_STAGE_INITPRESOLVE )
3929 SCIP_CALL( SCIPdropVarEvent(scip, (*consdata)->vars[v], SCIP_EVENTTYPE_VARFIXED, conshdlrdata->eventhdlr,
3965 SCIPconsIsInitial(sourcecons), SCIPconsIsSeparated(sourcecons), SCIPconsIsEnforced(sourcecons),
3968 SCIPconsIsDynamic(sourcecons), SCIPconsIsRemovable(sourcecons), SCIPconsIsStickingAtNode(sourcecons)) );
3974 /** LP initialization method of constraint handler (called before the initial LP relaxation at a node is solved) */
4019 SCIP_CALL( separateCons(scip, conss[c], NULL, conshdlrdata->eventhdlr, &cutoff, &separated, &reduceddom) );
4066 SCIP_CALL( separateCons(scip, conss[c], sol, conshdlrdata->eventhdlr, &cutoff, &separated, &reduceddom) );
4115 SCIP_CALL( separateCons(scip, conss[c], NULL, conshdlrdata->eventhdlr, &cutoff, &separated, &reduceddom) );
4121 SCIP_CALL( separateCons(scip, conss[c], NULL, conshdlrdata->eventhdlr, &cutoff, &separated, &reduceddom) );
4167 SCIP_CALL( enforcePseudo(scip, conss[c], conshdlrdata->eventhdlr, &cutoff, &infeasible, &reduceddom, &solvelp) );
4270 SCIP_CALL( processWatchedVars(scip, conss[c], conshdlrdata->eventhdlr, &cutoff, &reduceddom, &addcut, &mustcheck) );
4343 /* remove all variables that are fixed to zero, check redundancy due to fixed-to-one variable */
4344 SCIP_CALL( applyFixings(scip, cons, conshdlrdata->eventhdlr, &redundant, nchgcoefs, naddconss, ndelconss) );
4351 /* find sets of equal variables in constraint: multiple entries of variable can be replaced by single entry */
4354 SCIP_CALL( mergeMultiples(scip, cons, conshdlrdata->eventhdlr, &entries, &nentries, &redundant, nchgcoefs) );
4372 SCIP_CALL( fixDeleteOrUpgradeCons(scip, cons, conshdlrdata->eventhdlr, conshdlrdata->conshdlrlinear, nfixedvars, nchgbds, nchgcoefs, ndelconss, naddconss, nupgdconss, &cutoff) );
4379 else if( *nfixedvars > oldnfixedvars || *nchgbds > oldnchgbds || *nchgcoefs > oldnchgcoefs || *ndelconss > oldndelconss || *nupgdconss > oldnupgdconss )
4390 SCIP_CALL( dualPresolving(scip, cons, conshdlrdata->eventhdlr, nfixedvars, ndelconss, nchgcoefs, result) );
4396 /* in dualpresolving we may have removed variables, so we need to take care of special cases */
4402 SCIP_CALL( fixDeleteOrUpgradeCons(scip, cons, conshdlrdata->eventhdlr, conshdlrdata->conshdlrlinear, nfixedvars, nchgbds, nchgcoefs, ndelconss, naddconss, nupgdconss, &cutoff) );
4409 else if( *nfixedvars > oldnfixedvars || *nchgbds > oldnchgbds || *nchgcoefs > oldnchgcoefs || *ndelconss > oldndelconss || *nupgdconss > oldnupgdconss )
4429 /* detect redundant constraints; fast version with hash table instead of pairwise comparison */
4430 SCIP_CALL( detectRedundantConstraints(scip, SCIPblkmem(scip), conss, nconss, &firstchange, ndelconss) );
4434 if( oldnfixedvars == *nfixedvars && oldnchgbds == *nchgbds && oldndelconss == *ndelconss && oldnupgdconss == *nupgdconss && oldnchgcoefs == *nchgcoefs )
4441 SCIP_CALL( removeRedundantConssAndNonzeros(scip, conss, nconss, &entries, &nentries, conshdlrdata->eventhdlr, conshdlrdata->usestrengthening, &firstchange, nfixedvars, ndelconss, nchgcoefs, &cutoff) );
4449 /* try to tighten constraints by reducing the number of variables in the constraints using implications and
4452 if( conshdlrdata->useimplications && (SCIPgetNCliques(scip) != conshdlrdata->nlastcliques || SCIPgetNImplications(scip) > conshdlrdata->nlastimpls) )
4454 SCIP_CALL( shortenConss(scip, conshdlrdata->eventhdlr, conss, nconss, &entries, &nentries, nfixedvars, ndelconss, nchgcoefs, &cutoff) );
4463 SCIP_CALL( removeConstraintsDueToNegCliques(scip, conshdlr, conshdlrdata->eventhdlr, conss, nconss, &entries, &nentries, nfixedvars, ndelconss, nupgdconss, nchgcoefs, &cutoff) );
4506 /* the only deductions are variables infered to 1.0 on logic or constraints where all other variables
4509 assert(SCIPvarGetLbAtIndex(infervar, bdchgidx, TRUE) > 0.5); /* the inference variable must be assigned to one */
4576 SCIPdebugMessage("activating information for logic or constraint <%s>\n", SCIPconsGetName(cons));
4583 SCIP_EVENTTYPE_UBTIGHTENED | SCIP_EVENTTYPE_LBRELAXED, conshdlrdata->eventhdlr, (SCIP_EVENTDATA*)cons,
4589 SCIP_EVENTTYPE_UBTIGHTENED | SCIP_EVENTTYPE_LBRELAXED, conshdlrdata->eventhdlr, (SCIP_EVENTDATA*)cons,
4615 SCIPdebugMessage("deactivating information for logic or constraint <%s>\n", SCIPconsGetName(cons));
4623 SCIP_EVENTTYPE_UBTIGHTENED | SCIP_EVENTTYPE_LBRELAXED, conshdlrdata->eventhdlr, (SCIP_EVENTDATA*)cons,
4630 SCIP_EVENTTYPE_UBTIGHTENED | SCIP_EVENTTYPE_LBRELAXED, conshdlrdata->eventhdlr, (SCIP_EVENTDATA*)cons,
4672 initial, separate, enforce, check, propagate, local, modifiable, dynamic, removable, stickingatnode, global, valid) );
4728 SCIP_CALL( SCIPparseVarsList(scip, strcopy, vars, &nvars, varssize, &requiredsize, &endptr, ',', success) );
4740 SCIP_CALL( SCIPparseVarsList(scip, strcopy, vars, &nvars, varssize, &requiredsize, &endptr, ',', success) );
4748 initial, separate, enforce, check, propagate, local, modifiable, dynamic, removable, stickingatnode) );
4765 initial, separate, enforce, check, propagate, local, modifiable, dynamic, removable, stickingatnode) );
4795 /** constraint method of constraint handler which returns the number of variables (if possible) */
4826 SCIPdebugMessage("enabling constraint cons <%s> at depth %d\n", SCIPconsGetName((SCIP_CONS*)eventdata), SCIPgetDepth(scip));
4893 /* if the conflict consists of only two (binary) variables, it will be handled by the setppc conflict handler */
4925 (void) SCIPsnprintf(consname, SCIP_MAXSTRLEN, "cf%d_%"SCIP_LONGINT_FORMAT, SCIPgetNRuns(scip), SCIPgetNConflictConssApplied(scip));
4960 SCIP_CALL( SCIPincludeConflicthdlrBasic(scip, &conflicthdlr, CONFLICTHDLR_NAME, CONFLICTHDLR_DESC, CONFLICTHDLR_PRIORITY,
4986 SCIP_CALL( SCIPsetConshdlrPresol(scip, conshdlr, consPresolLogicor,CONSHDLR_MAXPREROUNDS, CONSHDLR_DELAYPRESOL) );
4988 SCIP_CALL( SCIPsetConshdlrProp(scip, conshdlr, consPropLogicor, CONSHDLR_PROPFREQ, CONSHDLR_DELAYPROP,
4991 SCIP_CALL( SCIPsetConshdlrSepa(scip, conshdlr, consSepalpLogicor, consSepasolLogicor, CONSHDLR_SEPAFREQ,
4999 /* include the linear constraint to logicor constraint upgrade in the linear constraint handler */
5000 SCIP_CALL( SCIPincludeLinconsUpgrade(scip, linconsUpgdLogicor, LINCONSUPGD_PRIORITY, CONSHDLR_NAME) );
5026 "should pairwise constraint comparison try to strengthen constraints by removing superflous non-zeros?",
5035 * @note the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons()
5061 SCIP_Bool removable, /**< should the relaxation be removed from the LP due to aging or cleanup?
5063 SCIP_Bool stickingatnode /**< should the constraint always be kept at the node where it was added, even
5085 SCIP_CALL( SCIPcreateCons(scip, cons, name, conshdlr, consdata, initial, separate, enforce, check, propagate,
5098 SCIP_CALL( SCIPcatchVarEvent(scip, consdata->vars[v], SCIP_EVENTTYPE_VARFIXED, conshdlrdata->eventhdlr,
5107 * in its most basic version, i. e., all constraint flags are set to their basic value as explained for the
5108 * method SCIPcreateConsLogicor(); all flags can be set via SCIPsetConsFLAGNAME-methods in scip.h
5112 * @note the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons()
|