Z3 Context serialization/deserialization?

杀马特。学长 韩版系。学妹 提交于 2019-12-11 07:37:08

问题


Is it possible to serialize/deserialize a Z3 context (from C#)? If not, is this feature planned ?

I think this feature is important for real world applications.


回答1:


This is not directly supported in the current API. The next release will support multiple solvers, and we will provide commands for copying the assertions from one solver to another, and retrieving the assertions. With these commands, one can implement serialization by dumping the expressions in a file (in SMT 2.0 format). To deserialize, we just read the file back. Note that, this solution can already be implemented using the current API if you keep track of the assertions you asserted into the logical context.

That being said, I've seen the following approach used in many projects that use Z3. They have their own representation for formulas. When they invoke Z3, they translate their representation into Z3's representation. In most cases the performance overhead is minimal. This approach gives them a lot of flexibility. Serialization is a good example. Some programming environment (e.g., Python) already provide some built-in support for serialization.



来源:https://stackoverflow.com/questions/9596930/z3-context-serialization-deserialization

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