scipopt / scip

SCIP - Solving Constraint Integer Programs
Other
369 stars 63 forks source link

ERROR: cannot change bounds of multi-aggregated variable #29

Closed gingerjhan closed 1 year ago

gingerjhan commented 1 year ago

I have a MILP problem that is having trouble running through SCIP with pyscipopt. Two specific variables would occasionally cause an error. The error message is listed below:

[tree.c:1875] ERROR: cannot change bounds of multi-aggregated variable <t_x3377>
[tree.c:2098] ERROR: Error <-9> in function call
[scip_var.c:5388] ERROR: Error <-9> in function call
[presol_implics.c:278] ERROR: Error <-9> in function call
[presol.c:466] ERROR: Error <-9> in function call
[scip_solve.c:1081] ERROR: Error <-9> in function call
[scip_solve.c:1208] ERROR: Error <-9> in function call
[scip_solve.c:1374] ERROR: Error <-9> in function call
[scip_solve.c:2484] ERROR: Error <-9> in function call
[scip_solve.c:2722] ERROR: Error <-9> in function call
[dialog_default.c:2183] ERROR: Error <-9> in function call
[dialog.c:942] ERROR: Error <-9> in function call
[dialog.c:393] ERROR: Error <-9> in function call
[scip_dialog.c:243] ERROR: Error <-9> in function call
[scipshell.c:479] ERROR: Error <-9> in function call
[scipshell.c:533] ERROR: Error <-9> in function call
SCIP Error (-9): method cannot be called with this type of data

The attachment contains my test file. I saved the model in .lp and .cip formats before the error occurred. test_lp_transform.cip is a file that tranfrom from test.lp. I figured out that the difference between test.cip and test_lp_transform.cip is the order of the variable, which would cause a different presolving result.

test.cip can reproduce the error in scip. test.lp can be successfully optimized in scip. test_lp_transform.cip can be successfully optimized in scip.

test.zip

svigerske commented 1 year ago

Hmm, this is quite old code and strange that it hasn't come up before.

A quick workaround is to add

diff --git a/src/scip/presol_implics.c b/src/scip/presol_implics.c
index c04d04f3aa..ed2031b27f 100644
--- a/src/scip/presol_implics.c
+++ b/src/scip/presol_implics.c
@@ -269,6 +269,9 @@ SCIP_DECL_PRESOLEXEC(presolExecImplics)
       assert(bdchgvars != NULL);
       assert(bdchgvals != NULL);

+      if( SCIPvarGetStatus(bdchgvars[v]) == SCIP_VARSTATUS_MULTAGGR )
+         continue;
+
       if( bdchgtypes[v] == SCIP_BOUNDTYPE_LOWER )
       {
          SCIP_CALL( SCIPtightenVarLb(scip, bdchgvars[v], bdchgvals[v], FALSE, &infeasible, &tightened) );