【发布时间】: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 二进制文件并使用 presolve 和 optimize 进行了双重检查,时间限制为 60 秒。使用display statistics时结果相同。
我还尝试通过执行 SCIPprintRow(scip, *allcuts, NULL); 来遍历 allcuts,但遇到了分段错误。
因此,我不知道为什么没有保存切割平面。能否就如何解决这个问题给我一些建议?谢谢。
【问题讨论】:
标签: optimization scip