Skip to content

Commit

Permalink
Remove 'Terminal Count' heuristic
Browse files Browse the repository at this point in the history
It seems like this heuristic is not good enough at differentiating between cases
that should use one or more partial sweeps and those that should not. If anything,
it might only be a bad proxy for some other meta information that we should use
instead. Hence, we better remove it to not have semi-dead and untested code laying
around in the codebase
  • Loading branch information
SSoelvsten committed Apr 5, 2024
1 parent 93b4f11 commit 897a723
Showing 1 changed file with 3 additions and 21 deletions.
24 changes: 3 additions & 21 deletions src/adiar/internal/algorithms/quantify.h
Original file line number Diff line number Diff line change
Expand Up @@ -1311,26 +1311,8 @@ namespace adiar::internal
const predicate<typename Policy::label_type>& pred)
{
// Extract meta data constants about the DAG
const size_t size = dd.size();
const size_t width = dd.width();
const size_t false_terminals = dd.number_of_terminals(false);
const size_t true_terminals = dd.number_of_terminals(true);

// ---------------------------------------------------------------------------------------------
// Terminal Count Heuristics

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

const size_t true_weight =
1 + 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;
const size_t size = dd.size();
const size_t width = dd.width();

// ---------------------------------------------------------------------------------------------
// Shallow Variables Heuristic
Expand Down Expand Up @@ -1364,7 +1346,7 @@ namespace adiar::internal
adiar_assert(shallow_variables <= Policy::max_label);

// ---------------------------------------------------------------------------------------------
return std::min<size_t>(terminal_threshold, shallow_variables);
return shallow_variables;
}

//////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down

0 comments on commit 897a723

Please sign in to comment.