mirror of
https://github.com/Z3Prover/z3
synced 2025-04-12 04:03:39 +00:00
try another sorting of terms to tighten
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
This commit is contained in:
parent
ec7c61569d
commit
50418fa170
|
@ -1389,11 +1389,39 @@ namespace lp {
|
||||||
}
|
}
|
||||||
sorted_changed_terms.push_back(j);
|
sorted_changed_terms.push_back(j);
|
||||||
}
|
}
|
||||||
// Sort by term_weight descending
|
|
||||||
std::sort(sorted_changed_terms.begin(), sorted_changed_terms.end(),
|
bool sort_by_weight = false;
|
||||||
[this](unsigned j1, unsigned j2) {
|
if (sort_by_weight)
|
||||||
return term_weight(lra.get_term(j1)) > term_weight(lra.get_term(j2) );
|
// Sort by term_weight descending
|
||||||
});
|
std::sort(sorted_changed_terms.begin(), sorted_changed_terms.end(),
|
||||||
|
[this](unsigned j1, unsigned j2) {
|
||||||
|
return term_weight(lra.get_term(j1)) > term_weight(lra.get_term(j2) );
|
||||||
|
});
|
||||||
|
else {
|
||||||
|
std::sort(sorted_changed_terms.begin(), sorted_changed_terms.end(),
|
||||||
|
[this](unsigned j1, unsigned j2) {
|
||||||
|
// First check if both columns are boxed
|
||||||
|
bool j1_is_boxed = lia.is_boxed(j1);
|
||||||
|
bool j2_is_boxed = lia.is_boxed(j2);
|
||||||
|
|
||||||
|
// If one is boxed and the other isn't, prefer the boxed one
|
||||||
|
if (j1_is_boxed && !j2_is_boxed)
|
||||||
|
return true;
|
||||||
|
if (!j1_is_boxed && j2_is_boxed)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// If both are boxed, compare spans (prefer smaller spans)
|
||||||
|
if (j1_is_boxed && j2_is_boxed) {
|
||||||
|
mpq span1 = lra.bound_span_x(j1);
|
||||||
|
mpq span2 = lra.bound_span_x(j2);
|
||||||
|
if (span1 != span2)
|
||||||
|
return span1 < span2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fall back to weight comparison
|
||||||
|
return term_weight(lra.get_term(j1)) > term_weight(lra.get_term(j2));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
lia_move r = lia_move::undef;
|
lia_move r = lia_move::undef;
|
||||||
// Process sorted terms
|
// Process sorted terms
|
||||||
|
|
Loading…
Reference in a new issue