From be488f75ab022eabfd4f796fefa42ad278cedb74 Mon Sep 17 00:00:00 2001 From: Jakob Rath Date: Wed, 13 Apr 2022 09:34:59 +0200 Subject: [PATCH] Add some fi info --- src/math/polysat/conflict.cpp | 14 ++++++++------ src/math/polysat/conflict.h | 4 ++-- src/math/polysat/solver.cpp | 6 +++--- src/math/polysat/viable.cpp | 11 ++++++++++- src/math/polysat/viable.h | 4 ++-- 5 files changed, 25 insertions(+), 14 deletions(-) diff --git a/src/math/polysat/conflict.cpp b/src/math/polysat/conflict.cpp index ab177da37..1a6a0fe90 100644 --- a/src/math/polysat/conflict.cpp +++ b/src/math/polysat/conflict.cpp @@ -92,13 +92,15 @@ namespace polysat { out().flush(); } - void log_gamma(search_state const& m_search) { + void end_conflict(search_state const& search, viable const& v) { out() << "\n" << hline() << "\n\n"; out() << "Search state (part):\n"; - for (auto const& item : m_search) + for (auto const& item : search) if (is_relevant(item)) - out_indent() << search_item_pp(m_search, item, true) << "\n"; - // TODO: log viable + out_indent() << search_item_pp(search, item, true) << "\n"; + out() << hline() << "\nViable (part):\n"; + for (pvar var : m_used_vars) + out_indent() << "v" << std::setw(3) << std::left << var << ": " << viable::var_pp(v, var) << "\n"; out().flush(); } @@ -139,9 +141,9 @@ namespace polysat { m_logger->log_inference(*this, &inf); } - void conflict::log_gamma() { + void conflict::end_conflict() { if (m_logger) - m_logger->log_gamma(s.m_search); + m_logger->end_conflict(s.m_search, s.m_viable); } constraint_manager& conflict::cm() const { return s.m_constraints; } diff --git a/src/math/polysat/conflict.h b/src/math/polysat/conflict.h index af5555ed2..58a3e5dea 100644 --- a/src/math/polysat/conflict.h +++ b/src/math/polysat/conflict.h @@ -136,8 +136,8 @@ namespace polysat { /// Log inference at the current state. void log_inference(inference const& inf); void log_inference(char const* name) { log_inference(inference_named(name)); } - /// Log relevant part of search state. - void log_gamma(); + /// Log relevant part of search state and viable. + void end_conflict(); pvar conflict_var() const { return m_conflict_var; } diff --git a/src/math/polysat/solver.cpp b/src/math/polysat/solver.cpp index a14b9b581..71a69753a 100644 --- a/src/math/polysat/solver.cpp +++ b/src/math/polysat/solver.cpp @@ -602,7 +602,7 @@ namespace polysat { inc_activity(v); justification& j = m_justification[v]; if (j.level() > base_level() && !m_conflict.resolve_value(v) && j.is_decision()) { - m_conflict.log_gamma(); + m_conflict.end_conflict(); revert_decision(v); return; } @@ -623,7 +623,7 @@ namespace polysat { if (m_bvars.is_assumption(var)) continue; else if (m_bvars.is_decision(var)) { - m_conflict.log_gamma(); + m_conflict.end_conflict(); revert_bool_decision(lit); return; } @@ -635,7 +635,7 @@ namespace polysat { } } } - m_conflict.log_gamma(); + m_conflict.end_conflict(); report_unsat(); } diff --git a/src/math/polysat/viable.cpp b/src/math/polysat/viable.cpp index 2544782ee..305a9c81f 100644 --- a/src/math/polysat/viable.cpp +++ b/src/math/polysat/viable.cpp @@ -615,6 +615,15 @@ namespace polysat { return dd::find_t::multiple; } + struct inference_fi : public inference { + viable& v; + pvar var; + inference_fi(viable& v, pvar var) : v(v), var(var) {} + std::ostream& display(std::ostream& out) const override { + return out << "Forbidden intervals for v" << var << ": " << viable::var_pp(v, var); + } + }; + bool viable::resolve(pvar v, conflict& core) { if (has_viable(v)) return false; @@ -649,7 +658,7 @@ namespace polysat { break; } } - core.log_inference("forbidden intervals"); + core.log_inference(inference_fi(*this, v)); return true; } diff --git a/src/math/polysat/viable.h b/src/math/polysat/viable.h index e64352b6e..cffc4f14e 100644 --- a/src/math/polysat/viable.h +++ b/src/math/polysat/viable.h @@ -171,9 +171,9 @@ namespace polysat { std::ostream& display(std::ostream& out, pvar v) const; struct var_pp { - viable& v; + viable const& v; pvar var; - var_pp(viable& v, pvar var) : v(v), var(var) {} + var_pp(viable const& v, pvar var) : v(v), var(var) {} }; };