mirror of
https://github.com/Z3Prover/z3
synced 2025-08-25 20:46:01 +00:00
conflict logging
This commit is contained in:
parent
00fa4b3320
commit
9fa5096776
11 changed files with 210 additions and 26 deletions
|
@ -81,6 +81,22 @@ namespace polysat {
|
|||
class inference_engine;
|
||||
class variable_elimination_engine;
|
||||
class conflict_iterator;
|
||||
class inference_logger;
|
||||
|
||||
class inference {
|
||||
public:
|
||||
virtual ~inference() {}
|
||||
virtual std::ostream& display(std::ostream& out) const = 0;
|
||||
};
|
||||
|
||||
inline std::ostream& operator<<(std::ostream& out, inference const& i) { return i.display(out); }
|
||||
|
||||
class inference_named : public inference {
|
||||
char const* m_name;
|
||||
public:
|
||||
inference_named(char const* name) : m_name(name) { SASSERT(name); }
|
||||
std::ostream& display(std::ostream& out) const override { return out << m_name; }
|
||||
};
|
||||
|
||||
/** Conflict state, represented as core (~negation of clause). */
|
||||
class conflict {
|
||||
|
@ -90,6 +106,8 @@ namespace polysat {
|
|||
uint_set m_vars; // variable assignments used as premises
|
||||
uint_set m_bail_vars;
|
||||
|
||||
scoped_ptr<inference_logger> m_logger;
|
||||
|
||||
// If this is not null_var, the conflict was due to empty viable set for this variable.
|
||||
// Can be treated like "v = x" for any value x.
|
||||
pvar m_conflict_var = null_var;
|
||||
|
@ -113,6 +131,14 @@ namespace polysat {
|
|||
conflict(solver& s);
|
||||
~conflict();
|
||||
|
||||
/// Begin next conflict
|
||||
void begin_conflict();
|
||||
/// 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();
|
||||
|
||||
pvar conflict_var() const { return m_conflict_var; }
|
||||
|
||||
bool is_bailout() const { return m_bailout; }
|
||||
|
@ -168,6 +194,9 @@ namespace polysat {
|
|||
const_iterator begin() const;
|
||||
const_iterator end() const;
|
||||
|
||||
uint_set const& vars() const { return m_vars; }
|
||||
uint_set const& bail_vars() const { return m_bail_vars; }
|
||||
|
||||
std::ostream& display(std::ostream& out) const;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue