z3模型的无类型输出

时间:2019-11-13 15:30:32

标签: z3 smt

我正在使用MaxSMT来找到一组软约束和硬约束的解决方案。超时为600秒,我从求解器得到的模型输出对于所有参数都是Nonetype。我期望求解器为我提供次优的解决方案。我认为这是错误的。有人可以解释一下吗?

编辑:因此,我添加了详细选项以打印出中间步骤:我收到以下消息:

(optimize:check-sat)
(smt.searching)
(smt.simplifying-clause-set :num-deleted-clauses 2)
(smt.simplifying-clause-set :num-deleted-clauses 1)
(smt.restarting :propagations 417 :decisions 948 :conflicts 101 :restart 100 :restart-outer 110 :agility 0.000299947)
(smt.simplifying-clause-set :num-deleted-clauses 0)
(smt.simplifying-clause-set :num-deleted-clauses 0)
(smt.simplifying-clause-set :num-deleted-clauses 0)
(smt.simplifying-clause-set :num-deleted-clauses 0)
(smt.simplifying-clause-set :num-deleted-clauses 0)
(smt.simplifying-clause-set :num-deleted-clauses 0)
(smt.simplifying-clause-set :num-deleted-clauses 0)
(smt.simplifying-clause-set :num-deleted-clauses 0)
(smt.simplifying-clause-set :num-deleted-clauses 0)
(smt.simplifying-clause-set :num-deleted-clauses 0)
(smt.simplifying-clause-set :num-deleted-clauses 0)
(smt.simplifying-clause-set :num-deleted-clauses 0)
(smt.restarting :propagations 3497 :decisions 11262 :conflicts 202 :restart 110 :restart-outer 110 :agility 0.00588127)
(smt.simplifying-clause-set :num-deleted-clauses 0)
(smt.simplifying-clause-set :num-deleted-clauses 0)
(smt.simplifying-clause-set :num-deleted-clauses 0)
(smt.simplifying-clause-set :num-deleted-clauses 0)
(smt.simplifying-clause-set :num-deleted-clauses 0)
(smt.simplifying-clause-set :num-deleted-clauses 0)
(smt.simplifying-clause-set :num-deleted-clauses 0)
(smt.simplifying-clause-set :num-deleted-clauses 0)
(smt.restarting :propagations 10138 :decisions 18514 :conflicts 313 :restart 100 :restart-outer 121 :agility 0.001524)
(smt.simplifying-clause-set :num-deleted-clauses 0)
(smt.simplifying-clause-set :num-deleted-clauses 0)
(smt.simplifying-clause-set :num-deleted-clauses 0)
(smt.simplifying-clause-set :num-deleted-clauses 0)
(smt.simplifying-clause-set :num-deleted-clauses 0)
(smt.simplifying-clause-set :num-deleted-clauses 0)
(smt.simplifying-clause-set :num-deleted-clauses 0)
(smt.restarting :propagations 16862 :decisions 21147 :conflicts 426 :restart 110 :restart-outer 121 :agility 0.0337523)
(smt.simplifying-clause-set :num-deleted-clauses 0)
(smt.restarting :propagations 17827 :decisions 24053 :conflicts 537 :restart 121 :restart-outer 121 :agility 0.0268182)
(smt.simplifying-clause-set :num-deleted-clauses 0)
(smt.simplifying-clause-set :num-deleted-clauses 0)
(smt.simplifying-clause-set :num-deleted-clauses 0)
(smt.simplifying-clause-set :num-deleted-clauses 0)
(smt.restarting :propagations 25141 :decisions 36272 :conflicts 660 :restart 100 :restart-outer 133 :agility 0.00362989)
(smt.simplifying-clause-set :num-deleted-clauses 0)
(smt.simplifying-clause-set :num-deleted-clauses 0)
(smt.simplifying-clause-set :num-deleted-clauses 0)
(smt.simplifying-clause-set :num-deleted-clauses 0)
(smt.simplifying-clause-set :num-deleted-clauses 0)
(smt.simplifying-clause-set :num-deleted-clauses 0)
(smt.simplifying-clause-set :num-deleted-clauses 0)
(smt.restarting :propagations 35575 :decisions 47933 :conflicts 765 :restart 110 :restart-outer 133 :agility 0.00289772)
(smt.simplifying-clause-set :num-deleted-clauses 0)
(smt.simplifying-clause-set :num-deleted-clauses 0)
(smt.restarting :propagations 39641 :decisions 52637 :conflicts 876 :restart 121 :restart-outer 133 :agility 0.000965057)
(smt.simplifying-clause-set :num-deleted-clauses 0)
(smt.simplifying-clause-set :num-deleted-clauses 0)
        (smt.restarting :propagations 40803 :decisions 57913 :conflicts 998 :restart 133 :restart-outer 133 :agility 0.0349118)

看来求解器并不容易找到可行的解决方案。这是否意味着没有任何软约束可以满足?

1 个答案:

答案 0 :(得分:3)

没有理由期待在超时后获得“次优”解决方案。除非求解器返回肯定的答案,否则您可以搜集到的任何内部信息都只是:有些内部值可能不相关。更重要的是,没有理由期望它甚至会是令人满意的实例。有关更多详细信息,请参见此答案:How to check progress for Z3 optimization problem

如果您正处于时间紧迫而无力等待的情况下,最好的选择也许就是迭代自己:不使用优化引擎,只需执行常规查询,评估成本函数并再次调用求解器,还有一个额外的约束条件,那就是成本应该比以前少。尽管这显然不一定会收敛到最佳解决方案,但它使您可以控制要进行的迭代次数,并且可以在实践中充分发挥作用。请参阅有关此问题的讨论以获取更多深入的了解:Scalability of z3