Skip to content

Commit e3f5e8c

Browse files
committed
restore lar_solver::add_named_var
Signed-off-by: Lev Nachmanson <[email protected]>
1 parent b375faa commit e3f5e8c

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

src/math/lp/lar_solver.cpp

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1289,6 +1289,11 @@ namespace lp {
12891289
#endif
12901290
return true;
12911291
}
1292+
lpvar lar_solver::add_named_var(unsigned ext_j, bool is_int, const std::string& name) {
1293+
lpvar j = add_var(ext_j, is_int);
1294+
m_imp->m_var_register.set_name(j, name);
1295+
return j;
1296+
}
12921297

12931298
bool lar_solver::inf_explanation_is_correct() const {
12941299
#ifdef Z3DEBUG
@@ -1415,33 +1420,25 @@ namespace lp {
14151420

14161421
#if 1
14171422
if(is_upper) {
1418-
unsigned current_update_index = ul.previous_upper();
1419-
while (current_update_index != UINT_MAX) {
1420-
auto const& [_is_upper, _j, _bound, _column] = m_imp->m_column_updates[current_update_index];
1423+
if (ul.previous_upper() != UINT_MAX) {
1424+
auto const& [_is_upper, _j, _bound, _column] = m_imp->m_column_updates[ul.previous_upper()];
14211425
auto new_slack = slack + coeff * (_bound - get_upper_bound(j));
14221426
if (sign == get_sign(new_slack)) {
14231427
//verbose_stream() << "can weaken upper j" << j << " " << coeff << " " << get_upper_bound(j) << " " << _bound << "\n";
14241428
slack = new_slack;
14251429
bound_constr_i = _column.upper_bound_witness();
1426-
current_update_index = _column.previous_upper(); // Move to the next previous bound in the list
1427-
} else
1428-
break; // Stop if weakening is not possible with this previous bound
1429-
1430+
}
14301431
}
14311432
}
14321433
else {
1433-
unsigned prev_l = ul.previous_lower();
1434-
while (prev_l != UINT_MAX) {
1435-
auto const& [_is_upper, _j, _bound, _column] = m_imp->m_column_updates[prev_l];
1434+
if (ul.previous_lower() != UINT_MAX) {
1435+
auto const& [_is_upper, _j, _bound, _column] = m_imp->m_column_updates[ul.previous_lower()];
14361436
auto new_slack = slack + coeff * (_bound - get_lower_bound(j));
14371437
if (sign == get_sign(new_slack)) {
14381438
//verbose_stream() << "can weaken lower j" << j << " " << coeff << " " << get_lower_bound(j) << " " << _bound << "\n";
14391439
slack = new_slack;
14401440
bound_constr_i = _column.lower_bound_witness();
1441-
prev_l = _column.previous_lower();
14421441
}
1443-
else
1444-
break;
14451442
}
14461443
}
14471444
#endif

src/math/lp/lar_solver.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,7 @@ class lar_solver : public column_namer {
296296
lar_term t;
297297
};
298298

299+
lpvar add_named_var(unsigned ext_j, bool is_integer, const std::string&);
299300
void solve_for(unsigned_vector const& js, vector<solution>& sol);
300301
void check_fixed(unsigned j);
301302
void solve_for(unsigned j, uint_set& tabu, vector<solution>& sol);

0 commit comments

Comments
 (0)