SMT-RAT  24.02
Toolbox for Strategic and Parallel Satisfiability-Modulo-Theories Solving
Explanation.cpp
Go to the documentation of this file.
1 #include "Explanation.h"
2 
3 #include "ExplanationGenerator.h"
4 
5 namespace smtrat {
6 namespace mcsat {
7 namespace vs {
8 
9 std::optional<mcsat::Explanation> Explanation::operator()(const mcsat::Bookkeeping& data, carl::Variable var, const FormulasT& reason, bool) const {
10  SMTRAT_LOG_DEBUG("smtrat.mcsat.vs", "Explain conflict " << reason);
11  #ifdef SMTRAT_DEVOPTION_Statistics
12  mStatistics.explanationCalled();
13  #endif
14  // 'variableOrder' is ordered 'x0,.., xk, .., xn', the relevant variables that appear in the
15  // reason and implication end at 'var'=xk, so the relevant prefix is 'x0 ... xk'
16  // where VS starts its variable elimination from back ('xk') to front ('x0').
17  // compute compatible complete variable ordering
18  std::vector varOrder(data.assignedVariables());
19  for (const auto& v : data.variables()) {
20  if (std::find(data.assignedVariables().begin(), data.assignedVariables().end(), v) == data.assignedVariables().end()) {
21  varOrder.push_back(v);
22  }
23  }
24  SMTRAT_LOG_DEBUG("smtrat.mcsat.vs", "Ascending variable order " << varOrder << " and eliminating down from " << var);
25  SMTRAT_LOG_DEBUG("smtrat.mcsat.vs", "Bookkeep: " << data);
26  ExplanationGenerator<DefaultSettings> eg(reason, varOrder, var, data.model());
27  auto ret = eg.getExplanation();
28  if (ret == std::nullopt) {
29  SMTRAT_LOG_DEBUG("smtrat.mcsat.vs", "Could not generate explanation");
30  } else {
31  #ifdef SMTRAT_DEVOPTION_Statistics
32  mStatistics.explanationSuccess();
33  #endif
34  }
35  return ret;
36 }
37 
38 }
39 }
40 }
Represent the trail, i.e.
Definition: Bookkeeping.h:19
const auto & assignedVariables() const
Definition: Bookkeeping.h:37
const auto & variables() const
Definition: Bookkeeping.h:49
const auto & model() const
Definition: Bookkeeping.h:34
std::optional< mcsat::Explanation > getExplanation() const
int var(Lit p)
Definition: SolverTypes.h:64
static bool find(V &ts, const T &t)
Definition: Alg.h:47
Class to create the formulas for axioms.
carl::Formulas< Poly > FormulasT
Definition: types.h:39
#define SMTRAT_LOG_DEBUG(channel, msg)
Definition: logging.h:35
std::optional< mcsat::Explanation > operator()(const mcsat::Bookkeeping &data, carl::Variable var, const FormulasT &reason, bool) const
Definition: Explanation.cpp:9