Skip to content

Commit

Permalink
Merge branch '3462_fix_individual_donotaggr_in_setppc' into 'v80-bugfix'
Browse files Browse the repository at this point in the history
fix problems with forbidden aggregation for individual vars

See merge request integer/scip!2963
  • Loading branch information
ambros-gleixner committed Dec 12, 2022
2 parents 273138d + b768907 commit 640603d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 21 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ Fixed bugs
- fixed that the implication presolver tried to aggregate or tighten bounds of multiaggregated variables
- fixed a sign check in detection of linear constraints that are parallel to the objective
- fixed bug in Clp and lpi_clp with missing basis information when calling the barrier with crossover; needs new Clp version
- do not assume aggregation is successful in cons_setppc.c

Miscellaneous
-------------
Expand Down
46 changes: 25 additions & 21 deletions src/scip/cons_setppc.c
Original file line number Diff line number Diff line change
Expand Up @@ -5519,11 +5519,11 @@ SCIP_RETCODE multiAggregateBinvar(
{
SCIP_Bool redundant;

SCIPdebugMsg(scip, "aggregating %s = 1 - %s\n", SCIPvarGetName(vars[pos]), SCIPvarGetName(vars[nvars - pos - 1]));

/* perform aggregation on variables resulting from a set-packing constraint */
SCIP_CALL( SCIPaggregateVars(scip, vars[pos], vars[nvars - pos - 1], 1.0, 1.0, 1.0, infeasible, &redundant, aggregated) );
assert(*infeasible || *aggregated);

if( *aggregated )
SCIPdebugMsg(scip, "aggregated %s = 1 - %s\n", SCIPvarGetName(vars[pos]), SCIPvarGetName(vars[nvars - pos - 1]));

return SCIP_OKAY;
}
Expand Down Expand Up @@ -5832,8 +5832,6 @@ SCIP_RETCODE removeDoubleAndSingletonsAndPerformDualpresolve(

if( nuplocks == 1 && objval <= 0 )
{
SCIPdebugMsg(scip, "dualpresolve, aggregating %s + %s = 1, in set-packing constraint %s\n", SCIPvarGetName(var), SCIPvarGetName(consdata->vars[1]), SCIPconsGetName(cons));

/* perform aggregation on variables resulting from a set-packing constraint */
SCIP_CALL( SCIPaggregateVars(scip, var, consdata->vars[1], 1.0, 1.0, 1.0, &infeasible, &redundant, &aggregated) );

Expand All @@ -5843,11 +5841,14 @@ SCIP_RETCODE removeDoubleAndSingletonsAndPerformDualpresolve(
break;
}

assert(aggregated);
++(*naggrvars);
if( aggregated )
{
SCIPdebugMsg(scip, "dualpresolve, aggregated %s + %s = 1, in set-packing constraint %s\n", SCIPvarGetName(var), SCIPvarGetName(consdata->vars[1]), SCIPconsGetName(cons));
++(*naggrvars);

SCIP_CALL( SCIPdelCons(scip, cons) );
++(*ndelconss);
SCIP_CALL( SCIPdelCons(scip, cons) );
++(*ndelconss);
}

continue;
}
Expand All @@ -5863,8 +5864,6 @@ SCIP_RETCODE removeDoubleAndSingletonsAndPerformDualpresolve(

if( nuplocks == 1 && objval <= 0 )
{
SCIPdebugMsg(scip, "dualpresolve, aggregating %s + %s = 1, in set-packing constraint %s\n", SCIPvarGetName(var), SCIPvarGetName(consdata->vars[0]), SCIPconsGetName(cons));

/* perform aggregation on variables resulting from a set-packing constraint */
SCIP_CALL( SCIPaggregateVars(scip, var, consdata->vars[0], 1.0, 1.0, 1.0, &infeasible, &redundant, &aggregated) );

Expand All @@ -5873,11 +5872,15 @@ SCIP_RETCODE removeDoubleAndSingletonsAndPerformDualpresolve(
*cutoff = TRUE;
break;
}
assert(aggregated);
++(*naggrvars);

SCIP_CALL( SCIPdelCons(scip, cons) );
++(*ndelconss);
if( aggregated )
{
SCIPdebugMsg(scip, "dualpresolve, aggregated %s + %s = 1, in set-packing constraint %s\n", SCIPvarGetName(var), SCIPvarGetName(consdata->vars[0]), SCIPconsGetName(cons));
++(*naggrvars);

SCIP_CALL( SCIPdelCons(scip, cons) );
++(*ndelconss);
}

continue;
}
Expand All @@ -5887,8 +5890,6 @@ SCIP_RETCODE removeDoubleAndSingletonsAndPerformDualpresolve(
{
SCIP_Bool redundant;

SCIPdebugMsg(scip, "aggregating %s + %s = 1, in set-partition constraint %s\n", SCIPvarGetName(consdata->vars[0]), SCIPvarGetName(consdata->vars[1]), SCIPconsGetName(cons));

/* perform aggregation on variables resulting from a set-partitioning constraint */
SCIP_CALL( SCIPaggregateVars(scip, consdata->vars[0], consdata->vars[1], 1.0, 1.0, 1.0, &infeasible, &redundant, &aggregated) );

Expand All @@ -5898,11 +5899,14 @@ SCIP_RETCODE removeDoubleAndSingletonsAndPerformDualpresolve(
break;
}

assert(aggregated);
++(*naggrvars);
if( aggregated )
{
SCIPdebugMsg(scip, "aggregated %s + %s = 1, in set-partition constraint %s\n", SCIPvarGetName(consdata->vars[0]), SCIPvarGetName(consdata->vars[1]), SCIPconsGetName(cons));
++(*naggrvars);

SCIP_CALL( SCIPdelCons(scip, cons) );
++(*ndelconss);
SCIP_CALL( SCIPdelCons(scip, cons) );
++(*ndelconss);
}

continue;
}
Expand Down

0 comments on commit 640603d

Please sign in to comment.