mirror of
https://github.com/Z3Prover/z3
synced 2025-04-27 02:45:51 +00:00
fix latent sign bug
This commit is contained in:
parent
fe1fff3b7e
commit
792ffeeda7
1 changed files with 4 additions and 3 deletions
|
@ -1183,7 +1183,8 @@ namespace lp {
|
||||||
slack += coeff * (adj_sign < 0 ? get_upper_bound(j) : get_lower_bound(j));
|
slack += coeff * (adj_sign < 0 ? get_upper_bound(j) : get_lower_bound(j));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_pos = slack.is_pos();
|
#define get_sign(_x_) (_x_.is_pos() ? 1 : (_x_.is_neg() ? -1 : 0))
|
||||||
|
int sign = get_sign(slack);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (auto& [coeff, j] : inf_row) {
|
for (auto& [coeff, j] : inf_row) {
|
||||||
|
@ -1199,7 +1200,7 @@ namespace lp {
|
||||||
if (ul.previous_upper() != UINT_MAX) {
|
if (ul.previous_upper() != UINT_MAX) {
|
||||||
auto const& [_is_upper, _j, _bound, _column] = m_column_updates[ul.previous_upper()];
|
auto const& [_is_upper, _j, _bound, _column] = m_column_updates[ul.previous_upper()];
|
||||||
auto new_slack = slack + coeff * (_bound - get_upper_bound(j));
|
auto new_slack = slack + coeff * (_bound - get_upper_bound(j));
|
||||||
if (is_pos == new_slack.is_pos()) {
|
if (sign == get_sign(new_slack)) {
|
||||||
//verbose_stream() << "can weaken j" << j << " " << coeff << " " << get_upper_bound(j) << " " << _bound << "\n";
|
//verbose_stream() << "can weaken j" << j << " " << coeff << " " << get_upper_bound(j) << " " << _bound << "\n";
|
||||||
slack = new_slack;
|
slack = new_slack;
|
||||||
bound_constr_i = _column.upper_bound_witness();
|
bound_constr_i = _column.upper_bound_witness();
|
||||||
|
@ -1210,7 +1211,7 @@ namespace lp {
|
||||||
if (ul.previous_lower() != UINT_MAX) {
|
if (ul.previous_lower() != UINT_MAX) {
|
||||||
auto const& [_is_upper, _j, _bound, _column] = m_column_updates[ul.previous_lower()];
|
auto const& [_is_upper, _j, _bound, _column] = m_column_updates[ul.previous_lower()];
|
||||||
auto new_slack = slack + coeff * (_bound - get_lower_bound(j));
|
auto new_slack = slack + coeff * (_bound - get_lower_bound(j));
|
||||||
if (is_pos == new_slack.is_pos()) {
|
if (sign == get_sign(new_slack)) {
|
||||||
//verbose_stream() << "can weaken j" << j << " " << coeff << " " << get_lower_bound(j) << " " << _bound << "\n";
|
//verbose_stream() << "can weaken j" << j << " " << coeff << " " << get_lower_bound(j) << " " << _bound << "\n";
|
||||||
slack = new_slack;
|
slack = new_slack;
|
||||||
bound_constr_i = _column.lower_bound_witness();
|
bound_constr_i = _column.lower_bound_witness();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue