Given a problem that is encoded using Z3's reals, which of the statistics that Z3 /smt2 /st
produces might be helpful in order to judge if the reals engine "has problems/does lots of work"?
In my case, I have two mostly equivalent encodings of the problem, both using reals. The "small" difference in the encoding, however, makes a big difference in runtime, namely, that encoding A takes 2:30min and encoding B 13min. The Z3 statistics show that conflicts
and quant-instantiations
are mostly equivalent, but others are not, for example grobner
, pivots
and nonlinear-horner
.
The two different statistics are available as a gist.
EDIT (to address Leo's comment):
The SMT2-encoding generated by both versions is ~30k lines and the assertions where reals are used are sprinkled all over the code. The main difference is that encoding B uses lots of underspecified real-typed constants from the range 0.0
to 1.0
that are bounded by inequalities, e.g. 0.0 < r1 < 1.0
or 0.0 < r3 < 0.75 - r1 - r2
, whereas in encoding A lots of these underspecified constants have been replaced with fixed real values from the same range, e.g., 0.1
or 0.75 - 0.01
. Both encodings use non-linear real arithmetic, e.g. r1 * (1.0 - r2)
.
A few random examples from the two encodings are available as a gist. All occurring variables are underspecified reals as described above.
PS: Does introducing aliases for fixed real values, e.g.,
(define-sort $Perms () Real)
(declare-const $Perms.$Full $Perms)
(declare-const $Perms.$None $Perms)
(assert (= $Perms.Zero 0.0))
(assert (= $Perms.Write 1.0))
inflict significant performance penalties?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…