3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-06-05 21:53:23 +00:00

add a trace statement

Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
This commit is contained in:
Lev Nachmanson 2021-03-19 13:17:27 -07:00
parent 1971ee60e1
commit 3b67dd8288
3 changed files with 58 additions and 40 deletions

View file

@ -215,6 +215,7 @@ namespace lp {
if (u1 < l1) { if (u1 < l1) {
fill_explanation_from_fixed_columns(row); fill_explanation_from_fixed_columns(row);
TRACE("gcd_test", tout << "row failed the GCD test:\n"; lia.display_row(tout, row););
return false; return false;
} }
return true; return true;

View file

@ -488,12 +488,15 @@ bool int_solver::at_upper(unsigned j) const {
} }
} }
std::ostream& int_solver::display_row_info(std::ostream & out, unsigned row_index) const { std::ostream & int_solver::display_row(std::ostream & out, lp::row_strip<rational> const & row) const {
auto & rslv = lrac.m_r_solver;
bool first = true; bool first = true;
for (const auto &c: rslv.m_A.m_rows[row_index]) { auto & rslv = lrac.m_r_solver;
if (is_fixed(c.var())) { for (const auto &c : row)
if (!get_value(c.var()).is_zero()) { {
if (is_fixed(c.var()))
{
if (!get_value(c.var()).is_zero())
{
impq val = get_value(c.var()) * c.coeff(); impq val = get_value(c.var()) * c.coeff();
if (!first && val.is_pos()) if (!first && val.is_pos())
out << "+"; out << "+";
@ -505,18 +508,22 @@ std::ostream& int_solver::display_row_info(std::ostream & out, unsigned row_inde
first = false; first = false;
continue; continue;
} }
if (c.coeff().is_one()) { if (c.coeff().is_one())
{
if (!first) if (!first)
out << "+"; out << "+";
} }
else if (c.coeff().is_minus_one()) else if (c.coeff().is_minus_one())
out << "-"; out << "-";
else { else
if (c.coeff().is_pos()) { {
if (c.coeff().is_pos())
{
if (!first) if (!first)
out << "+"; out << "+";
} }
if (c.coeff().is_big()) { if (c.coeff().is_big())
{
out << " b*"; out << " b*";
} }
else else
@ -526,14 +533,22 @@ std::ostream& int_solver::display_row_info(std::ostream & out, unsigned row_inde
first = false; first = false;
} }
out << "\n"; out << "\n";
for (const auto& c: rslv.m_A.m_rows[row_index]) { for (const auto &c : row)
{
if (is_fixed(c.var())) if (is_fixed(c.var()))
continue; continue;
rslv.print_column_info(c.var(), out); rslv.print_column_info(c.var(), out);
if (is_base(c.var())) out << "j" << c.var() << " base\n"; if (is_base(c.var()))
out << "j" << c.var() << " base\n";
} }
return out; return out;
} }
std::ostream& int_solver::display_row_info(std::ostream & out, unsigned row_index) const {
auto & rslv = lrac.m_r_solver;
auto row = rslv.m_A.m_rows[row_index];
return display_row(out, row);
}
bool int_solver::shift_var(unsigned j, unsigned range) { bool int_solver::shift_var(unsigned j, unsigned range) {

View file

@ -117,6 +117,8 @@ public:
bool shift_var(unsigned j, unsigned range); bool shift_var(unsigned j, unsigned range);
std::ostream& display_row_info(std::ostream & out, unsigned row_index) const; std::ostream& display_row_info(std::ostream & out, unsigned row_index) const;
std::ostream & display_row(std::ostream & out, vector<row_cell<rational>> const & row) const;
private: private:
unsigned random(); unsigned random();
bool has_inf_int() const; bool has_inf_int() const;