cprover
Toggle main menu visibility
Loading...
Searching...
No Matches
bdd_cudd.h
Go to the documentation of this file.
1
/*******************************************************************\
2
3
Module: Binary Decision Diagrams
4
5
Author: Romain Brenguier, romain.brenguier@diffblue.com
6
7
\*******************************************************************/
8
14
15
#ifndef CPROVER_SOLVERS_BDD_BDD_CUDD_H
16
#define CPROVER_SOLVERS_BDD_BDD_CUDD_H
17
18
#include <cplusplus/cuddObj.hh>
19
20
#include <
util/narrow.h
>
21
22
class
bdd_managert
;
23
class
bddt
;
24
class
bdd_nodet
;
25
27
class
bdd_nodet
28
{
29
public
:
30
bool
is_constant
()
const
31
{
32
return
Cudd_IsConstant(
node
) != 0;
33
}
34
35
bool
is_complement
()
const
36
{
37
return
Cudd_IsComplement(
node
) != 0;
38
}
39
41
using
indext
=
unsigned
int;
42
44
indext
index
()
const
45
{
46
return
Cudd_NodeReadIndex(
node
);
47
}
48
49
bdd_nodet
then_branch
()
const
50
{
51
return
bdd_nodet
(Cudd_T(
node
));
52
}
53
54
bdd_nodet
else_branch
()
const
55
{
56
return
bdd_nodet
(Cudd_E(
node
));
57
}
58
60
using
idt
= DdNode *;
61
63
idt
id
()
const
64
{
65
return
node
;
66
}
67
68
private
:
69
DdNode *
node
;
70
explicit
bdd_nodet
(DdNode *
node
) :
node
(
node
)
71
{
72
}
73
friend
class
bdd_managert
;
74
};
75
77
class
bddt
78
{
79
public
:
80
bool
equals
(
const
bddt
&other)
const
81
{
82
return
bdd
== other.
bdd
;
83
}
84
85
bool
is_true
()
const
86
{
87
return
bdd
.IsOne();
88
}
89
90
bool
is_false
()
const
91
{
92
return
bdd
.IsZero();
93
}
94
95
bddt
bdd_not
()
const
96
{
97
return
bddt
(!
bdd
);
98
}
99
100
bddt
bdd_or
(
const
bddt
&other)
const
101
{
102
return
bddt
(
bdd
.Or(other.
bdd
));
103
}
104
105
bddt
bdd_and
(
const
bddt
&other)
const
106
{
107
return
bddt
(
bdd
.And(other.
bdd
));
108
}
109
110
bddt
bdd_xor
(
const
bddt
&other)
const
111
{
112
return
bddt
(
bdd
.Xor(other.
bdd
));
113
}
114
115
static
bddt
bdd_ite
(
const
bddt
&i,
const
bddt
&t,
const
bddt
&e)
116
{
117
return
bddt
(i.
bdd
.Ite(t.
bdd
, e.
bdd
));
118
}
119
120
bddt
constrain
(
const
bddt
&other)
121
{
122
return
bddt
(
bdd
.Constrain(other.
bdd
));
123
}
124
125
bddt
&
operator=
(
const
bddt
&other) =
default
;
126
127
private
:
128
BDD
bdd
;
129
friend
class
bdd_managert
;
130
explicit
bddt
(BDD
bdd
) :
bdd
(
std
::move(
bdd
))
131
{
132
}
133
};
134
136
class
bdd_managert
137
{
138
public
:
139
bdd_managert
() :
cudd
()
140
{
141
}
142
143
bdd_managert
(
const
bdd_managert
&) =
delete
;
144
145
bddt
bdd_true
()
146
{
147
return
bddt
(
cudd
.bddOne());
148
}
149
150
bddt
bdd_false
()
151
{
152
return
bddt
(
cudd
.bddZero());
153
}
154
155
bddt
bdd_variable
(
bdd_nodet::indext
index)
156
{
157
return
bddt
(
cudd
.bddVar(
narrow_cast<int>
(index)));
158
}
159
160
bdd_nodet
bdd_node
(
const
bddt
&bdd)
const
161
{
162
return
bdd_nodet
(bdd.
bdd
.getNode());
163
}
164
165
private
:
166
Cudd
cudd
;
167
};
168
169
#endif
// CPROVER_SOLVERS_BDD_BDD_H
bdd_managert
Manager for BDD creation.
Definition
bdd_cudd.h:137
bdd_managert::bdd_false
bddt bdd_false()
Definition
bdd_cudd.h:150
bdd_managert::bdd_true
bddt bdd_true()
Definition
bdd_cudd.h:145
bdd_managert::bdd_node
bdd_nodet bdd_node(const bddt &bdd) const
Definition
bdd_cudd.h:160
bdd_managert::bdd_managert
bdd_managert()
Definition
bdd_cudd.h:139
bdd_managert::bdd_managert
bdd_managert(const bdd_managert &)=delete
bdd_managert::bdd_variable
bddt bdd_variable(bdd_nodet::indext index)
Definition
bdd_cudd.h:155
bdd_managert::cudd
Cudd cudd
Definition
bdd_cudd.h:166
bdd_nodet
Low level access to the structure of the BDD, read-only.
Definition
bdd_cudd.h:28
bdd_nodet::index
indext index() const
Label on the node, corresponds to the index of a Boolean variable.
Definition
bdd_cudd.h:44
bdd_nodet::indext
unsigned int indext
Type of indexes of Boolean variables.
Definition
bdd_cudd.h:41
bdd_nodet::idt
DdNode * idt
Return type for id().
Definition
bdd_cudd.h:60
bdd_nodet::is_complement
bool is_complement() const
Definition
bdd_cudd.h:35
bdd_nodet::id
idt id() const
Unique identifier of the node.
Definition
bdd_cudd.h:63
bdd_nodet::bdd_nodet
bdd_nodet(DdNode *node)
Definition
bdd_cudd.h:70
bdd_nodet::is_constant
bool is_constant() const
Definition
bdd_cudd.h:30
bdd_nodet::then_branch
bdd_nodet then_branch() const
Definition
bdd_cudd.h:49
bdd_nodet::node
DdNode * node
Definition
bdd_cudd.h:69
bdd_nodet::bdd_managert
friend class bdd_managert
Definition
bdd_cudd.h:73
bdd_nodet::else_branch
bdd_nodet else_branch() const
Definition
bdd_cudd.h:54
bddt
Logical operations on BDDs.
Definition
bdd_cudd.h:78
bddt::equals
bool equals(const bddt &other) const
Definition
bdd_cudd.h:80
bddt::bdd_xor
bddt bdd_xor(const bddt &other) const
Definition
bdd_cudd.h:110
bddt::constrain
bddt constrain(const bddt &other)
Definition
bdd_cudd.h:120
bddt::bdd_ite
static bddt bdd_ite(const bddt &i, const bddt &t, const bddt &e)
Definition
bdd_cudd.h:115
bddt::bdd_or
bddt bdd_or(const bddt &other) const
Definition
bdd_cudd.h:100
bddt::operator=
bddt & operator=(const bddt &other)=default
bddt::bdd_not
bddt bdd_not() const
Definition
bdd_cudd.h:95
bddt::is_true
bool is_true() const
Definition
bdd_cudd.h:85
bddt::bdd_and
bddt bdd_and(const bddt &other) const
Definition
bdd_cudd.h:105
bddt::bdd_managert
friend class bdd_managert
Definition
bdd_cudd.h:129
bddt::is_false
bool is_false() const
Definition
bdd_cudd.h:90
bddt::bddt
bddt(BDD bdd)
Definition
bdd_cudd.h:130
bddt::bdd
BDD bdd
Definition
bdd_cudd.h:128
std
STL namespace.
narrow.h
narrow_cast
output_type narrow_cast(input_type value)
Alias for static_cast intended to be used for numeric casting Rationale: Easier to grep than static_c...
Definition
narrow.h:19
solvers
bdd
bdd_cudd.h
Generated by
1.17.0