cprover
satcheck_minisat2.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_MINISAT2_H
11 #define CPROVER_SOLVERS_SAT_SATCHECK_MINISAT2_H
12 
13 #include "cnf.h"
14 
16 
17 #include <memory>
18 
19 // Select one: basic solver or with simplification.
20 // Note that the solver with simplifier isn't really robust
21 // when used incrementally, as variables may disappear
22 // unless set to 'frozen'.
23 
24 namespace Minisat // NOLINT(readability/namespace)
25 {
26 class Solver; // NOLINT(readability/identifiers)
27 class SimpSolver; // NOLINT(readability/identifiers)
28 }
29 
30 template <typename T>
32 {
33 public:
34  explicit satcheck_minisat2_baset(message_handlert &message_handler);
38 
39  tvt l_get(literalt a) const override final;
40 
41  void lcnf(const bvt &bv) override final;
42  void set_assignment(literalt a, bool value) override;
43 
44  // extra MiniSat feature: solve with assumptions
45  void set_assumptions(const bvt &_assumptions) override;
46 
47  // extra MiniSat feature: default branching decision
48  void set_polarity(literalt a, bool value);
49 
50  // extra MiniSat feature: interrupt running SAT query
51  void interrupt();
52 
53  // extra MiniSat feature: permit previously interrupted SAT query to continue
54  void clear_interrupt();
55 
56  bool is_in_conflict(literalt a) const override;
57  bool has_set_assumptions() const override final
58  {
59  return true;
60  }
61  bool has_is_in_conflict() const override final
62  {
63  return true;
64  }
65 
66  void set_time_limit_seconds(uint32_t lim) override
67  {
69  }
70 
71 protected:
72  resultt do_prop_solve() override;
73 
74  std::unique_ptr<T> solver;
76 
77  void add_variables();
79 };
80 
82  public satcheck_minisat2_baset<Minisat::Solver>
83 {
84 public:
86  const std::string solver_text() override;
87 };
88 
90  public satcheck_minisat2_baset<Minisat::SimpSolver>
91 {
92 public:
94  const std::string solver_text() override final;
95  void set_frozen(literalt a) override final;
96  bool is_eliminated(literalt a) const;
97 };
98 
99 #endif // CPROVER_SOLVERS_SAT_SATCHECK_MINISAT2_H
bool is_in_conflict(literalt a) const override
Returns true if an assumption is in the final conflict.
std::unique_ptr< T > solver
bool has_is_in_conflict() const override final
bool has_set_assumptions() const override final
~satcheck_minisat2_baset() override
A default destructor defined in the .cpp is used to ensure the unique_ptr to the solver is correctly ...
satcheck_minisat2_baset(message_handlert &message_handler)
void set_polarity(literalt a, bool value)
void lcnf(const bvt &bv) override final
tvt l_get(literalt a) const override final
void set_time_limit_seconds(uint32_t lim) override
resultt do_prop_solve() override
void set_assignment(literalt a, bool value) override
void set_assumptions(const bvt &_assumptions) override
const std::string solver_text() override
void set_frozen(literalt a) override final
bool is_eliminated(literalt a) const
const std::string solver_text() override final
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
resultt
The result of goto verifying.
Definition: properties.h:45