Reputation: 321
I am interested in Z3 giving me a model and at the same time I would be happy if it tried to take an objective function into account as a heuristic, but I don't want to pay the performance penalty of finding the actual (max|min)imum.
Is this possible in Z3?
Upvotes: 1
Views: 104
Reputation: 30418
This is already possible in Z3 with soft time outs, see this answer: Z3 Time Restricted Optimization
The way to achieve what you want is to use incremental solving:
check-sat
and get the modelIn the last step, you can adjust how much you want to wait, i.e., the penalty you are willing to pay.
Related note: You might also want to play with soft-constraints, which the solver can "satisfy" optionally, incurring penalties if it doesn't. Perhaps that's more appropriate for your use case. See here on how to do that: https://rise4fun.com/Z3/tutorialcontent/optimization#h23
Upvotes: 2