简体   繁体   English

如何在 Z3py 中激活部分模式?

[英]How to activate partial mode in Z3py?

I am using Z3's Python bindings and am curious wether partial mode would speed up my model.我正在使用 Z3 的 Python 绑定,并且很好奇部分模式是否会加速我的模型。 However there doesn't seem to be a way to do this in Python.但是,在 Python 中似乎没有办法做到这一点。 ( set_param(...) doesn"t seem to have a parameter for it) set_param(...)似乎没有参数)

I considered migrating to pySMT since it claims to support partial mode for Z3, but I would prefer to keep Z3Py.我考虑迁移到pySMT,因为它声称支持 Z3 的部分模式,但我更愿意保留 Z3Py。

Bonus question: Would partial mode actually do me any good?额外问题:部分模式实际上对我有好处吗? I am simulating computer memory in Arrays and want Z3 to ignore entries that are never referenced.我正在模拟数组中的计算机内存,并希望 Z3 忽略从未被引用的条目。

This is how you can set partial models:这是设置部分模型的方法:

from z3 import *

print get_param('model.partial')
set_param('model.partial', True)
print get_param('model.partial')

This prints:这打印:

false
true

Regarding your bonus question: I doubt partial models will buy you anything.关于你的奖金问题:我怀疑部分模型会给你买任何东西。 SMT solvers typically find a model in case of sat and then complete the model as necessary. SMT 求解器通常会在sat情况下找到模型,然后根据需要完成模型。 The "finding the model" part is typically the costly action, not completing the model. “寻找模型”部分通常是代价高昂的操作,而不是完成模型。 But it of course depends on your particular problem;但这当然取决于您的特定问题; so it wouldn't hurt to try.所以尝试不会有什么坏处。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM