Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

z3py time not in Optimize.statistics() #5515

Closed
diegochine opened this issue Aug 28, 2021 · 2 comments
Closed

z3py time not in Optimize.statistics() #5515

diegochine opened this issue Aug 28, 2021 · 2 comments

Comments

@diegochine
Copy link

Looks like z3py saves time in statistics only for Solver objects and not for Optimize ones.
Using Solver:

x = Int('x')
y = Int('y')
s = Solver()
s.add(x > 10, y == x + 2)
s.set("timeout", 1000) # not actually needed to have time in statistics
s.check()
print(s.statistics())

outputs

(:eliminated-applications 2
 :eliminated-vars         2
 :max-memory              18.93
 :memory                  18.93
 :num-allocs              8649163
 :rlimit-count            536
 :time                    0.00)

which includes time, but for Optimize the same code

x = Int('x')
y = Int('y')
s = Optimize()
s.set("timeout", 1000)
s.add(x > 10, y == x + 2)
s.minimize(x)
print(s.statistics())

outputs

(:max-memory   18.93
 :memory       16.72
 :num-allocs   11346270
 :rlimit-count 536)

This issue looks very similar to issue #4662. Is there any way to get the internal time when using the Optimize class?

@NikolajBjorner
Copy link
Contributor

you also need to call s.check()

@diegochine
Copy link
Author

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants