Comments (8)
There is currently no such feature implemented in the SMT2 front-end. However, we can add this feature in the future via the terminate function callbacks in the SMT2 front-end.
from boolector.
Thank you very much for your quick response, much appreciated!
While you are at it, I'm also missing a feature to reset the solver, i.e., z3's (reset). My workflow is as follows:
- I spawn multiple sover processes in queue
- then alternating between them I send them queries
- then reset them and add them back to queue
However, I kind of want to avoid resetting them every time.
I hope I am not asking to much.
from boolector.
Can you provide a small SMT2 example for this workflow? That would be really helpful!
from boolector.
Sure:
(declare-const sub_1 (_ BitVec 256))
(declare-const sub_3 (_ BitVec 256))
(declare-const sub_2 (_ BitVec 256))
(assert (= sub_1 (_ bv1 256) ))
(assert (= sub_2 (_ bv0 256) ))
(assert (= sub_3 (ite (= sub_2 sub_1) (_ bv1 256) (_ bv0 256)) ))
(assert (= sub_3 (_ bv1 256) ))
(check-sat)
(reset)
(declare-const sub_1 (_ BitVec 256))
(declare-const sub_3 (_ BitVec 256))
(declare-const sub_2 (_ BitVec 256))
(assert (= sub_1 (_ bv0 256) ))
(assert (= sub_2 (_ bv0 256) ))
(assert (= sub_3 (ite (= sub_2 sub_1) (_ bv1 256) (_ bv0 256)) ))
(assert (= sub_3 (_ bv1 256) ))
(check-sat)
Maybe as context, I'm doing symbolic execution. However, in a multi threaded environment, i.e., I explore multiple paths simultaneously. I run multiple solver instances and tracking which solver has which symbols defined is too much of an overhead. Thus, I just cycle through the solvers, reseting them every time.
Note (reset)
, is defined by z3 not by SMT2.
from boolector.
Have you tried using push/pop instead of a reset? Or are the queries not related at all so that you always want to query a "fresh" instance of the solver?
Here would be the version with push/pop:
(push 1)
(declare-const sub_1 (_ BitVec 256))
(declare-const sub_3 (_ BitVec 256))
(declare-const sub_2 (_ BitVec 256))
(assert (= sub_1 (_ bv1 256) ))
(assert (= sub_2 (_ bv0 256) ))
(assert (= sub_3 (ite (= sub_2 sub_1) (_ bv1 256) (_ bv0 256)) ))
(assert (= sub_3 (_ bv1 256) ))
(check-sat)
(pop 1)
(push 1)
(declare-const sub_1 (_ BitVec 256))
(declare-const sub_3 (_ BitVec 256))
(declare-const sub_2 (_ BitVec 256))
(assert (= sub_1 (_ bv0 256) ))
(assert (= sub_2 (_ bv0 256) ))
(assert (= sub_3 (ite (= sub_2 sub_1) (_ bv1 256) (_ bv0 256)) ))
(assert (= sub_3 (_ bv1 256) ))
(check-sat)
(pop 1)
from boolector.
Ohh yeah forgot about that mode, I tried it with z3, but performance really suffers (https://stackoverflow.com/questions/26416814/why-does-z3-check-slow-when-it-is-immediately-preceded-by-z3-push). Thanks! I will give it a try with boolector.
from boolector.
Any update in the meantime?
According to the help message there is the possibility of a time limit, but its an absolute timeout starting with the program execution:
-t <seconds>,
--time=<seconds> set time limit
It would be nice to have the ability to set a timeout which applies to commands like (check-sat)
, and thus is meaningful when using boolector for iterative solving. A global time limit does not make sense in those cases.
from boolector.
Hi @pointhi,
This is definitely not an official answer, but I had a need for something like this, which ended-up with this branch:
https://github.com/Boolector/boolector/compare/smtcomp19...andrewvaughanj:timeouts_for_term?expand=1
This adds:
-
a
-to <VALUE>
argument to the main command-line application -
support for
(set-option :timeout <VALUE>)
in the SMT2 front-end -
support for
self.btor.Set_opt(boolector.BTOR_OPT_TIMEOUT, <VALUE>)
via the Python API
(all values are in millis).
Some important notes:
-
this is based off of the
smtcomp19
branch, which I am not sure is officially "ready for consumption" (so please be wary) -
this will only work (currently) with Lingeling; CaDiCaL does not adhere to the call-back mechanism (yet, there's another PR for that), and CMS/MiniSAT do not have a call-back mechanism at all
Let me know how you get on and, if it is successful, I can see about wrapping it up into an official PR.
Cheers,
Andrew
from boolector.
Related Issues (20)
- Not able to found how to get different solution after every boolector_sat under same assertions HOT 1
- PyBoolector install via PIP fails on x86_64 MacOS HOT 10
- Lookup Table HOT 1
- Assertion with zero and propagation engine HOT 5
- Is there any Distribution Constraint sv equivalent in boolector?
- Printing of Constant Arrays
- Linker error when building boolector from source HOT 2
- windows10 install pyboolector failed HOT 1
- ./configure.sh problem HOT 2
- install pyboolector failed on python 3.11 macos
- Stuck rewriting in rewrite_eq_exp
- Installing pyboolector fails for python 3.11.3 on Linux (Arch) HOT 2
- install error on macos 13.4.1
- Hello, how do I install Boolector and cryptominisat offline? HOT 1
- Make error while running btor2tools HOT 15
- How to install pyboolector for pypy HOT 1
- Tests fail to compile: error: no member named 'make_unique' in namespace 'std', etc. HOT 1
- FileNotFoundError when installing on windows
- BtorMC --kind not converging
- Wrong path for libbtor2parser.a in reach's Makefile HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from boolector.