Conversation
456a78b to
6440fe8
Compare
|
In the end, I implemented it as a |
7e27f53 to
7723b5d
Compare
|
In the last commits, except of some refactoring, I resolved compatibility issues with MacOS and fixed some narrowing conversions of |
|
I added more comments on how the synchronization works, based on cppreference. The regression tests are unstable though (they may fail in the future), and also require large benchmarks. |
|
I moved the regression tests to a separate branch and replaced them with unit tests. |
|
I changed the behavior of With this, it was possible to include unit tests on |
I realized that now it is a bit confusing, because the behavior is different if we call
The advantage of (2) is that the semantics are clear and independent from the time it is set, as is usual for a configuration. The disadvantage is that, e.g., parsing the formula is excluded from the time limit, which may or may not be desired. (3) is a bit complicated to implement as an option in All 3 options can be addressed as separate things. The question is which of them we want. |
Currently, it actually keeps returning I checked that CVC5 nor z3 return |
|
CVC5 only supports It makes sense to me. I would not include the overall timeout in the options at all, only This would ideally also require checking the stop flag not only within the solving, but also within adding assertions and preprocessing. |
67d8e78 to
59c857e
Compare
|
I reverted to the previous solution where As mentioned above, it should ideally also stop processing formulas and simplifying them once the time limit is reached, i.e., not only in the case of solving. |
a149403 to
51942c1
Compare
| SMTOption() {} | ||
| SMTOption(int i) : value(i) {} | ||
| //+ Should also support long representation | ||
| SMTOption(long i) : SMTOption(static_cast<int>(i)) {} |
There was a problem hiding this comment.
Hmm, when do you think it will be called with long? 🤔
And why allow it even, if you anyway would cast it to int?
| } | ||
|
|
||
| //+ SMTOption is not defined for long long | ||
| ok &= res.setOption(SMTConfig::o_time_limit, SMTOption(long(timeLimit)), msg); |
There was a problem hiding this comment.
Why not to convert it to int at this line instead of supporting SMTOption(long)?
There was a problem hiding this comment.
Also why break if ok is false? 🤔
This is the only place when Ok is used anyway, mb it is possible to omit it? Or do you want to use it in more places eventually?
| using namespace std::string_literals; | ||
|
|
||
| namespace { | ||
| bool pipeExecution = false; |
There was a problem hiding this comment.
What's an intuition behind moving it in its own namespace?
| // When it expires, the solving is terminated gracefully and unknown is returned | ||
| // Overrides previously set and still running limit | ||
| void setTimeLimit(std::chrono::milliseconds limit) { setTimeLimit(limit, {}); } | ||
| struct TimeLimitConf { |
There was a problem hiding this comment.
Why is separate struct needed for a single bool? 🤔 Do you think it will be extended?
| if (rval == false) | ||
| if (rval == false) { | ||
| notify_formatted(true, "set-option failed for %s: %s", name, msg); | ||
| } else if (main_solver) { |
There was a problem hiding this comment.
Should it be else if or else { assert(main_solver)}? Can it be that main_solver is null?
| TimeLimitImpl(MainSolver & s) : solver(s) {} | ||
| ~TimeLimitImpl(); | ||
|
|
||
| void setLimit(std::chrono::milliseconds); |
There was a problem hiding this comment.
Should it be milliseconds? 🤔
Why not seconds, do you think this much precision is needed?
| assert(limit > std::chrono::milliseconds::zero()); | ||
|
|
||
| // Override already running thread | ||
| if (isRunning()) { |
There was a problem hiding this comment.
Hmm, does it mean you are not updating limit, but killing current solver and starting a new one basically?
It is possible to set it via API, SMT-LIB, or as a command-line parameter.
I did not implement it within the
set-optioncommand, hence withinSMTConfig, because the timeout also takes an immediate action by starting a thread, which may stop the evaluation. The configuration may even be supplied by a user externally. It is also possible to specify this command after the solver was already created, which typically happens in SMT-LIB scripts. UsingSMTConfigwould require special treatment compared to other options, that is, to run an action once the option is set.Resolves #766
We still do not support a timeout per query for incremental solving (as e.g. CVC5 does).