@@ -576,14 +576,14 @@ namespace lp {
576
576
577
577
void lar_solver::set_upper_bound_witness (lpvar j, u_dependency* dep, impq const & high) {
578
578
m_trail.push (vector_value_trail (m_columns, j));
579
- m_columns[j].upper_bound_witness () = dep;
579
+ m_columns[j].set_upper_bound_witness ( dep) ;
580
580
m_mpq_lar_core_solver.m_r_upper_bounds [j] = high;
581
581
insert_to_columns_with_changed_bounds (j);
582
582
}
583
583
584
584
void lar_solver::set_lower_bound_witness (lpvar j, u_dependency* dep, impq const & low) {
585
585
m_trail.push (vector_value_trail (m_columns, j));
586
- m_columns[j].lower_bound_witness () = dep;
586
+ m_columns[j].set_lower_bound_witness ( dep) ;
587
587
m_mpq_lar_core_solver.m_r_lower_bounds [j] = low;
588
588
insert_to_columns_with_changed_bounds (j);
589
589
}
@@ -2072,12 +2072,11 @@ namespace lp {
2072
2072
Z3_fallthrough;
2073
2073
case LE: {
2074
2074
auto up = numeric_pair<mpq>(right_side, y_of_bound);
2075
- if (up < m_mpq_lar_core_solver. m_r_lower_bounds [j] ) {
2075
+ if (up < get_lower_bound (j) ) {
2076
2076
set_crossed_bounds_column_and_deps (j, true , dep);
2077
2077
}
2078
2078
else {
2079
- impq const & old_up = m_mpq_lar_core_solver.m_r_upper_bounds [j];
2080
- if (up >= old_up)
2079
+ if (up >= get_upper_bound (j))
2081
2080
return ;
2082
2081
set_upper_bound_witness (j, dep, up);
2083
2082
}
@@ -2088,23 +2087,22 @@ namespace lp {
2088
2087
Z3_fallthrough;
2089
2088
case GE: {
2090
2089
auto low = numeric_pair<mpq>(right_side, y_of_bound);
2091
- if (low > m_mpq_lar_core_solver. m_r_upper_bounds [j] ) {
2090
+ if (low > get_upper_bound (j) ) {
2092
2091
set_crossed_bounds_column_and_deps (j, false , dep);
2093
2092
}
2094
2093
else {
2095
- impq const & old_low = m_mpq_lar_core_solver.m_r_lower_bounds [j];
2096
- if (low < old_low)
2094
+ if (low < get_lower_bound (j))
2097
2095
return ;
2098
2096
set_lower_bound_witness (j, dep, low);
2099
- m_mpq_lar_core_solver.m_column_types [j] = (low == m_mpq_lar_core_solver. m_r_upper_bounds [j] ? column_type::fixed : column_type::boxed);
2097
+ m_mpq_lar_core_solver.m_column_types [j] = (low == get_upper_bound (j) ? column_type::fixed : column_type::boxed);
2100
2098
}
2101
2099
break ;
2102
2100
}
2103
2101
case EQ: {
2104
2102
auto v = numeric_pair<mpq>(right_side, zero_of_type<mpq>());
2105
- if (v > m_mpq_lar_core_solver. m_r_upper_bounds [j] )
2103
+ if (v > get_upper_bound (j) )
2106
2104
set_crossed_bounds_column_and_deps (j, false , dep);
2107
- else if (v < m_mpq_lar_core_solver. m_r_lower_bounds [j] )
2105
+ else if (v < get_lower_bound (j) )
2108
2106
set_crossed_bounds_column_and_deps (j, true , dep);
2109
2107
else {
2110
2108
set_upper_bound_witness (j, dep, v);
@@ -2116,8 +2114,8 @@ namespace lp {
2116
2114
default :
2117
2115
UNREACHABLE ();
2118
2116
}
2119
- numeric_pair<mpq> const & lo = m_mpq_lar_core_solver. m_r_lower_bounds [j] ;
2120
- numeric_pair<mpq> const & hi = m_mpq_lar_core_solver. m_r_upper_bounds [j] ;
2117
+ numeric_pair<mpq> const & lo = get_lower_bound (j) ;
2118
+ numeric_pair<mpq> const & hi = get_upper_bound (j) ;
2121
2119
if (lo == hi)
2122
2120
m_mpq_lar_core_solver.m_column_types [j] = column_type::fixed;
2123
2121
}
@@ -2133,28 +2131,28 @@ namespace lp {
2133
2131
Z3_fallthrough;
2134
2132
case LE: {
2135
2133
auto up = numeric_pair<mpq>(right_side, y_of_bound);
2136
- if (up < m_mpq_lar_core_solver. m_r_lower_bounds [j] ) {
2134
+ if (up < get_lower_bound (j) ) {
2137
2135
set_crossed_bounds_column_and_deps (j, true , dep);
2138
2136
}
2139
2137
else {
2140
2138
set_upper_bound_witness (j, dep, up);
2141
- m_mpq_lar_core_solver.m_column_types [j] = (up == m_mpq_lar_core_solver. m_r_lower_bounds [j] ? column_type::fixed : column_type::boxed);
2139
+ m_mpq_lar_core_solver.m_column_types [j] = (up == get_lower_bound (j) ? column_type::fixed : column_type::boxed);
2142
2140
}
2143
2141
break ;
2144
2142
}
2145
2143
case GT:
2146
2144
y_of_bound = 1 ;
2147
2145
case GE: {
2148
2146
auto low = numeric_pair<mpq>(right_side, y_of_bound);
2149
- if (low < m_mpq_lar_core_solver. m_r_lower_bounds [j] ) {
2147
+ if (low < get_lower_bound (j) ) {
2150
2148
return ;
2151
2149
}
2152
2150
set_lower_bound_witness (j, dep, low);
2153
2151
break ;
2154
2152
}
2155
2153
case EQ: {
2156
2154
auto v = numeric_pair<mpq>(right_side, zero_of_type<mpq>());
2157
- if (v < m_mpq_lar_core_solver. m_r_lower_bounds [j] ) {
2155
+ if (v < get_lower_bound (j) ) {
2158
2156
set_crossed_bounds_column_and_deps (j, true , dep);
2159
2157
}
2160
2158
else {
@@ -2181,7 +2179,7 @@ namespace lp {
2181
2179
case LE:
2182
2180
{
2183
2181
auto up = numeric_pair<mpq>(right_side, y_of_bound);
2184
- if (up >= m_mpq_lar_core_solver. m_r_upper_bounds [j] )
2182
+ if (up >= get_upper_bound (j) )
2185
2183
return ;
2186
2184
set_upper_bound_witness (j, dep, up);
2187
2185
}
@@ -2192,19 +2190,19 @@ namespace lp {
2192
2190
case GE:
2193
2191
{
2194
2192
auto low = numeric_pair<mpq>(right_side, y_of_bound);
2195
- if (low > m_mpq_lar_core_solver. m_r_upper_bounds [j] ) {
2193
+ if (low > get_upper_bound (j) ) {
2196
2194
set_crossed_bounds_column_and_deps (j, false , dep);
2197
2195
}
2198
2196
else {
2199
2197
set_lower_bound_witness (j, dep, low);
2200
- m_mpq_lar_core_solver.m_column_types [j] = (low == m_mpq_lar_core_solver. m_r_upper_bounds [j] ? column_type::fixed : column_type::boxed);
2198
+ m_mpq_lar_core_solver.m_column_types [j] = (low == get_upper_bound (j) ? column_type::fixed : column_type::boxed);
2201
2199
}
2202
2200
}
2203
2201
break ;
2204
2202
case EQ:
2205
2203
{
2206
2204
auto v = numeric_pair<mpq>(right_side, zero_of_type<mpq>());
2207
- if (v > m_mpq_lar_core_solver. m_r_upper_bounds [j] ) {
2205
+ if (v > get_upper_bound (j) ) {
2208
2206
set_crossed_bounds_column_and_deps (j, false , dep);
2209
2207
}
2210
2208
else {
@@ -2265,11 +2263,10 @@ namespace lp {
2265
2263
2266
2264
impq ivalue (value);
2267
2265
auto & lcs = m_mpq_lar_core_solver;
2268
- auto & slv = m_mpq_lar_core_solver.m_r_solver ;
2269
2266
2270
- if (slv. column_has_upper_bound (j) && lcs.m_r_upper_bounds ()[j] < ivalue)
2267
+ if (column_has_upper_bound (j) && lcs.m_r_upper_bounds ()[j] < ivalue)
2271
2268
return false ;
2272
- if (slv. column_has_lower_bound (j) && lcs.m_r_lower_bounds ()[j] > ivalue)
2269
+ if (column_has_lower_bound (j) && lcs.m_r_lower_bounds ()[j] > ivalue)
2273
2270
return false ;
2274
2271
2275
2272
set_value_for_nbasic_column (j, ivalue);
@@ -2279,27 +2276,26 @@ namespace lp {
2279
2276
2280
2277
bool lar_solver::tighten_term_bounds_by_delta (lpvar j, const impq& delta) {
2281
2278
SASSERT (column_has_term (j));
2282
- auto & slv = m_mpq_lar_core_solver.m_r_solver ;
2283
2279
TRACE (" cube" , tout << " delta = " << delta << std::endl;
2284
2280
m_int_solver->display_column (tout, j); );
2285
- if (slv. column_has_upper_bound (j) && slv. column_has_lower_bound (j)) {
2286
- if (slv. m_upper_bounds [j] - delta < slv. m_lower_bounds [j] + delta) {
2281
+ if (column_has_upper_bound (j) && column_has_lower_bound (j)) {
2282
+ if (get_upper_bound (j) - delta < get_lower_bound (j) + delta) {
2287
2283
TRACE (" cube" , tout << " cannot tighten, delta = " << delta;);
2288
2284
return false ;
2289
2285
}
2290
2286
}
2291
2287
TRACE (" cube" , tout << " can tighten" ;);
2292
- if (slv. column_has_upper_bound (j)) {
2293
- if (!is_zero (delta.y ) || !is_zero (slv. m_upper_bounds [j] .y ))
2294
- add_var_bound (j, lconstraint_kind::LT, slv. m_upper_bounds [j] .x - delta.x );
2288
+ if (column_has_upper_bound (j)) {
2289
+ if (!is_zero (delta.y ) || !is_zero (get_upper_bound (j) .y ))
2290
+ add_var_bound (j, lconstraint_kind::LT, get_upper_bound (j) .x - delta.x );
2295
2291
else
2296
- add_var_bound (j, lconstraint_kind::LE, slv. m_upper_bounds [j] .x - delta.x );
2292
+ add_var_bound (j, lconstraint_kind::LE, get_upper_bound (j) .x - delta.x );
2297
2293
}
2298
- if (slv. column_has_lower_bound (j)) {
2299
- if (!is_zero (delta.y ) || !is_zero (slv. m_lower_bounds [j] .y ))
2300
- add_var_bound (j, lconstraint_kind::GT, slv. m_lower_bounds [j] .x + delta.x );
2294
+ if (column_has_lower_bound (j)) {
2295
+ if (!is_zero (delta.y ) || !is_zero (get_lower_bound (j) .y ))
2296
+ add_var_bound (j, lconstraint_kind::GT, get_lower_bound (j) .x + delta.x );
2301
2297
else
2302
- add_var_bound (j, lconstraint_kind::GE, slv. m_lower_bounds [j] .x + delta.x );
2298
+ add_var_bound (j, lconstraint_kind::GE, get_lower_bound (j) .x + delta.x );
2303
2299
}
2304
2300
return true ;
2305
2301
}
0 commit comments