Solver timeout within loop using z3 Python API

痞子三分冷 提交于 2020-01-07 06:28:05

问题


Per an earlier suggestion, I'm trying to set early timeout for a solver while using z3Py.

Again, without all the particulars, this is what I'm attempting:

for bits in range(A, B, incrmt)
    s = Solver();
    s.set("timeout", 30) #30, 3000, 30000, 60000 no change
    s.add(some constraints)
    if(s.check() == sat):
        print "Sat, %d," %(bits)
    else:
        print "Sat Unknown, %d," %(bits)
        break
    sys.stdout.flush()

Essentially, timeout never occurs (even with ridiculously small times in ms).


回答1:


Are you using Z3 on Linux or FreeBSD? There was a bug related to timers on these platforms. I fixed the problem, but it is not part of the official release yet. See the following post for more details.

  • how to set timeout for z3_solver using C-API?


来源:https://stackoverflow.com/questions/14721765/solver-timeout-within-loop-using-z3-python-api

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!