mirror of
https://github.com/Z3Prover/z3
synced 2025-04-12 20:18:18 +00:00
refactor propagat_monic
This commit is contained in:
parent
7353d7fb4d
commit
30b743d7b3
|
@ -192,9 +192,19 @@ private:
|
||||||
k *= lp().get_column_value(v).x;
|
k *= lp().get_column_value(v).x;
|
||||||
if (k.is_big()) return;
|
if (k.is_big()) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (non_fixed != null_lpvar) {
|
||||||
|
propagate_monic_with_non_fixed(monic_var, vars, non_fixed, k);
|
||||||
|
} else { // all variables are fixed
|
||||||
|
propagate_monic_with_all_fixed(monic_var, vars, k);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void propagate_monic_with_non_fixed(lpvar monic_var, const svector<lpvar>& vars, lpvar non_fixed, rational k) {
|
||||||
lp::impq bound_value;
|
lp::impq bound_value;
|
||||||
bool is_strict;
|
bool is_strict;
|
||||||
if (non_fixed != null_lpvar) {
|
|
||||||
if (lower_bound_is_available(non_fixed)) {
|
if (lower_bound_is_available(non_fixed)) {
|
||||||
bound_value = lp().column_lower_bound(non_fixed);
|
bound_value = lp().column_lower_bound(non_fixed);
|
||||||
is_strict = !bound_value.y.is_zero();
|
is_strict = !bound_value.y.is_zero();
|
||||||
|
@ -209,10 +219,11 @@ private:
|
||||||
return dep;
|
return dep;
|
||||||
};
|
};
|
||||||
if (k.is_pos())
|
if (k.is_pos())
|
||||||
add_lower_bound_monic(monic_var, k * bound_value.x, is_strict , lambda);
|
add_lower_bound_monic(monic_var, k * bound_value.x, is_strict, lambda);
|
||||||
else
|
else
|
||||||
add_upper_bound_monic(monic_var, k * bound_value.x, is_strict, lambda);
|
add_upper_bound_monic(monic_var, k * bound_value.x, is_strict, lambda);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (upper_bound_is_available(non_fixed)) {
|
if (upper_bound_is_available(non_fixed)) {
|
||||||
bound_value = lp().column_upper_bound(non_fixed);
|
bound_value = lp().column_upper_bound(non_fixed);
|
||||||
is_strict = !bound_value.y.is_zero();
|
is_strict = !bound_value.y.is_zero();
|
||||||
|
@ -269,15 +280,13 @@ private:
|
||||||
else
|
else
|
||||||
add_upper_bound_monic(non_fixed, bound_value.x / k, is_strict, lambda);
|
add_upper_bound_monic(non_fixed, bound_value.x / k, is_strict, lambda);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void propagate_monic_with_all_fixed(lpvar monic_var, const svector<lpvar>& vars, rational k) {
|
||||||
} else { // all variables are fixed
|
auto lambda = [vars](int* s) { return ((lp_bound_propagator*)s)->lp().get_bound_constraint_witnesses_for_columns(vars); };
|
||||||
auto lambda = [vars](int* s){return ((lp_bound_propagator*)s)->lp().get_bound_constraint_witnesses_for_columns(vars);};
|
|
||||||
add_lower_bound_monic(monic_var, k, false, lambda);
|
add_lower_bound_monic(monic_var, k, false, lambda);
|
||||||
add_upper_bound_monic(monic_var, k, false, lambda);
|
add_upper_bound_monic(monic_var, k, false, lambda);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
column_type get_column_type(unsigned j) const {
|
column_type get_column_type(unsigned j) const {
|
||||||
return (*m_column_types)[j];
|
return (*m_column_types)[j];
|
||||||
|
|
Loading…
Reference in a new issue