问题
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