-
Notifications
You must be signed in to change notification settings - Fork 1
/
bdd_utils.h
56 lines (46 loc) · 2.05 KB
/
bdd_utils.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/* This file is part of CARL.
* Author: Eva Charlotte Mayer <eva-charlotte.mayer@posteo.de>
*
* CARL is free software: you can redistribute it and/or modify it under the
* terms of the GNU General Public License as published by the Free Software
* Foundation, Version 3.
*
* CARL is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
struct bdd {
char *var;
int level; /* root has level 1, children of root 2, .. */
struct bdd *high;
struct bdd *low;
};
extern struct bdd bdd_true;
extern struct bdd bdd_false;
/* Prints the name of the variable for a given node. */
void print_node(struct bdd b);
/* Prints the function represented by a given BDD in Disjunctive Normal Form.
* Parameter size equals the highest level in the BDD. */
void print_dnf(struct bdd b, int size);
/* Helper functions for printDNF. */
void print_path(struct bdd b, int pathlen, int *path);
void print_dnf_rec(struct bdd b, struct bdd original, int size, int pathlen,
int *path, int *print_or);
/* Calculates the ON-set for a given BDD. The ON-set is the number of paths
* leading to the terminal node TRUE. */
void on_set(struct bdd b, int *count);
/* Calculates the OFF-set for a given BDD. The OFF-set is the number of paths
* leading to the terminal node FALSE. */
void off_set(struct bdd b, int *count);
/* Helper function for onSet and offSet. */
void onoff_set_helper(struct bdd b, int *count, char *boolean1, char *boolean2);
/* Approximation operators that are applied on the specified level for a given
* BDD. */
void rounding(struct bdd *b, int level);
void rounding_up(struct bdd *b, int level);
void rounding_down(struct bdd *b, int level);
/* Helper function for rounding up and down. */
void rounding_updown_helper(struct bdd *b, struct bdd *terminal, int level);