Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/v9-minor'
Browse files Browse the repository at this point in the history
  • Loading branch information
scip-ci committed Apr 2, 2024
2 parents 8cbff9e + 3d4914d commit 1870863
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 7 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ Fixed bugs
- declare contradicting infinities in getMinActivity() and getMaxActivity() as non-tight
- reject farkas solution with large values to bound magnification of errors in SCIPgetFarkasProof()
- if all variables are fixed, apply relative feasibility tolerance to avoid invalid infeasibility in applyFixings() of cons_linear.c
- delete empty redundant knapsack and linear constraints after cleanup in SCIPmatrixCreate()
- cleanup first constraints in SCIPcleanupConssVarbound(), SCIPcleanupConssSetppc(), and SCIPcleanupConssLogicor()

Miscellaneous
-------------
Expand Down
2 changes: 1 addition & 1 deletion src/scip/cons_logicor.c
Original file line number Diff line number Diff line change
Expand Up @@ -5684,7 +5684,7 @@ SCIP_RETCODE SCIPcleanupConssLogicor(
SCIP_CALL( SCIPallocBufferArray(scip, &entries, nentries) );

/* loop backwards since then deleted constraints do not interfere with the loop */
for( i = nconss - 1; i > 0; --i )
for( i = nconss - 1; i >= 0; --i )
{
SCIP_CONS* cons;
SCIP_Bool redundant;
Expand Down
2 changes: 1 addition & 1 deletion src/scip/cons_setppc.c
Original file line number Diff line number Diff line change
Expand Up @@ -9763,7 +9763,7 @@ SCIP_RETCODE SCIPcleanupConssSetppc(
conss = onlychecked ? SCIPconshdlrGetCheckConss(conshdlr) : SCIPconshdlrGetConss(conshdlr);

/* loop backwards since then deleted constraints do not interfere with the loop */
for( i = nconss - 1; i > 0; --i )
for( i = nconss - 1; i >= 0; --i )
{
SCIP_CONS* cons = conss[i];

Expand Down
2 changes: 1 addition & 1 deletion src/scip/cons_varbound.c
Original file line number Diff line number Diff line change
Expand Up @@ -5702,7 +5702,7 @@ SCIP_RETCODE SCIPcleanupConssVarbound(
conss = onlychecked ? SCIPconshdlrGetCheckConss(conshdlr) : SCIPconshdlrGetConss(conshdlr);

/* loop backwards since then deleted constraints do not interfere with the loop */
for( i = nconss - 1; i > 0; --i )
for( i = nconss - 1; i >= 0; --i )
{
SCIP_CALL( applyFixings(scip, conss[i], eventhdlr, infeasible, nchgbds, ndelconss, naddconss) );

Expand Down
39 changes: 35 additions & 4 deletions src/scip/matrix.c
Original file line number Diff line number Diff line change
Expand Up @@ -467,11 +467,14 @@ SCIP_RETCODE SCIPmatrixCreate(
{
SCIP_MATRIX* matrix;
SCIP_CONSHDLR** conshdlrs;
SCIP_CONSHDLR* conshdlr;
const char* conshdlrname;
SCIP_Bool stopped;
SCIP_VAR** vars;
SCIP_VAR* var;
SCIP_CONS** conshdlrconss;
SCIP_CONS* cons;
int nconshdlrconss;
int nconshdlrs;
int nconss;
int nconssall;
Expand Down Expand Up @@ -509,8 +512,6 @@ SCIP_RETCODE SCIPmatrixCreate(

for( i = 0; i < nconshdlrs; ++i )
{
int nconshdlrconss;

nconshdlrconss = SCIPconshdlrGetNCheckConss(conshdlrs[i]);

if( nconshdlrconss > 0 )
Expand Down Expand Up @@ -586,10 +587,42 @@ SCIP_RETCODE SCIPmatrixCreate(
if( *infeasible )
return SCIP_OKAY;

/* delete empty redundant knapsack constraints */
conshdlr = SCIPfindConshdlr(scip, "knapsack");
if( conshdlr != NULL )
{
nconshdlrconss = SCIPconshdlrGetNCheckConss(conshdlr);
conshdlrconss = SCIPconshdlrGetCheckConss(conshdlr);
for( i = nconshdlrconss - 1; i >= 0; --i )
{
if( SCIPgetNVarsKnapsack(scip, conshdlrconss[i]) == 0 )
{
SCIP_CALL( SCIPdelCons(scip, conshdlrconss[i]) );
++(*ndelconss);
}
}
}

SCIP_CALL( SCIPcleanupConssLinear(scip, TRUE, infeasible) );
if( *infeasible )
return SCIP_OKAY;

/* delete empty redundant linear constraints */
conshdlr = SCIPfindConshdlr(scip, "linear");
if( conshdlr != NULL )
{
nconshdlrconss = SCIPconshdlrGetNCheckConss(conshdlr);
conshdlrconss = SCIPconshdlrGetCheckConss(conshdlr);
for( i = nconshdlrconss - 1; i >= 0; --i )
{
if( SCIPgetNVarsLinear(scip, conshdlrconss[i]) == 0 )
{
SCIP_CALL( SCIPdelCons(scip, conshdlrconss[i]) );
++(*ndelconss);
}
}
}

vars = SCIPgetVars(scip);
nvars = SCIPgetNVars(scip);

Expand Down Expand Up @@ -661,8 +694,6 @@ SCIP_RETCODE SCIPmatrixCreate(
/* loop a second time over constraints handlers and add supported constraints to the matrix */
for( i = 0; i < nconshdlrs; ++i )
{
SCIP_CONS** conshdlrconss;
int nconshdlrconss;
SCIP_Bool rowadded;

if( SCIPisStopped(scip) || (onlyifcomplete && !(*complete)) )
Expand Down

0 comments on commit 1870863

Please sign in to comment.