简体   繁体   English

如何解决错误:SCIP C++ 中的 SCIP 阶段 <10> 无效

[英]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).我试图在解决 LP 后添加一个约束(使用最佳 LP 解决方案作为设计此约束的机制)。 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 .第 10 阶段是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.然后您可能需要实现一个约束处理程序并在处理程序的 sepalp 回调中添加您的约束。 As an example, you could look at the TSP example in the SCIP documentation (it has a subtour-elimination constraint handler)例如,您可以查看 SCIP 文档中的 TSP 示例(它有一个 subtour-elimination 约束处理程序)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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