Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
konpklr committed Jul 1, 2024
1 parent b7ec4b9 commit 574cb5c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
3 changes: 3 additions & 0 deletions mt-kahypar/io/command_line_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,9 @@ namespace mt_kahypar {
("penalty-metric-idx",
po::value<int>(&context.partition.penalty_metric_idx)->value_name("<bool>")->default_value(0),
"max imbalance of refinement in md_rebalancer")
("penalty-metric-idx-binpack",
po::value<int>(&context.partition.penalty_metric_idx_binpacking)->value_name("<bool>")->default_value(0),
"max imbalance of refinement in md_rebalancer")
("l1-factor",
po::value<double>(&context.partition.l1_start_factor)->value_name("<double>")->default_value(1.0),
"l1 factor")
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 @@ -85,6 +85,7 @@ struct PartitioningParameters {
double fallback_large_node_threshold;
bool fallback_extract_equally = false;
int penalty_metric_idx;
int penalty_metric_idx_binpacking = 1;

bool constrained_refinement_after_fallback = false;

Expand Down
15 changes: 13 additions & 2 deletions mt-kahypar/partition/refinement/rebalancing/md_rebalancer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2414,6 +2414,17 @@ namespace mt_kahypar{
case 6: return penalty6(weight);
}
};
auto penalty_binpack = [&](HypernodeWeight weight){
switch(_context->partition.penalty_metric_idx_binpacking){
case 0: return penalty0(weight);
case 1: return penalty1(weight);
case 2: return penalty2(weight);
case 3: return penalty3(weight);
case 4: return penalty4(weight);
case 5: return penalty5(weight);
case 6: return penalty6(weight);
}
};

std::vector<HypernodeID> S;
std::vector<bool> is_in_S(phg->initialNumNodes(), false);
Expand Down Expand Up @@ -2505,7 +2516,7 @@ namespace mt_kahypar{
PartitionID max_p = _context->partition.fallback_extract_equally ? select_heaviest_p() : select_max_pen_p();
if(!extract(max_p)) return {0.0,false};
}
if(binpacker.binpack(S.size(), virtual_weight, penalty)){
if(binpacker.binpack(S.size(), virtual_weight, penalty_binpack)){
break;
}
else{
Expand Down Expand Up @@ -2546,7 +2557,7 @@ namespace mt_kahypar{
S_weight += get_normalized_weight(phg->nodeWeight(S[last_idx]));
}
ASSERT(last_idx + 1 >= starting_size);
if(binpacker.binpack(last_idx + 1, virtual_weight, penalty)){
if(binpacker.binpack(last_idx + 1, virtual_weight, penalty_binpack)){
succ_idx = last_idx + 1;
upper = current;
highest_possible_idx = last_idx;
Expand Down

0 comments on commit 574cb5c

Please sign in to comment.