如何获取千里眼重启所用的时间?

How to get the time taken for Clairvoyant restart?

我正在尝试获取SCIP7.0.0中千里眼重启所花费的时间,以便与其他数值方法比较速度。

event_estim.c中,我将第2792行修改为SCIPverbMessage(scip, SCIP_VERBLEVEL_HIGH, NULL, "Restart triggered after %d consecutive estimations that the remaining tree will be large. Time taken is %.3f \n", eventhdlrdata->restarthitcounter, SCIPclockGetTime(scip->stat->solvingtime));

但是,在重新编译 SCIP 后出现以下错误:

src/scip/event_estim.c: In function ‘eventExecEstim’:
src/scip/event_estim.c:2793:50: warning: implicit declaration of function ‘SCIPclockGetTime’; did you mean ‘SCIPsolGetTime’? [-Wimplicit-function-declaration]
                eventhdlrdata->restarthitcounter, SCIPclockGetTime(scip->stat->solvingtime));             
                                                  ^~~~~~~~~~~~~~~~
                                                  SCIPsolGetTime
src/scip/event_estim.c: At top level:
cc1: warning: unrecognized command line option ‘-Wno-unknown-warning-option’

我将 SCIPclockGetTime 与这些参数一起使用,因为我想要当前的求解时间。有人可以帮我吗?谢谢你的帮助。

简答:您要找的函数是SCIPgetSolvingTime(scip)

更长的答案:函数 SCIPclockGetTime()private header clock.h 中声明,因此不应直接在此类插件中使用作为此事件处理程序插件。相反,您可以使用 SCIPgetClockTime(scip, clockptr),(注意命名的区别,“get”现在排在第一位。)它是 SCIPclockGetTime() 的 public 包装器。要访问解决时间时钟,这是 SCIP 中最中心的时钟 object,您可以使用方便的方法 SCIPgetSolvingTime(scip),这样您就不需要取消引用 scip->stat->solvingtime你自己。

这种包装的原因是 SCIP 核心内部可能会发生变化,例如,将来可能会向 SCIPclockGetTime() 添加一个新参数,或者解决时间时钟 object 可能会移动到不同的地点。插件使用的 public API 在这种情况下不需要更改。