@@ -77,9 +77,12 @@ namespace lp {
77
77
unsigned size () const {return static_cast <unsigned >(m_map.size ());}
78
78
79
79
void erase_val (unsigned b) {
80
- SASSERT (contains (m_rev_map, b) && contains (m_map, m_rev_map[b]));
81
- unsigned key = m_rev_map[b];
82
- m_rev_map.erase (b);
80
+ VERIFY (contains (m_rev_map, b) && contains (m_map, m_rev_map[b]));
81
+ auto it = m_rev_map.find (b);
82
+ if (it == m_rev_map.end ()) return ;
83
+ unsigned key = it->second ;
84
+ m_rev_map.erase (it);
85
+ VERIFY (has_key (key));
83
86
m_map.erase (key);
84
87
}
85
88
bool has_val (unsigned b) const {
@@ -123,7 +126,7 @@ namespace lp {
123
126
}
124
127
unsigned operator [](unsigned i) const {
125
128
auto it = m_map.find (i);
126
- SASSERT (it != m_map.end ());
129
+ VERIFY (it != m_map.end ());
127
130
return it->second ;
128
131
}
129
132
};
@@ -151,10 +154,10 @@ namespace lp {
151
154
}
152
155
153
156
void erase_by_second_key (unsigned b) {
154
- SASSERT (m_bij.has_val (b));
157
+ VERIFY (m_bij.has_val (b));
155
158
m_bij.erase_val (b);
156
159
auto it = m_data.find (b);
157
- SASSERT (it != m_data.end ());
160
+ VERIFY (it != m_data.end ());
158
161
m_data.erase (it);
159
162
}
160
163
@@ -169,7 +172,7 @@ namespace lp {
169
172
// Get the data by 'b' directly
170
173
const T& get_by_val (unsigned b) const {
171
174
auto it = m_data.find (b);
172
- SASSERT (it != m_data.end ());
175
+ VERIFY (it != m_data.end ());
173
176
return it->second ;
174
177
}
175
178
};
@@ -351,7 +354,7 @@ namespace lp {
351
354
352
355
const mpq& operator [](unsigned j) const {
353
356
SASSERT (j >= 0 && j < m_index.size ());
354
- SASSERT (m_index[j] >= 0 && m_index[j] < m_data.size ());
357
+ SASSERT (m_index[j] >= 0 && m_index[j] < ( int ) m_data.size ());
355
358
return m_data[m_index[j]].coeff ();
356
359
}
357
360
@@ -470,8 +473,8 @@ namespace lp {
470
473
471
474
472
475
unsigned m_conflict_index = -1 ; // the row index of the conflict
473
- unsigned m_max_number_of_iterations = 100 ;
474
- unsigned m_number_of_iterations ;
476
+ unsigned m_max_of_branching_iterations = 0 ;
477
+ unsigned m_number_of_branching_calls ;
475
478
struct branch {
476
479
unsigned m_j = UINT_MAX;
477
480
mpq m_rs;
@@ -1084,7 +1087,7 @@ namespace lp {
1084
1087
m_conflict_index = -1 ;
1085
1088
m_infeas_explanation.clear ();
1086
1089
lia.get_term ().clear ();
1087
- m_number_of_iterations = 0 ;
1090
+ m_number_of_branching_calls = 0 ;
1088
1091
m_branch_stack.clear ();
1089
1092
m_lra_level = 0 ;
1090
1093
@@ -1182,11 +1185,6 @@ namespace lp {
1182
1185
return true ;
1183
1186
}
1184
1187
// c_g is not integral
1185
- if (lra.stats ().m_dio_calls %
1186
- lra.settings ().dio_branch_from_proof_period () ==
1187
- 0 &&
1188
- !has_fresh_var (ei))
1189
- prepare_lia_branch_report (ei, e, g, c_g);
1190
1188
return false ;
1191
1189
}
1192
1190
@@ -1738,8 +1736,8 @@ namespace lp {
1738
1736
lia_move branching_on_undef () {
1739
1737
m_explanation_of_branches.clear ();
1740
1738
bool need_create_branch = true ;
1741
- m_number_of_iterations = 0 ;
1742
- while (++m_number_of_iterations < m_max_number_of_iterations ) {
1739
+ m_number_of_branching_calls = 0 ;
1740
+ while (++m_number_of_branching_calls < m_max_of_branching_iterations ) {
1743
1741
lra.stats ().m_dio_branch_iterations ++;
1744
1742
if (need_create_branch) {
1745
1743
if (!push_branch ()) {
@@ -1954,12 +1952,14 @@ namespace lp {
1954
1952
if (ret == lia_move::branch || ret == lia_move::conflict)
1955
1953
return ret;
1956
1954
SASSERT (ret == lia_move::undef);
1957
- ret = branching_on_undef ();
1955
+ if (lra.stats ().m_dio_calls % lra.settings ().dio_branching_period () == 0 ) {
1956
+ ret = branching_on_undef ();
1957
+ }
1958
1958
if (ret == lia_move::sat || ret == lia_move::conflict) {
1959
1959
return ret;
1960
1960
}
1961
1961
SASSERT (ret == lia_move::undef);
1962
- m_max_number_of_iterations = (unsigned )m_max_number_of_iterations /2 ;
1962
+ m_max_of_branching_iterations = (unsigned )m_max_of_branching_iterations /2 ;
1963
1963
1964
1964
return lia_move::undef;
1965
1965
}
@@ -1979,8 +1979,7 @@ namespace lp {
1979
1979
mpq t;
1980
1980
for (const auto & p : m_e_matrix.m_rows [ei]) {
1981
1981
t = abs (p.coeff ());
1982
- if (first || t < ahk ||
1983
- (t == ahk && p.var () < k)) { // the last condition is for debug
1982
+ if (first || t < ahk) {
1984
1983
ahk = t;
1985
1984
k_sign = p.coeff ().is_pos () ? 1 : -1 ;
1986
1985
k = p.var ();
@@ -2092,11 +2091,10 @@ namespace lp {
2092
2091
2093
2092
mpq coeff = m_e_matrix.get_val (c);
2094
2093
TRACE (" dioph_eq" , tout << " before pivot entry :" ; print_entry (c.var (), tout) << std::endl;);
2095
- unsigned c_row = c.var ();
2096
2094
m_e_matrix.pivot_term_to_row_given_cell (t, c, j, j_sign);
2097
2095
TRACE (" dioph_eq" , tout << " after pivoting c_row:" ;
2098
- print_entry (c_row , tout););
2099
- SASSERT (entry_invariant (c_row ));
2096
+ print_entry (c. var () , tout););
2097
+ SASSERT (entry_invariant (c. var () ));
2100
2098
cell_to_process--;
2101
2099
}
2102
2100
SASSERT (is_eliminated_from_f (j));
0 commit comments