Created
January 15, 2019 12:28
-
-
Save rschwarz/4a64a7a690a44919d3ec88330021405b to your computer and use it in GitHub Desktop.
use SCIPdelVar for variable which is still in constraint (failed assertion / segfault)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "scip/scip.h" | |
#include "scip/scipdefplugins.h" | |
// compile with: | |
// gcc -lscip del_var.c -o del_var | |
int main() { | |
SCIP* scip; | |
SCIP_CALL(SCIPcreate(&scip)); | |
SCIP_CALL(SCIPincludeDefaultPlugins(scip)); | |
SCIP_CALL(SCIPcreateProbBasic(scip, "")); | |
SCIP_VAR* var; | |
SCIP_CALL(SCIPcreateVarBasic(scip, &var, "", 0.0, 1.0, 0.0, | |
SCIP_VARTYPE_CONTINUOUS)); | |
SCIP_CALL(SCIPaddVar(scip, var)); | |
SCIP_CONS* cons; | |
SCIP_CALL(SCIPcreateConsBasicLinear(scip, &cons, "", 0, NULL, NULL, 0.0, 0.0)); | |
SCIP_CALL(SCIPaddCoefLinear(scip, cons, var, 1.0)); | |
SCIP_CALL(SCIPaddCons(scip, cons)); | |
SCIP_Bool feasible; | |
SCIP_CALL(SCIPdelVar(scip, var, &feasible)); | |
printf("SCIPdelVar feasible: %d\n", feasible); | |
SCIP_CALL(SCIPsolve(scip)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ./del_var | |
SCIPdelVar feasible: 1 | |
[1] 18634 segmentation fault ./del_var |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ LD_LIBRARY_PATH=/home/rs/opt/scipoptsuite-6.0.0/build/lib ./del_var | |
SCIPdelVar feasible: 1 | |
del_var: /home/rs/opt/scipoptsuite-6.0.0/scip/src/scip/cons_linear.c:1025: consdataCreate: Assertion `(*consdata)->vars[v] != NULL' failed. | |
[1] 21785 abort LD_LIBRARY_PATH=/home/rs/opt/scipoptsuite-6.0.0/build/lib ./del_var |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The output from the optimized SCIP is actually version 6.0.1. I don't think there is a difference to 6.0.0.