Adiar  2.1.0
An External Memory Decision Diagram Library
statistics.h
1 #ifndef ADIAR_STATISTICS_H
2 #define ADIAR_STATISTICS_H
3 
13 
14 #include <cstddef>
15 #include <iostream>
16 
17 #include <adiar/internal/cnl.h>
18 
19 namespace adiar
20 {
25 
32  struct statistics
33  {
35  // I/O
36 
40  struct arc_file_t
41  {
45  uintwide push_internal = 0;
46 
50  uintwide push_in_order = 0;
51 
55  uintwide push_out_of_order = 0;
56 
60  uintwide push_level = 0;
61 
65  uintwide sort_out_of_order = 0;
66  }
69 
73  struct node_file_t
74  {
78  uintwide push_node = 0;
79 
83  uintwide push_level = 0;
84  }
87 
89  // Data Structures
90 
95  {
99  uintwide push_bucket = 0;
100 
104  uintwide push_overflow = 0;
105 
113 
120  uintwide sum_actual_max_size = 0;
121 
128  double sum_max_size_ratio = 0.0;
129 
134  size_t sum_destructors = 0;
135  }
138 
140  // Algorithms
141 
145  struct __alg_base
146  {
151  {
155  uintwide unbucketed = 0;
156 
160  uintwide internal = 0;
161 
165  uintwide external = 0;
166 
170  uintwide
171  total() const
172  {
173  return unbucketed + internal + external;
174  }
175  }
178  };
179 
184  {
188  uintwide runs = 0;
189 
193  uintwide used_narrowest = 0;
194 
198  uintwide acc_width = 0;
199 
203  size_t min_width = std::numeric_limits<size_t>::max();
204 
208  size_t max_width = 0u;
209  };
210 
214  struct __pq2_base
215  {
219  uintwide runs = 0;
220 
225  uintwide pq_2_elems = 0;
226  };
227 
229  // Algorithms: Top-down Sweeps
230 
236  struct count_t : public __alg_base
237  {
238  }
241 
247  struct equality_t : public __alg_base
248  {
249  // Early termination cases
250 
254  uintwide exit_on_same_file = 0;
255 
259  uintwide exit_on_nodecount = 0;
260 
264  uintwide exit_on_varcount = 0;
265 
269  uintwide exit_on_width = 0;
270 
274  uintwide exit_on_terminalcount = 0;
275 
280 
284  struct slow_t
285  {
289  uintwide runs = 0;
290 
294  uintwide exit_on_root = 0;
295 
301 
306  uintwide exit_on_children = 0;
307  }
310 
316  struct fast_t
317  {
321  uintwide runs = 0;
322 
326  uintwide exit_on_mismatch = 0;
327  }
330  }
333 
339  struct intercut_t : public __alg_base
340  {
341  }
344 
350  struct optmin_t : public __alg_base
351  {
352  }
355 
361  struct prod2_t : public __alg_base
362  {
366  uintwide trivial_file = 0;
367 
371  uintwide trivial_terminal = 0;
372 
377 
382  }
385 
391  struct prod3_t : public __alg_base
392  {
393  }
396 
402  struct quantify_t : public __alg_base
403  {
407  uintwide runs = 0;
408 
412  uintwide skipped = 0;
413 
417  uintwide singleton_sweeps = 0;
418 
422  uintwide nested_sweeps = 0;
423 
428  {
432  uintwide none = 0;
433 
437  uintwide simple = 0;
438 
442  uintwide singleton = 0;
443 
447  uintwide pruning = 0;
448 
452  uintwide partial = 0;
453 
457  uintwide partial_terminations = 0;
458 
463  uintwide partial_repetitions = 0;
464  } nested_transposition;
465 
470  {
474  uintwide shortcut_terminal = 0;
475 
479  uintwide shortcut_node = 0;
480 
484  uintwide products = 0;
485  } nested_policy;
486 
491 
496 
500  uintwide requests[2] = { 0, 0 };
501 
505  uintwide requests_unique[2] = { 0, 0 };
506  }
509 
515  struct select_t : public __alg_base
516  {
517  }
520 
522  // Algorithms: Bottom-up Sweeps
523 
529  struct reduce_t : public __alg_base
530  {
534  uintwide sum_node_arcs = 0;
535 
539  uintwide sum_terminal_arcs = 0;
540 
545  uintwide removed_by_rule_1 = 0;
546 
551  uintwide removed_by_rule_2 = 0;
552  }
555 
557  // Algorithms: Other
558 
564  struct replace_t
565  {
569  uintwide terminal_returns = 0;
570 
574  uintwide identity_returns = 0;
575 
579  uintwide identity_reduces = 0;
580 
585  uintwide shift_returns = 0;
586 
590  uintwide monotonic_scans = 0;
591 
595  uintwide monotonic_reduces = 0;
596 
601  uintwide nested_sweeps = 0;
602  }
605 
616  {
620  uintwide skips = 0;
621 
625  uintwide runs = 0;
626 
630  struct outer_up_t : public reduce_t
631  {
635  uintwide reduced_levels = 0;
636 
640  uintwide reduced_levels__fast = 0;
641 
645  uintwide nested_levels = 0;
646 
650  uintwide skipped_nested_levels = 0;
651 
656 
660  uintwide collapse_to_terminal = 0;
661  }
664 
669  {
670  struct inputs_t
671  {
675  uintwide acc_size = 0;
676 
680  uintwide max_size = 0;
681 
685  uintwide acc_width = 0;
686 
690  uintwide max_width = 0;
691 
695  uintwide acc_levels = 0;
696 
701  uintwide max_levels = 0;
702  } inputs;
703 
704  struct requests_t
705  {
709  uintwide terminals = 0;
710 
714  uintwide preserving = 0;
715 
719  uintwide modifying = 0;
720  } requests;
721 
726  uintwide removed_by_rule_1 = 0;
727 
731  uintwide ra_runs = 0;
732 
736  uintwide pq_runs = 0;
737  }
740 
744  struct inner_up_t : public reduce_t
745  {
749  uintwide inner_arcs = 0;
750 
754  uintwide outer_arcs = 0;
755 
759  uintwide reduced_levels = 0;
760 
764  uintwide reduced_levels__fast = 0;
765  }
768  }
771  };
772 
778  statistics
780 
786  void
787  statistics_print(std::ostream& o = std::cout);
788 
794  void
796 
799 }
800 
801 #endif // ADIAR_STATISTICS_H
void statistics_print(std::ostream &o=std::cout)
Print statistics to an output stream (default std::cout).
void statistics_reset()
Resets all statistics to default value.
statistics statistics_get()
Obtain a copy of all statistics gathered.
Core types.
Definition: adiar.h:40
Type and usage of this algorithm's levelized priority queue.
Definition: statistics.h:151
uintwide unbucketed
Number of unbucketed internal levelized priority queues.
Definition: statistics.h:155
uintwide total() const
Total number of levelized priority queues.
Definition: statistics.h:171
uintwide external
Number of bucketed external levelized priority queues.
Definition: statistics.h:165
Common statistics for all algorithms.
Definition: statistics.h:146
adiar::statistics::__alg_base::__lpq_t lpq
Type and usage of this algorithm's levelized priority queue.
Common statistics for algorithms using a second priority queue.
Definition: statistics.h:215
uintwide runs
Number of runs resolved with a secondary priority queue.
Definition: statistics.h:219
uintwide pq_2_elems
Number of elements moved from the first priority queue into the second one.
Definition: statistics.h:225
Common statistics for algorithms using random access.
Definition: statistics.h:184
uintwide acc_width
Accumulation of the width of all diagrams where random access has been used.
Definition: statistics.h:198
uintwide runs
Number of runs resolved with a secondary priority queue.
Definition: statistics.h:188
size_t max_width
Maximum width of a diagrams using random access.
Definition: statistics.h:208
size_t min_width
Minimum width of a diagrams using random access.
Definition: statistics.h:203
uintwide used_narrowest
Number of runs where the narrowest could be used.
Definition: statistics.h:193
Arc Files statistics.
Definition: statistics.h:41
uintwide sort_out_of_order
Number of times out-of-order terminal arcs are sorted.
Definition: statistics.h:65
uintwide push_level
Number of level informations pushed.
Definition: statistics.h:60
uintwide push_out_of_order
Number of terminal arcs written out-of-order.
Definition: statistics.h:55
uintwide push_in_order
Number of terminal arcs written in-order.
Definition: statistics.h:50
uintwide push_internal
Number of internal arcs written.
Definition: statistics.h:45
Counting algorithm statistics.
Definition: statistics.h:237
Statistics from O(N) linear-scan equality checking algorithm.
Definition: statistics.h:317
uintwide exit_on_mismatch
Termination due to the i'th nodes do not match numerically.
Definition: statistics.h:326
uintwide runs
Number of runs of the fast isomorphism algorithm.
Definition: statistics.h:321
Statistics from O(N log N) time-forward processing equality checking algorithm.
Definition: statistics.h:285
uintwide exit_on_root
Termination due to a local violation at the root.
Definition: statistics.h:294
uintwide runs
Number of runs of the slow isomorphism checking algorithm.
Definition: statistics.h:289
uintwide exit_on_children
Termination due to mismatch in a node's children's level, i.e. a local violation at some node.
Definition: statistics.h:306
uintwide exit_on_processed_on_level
Termination due to too many requests being processed at some level, i.e. one node must have been pair...
Definition: statistics.h:300
Equality Checking algorithm statistics.
Definition: statistics.h:248
uintwide exit_on_varcount
Early O(1) termination due to mismatch in number of levels.
Definition: statistics.h:264
uintwide exit_on_levels_mismatch
Early O(L) termination due to per-level meta information does not match.
Definition: statistics.h:279
uintwide exit_on_width
Early O(1) termination due to mismatch in width.
Definition: statistics.h:269
struct adiar::statistics::equality_t::fast_t fast_check
Statistics from O(N) linear-scan equality checking algorithm.
struct adiar::statistics::equality_t::slow_t slow_check
Statistics from O(N log N) time-forward processing equality checking algorithm.
uintwide exit_on_nodecount
Early O(1) termination due to mismatch in number of nodes.
Definition: statistics.h:259
uintwide exit_on_same_file
Early O(1) termination due to same file on disk.
Definition: statistics.h:254
uintwide exit_on_terminalcount
Early O(1) termination due to mismatch in number of arcs to terminals.
Definition: statistics.h:274
Intercut algorithm statistics.
Definition: statistics.h:340
Levelized Priority Queue statistics.
Definition: statistics.h:95
size_t sum_destructors
Number of calls to the destructor, i.e. the total number of levelized priority queues that have repor...
Definition: statistics.h:134
double sum_max_size_ratio
Sum over the ratio between predicted and actual maximum size, i.e. .
Definition: statistics.h:128
uintwide push_bucket
Number of pushes in the bucketed variant to a bucket.
Definition: statistics.h:99
uintwide push_overflow
Number of pushes in the bucketed variant to the overflow queue.
Definition: statistics.h:104
uintwide sum_predicted_max_size
The sum over all levelized priority queue's predicted maximum size, i.e. .
Definition: statistics.h:112
uintwide sum_actual_max_size
The sum over all levelized priority queue's maximum size, i.e. .
Definition: statistics.h:120
uintwide acc_size
Accumulated size of all diagrams handed over to nested sweeps.
Definition: statistics.h:675
uintwide max_size
Size of the largest diagram handed over to a nested sweep.
Definition: statistics.h:680
uintwide max_levels
The largest number of levels handed over to a nested sweep, i.e. the depth of the "deepest" diagram.
Definition: statistics.h:701
uintwide acc_width
Accumulated width of all diagrams handed over to nested sweeps.
Definition: statistics.h:685
uintwide max_width
Largest width of any diagram handed over to a nested sweep.
Definition: statistics.h:690
uintwide acc_levels
Accumulated number of levels of all diagrams handed over to nested sweeps.
Definition: statistics.h:695
uintwide modifying
Number of requests created at this level.
Definition: statistics.h:719
uintwide preserving
Number of requests crossing nesting level (and preserved).
Definition: statistics.h:714
uintwide terminals
Number of requests for terminals (and skipped).
Definition: statistics.h:709
Root Requests generated for Inner Down Sweep.
Definition: statistics.h:669
uintwide pq_runs
Number of sweeps run with multiple priority queues.
Definition: statistics.h:736
uintwide ra_runs
Number of sweeps run with random access.
Definition: statistics.h:731
uintwide removed_by_rule_1
Number of preserving and terminal requests that stem from suppressing a node on the nesting level.
Definition: statistics.h:726
Inner Up Sweep(s)
Definition: statistics.h:745
uintwide reduced_levels__fast
Number of levels reduced "fast" and non-canonically.
Definition: statistics.h:764
uintwide inner_arcs
Number of arcs within inner sweep.
Definition: statistics.h:749
uintwide reduced_levels
Number of levels reduced canonically.
Definition: statistics.h:759
uintwide outer_arcs
Number of arcs within outer sweep.
Definition: statistics.h:754
Outer Reduce Sweep.
Definition: statistics.h:631
uintwide skipped_nested_levels__prune
Number Inner Sweeps skipped that prunes all accumulated nodes.
Definition: statistics.h:655
uintwide skipped_nested_levels
Number Inner Sweeps skipped.
Definition: statistics.h:650
uintwide reduced_levels
Number of levels reduced canonically.
Definition: statistics.h:635
uintwide reduced_levels__fast
Number of levels reduced "fast" and non-canonically.
Definition: statistics.h:640
uintwide nested_levels
Number Inner Sweeps started.
Definition: statistics.h:645
uintwide collapse_to_terminal
Number of outer sweeps that collapsed early into a terminal.
Definition: statistics.h:660
Nested Sweeping statistics.
Definition: statistics.h:616
struct adiar::statistics::nested_sweeping_t::inner_down_t inner_down
Root Requests generated for Inner Down Sweep.
uintwide skips
Number of times Nested Sweeping Framework is skipped for a simple Reduce algorithm.
Definition: statistics.h:620
adiar::statistics::nested_sweeping_t::inner_up_t inner_up
adiar::statistics::nested_sweeping_t::outer_up_t outer_up
Outer Reduce Sweep.
uintwide runs
Number of times Nested Sweeping Framework is skipped for a simple Reduce algorithm.
Definition: statistics.h:625
Node Files statistics.
Definition: statistics.h:74
uintwide push_node
Number of nodes written.
Definition: statistics.h:78
uintwide push_level
Number of level informations written.
Definition: statistics.h:83
Boolean Optimization algorithm statistics.
Definition: statistics.h:351
2-ary Product Construction algorithm statistics.
Definition: statistics.h:362
uintwide trivial_file
Number of runs resolved due to the same file given twice.
Definition: statistics.h:366
__pq2_base pq
Statistics for the double priority queue algorithmic variant.
Definition: statistics.h:381
uintwide trivial_terminal
Number of runs resolved due to one argument being a terminal.
Definition: statistics.h:371
__random_access_base ra
Statistics for the random-access algorithmic variant.
Definition: statistics.h:376
3-ary Product Construction algorithm statistics.
Definition: statistics.h:392
Nested multi-variable sweeping.
Definition: statistics.h:470
uintwide products
Number of recursions left for a product construction.
Definition: statistics.h:484
uintwide shortcut_terminal
Number of potential recursions shortcut to a terminal.
Definition: statistics.h:474
uintwide shortcut_node
Number of potential recursions shortcut to an internal node.
Definition: statistics.h:479
Transposition algorithms prior to nested multi-variable sweeping.
Definition: statistics.h:428
uintwide simple
Number of simple transposition sweeps.
Definition: statistics.h:437
uintwide partial_repetitions
Number of partial multi-variable sweeps that are repeated partial transposition.
Definition: statistics.h:463
uintwide partial
Number of partial multi-variable transposition sweeps.
Definition: statistics.h:452
uintwide none
Number of skipped transpositions (already transposed).
Definition: statistics.h:432
uintwide singleton
Number of single-variable transposition sweeps.
Definition: statistics.h:442
uintwide partial_terminations
Number of early-termination during partial transposition sweeps.
Definition: statistics.h:457
uintwide pruning
Number of pruning multi-variable transposition sweeps.
Definition: statistics.h:447
Quantification algorithm statistics.
Definition: statistics.h:403
uintwide nested_sweeps
Number of nested multi-variable sweeps.
Definition: statistics.h:422
uintwide requests_unique[2]
Number of unique requests of arity 1 and 2.
Definition: statistics.h:505
uintwide runs
Number of calls to quantification operation.
Definition: statistics.h:407
__random_access_base ra
Statistics for the random-access algorithmic variant.
Definition: statistics.h:490
uintwide skipped
Number of bailed-out quantifications for non-existent labels.
Definition: statistics.h:412
__pq2_base pq
Statistics for the double priority queue algorithmic variant.
Definition: statistics.h:495
uintwide singleton_sweeps
Number of single-variable sweeps.
Definition: statistics.h:417
uintwide requests[2]
Number of requests of arity 1 and 2.
Definition: statistics.h:500
Reduce algorithm statistics.
Definition: statistics.h:530
uintwide sum_node_arcs
Sum of the inputs' number of arcs to internal nodes.
Definition: statistics.h:534
uintwide removed_by_rule_2
Number of nodes removed due to reduction rule 2, i.e. the number of duplicate of nodes that have been...
Definition: statistics.h:551
uintwide sum_terminal_arcs
Sum of the inputs' number of arcs to terminals.
Definition: statistics.h:539
uintwide removed_by_rule_1
Number of nodes removed due to reduction rule 1, i.e. the number of nodes that are suppressed in the ...
Definition: statistics.h:545
Variable replacement statistics.
Definition: statistics.h:565
uintwide identity_reduces
Number of runs using a mere Reduce sweep without any variables changed.
Definition: statistics.h:579
uintwide monotonic_reduces
Number of runs where replacement has been incorporated into the Reduce sweep.
Definition: statistics.h:595
uintwide terminal_returns
Number of runs using 0 I/Os due to a terminal input.
Definition: statistics.h:569
uintwide identity_returns
Number of runs using 0 I/Os due to no variables are changed.
Definition: statistics.h:574
uintwide shift_returns
Number of runs using 0 I/Os due to the variables are replaced according to a simple linear shift.
Definition: statistics.h:585
uintwide nested_sweeps
Number of runs where replacement uses the Nested Sweeping framework to handle non-monotonic replaceme...
Definition: statistics.h:601
uintwide monotonic_scans
Number of runs using a 2N/B linear copy-paste.
Definition: statistics.h:590
Select algorithm statistics.
Definition: statistics.h:516
Available statistics from algorithm's and data structures.
Definition: statistics.h:33
adiar::statistics::equality_t equality
Equality Checking algorithm statistics.
struct adiar::statistics::levelized_priority_queue_t levelized_priority_queue
Levelized Priority Queue statistics.
adiar::statistics::select_t select
Select algorithm statistics.
adiar::statistics::prod2_t prod2
2-ary Product Construction algorithm statistics.
struct adiar::statistics::arc_file_t arc_file
Arc Files statistics.
struct adiar::statistics::nested_sweeping_t nested_sweeping
Nested Sweeping statistics.
adiar::statistics::reduce_t reduce
Reduce algorithm statistics.
adiar::statistics::prod3_t prod3
3-ary Product Construction algorithm statistics.
struct adiar::statistics::replace_t replace
Variable replacement statistics.
adiar::statistics::optmin_t optmin
3-ary Product Construction algorithm statistics.
adiar::statistics::intercut_t intercut
Intercut algorithm statistics.
struct adiar::statistics::node_file_t node_file
Node Files statistics.
adiar::statistics::quantify_t quantify
Quantification algorithm statistics.
adiar::statistics::count_t count
Counting algorithm statistics.