SMT-RAT  24.02
Toolbox for Strategic and Parallel Satisfiability-Modulo-Theories Solving
SequentialAssignment.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "../utils/Bookkeeping.h"
4 
5 #include <carl-common/util/tuple_util.h>
7 
8 namespace smtrat {
9 namespace mcsat {
10 
11 template<typename... Backends>
13 private:
14  using B = std::tuple<Backends...>;
16  template<std::size_t N = 0, carl::EnableIfBool<N == std::tuple_size<B>::value> = carl::dummy>
17  std::optional<AssignmentOrConflict> findAssignment(const mcsat::Bookkeeping&, carl::Variable) const {
18  SMTRAT_LOG_ERROR("smtrat.mcsat.assignment", "No assignment finder left.");
19  return std::nullopt;
20  }
21  template<std::size_t N = 0, carl::EnableIfBool<N < std::tuple_size<B>::value> = carl::dummy>
22  std::optional<AssignmentOrConflict> findAssignment(const mcsat::Bookkeeping& data, carl::Variable var) const {
23  auto res = std::get<N>(mBackends)(data, var);
24  if (res) return res;
25  return findAssignment<N+1>(data, var);
26  }
27 
28  template<std::size_t N = 0, carl::EnableIfBool<N == std::tuple_size<B>::value> = carl::dummy>
29  bool active(const mcsat::Bookkeeping&, const FormulaT&) const {
30  SMTRAT_LOG_ERROR("smtrat.mcsat.assignment", "No assignment finder left.");
31  return true;
32  }
33  template<std::size_t N = 0, carl::EnableIfBool<N < std::tuple_size<B>::value> = carl::dummy>
34  bool active(const mcsat::Bookkeeping& data, const FormulaT& f) const {
35  auto res = std::get<N>(mBackends).active(data, f);
36  return res && active<N+1>(data, f);
37  }
38 public:
39  std::optional<AssignmentOrConflict> operator()(const mcsat::Bookkeeping& data, carl::Variable var) const {
40  return findAssignment<0>(data, var);
41  }
42 
43  bool active(const mcsat::Bookkeeping& data, const FormulaT& f) const {
44  return active<0>(data, f);
45  }
46 
47 };
48 
49 } // namespace mcsat
50 } // namespace smtrat
Represent the trail, i.e.
Definition: Bookkeeping.h:19
int var(Lit p)
Definition: SolverTypes.h:64
Class to create the formulas for axioms.
carl::Formula< Poly > FormulaT
Definition: types.h:37
#define SMTRAT_LOG_ERROR(channel, msg)
Definition: logging.h:32
std::optional< AssignmentOrConflict > findAssignment(const mcsat::Bookkeeping &, carl::Variable) const