简体   繁体   中英

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. However there doesn't seem to be a way to do this in Python. ( set_param(...) doesn"t seem to have a parameter for it)

I considered migrating to pySMT since it claims to support partial mode for Z3, but I would prefer to keep 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.

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. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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