mirror of
https://github.com/Z3Prover/z3
synced 2025-06-23 14:23:40 +00:00
avoid big pivots
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
This commit is contained in:
parent
20d72e5d97
commit
38c73090d8
2 changed files with 60 additions and 55 deletions
|
@ -280,8 +280,8 @@ public:
|
|||
// a short row produces short infeasibility explanation and benefits at least one pivot operation
|
||||
int choice = -1;
|
||||
int nchoices = 0;
|
||||
unsigned num_of_non_free_basics = 1000000;
|
||||
unsigned len = 100000000;
|
||||
unsigned prev_damage = UINT_MAX;
|
||||
unsigned len = UINT_MAX;
|
||||
unsigned bj = this->m_basis[i];
|
||||
bool bj_needs_to_grow = needs_to_grow(bj);
|
||||
for (unsigned k = 0; k < this->m_A.m_rows[i].size(); k++) {
|
||||
|
@ -296,14 +296,18 @@ public:
|
|||
if (!monoid_can_increase(rc))
|
||||
continue;
|
||||
}
|
||||
unsigned damage = get_number_of_basic_vars_that_might_become_inf(j);
|
||||
if (damage < num_of_non_free_basics) {
|
||||
num_of_non_free_basics = damage;
|
||||
unsigned damage = numeric_traits<T>::is_big(rc.coeff())? prev_damage:
|
||||
get_number_of_basic_vars_that_might_become_inf(j);
|
||||
if (damage < prev_damage) {
|
||||
prev_damage = damage;
|
||||
len = this->m_A.m_columns[j].size();
|
||||
choice = k;
|
||||
nchoices = 1;
|
||||
} else if (damage == num_of_non_free_basics &&
|
||||
this->m_A.m_columns[j].size() <= len && (this->m_settings.random_next() % (++nchoices))) {
|
||||
} else if (damage == prev_damage
|
||||
&&
|
||||
this->m_A.m_columns[j].size() <= len
|
||||
&&
|
||||
(this->m_settings.random_next() % (++nchoices))) {
|
||||
choice = k;
|
||||
len = this->m_A.m_columns[j].size();
|
||||
}
|
||||
|
|
|
@ -82,6 +82,7 @@ template <> class numeric_traits<double> {
|
|||
static double from_string(std::string const & str) { return atof(str.c_str()); }
|
||||
static bool is_pos(const double & d) {return d > 0.0;}
|
||||
static bool is_neg(const double & d) {return d < 0.0;}
|
||||
static bool is_big(const double & d) { return false; }
|
||||
};
|
||||
|
||||
template<>
|
||||
|
@ -97,13 +98,13 @@ template <> class numeric_traits<double> {
|
|||
static bool is_pos(const rational & d) {return d.is_pos();}
|
||||
static bool is_neg(const rational & d) {return d.is_neg();}
|
||||
static bool is_int(const rational & d) {return d.is_int();}
|
||||
static bool is_big(const rational & d) {return d.is_big();}
|
||||
static mpq ceil_ratio(const mpq & a, const mpq & b) {
|
||||
return ceil(a / b);
|
||||
}
|
||||
static mpq floor_ratio(const mpq & a, const mpq & b) {
|
||||
return floor(a / b);
|
||||
}
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue