CBMC
dimacs_cnf.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_DIMACS_CNF_H
11 #define CPROVER_SOLVERS_SAT_DIMACS_CNF_H
12 
13 #include <iosfwd>
14 
15 #include "cnf_clause_list.h"
16 
18 {
19 public:
20  explicit dimacs_cnft(message_handlert &);
21  virtual ~dimacs_cnft() { }
22 
23  virtual void write_dimacs_cnf(std::ostream &out) const;
24 
25  // dummy functions
26 
27  std::string solver_text() const override
28  {
29  return "DIMACS CNF";
30  }
31 
32  void set_assignment(literalt a, bool value) override;
33  bool is_in_conflict(literalt l) const override;
34 
35  static void
36  write_dimacs_clause(const bvt &, std::ostream &, bool break_lines);
37 
38 protected:
39  void write_problem_line(std::ostream &out) const;
40  void write_clauses(std::ostream &out) const;
41 
43 };
44 
45 class dimacs_cnf_dumpt:public cnft
46 {
47 public:
48  dimacs_cnf_dumpt(std::ostream &_out, message_handlert &message_handler);
49  virtual ~dimacs_cnf_dumpt() { }
50 
51  std::string solver_text() const override
52  {
53  return "DIMACS CNF Dumper";
54  }
55 
56  void lcnf(const bvt &bv) override;
57 
58  tvt l_get(literalt) const override
59  {
60  return tvt::unknown();
61  }
62 
63  size_t no_clauses() const override
64  {
65  return 0;
66  }
67 
68 protected:
69  resultt do_prop_solve(const bvt &) override
70  {
71  return resultt::P_ERROR;
72  }
73 
74  std::ostream &out;
75 };
76 
77 #endif // CPROVER_SOLVERS_SAT_DIMACS_CNF_H
Definition: cnf.h:18
std::ostream & out
Definition: dimacs_cnf.h:74
virtual ~dimacs_cnf_dumpt()
Definition: dimacs_cnf.h:49
size_t no_clauses() const override
Definition: dimacs_cnf.h:63
resultt do_prop_solve(const bvt &) override
Definition: dimacs_cnf.h:69
std::string solver_text() const override
Definition: dimacs_cnf.h:51
dimacs_cnf_dumpt(std::ostream &_out, message_handlert &message_handler)
Definition: dimacs_cnf.cpp:33
tvt l_get(literalt) const override
Definition: dimacs_cnf.h:58
void lcnf(const bvt &bv) override
Definition: dimacs_cnf.cpp:100
bool is_in_conflict(literalt l) const override
Returns true if an assumption is in the final conflict.
Definition: dimacs_cnf.cpp:27
dimacs_cnft(message_handlert &)
Definition: dimacs_cnf.cpp:17
std::string solver_text() const override
Definition: dimacs_cnf.h:27
virtual ~dimacs_cnft()
Definition: dimacs_cnf.h:21
void write_clauses(std::ostream &out) const
Definition: dimacs_cnf.cpp:79
static void write_dimacs_clause(const bvt &, std::ostream &, bool break_lines)
Definition: dimacs_cnf.cpp:53
bool break_lines
Definition: dimacs_cnf.h:42
void set_assignment(literalt a, bool value) override
Definition: dimacs_cnf.cpp:22
virtual void write_dimacs_cnf(std::ostream &out) const
Definition: dimacs_cnf.cpp:40
void write_problem_line(std::ostream &out) const
Definition: dimacs_cnf.cpp:46
resultt
Definition: prop.h:101
Definition: threeval.h:20
static tvt unknown()
Definition: threeval.h:33
CNF Generation.
std::vector< literalt > bvt
Definition: literal.h:201