Using a text file to input the Z3 model

若如初见. 提交于 2021-01-07 04:25:46

问题


I am using Z3 through its .Net Api. I build models which have considerably huge number of constraints. Until now I have been using the respective Z3 commands (in the .Net Api) to build my model line by line. But now that the model has increased in size the time it takes to create the model is very considerable. I was thinking is there a way to build the model as a text file and input the completed model to a Z3 solver in one go?


回答1:


Your question is rather cryptic, but all SMT-solvers support the so called SMTLib2 input format: http://smtlib.cs.uiowa.edu/papers/smt-lib-reference-v2.6-r2017-07-18.pdf

So, at least in theory, you can write your constraints to a file in the SMTLib format as described in the above document and then call z3 on that file.

But this isn't necessarily going to be faster than using the API directly: In fact, I'd expect calling z3 via its API to be faster since it avoids the "write-to-file, read-from-file" step; but it might work well better in your particular use case if you can reuse some of these constraints over many calls.



来源:https://stackoverflow.com/questions/63999489/using-a-text-file-to-input-the-z3-model

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