-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.ml
56 lines (50 loc) · 1.66 KB
/
main.ml
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
open Utils.Math;;
open Utils.Tools;;
open Bdd;;
let () =
(* Example 1 : bdd from 38 truth table decomposition *)
let ttable_38 = truth_table 38 8 in
let bdd_38 = bdd_create ttable_38 in
let cbdd_38 = bdd_luka_compression bdd_38 in
truth_table_printer ttable_38;
truth_table_printer_2 ttable_38;
print_newline ();
print_int (bdd_nb_nodes bdd_38);
print_newline ();
print_int (bdd_nb_nodes cbdd_38);
print_newline ();
let file = "bdd_38.dot" in bdd_to_dot bdd_38 ~file;
let file = "cbdd_38.dot" in bdd_to_dot cbdd_38 ~file;
;;
(* Example 2 : 1422119206754208377 *)
let ttable_ = truth_table 1422119206754208377 64 in
let bdd_ = bdd_create ttable_ in
let cbdd_ = bdd_luka_compression bdd_ in
truth_table_printer_2 ttable_;
print_newline ();
print_int (bdd_nb_nodes bdd_);
print_newline ();
print_int (bdd_nb_nodes cbdd_);
print_newline ();
let file = "bdd_.dot" in bdd_to_dot bdd_ ~file;
let file = "cbdd_.dot" in bdd_to_dot cbdd_ ~file;
;;
(* scalability complexity
- 4 variables > 2^(2^4)=2^16=65.536 combinaisons (OK)
- 5 variables > 2^32=4.294.967.296 combinaisons (KO!)
*)
let t = Sys.time() in
let stat_array = robdd_benchmark_full_distrib 4 in
Format.printf "Execution time: %fs\n" (Sys.time() -. t);
for i = 0 to (Array.length stat_array)-1 do
Format.printf "%d nodes >> count %d\n" i stat_array.(i)
done
;;
let t = Sys.time() in
let stat_array = robdd_benchmark_random_distrib 5 in
Format.printf "Execution time: %fs\n" (Sys.time() -. t);
for i = 0 to (Array.length stat_array)-1 do
Format.printf "%d nodes >> count %d\n" i stat_array.(i)
done
;;
;;