mirror of
https://github.com/Z3Prover/z3
synced 2025-04-27 02:45:51 +00:00
Perf branch (#4710)
* avoid creating rows with all but one fixed columns Signed-off-by: Lev Nachmanson <levnach@hotmail.com> * pb Signed-off-by: Lev Nachmanson <levnach@hotmail.com> * once in a while flip bounds of boxed variables during move_nbasic_to_bounds Signed-off-by: Lev Nachmanson <levnach@hotmail.com> * flip rarely Signed-off-by: Lev Nachmanson <levnach@hotmail.com> * flip rarely Signed-off-by: Lev Nachmanson <levnach@hotmail.com> * flip rarely Signed-off-by: Lev Nachmanson <levnach@hotmail.com> * return an empty model when lar_solver is not ready Signed-off-by: Lev Nachmanson <levnach@hotmail.com> * randomly change bounded base var on demand only Signed-off-by: Lev Nachmanson <levnach@hotmail.com> * randomly change bounded base var on demand only Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
This commit is contained in:
parent
e775964cfd
commit
25724401cf
10 changed files with 72 additions and 70 deletions
|
@ -25,8 +25,7 @@ namespace lp {
|
|||
int_branch::int_branch(int_solver& lia):lia(lia), lra(lia.lra) {}
|
||||
|
||||
lia_move int_branch::operator()() {
|
||||
lra.move_non_basic_columns_to_bounds();
|
||||
int j = find_inf_int_base_column();
|
||||
int j = find_inf_int_column();
|
||||
return j == -1? lia_move::sat : create_branch_on_column(j);
|
||||
}
|
||||
|
||||
|
@ -51,7 +50,7 @@ lia_move int_branch::create_branch_on_column(int j) {
|
|||
}
|
||||
|
||||
|
||||
int int_branch::find_inf_int_base_column() {
|
||||
int int_branch::find_inf_int_column() {
|
||||
int result = -1;
|
||||
mpq range;
|
||||
mpq new_range;
|
||||
|
@ -59,19 +58,16 @@ int int_branch::find_inf_int_base_column() {
|
|||
unsigned n = 0;
|
||||
lar_core_solver & lcs = lra.m_mpq_lar_core_solver;
|
||||
unsigned prev_usage = 0; // to quiet down the compile
|
||||
unsigned k = 0;
|
||||
unsigned usage;
|
||||
unsigned j;
|
||||
unsigned j = 0;
|
||||
// this loop looks for a column with the most usages, but breaks when
|
||||
// a column with a small span of bounds is found
|
||||
for (; k < lra.r_basis().size(); k++) {
|
||||
j = lra.r_basis()[k];
|
||||
for (; j < lra.column_count(); j++) {
|
||||
if (!lia.column_is_int_inf(j))
|
||||
continue;
|
||||
usage = lra.usage_in_terms(j);
|
||||
if (lia.is_boxed(j) && (range = lcs.m_r_upper_bounds()[j].x - lcs.m_r_lower_bounds()[j].x - rational(2*usage)) <= small_range_thresold) {
|
||||
result = j;
|
||||
k++;
|
||||
result = j++;
|
||||
n = 1;
|
||||
break;
|
||||
}
|
||||
|
@ -83,14 +79,12 @@ int int_branch::find_inf_int_base_column() {
|
|||
result = j;
|
||||
}
|
||||
}
|
||||
SASSERT(k == lra.r_basis().size() || n == 1);
|
||||
|
||||
// this loop looks for boxed columns with a small span
|
||||
for (; k < lra.r_basis().size(); k++) {
|
||||
j = lra.r_basis()[k];
|
||||
usage = lra.usage_in_terms(j);
|
||||
for (; j < lra.column_count(); j++) {
|
||||
if (!lia.column_is_int_inf(j) || !lia.is_boxed(j))
|
||||
continue;
|
||||
SASSERT(!lia.is_fixed(j));
|
||||
usage = lra.usage_in_terms(j);
|
||||
new_range = lcs.m_r_upper_bounds()[j].x - lcs.m_r_lower_bounds()[j].x - rational(2*usage);
|
||||
if (new_range < range) {
|
||||
n = 1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue