Skip to content

Commit 9b1f558

Browse files
NikolajBjornerhgvk94
authored andcommitted
1 parent 93efb56 commit 9b1f558

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

src/smt/theory_dense_diff_logic_def.h

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -764,11 +764,17 @@ namespace smt {
764764
765765
Therefore:
766766
767-
epsilon <= (n_y + n_c - n_x) / (k_x - k_y - k_c)
767+
epsilon <= (n_y + n_c - n_x) / 2*(k_x - k_y - k_c)
768+
769+
Division by 2 is introduced to avoid introducing new equalities.
770+
Consider when n_x = n_y = k_x = k_y = 0, n_c = 4, k_c = -1,
771+
then n_c / -k_c = n_c, hence setting epsilon to n_c introduces a value
772+
that is not smaller than the smallest integral difference.
768773
*/
769774
template<typename Ext>
770775
void theory_dense_diff_logic<Ext>::compute_epsilon() {
771776
m_epsilon = rational(1, 2);
777+
TRACE("ddl", display(tout););
772778
typename edges::const_iterator it = m_edges.begin();
773779
typename edges::const_iterator end = m_edges.end();
774780
// first edge is null
@@ -783,11 +789,15 @@ namespace smt {
783789
rational k_y = m_assignment[e.m_source].get_infinitesimal().to_rational();
784790
rational n_c = e.m_offset.get_rational().to_rational();
785791
rational k_c = e.m_offset.get_infinitesimal().to_rational();
786-
TRACE("epsilon", tout << "(n_x,k_x): " << n_x << ", " << k_x << ", (n_y,k_y): " << n_y << ", " << k_y << ", (n_c,k_c): " << n_c << ", " << k_c << "\n";);
792+
TRACE("ddl",
793+
tout << e.m_source << " - " << e.m_target << " <= " << e.m_offset << "\n";
794+
tout << "(n_x,k_x): " << n_x << ", " << k_x <<
795+
", (n_y,k_y): " << n_y << ", " << k_y <<
796+
", (n_c,k_c): " << n_c << ", " << k_c << "\n";);
787797
if (n_x < n_y + n_c && k_x > k_y + k_c) {
788-
rational new_epsilon = (n_y + n_c - n_x) / (k_x - k_y - k_c);
798+
rational new_epsilon = (n_y + n_c - n_x) / (2*(k_x - k_y - k_c));
789799
if (new_epsilon < m_epsilon) {
790-
TRACE("epsilon", tout << "new epsilon: " << new_epsilon << "\n";);
800+
TRACE("ddl", tout << "new epsilon: " << new_epsilon << "\n";);
791801
m_epsilon = new_epsilon;
792802
}
793803
}

0 commit comments

Comments
 (0)