Skip to content

Commit

Permalink
Simplify 'Terminal Count' heuristic to be linear and ignore idempoten…
Browse files Browse the repository at this point in the history
…t terminal

- It now only cares about the shortcutting terminal
- It now also is fully linear such that at least 0.5 percent of all arcs have to be
  a shortcutting terminal
  • Loading branch information
SSoelvsten committed Apr 4, 2024
1 parent e3ab240 commit f0b2977
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/adiar/internal/algorithms/quantify.h
Original file line number Diff line number Diff line change
Expand Up @@ -1320,17 +1320,16 @@ namespace adiar::internal
// Terminal Count Heuristics

const size_t false_weight =
1 + Policy::collapse_to_terminal(typename Policy::pointer_type(false));
Policy::collapse_to_terminal(typename Policy::pointer_type(false));

const size_t true_weight =
1 + Policy::collapse_to_terminal(typename Policy::pointer_type(true));
Policy::collapse_to_terminal(typename Policy::pointer_type(true));

const double total_arcs = 2.0 * size;
const double weighted_terminals = false_weight * false_terminals + true_weight * true_terminals;
const size_t exponent = 21.0 * (weighted_terminals / total_arcs) + 0.4;

const typename Policy::label_type terminal_threshold =
(1u << std::min<size_t>(exponent, log2(2 * Policy::max_label))) - 1u;
(200.0 * weighted_terminals) / total_arcs;

// ---------------------------------------------------------------------------------------------
// Shallow Variables Heuristic
Expand Down

0 comments on commit f0b2977

Please sign in to comment.