Google OR-Tools使用 SCIP 求解器 - 如何使用 WallTime() 获取唯一时间戳?

问题描述

我使用 SCIP 作为求解器实现了 MIP 模型。我的目标之一是绘制中间解决方案随时间的演变图。

使用 NextSolution() 上的循环,我检索中间解决方案(如 Google OR-Tools (using SCIP solver) - How to access the intermediate solutions found by the solver? 中所述)。由于我还需要监控时间(即每个中间解决方案的时间戳),我将 WallTime() 添加到循环中:

solutions = [] # list to store intermediate solutions
localtimes = [] #list to store intermediate localtimes

while solver.NextSolution():
  solutions.append(solver.WallTime()) #in miliseconds
  localtimes.append(C.solution_value())

问题是我没有足够的时间精度来区分时间戳。我得到的输出是:

[5329,5329,5330,...] --> intermediate localtimes list
[263.0,264.0,268.0,269.0,275.0,279.0,280.0,296.0,297.0,304.0,306.0,307.0,308.0,309.0,311.0,...] --> intermediate solutions list

因此,不同的解决方案具有相同的时间戳。有没有办法获得更高的时间精度以获得唯一的时间戳?

谢谢。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)