cprover
satcheck_glucose.h
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module:
4 
5 Author: Daniel Kroening, kroening@kroening.com
6 
7 \*******************************************************************/
8 
9 
10 #ifndef CPROVER_SOLVERS_SAT_SATCHECK_GLUCOSE_H
11 #define CPROVER_SOLVERS_SAT_SATCHECK_GLUCOSE_H
12 
13 #include "cnf.h"
14 
16 
17 // Select one: basic solver or with simplification.
18 // Note that the solver with simplifier isn't really robust
19 // when used incrementally, as variables may disappear
20 // unless set to 'frozen'.
21 
22 namespace Glucose // NOLINT(readability/namespace)
23 {
24 class Solver; // NOLINT(readability/identifiers)
25 class SimpSolver; // NOLINT(readability/identifiers)
26 }
27 
28 template <typename T>
30 {
31 public:
32  satcheck_glucose_baset(T *, message_handlert &message_handler);
34 
35  tvt l_get(literalt a) const override;
36 
37  void lcnf(const bvt &bv) override;
38  void set_assignment(literalt a, bool value) override;
39 
40  // extra MiniSat feature: solve with assumptions
41  void set_assumptions(const bvt &_assumptions) override;
42 
43  // extra MiniSat feature: default branching decision
44  void set_polarity(literalt a, bool value);
45 
46  bool is_in_conflict(literalt a) const override;
47  bool has_set_assumptions() const override
48  {
49  return true;
50  }
51  bool has_is_in_conflict() const override
52  {
53  return true;
54  }
55 
56  void
57  with_solver_hardness(std::function<void(solver_hardnesst &)> handler) override
58  {
59  if(solver_hardness.has_value())
60  {
61  handler(solver_hardness.value());
62  }
63  }
64 
66  {
68  }
69 
70 protected:
71  resultt do_prop_solve() override;
72 
73  T *solver;
74 
75  void add_variables();
77 
79 };
80 
82  public satcheck_glucose_baset<Glucose::Solver>
83 {
84 public:
85  explicit satcheck_glucose_no_simplifiert(message_handlert &message_handler);
86  const std::string solver_text() override;
87 };
88 
90  public satcheck_glucose_baset<Glucose::SimpSolver>
91 {
92 public:
93  explicit satcheck_glucose_simplifiert(message_handlert &message_handler);
94  const std::string solver_text() override;
95  void set_frozen(literalt a) override;
96  bool is_eliminated(literalt a) const;
97 };
98 
99 #endif // CPROVER_SOLVERS_SAT_SATCHECK_GLUCOSE_H
bool is_in_conflict(literalt a) const override
Returns true if an assumption is in the final conflict.
satcheck_glucose_baset(T *, message_handlert &message_handler)
void set_assumptions(const bvt &_assumptions) override
bool has_set_assumptions() const override
void lcnf(const bvt &bv) override
void set_polarity(literalt a, bool value)
resultt do_prop_solve() override
virtual ~satcheck_glucose_baset()
tvt l_get(literalt a) const override
bool has_is_in_conflict() const override
optionalt< solver_hardnesst > solver_hardness
void with_solver_hardness(std::function< void(solver_hardnesst &)> handler) override
void set_assignment(literalt a, bool value) override
void enable_hardness_collection() override
const std::string solver_text() override
satcheck_glucose_no_simplifiert(message_handlert &message_handler)
const std::string solver_text() override
satcheck_glucose_simplifiert(message_handlert &message_handler)
void set_frozen(literalt a) override
bool is_eliminated(literalt a) const
Definition: threeval.h:20
CNF Generation, via Tseitin.
Capability to collect the statistics of the complexity of individual solver queries.
std::vector< literalt > bvt
Definition: literal.h:201
nonstd::optional< T > optionalt
Definition: optional.h:35
resultt
The result of goto verifying.
Definition: properties.h:44
A structure that facilitates collecting the complexity statistics from a decision procedure.