微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

如何解决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 举报,一经查实,本站将立刻删除。