@@ -139,7 +139,41 @@ namespace lp {
139
139
return solver.get_status () == lp_status::INFEASIBLE;
140
140
}
141
141
}
142
- };
142
+ void require_nbasis_sort () { m_mpq_lar_core_solver.m_r_solver .m_nbasis_sort_counter = 0 ; }
143
+ void register_in_fixed_var_table (unsigned j, unsigned & equal_to_j) {
144
+ SASSERT (lra.column_is_fixed (j));
145
+ equal_to_j = null_lpvar;
146
+ const impq& bound = lra.get_lower_bound (j);
147
+ if (!bound.y .is_zero ())
148
+ return ;
149
+
150
+ const mpq& key = bound.x ;
151
+ unsigned k;
152
+ bool j_is_int = lra.column_is_int (j);
153
+ if (j_is_int) {
154
+ if (!m_fixed_var_table_int.find (key, k)) {
155
+ m_fixed_var_table_int.insert (key, j);
156
+ return ;
157
+ }
158
+ }
159
+ else { // j is not integral column
160
+ if (!m_fixed_var_table_real.find (key, k)) {
161
+ m_fixed_var_table_real.insert (key, j);
162
+ return ;
163
+ }
164
+ }
165
+
166
+ CTRACE (" arith" , !lra.column_is_fixed (k), lra.print_terms (tout););
167
+ // SASSERT(column_is_fixed(k));
168
+ if (j != k && lra.column_is_fixed (k)) {
169
+ SASSERT (lra.column_is_int (j) == lra.column_is_int (k));
170
+ equal_to_j = k;
171
+ TRACE (" lar_solver" , tout << " found equal column k = " << k <<
172
+ " , external = " << equal_to_j << " \n " ;);
173
+ }
174
+ }
175
+
176
+ }; // imp
143
177
unsigned_vector& lar_solver::row_bounds_to_replay () { return m_imp->m_row_bounds_to_replay ; }
144
178
145
179
trail_stack& lar_solver::trail () { return m_imp->m_trail ; }
@@ -211,8 +245,6 @@ namespace lp {
211
245
212
246
indexed_uint_set& lar_solver::basic_columns_with_changed_cost () { return m_imp->m_basic_columns_with_changed_cost ; }
213
247
214
- void lar_solver::require_nbasis_sort () { m_imp->m_mpq_lar_core_solver .m_r_solver .m_nbasis_sort_counter = 0 ; }
215
-
216
248
mpq lar_solver::bound_span_x (lpvar j) const {
217
249
SASSERT (column_has_upper_bound (j) && column_has_lower_bound (j));
218
250
return get_upper_bound (j).x - get_lower_bound (j).x ;
@@ -533,7 +565,7 @@ namespace lp {
533
565
m_imp->m_usage_in_terms .pop (k);
534
566
m_imp->m_dependencies .pop_scope (k);
535
567
// init the nbasis sorting
536
- require_nbasis_sort ();
568
+ m_imp-> require_nbasis_sort ();
537
569
set_status (lp_status::UNKNOWN);
538
570
}
539
571
@@ -759,7 +791,7 @@ namespace lp {
759
791
TRACE (" lar_solver" , print_term (term, tout << " maximize: " ) << " \n "
760
792
<< constraints () << " , strategy = " << (int )settings ().simplex_strategy () << " \n " ;);
761
793
if (settings ().simplex_strategy () != simplex_strategy_enum::tableau_costs)
762
- require_nbasis_sort ();
794
+ m_imp-> require_nbasis_sort ();
763
795
flet f (settings ().simplex_strategy (), simplex_strategy_enum::tableau_costs);
764
796
prepare_costs_for_r_solver (term);
765
797
ret = maximize_term_on_tableau (term, term_max);
@@ -1962,7 +1994,7 @@ namespace lp {
1962
1994
else {
1963
1995
get_core_solver ().m_r_heading .push_back (-static_cast <int >(get_core_solver ().m_r_nbasis .size ()) - 1 );
1964
1996
get_core_solver ().m_r_nbasis .push_back (j);
1965
- require_nbasis_sort ();
1997
+ m_imp-> require_nbasis_sort ();
1966
1998
}
1967
1999
}
1968
2000
@@ -2099,38 +2131,6 @@ namespace lp {
2099
2131
remove_non_fixed_from_table (m_imp->m_fixed_var_table_real );
2100
2132
}
2101
2133
2102
- void lar_solver::register_in_fixed_var_table (unsigned j, unsigned & equal_to_j) {
2103
- SASSERT (column_is_fixed (j));
2104
- equal_to_j = null_lpvar;
2105
- const impq& bound = get_lower_bound (j);
2106
- if (!bound.y .is_zero ())
2107
- return ;
2108
-
2109
- const mpq& key = bound.x ;
2110
- unsigned k;
2111
- bool j_is_int = column_is_int (j);
2112
- if (j_is_int) {
2113
- if (!m_imp->m_fixed_var_table_int .find (key, k)) {
2114
- m_imp->m_fixed_var_table_int .insert (key, j);
2115
- return ;
2116
- }
2117
- }
2118
- else { // j is not integral column
2119
- if (!m_imp->m_fixed_var_table_real .find (key, k)) {
2120
- m_imp->m_fixed_var_table_real .insert (key, j);
2121
- return ;
2122
- }
2123
- }
2124
-
2125
- CTRACE (" arith" , !column_is_fixed (k), print_terms (tout););
2126
- // SASSERT(column_is_fixed(k));
2127
- if (j != k && column_is_fixed (k)) {
2128
- SASSERT (column_is_int (j) == column_is_int (k));
2129
- equal_to_j = k;
2130
- TRACE (" lar_solver" , tout << " found equal column k = " << k <<
2131
- " , external = " << equal_to_j << " \n " ;);
2132
- }
2133
- }
2134
2134
2135
2135
void lar_solver::activate_check_on_equal (constraint_index ci, unsigned & equal_column) {
2136
2136
auto const & c = m_imp->m_constraints [ci];
@@ -2318,7 +2318,7 @@ namespace lp {
2318
2318
update_column_type_and_bound (j, right_side, constr_index);
2319
2319
equal_to_j = null_lpvar;
2320
2320
if (column_is_fixed (j)) {
2321
- register_in_fixed_var_table (j, equal_to_j);
2321
+ m_imp-> register_in_fixed_var_table (j, equal_to_j);
2322
2322
}
2323
2323
}
2324
2324
0 commit comments