@@ -176,29 +176,37 @@ namespace lp {
176176 }
177177 private:
178178 // the row comes from lar_solver
179- void fill_eprime_entry (const row_strip<mpq>& row , unsigned row_index ) {
180- m_f.push_back (row_index );
181- eprime_entry& e = m_eprime[row_index ];
182- e.m_row_index = row_index ;
183- const auto lcm = get_denominators_lcm (row );
179+ void fill_eprime_entry (const lar_term& t , unsigned term_index ) {
180+ m_f.push_back (term_index );
181+ eprime_entry& e = m_eprime[term_index ];
182+ e.m_row_index = term_index ;
183+ const auto lcm = get_denominators_lcm (t );
184184 mpq & c = e.m_c ;
185185 SASSERT (c.is_zero ());
186186
187- for (const auto & p: row ) {
187+ for (const auto & p: t ) {
188188 if (lia.is_fixed (p.var ())) {
189189 c += p.coeff ()*lia.lower_bound (p.var ()).x ;
190190 e.m_l = lra.mk_join (e.m_l , lra.get_bound_constraint_witnesses_for_column (p.var ()));
191191 }
192192 else {
193- m_e_matrix.add_new_element (row_index , p.var (), lcm * p.coeff ());
193+ m_e_matrix.add_new_element (term_index , p.var (), lcm * p.coeff ());
194194 }
195195 }
196+ unsigned j = t.j ();
197+ if (lia.is_fixed (j)) {
198+ c -= lia.lower_bound (j).x ;
199+ e.m_l = lra.mk_join (e.m_l , lra.get_bound_constraint_witnesses_for_column (j));
200+ }
201+ else {
202+ m_e_matrix.add_new_element (term_index, j, - lcm);
203+ }
196204 c *= lcm;
197205 e.m_entry_status = entry_status::F;
198206 }
199207
200- bool all_vars_are_int_and_small (const row_strip<mpq>& row ) const {
201- for (const auto & p : row ) {
208+ bool all_vars_are_int_and_small (const lar_term& term ) const {
209+ for (const auto & p : term ) {
202210 if (!lia.column_is_int (p.var ()))
203211 return false ;
204212 if (p.coeff ().is_big ())
@@ -218,19 +226,20 @@ namespace lp {
218226 m_infeas_explanation.clear ();
219227 lia.get_term ().clear ();
220228 m_eprime.clear ();
221- m_eprime.resize (n_of_rows);
222- for (unsigned i = 0 ; i < n_of_rows; i++) {
223- auto & row = lra.get_row (i);
224- TRACE (" dioph_eq" , tout << " row " << i <<" :" ; lra.print_row (row, tout) << " \n " ;
225- for (auto & p: row) {
226- lra.print_column_info (p.var (), tout);
227- });
228- if (!all_vars_are_int_and_small (row)) {
229+ m_eprime.resize (lra.terms ().size ());
230+ for (unsigned i = 0 ; i < lra.terms ().size (); i++) {
231+ const lar_term* t = lra.terms ()[i];
232+ TRACE (" dioph_eq" , tout << " term " << i <<" :" ; lra.print_term (*t, tout) << " \n " ;
233+ for (auto & p: *t) {
234+ lra.print_column_info (p.var (), tout);
235+ }
236+ );
237+ if (t->j () == UINT_MAX || !all_vars_are_int_and_small (*t)) {
229238 TRACE (" dioph_eq" , tout << " not all vars are int and small\n " ;);
230239 m_eprime[i].m_entry_status = entry_status::NO_S_NO_F;
231240 continue ;
232241 }
233- fill_eprime_entry (row , i);
242+ fill_eprime_entry (*t , i);
234243 TRACE (" dioph_eq" , print_eprime_entry (static_cast <unsigned >(i), tout););
235244 }
236245
0 commit comments