I'm trying to minimize a variable, but z3 takes to long in order to give me a solution.
And I would like to know if it's possible to get a solution when timeout gets triggered.
If yes how can i do that?
Thx in advance!
I'm trying to minimize a variable, but z3 takes to long in order to give me a solution.
And I would like to know if it's possible to get a solution when timeout gets triggered.
If yes how can i do that?
Thx in advance!
If by "solution" you mean the latest approximation of the optimal value, then you may be able to retrieve it, provided that the optimization algorithm being used finds any intermediate solution along the way. (Some optimization algorithms --like, e.g.,
maxres
-- don't find any intermediate solution).Example:
Even when
res = unknown
because of a timeout, theobjective
instance contains the latest approximation of the optimum value found byz3
before the timeout.Unfortunately, I am not sure whether it is also possible to retrieve the corresponding sub-optimal model with
o.model()
(or any other method).For OptiMathSAT, I show how to retrieve the latest approximation of the optimum value and the corresponding model in the unit-test
timeout.py
.