【问题标题】:Is there a way to save the cutting planes from SCIP?有没有办法从 SCIP 中保存切割平面?
【发布时间】:2022-02-11 18:46:58
【问题描述】:

我正在使用 SCIP 为我的项目生成切割平面。我这样做是直接使用包含默认插件的 C++ 代码,从 scip/examples/MIPsolver/src/cppmain 修改。然而,切割平面阵列没有被保存。程序将使用命令运行

./scipplanes [problem file]

我的程序受影响的部分如下所示:

/*******************
    * Problem Presolving *
    *******************/

   /* Presolve problem */
   std::cout << "=============" << std::endl;
   std::cout << "Presolve problem" << std::endl;
   std::cout << "=============" << std::endl;
   SCIP_CALL( SCIPpresolve(scip) ); //Presolve to simplify the problem
   SCIP_CALL( SCIPsetRealParam(scip, "limits/time", 60) ); //Limit of solving time in seconds
   
   /*************************
    * Obtain cutting planes *
    *************************/
   std::cout << "=============" << std::endl;
   std::cout << "Obtaining cutting planes" << std::endl;
   std::cout << "=============" << std::endl;
   
   SCIP_ROW** allcuts; //Because SCIPgetCuts outputs this kind of data (memory address/pointer) 
   int n_cuts; //For for loop iteration
   
   SCIP_CALL( SCIPsolve(scip) );
   allcuts = SCIPgetCuts(scip); /*Documentation says that this outputs the array of cuts currently stored in the separation storage, 
                                   in the form of a memory address of pointer of SCIP_ROW** */
   std::cout << "allcuts is " << allcuts << std::endl;
   n_cuts = SCIPgetNCuts(scip);
   std::cout << "n_cuts is " << n_cuts << std::endl;
   

当我运行我的代码时,我获得了n_cuts = 0,但统计表显示:

time | node  | left  |LP iter|LP it/n|mem/heur|mdpt |vars |cons |rows |cuts |sepa|confs|strbr|  dualbound   | primalbound  |  gap   | compl.
60.0s|     1 |     0 | 33295 |     - |   333M |   0 |1164 |  39k|  39k| 120 | 10 |  19 |   0 | 0.000000e+00 |      --      |    Inf | unknown

共有 120 个剪辑。我通过运行 SCIP 二进制文件并使用 presolveoptimize 进行了双重检查,时间限制为 60 秒。使用display statistics时结果相同。

我还尝试通过执行 SCIPprintRow(scip, *allcuts, NULL); 来遍历 allcuts,但遇到了分段错误。

因此,我不知道为什么没有保存切割平面。能否就如何解决这个问题给我一些建议?谢谢。

【问题讨论】:

    标签: optimization scip


    【解决方案1】:

    我很确定在求解完成后所有剪切都将被释放(无论如何,SCIP 会不时删除行)。如果您想要在求解过程中的任何时候使用的所有剪切,您应该编写一个事件处理程序(事件类型为SCIP_EVENTTYPE_ROWEVENT),您可以使用它来打印带有SCIPprintRow 的行)

    examples 子目录中有一个如何编写自己的事件处理程序的示例。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-12-19
      • 2019-03-05
      • 2017-10-05
      • 2013-06-10
      • 2021-09-12
      • 2020-05-17
      • 2021-08-23
      • 1970-01-01
      相关资源
      最近更新 更多