Skip to content

Commit

Permalink
geometric interpolation in cooling fm
Browse files Browse the repository at this point in the history
  • Loading branch information
N-Maas committed Jul 7, 2023
1 parent c51f377 commit 1dd9f74
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
4 changes: 4 additions & 0 deletions mt-kahypar/io/command_line_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,10 @@ namespace mt_kahypar {
po::value<double>((initial_partitioning ? &context.initial_partitioning.refinement.fm.unconstrained_upper_bound_min :
&context.refinement.fm.unconstrained_upper_bound_min))->value_name("<double>")->default_value(0.0),
"Cooling FM algorithm: Minimum (final) upper bound (default = 0 = equal to start).")
((initial_partitioning ? "i-r-fm-cooling-geometric-interpolation" : "r-fm-cooling-geometric-interpolation"),
po::value<bool>((initial_partitioning ? &context.initial_partitioning.refinement.fm.geometric_interpolation :
&context.refinement.fm.geometric_interpolation))->value_name("<bool>")->default_value(false),
"Cooling strategy: Use geometric instead of linear interpolation.")
((initial_partitioning ? "i-r-fm-activate-unconstrained-dynamically" : "r-fm-activate-unconstrained-dynamically"),
po::value<bool>((initial_partitioning ? &context.initial_partitioning.refinement.fm.activate_unconstrained_dynamically :
&context.refinement.fm.activate_unconstrained_dynamically))->value_name("<bool>")->default_value(false),
Expand Down
1 change: 1 addition & 0 deletions mt-kahypar/partition/context.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ struct FMParameters {
double imbalance_penalty_min = 0.2;
double imbalance_penalty_max = 1.0;
double unconstrained_upper_bound_min = 0.0;
bool geometric_interpolation = false;

// unconstrained: dynamic enabling/disableing
bool activate_unconstrained_dynamically = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,13 @@ class CoolingStrategy: public IFMStrategy {
if (round == 0) {
return start;
}
double summed = (n_rounds - round - 1) * start + round * end;
return summed / static_cast<double>(n_rounds - 1);
if (context.refinement.fm.geometric_interpolation) {
double factor = end / start;
return start * std::pow(factor, static_cast<double>(round) / static_cast<double>(n_rounds - 1));
} else {
double summed = (n_rounds - round - 1) * start + round * end;
return summed / static_cast<double>(n_rounds - 1);
}
};

if (round < n_rounds) {
Expand Down

0 comments on commit 1dd9f74

Please sign in to comment.