Skip to content

Commit 989019c

Browse files
committed
Merge remote-tracking branch 'origin/v90-bugfix' into v9-minor
2 parents 1bf51ec + 84a4929 commit 989019c

File tree

2 files changed

+4
-11
lines changed

2 files changed

+4
-11
lines changed

CHANGELOG

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ Fixed bugs
7979
- check knapsack constraints as linear constraints to avoid violations based on implicit integrality
8080
- make sure that symmetry detection callbacks report success
8181
- make arithmetics in cuts.c more robust to avoid invalid scg cuts due to numerical rounding sensitivity
82+
- allow to copy cons_pseudoboolean even if no AND constraints are present in order to avoid a warning
8283

8384
Miscellaneous
8485
-------------

src/scip/cons_pseudoboolean.c

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3876,7 +3876,7 @@ SCIP_RETCODE copyConsPseudoboolean(
38763876
assert(SCIPconsGetHdlr(targetlincons) != NULL);
38773877
/* @note due to copying special linear constraints, now leads only to simple linear constraints, we check that
38783878
* our target constraint handler is the same as our source constraint handler of the linear constraint,
3879-
* if not copying was not valid
3879+
* if copying was not valid
38803880
*/
38813881
if( strcmp(SCIPconshdlrGetName(SCIPconsGetHdlr(targetlincons)), "linear") == 0 )
38823882
targetlinconstype = SCIP_LINEARCONSTYPE_LINEAR;
@@ -3977,13 +3977,6 @@ SCIP_RETCODE copyConsPseudoboolean(
39773977
assert(ntargetandconss <= ntargetlinvars);
39783978
}
39793979

3980-
/* no correct pseudoboolean constraint */
3981-
if( ntargetandconss == 0 )
3982-
{
3983-
SCIPdebugMsg(sourcescip, "no and-constraints copied for pseudoboolean constraint <%s>\n", SCIPconsGetName(sourcecons));
3984-
*valid = FALSE;
3985-
}
3986-
39873980
if( *valid )
39883981
{
39893982
SCIP_Real targetrhs;
@@ -4027,6 +4020,7 @@ SCIP_RETCODE copyConsPseudoboolean(
40274020
/* create new pseudoboolean constraint */
40284021
/* coverity[var_deref_op] */
40294022
/* coverity[var_deref_model] */
4023+
/* Note that due to compression the and constraints might have disappeared in which case ntargetandconss == 0. */
40304024
SCIP_CALL( SCIPcreateConsPseudobooleanWithConss(targetscip, targetcons, consname,
40314025
targetlincons, targetlinconstype, targetandconss, targetandcoefs, ntargetandconss,
40324026
indvar, sourceconsdata->weight, sourceconsdata->issoftcons, intvar, targetlhs, targetrhs,
@@ -9369,9 +9363,7 @@ SCIP_RETCODE SCIPcreateConsPseudobooleanWithConss(
93699363
assert(cons != NULL);
93709364
assert(lincons != NULL);
93719365
assert(linconstype > SCIP_LINEARCONSTYPE_INVALIDCONS);
9372-
assert(andconss != NULL);
9373-
assert(andcoefs != NULL);
9374-
assert(nandconss >= 1);
9366+
assert(nandconss == 0 || (andconss != NULL && andcoefs != NULL));
93759367
assert(issoftcons == (indvar != NULL));
93769368

93779369
if( intvar != NULL )

0 commit comments

Comments
 (0)