Timeout for Z3 Optimize
问题 How do you set a timeout for the z3 optimizer such that it will give you the best known solution when it runs out of time? from z3 import * s = Optimize() # Hard Problem print(s.check()) print(s.model()) Follow-up question, can you set z3 to randomized hill climbing or does it always perform a complete search? 回答1: Long answer short, you can't . That's simply not how the optimizer works. That is, it doesn't find a solution and then try to improve it. If you interrupt it or set a time-out,