简体   繁体   中英

How to Resolve ERROR: invalid SCIP stage <10> in SCIP C++

I feel like I am missing something very simple and very straightforward. I am trying to add a constraint after the LP has been solved (using the optimal LP solution as a mechanism to devise this constraint). And I am adding it by this piece of code

432 SCIP_CONS * cons = nullptr;
433 namebuf.str("");
434 namebuf<<"cut_3_OR1";
435  SCIP_CALL(SCIPcreateConsLinear(scip, &cons, namebuf.str().c_str(), 0, nullptr, nullptr, -SCIPinfinity(scip), 1.0,   /* <= 1.0 constraint */
436                                    true,  /* initial  <= 0 */
437                                    false, /* separate */
438                                    true,  /* enforce */
439                                    true,  /* check */
440                                    true,  /* propagate */
441                                    false, /* local */
442                                    true,  /* modifiable */
443                                    false, /* dynamic */
444                                    false, /* removable */
445                                    false  /* stickingatnode */));

The code compiles fine but upon running the code, I get this error message

[src/scip/scip_cons.c:991] ERROR: invalid SCIP stage <10>
[src/scip/cons_linear.c:17695] ERROR: Error <-8> in function call
[src/Solver.h:445] ERROR: Error <-8> in function call
make: *** [run] Error 1

The code compiles and runs when I remove this constraint addition.

Could someone tell me what is wrong?

Stage 10 is SCIP_STAGE_SOLVED . You try to add a constraint after your problem is solved to optimality. Is the constraint that you want to add necessary? Then you might have to implement a constraint handler and add your constraint in the sepalp-callback of your handler. As an example, you could look at the TSP example in the SCIP documentation (it has a subtour-elimination constraint handler)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM