Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internal/quantify/terminal heuristic (4) #648

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/adiar/exec_policy.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ namespace adiar
public:
/// \brief Default value construction.
constexpr transposition_max()
: _value(std::numeric_limits<unsigned char>::max())
: _value(1)
{}

/// \brief Wrap an `unsigned char`
Expand Down
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;
(250.0 * weighted_terminals) / total_arcs;

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