cprover
Toggle main menu visibility
Loading...
Searching...
No Matches
bv_dimacs.cpp
Go to the documentation of this file.
1
/*******************************************************************\
2
3
Module: Writing DIMACS Files
4
5
Author: Daniel Kroening, kroening@kroening.com
6
7
\*******************************************************************/
8
11
12
#include "
bv_dimacs.h
"
13
14
#include <
solvers/sat/dimacs_cnf.h
>
15
16
bv_dimacst::bv_dimacst
(
17
const
namespacet
&_ns,
18
dimacs_cnft
&_prop,
19
message_handlert
&
message_handler
,
20
std::ostream &_out)
21
:
bv_pointerst
(_ns, _prop,
message_handler
),
out
(_out),
dimacs_cnf_prop
(_prop)
22
{
23
}
24
25
void
bv_dimacst::write_dimacs
()
26
{
27
dimacs_cnf_prop
.write_dimacs_cnf(
out
);
28
29
// we dump the mapping variable<->literals
30
for
(
const
auto
&s :
get_symbols
())
31
{
32
if
(s.second.is_constant())
33
out
<<
"c "
<< s.first <<
" "
<< (s.second.is_true() ?
"TRUE"
:
"FALSE"
)
34
<<
"\n"
;
35
else
36
out
<<
"c "
<< s.first <<
" "
<< s.second.dimacs() <<
"\n"
;
37
}
38
39
// dump mapping for selected bit-vectors
40
for
(
const
auto
&m :
get_map
().get_mapping())
41
{
42
const
auto
&literal_map = m.second.literal_map;
43
44
if
(literal_map.empty())
45
continue
;
46
47
out
<<
"c "
<< m.first;
48
49
for
(
const
auto
&lit : literal_map)
50
{
51
out
<<
' '
;
52
53
if
(lit.is_constant())
54
out
<< (lit.is_true() ?
"TRUE"
:
"FALSE"
);
55
else
56
out
<< lit.dimacs();
57
}
58
59
out
<<
"\n"
;
60
}
61
}
bv_dimacs.h
Writing DIMACS Files.
arrayst::message_handler
message_handlert & message_handler
Definition
arrays.h:65
boolbvt::get_map
const boolbv_mapt & get_map() const
Definition
boolbv.h:101
bv_dimacst::bv_dimacst
bv_dimacst(const namespacet &_ns, dimacs_cnft &_prop, message_handlert &message_handler, std::ostream &_out)
Definition
bv_dimacs.cpp:16
bv_dimacst::dimacs_cnf_prop
const dimacs_cnft & dimacs_cnf_prop
Definition
bv_dimacs.h:37
bv_dimacst::write_dimacs
void write_dimacs()
Definition
bv_dimacs.cpp:25
bv_dimacst::out
std::ostream & out
Definition
bv_dimacs.h:36
bv_pointerst::bv_pointerst
bv_pointerst(const namespacet &, propt &, message_handlert &, bool get_array_constraints=false)
Definition
bv_pointers.cpp:227
dimacs_cnft
Definition
dimacs_cnf.h:18
message_handlert
Definition
message.h:27
namespacet
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
Definition
namespace.h:91
prop_conv_solvert::get_symbols
const symbolst & get_symbols() const
Definition
prop_conv_solver.h:90
dimacs_cnf.h
solvers
flattening
bv_dimacs.cpp
Generated by
1.17.0