@@ -176,29 +176,37 @@ namespace lp {
176
176
}
177
177
private:
178
178
// 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 );
184
184
mpq & c = e.m_c ;
185
185
SASSERT (c.is_zero ());
186
186
187
- for (const auto & p: row ) {
187
+ for (const auto & p: t ) {
188
188
if (lia.is_fixed (p.var ())) {
189
189
c += p.coeff ()*lia.lower_bound (p.var ()).x ;
190
190
e.m_l = lra.mk_join (e.m_l , lra.get_bound_constraint_witnesses_for_column (p.var ()));
191
191
}
192
192
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 ());
194
194
}
195
195
}
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
+ }
196
204
c *= lcm;
197
205
e.m_entry_status = entry_status::F;
198
206
}
199
207
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 ) {
202
210
if (!lia.column_is_int (p.var ()))
203
211
return false ;
204
212
if (p.coeff ().is_big ())
@@ -218,19 +226,20 @@ namespace lp {
218
226
m_infeas_explanation.clear ();
219
227
lia.get_term ().clear ();
220
228
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)) {
229
238
TRACE (" dioph_eq" , tout << " not all vars are int and small\n " ;);
230
239
m_eprime[i].m_entry_status = entry_status::NO_S_NO_F;
231
240
continue ;
232
241
}
233
- fill_eprime_entry (row , i);
242
+ fill_eprime_entry (*t , i);
234
243
TRACE (" dioph_eq" , print_eprime_entry (static_cast <unsigned >(i), tout););
235
244
}
236
245
0 commit comments