# Example
hmetis.exe circuit.hgr 2 5 1 1 1 0 0 0
# Arguments (must provide all!):
# k : Number of parts
# UBfactor : Imbalance (5 = 5%)
# Nruns : Iterations
# CType : 1=HFC, 2=FC, 3=GFC, 4=HEDGE, 5=EDGE
# RType : 1=FM, 2=1WayFM, 3=EEFM
# VCycle : 0=No, 1=@End, 2=ForMin, 3=All
# Reconst : 0 or 1
# dbglvl : Debug level
```
> ๐ **No defaults**, requires 9+ positional args, zero documentation
---
### CLI: KaHyPar ๐
```bash
# Clean, modern argument parsing
mtkahypar -h circuit.hgr -k 2 -e 0.05 -o cut -p quality
# With verbose output
mtkahypar -h circuit.hgr -k 2 -e 0.05 -o cut -p default --verbose
# Write partition file
mtkahypar -h circuit.hgr -k 2 -e 0.05 -o cut -w --partition-output-folder ./out
# Arguments
# -h, --hypergraph : Input file
# -k, --blocks : Number of blocks
# -e, --epsilon : Imbalance parameter
# -o, --objective : cut / km1 / soed / steiner_tree
# -p, --preset-type : default / quality / highest_quality / deterministic
```
> ๐ **Modern CLI**, named arguments, good documentation, **but** requires `--objective` (no default)
---
class: nord-light, middle, center
## โ ๏ธ Warning Display Behavior
---
### The Test Case ๐งช
```
3 5 10 โ 3 nets, 5 vertices, format 10 (vertex weights)
1 2 3 โ Net 0 connects v1, v2, v3
1 4 5 โ Net 1 connects v1, v4, v5
2 3 5 โ Net 2 connects v2, v3, v5
10000000 โ Vertex 0 weight = 10,000,000 (huge!)
1 โ Vertex 1 weight = 1
1 โ Vertex 2 weight = 1
1 โ Vertex 3 weight = 1
1 โ Vertex 4 weight = 1
```
**Total weight**: 10,000,004 | **Ideal balance**: 5,000,002 per part
With $\epsilon = 0.0000001$ (0.00001%): each part must have weight $\ge 1$
The huge vertex (10M) **cannot** be split โ imbalance **guaranteed**!
---
### ckpttn-cpp: Warning Behavior โ
```
$ CkPttn.exe test_balance.hgr 2 0.5 --verbose
Reading hypergraph from test_balance.hgr...
Hypergraph: 5 vertices, 3 nets
K=2, epsilon=0.5, preset=default
Running partitioning (preset: default, mode: recursive)...
Partitioning cost: 2
Warning: final partition does not satisfy the balance constraint
```
| Part | Weight | Max Allowed | Status |
|:----:|:------:|:-----------:|:------:|
| 0 | 4 | ~5,000,002 | โ Violated |
| 1 | 10,000,000 | ~5,000,002 | โ Violated |
> ๐ข **Explicit warning** in final output โ impossible to miss
---
### hMetis: Warning Behavior โ
```
$ hmetis.exe test_balance_hmetis.hgr 2 1 1 1 1 0 0 0
HMETIS 1.5.3 Copyright 1998, Regents of the University of Minnesota
HyperGraph Information -----------------------------------------------------
Name: test_balance_hmetis.hgr, #Vtxs: 5, #Hedges: 3, #Parts: 2, UBfactor: 0.01
Options: HFC, FM, Reconst-False, No V-cycles, No Fixed Vertices
Recursive Partitioning... --------------------------------------------------
--------------------------------------------------------------------------
Summary for the 2-way partition:
Hyperedge Cut: 2
Sum of External Degrees: 4
Scaled Cost: 1.00e-001
Absorption: 2.00
Partition Sizes & External Degrees:
10000000[ 2] 4[ 2] โ 10M vs 4, imbalance = 99.96%
โ ๏ธ NO WARNING
```
| Part | Weight | UBfactor 1% | Warning? |
|:----:|:------:|:-----------:|:--------:|
| 0 | 10,000,000 | ~5,050,000 | ๐ด None! |
| 1 | 4 | ~5,050,000 | ๐ด None! |
> ๐ด **No warning at all** โ silently returns imbalanced result
---
### KaHyPar: Warning Behavior โ ๏ธ
```
$ mtkahypar -h test_balance.hgr -k 2 -e 0.0000001 -o cut --verbose
...
Local Search Results:
** Partition is imbalanced (Current Imbalance: 0.999999) **
Part weights: (violations in red)
|block 0| = 1 w(0) = 10000000 max(0) = 5000002 โ RED
|block 1| = 4 w(1) = 4 max(1) = 5000002 โ RED
** Start rebalancing! **
** Rebalancer improves solution quality by 0 **
...
*****************************************************************************
* Partitioning Result *
*****************************************************************************
Objectives:
Imbalance = 0.999999
Has Empty Blocks = false
...
```
| Part | Weight | Max Allowed | Warning? |
|:----:|:------:|:-----------:|:--------:|
| 0 | 10,000,000 | 5,000,002 | ๐ก In Local Search only |
| 1 | 4 | 5,000,002 | ๐ก Not in Final Result |
> ๐ก **Intermediate warning** but **final result** just shows `Imbalance = 0.999999`
---
### Comparison Summary โ ๏ธ
| Tool | Intermediate Warning | **Final Output** | User Visibility |
|:----:|:-------------------:|:----------------:|:---------------:|
| **ckpttn** | N/A | โ
**Explicit text** | ๐ข Clear |
| **hMetis** | โ None | โ **None** | ๐ด Missed |
| **KaHyPar** | ๐ก "Partition is imbalanced" | โ ๏ธ Raw data only | ๐ก Confusing |
**Key insight**: Only **ckpttn-cpp** provides an explicit warning message in the **final** output that clearly states the balance constraint is violated.
---
### Why Warnings Matter for Scientific Research ๐งช
> "If you just need an answer no matter correct or not, I can give you a program that runs within **0.000001 seconds**!" โก
**The "Instant Answer" Fallacy**:
```python
def partition(hypergraph, k, epsilon):
return [0] * len(hypergraph) # All vertices in part 0 โ done in 1ยตs!
```
โ
Fast? Yes.
โ
Gives an answer? Yes.
โ **Valid? No.** The balance constraint is trivially violated.
---
### The Scientific Integrity Problem ๐ฌ
**Without warnings**, these tools are indistinguishable:
```
Tool A (1ยตs): 0 0 0 0 0 โ all in one part, balance violated โ
Tool B (5ms): 0 0 1 1 0 โ balanced, legitimate result โ
```
**Silent failure** in scientific computing leads to:
| Problem | Consequence |
|:--------|:-----------|
| ๐ญ **False confidence** | User assumes result is valid |
| ๐ **Non-reproducible** | Different runs give different quality |
| ๐ **Invalid benchmarks** | Published results may be meaningless |
| ๐งช **Wrong conclusions** | Downstream research built on bad data |
**The warning transforms an opaque answer into accountable science.** ๐ก๏ธ
---
### The Reproducibility Crisis ๐
.mermaid[
flowchart LR
A[Silent Tool] --> B["Imbalanced\n Result"]
B --> C[User Trusts โ
]
C --> D[Published Paper ๐]
D --> E[Others Try to\n Reproduce ๐ค]
E --> F["Can't Reproduce โ\n Waste of Time"]
A2[Tool with Warning] --> B2["Imbalanced\n Result + โ ๏ธ"]
B2 --> C2[User Investigates ๐]
C2 --> D2[Fix Parameters ๐ง]
D2 --> E2[Valid Result โ
]
E2 --> F2[Reproducible Science ๐]
style A fill:#f44336
style B fill:#f44336
style C fill:#f44336
style D fill:#f44336
style E fill:#f44336
style F fill:#f44336
style A2 fill:#4caf50
style B2 fill:#4caf50
style C2 fill:#4caf50
style D2 fill:#ff9800
style E2 fill:#4caf50
style F2 fill:#4caf50
]
A warning turns a **silent failure** into an **actionable signal**. Without it, researchers waste months chasing results that were invalid from the start. โณ
---
### The "Rigorous Answer" Contract ๐
A partitioner should guarantee:
$$ \text{output} = \begin{cases}
\text{valid partition}, & \text{if } \exists \text{ feasible solution} \\
\text{best-effort} + \color{red}{\text{โ ๏ธ warning}}, & \text{otherwise}
\end{cases} $$
**Without warning**:
$$ \text{user assumes: } \text{output} \implies \text{valid} $$
**With warning**:
$$ \text{output} + \color{red}{\text{โ ๏ธ warning}} \implies \text{"check your constraints!"} $$
This is the **difference between science and guesswork**. ๐ฏ
---
### Confusing Downstream Auto-Tuning ๐ค
**Reinforcement Learning** for parameter tuning relies on **reward signals**:
$$ \text{Reward} = f(\text{cut}, \text{imbalance}, \text{runtime}) $$
A silent imbalanced result looks **identical** to a valid one:
```
State โ Agent โ Action (ฮต) โ Partitioner โ Result โ Reward
โ
Silent failure: cut=2, imbalance=0.999999 โ โ looks OK to RL
Valid result: cut=2, imbalance=0.000000 โ โ
actually OK
```
**The RL agent cannot distinguish** between:
- ๐ข "Good partition with low cut" (valid)
- ๐ด "Bad partition because constraint was violated" (invalid)
---
### RL Tuning Gone Wrong ๐ฐ
.mermaid[
flowchart TD
subgraph "Without Warning โ ๏ธ"
A1[RL Agent] -->|tune ฮต| B1[Silent Partitioner]
B1 -->|cut=2| C1[Reward: high!]
C1 --> A1
B1 -.->|imbalance hidden| D1[Agent thinks ฮต=0.5 is great]
D1 -.-> A1
end
subgraph "With Warning โ
"
A2[RL Agent] -->|tune ฮต| B2[Honest Partitioner]
B2 -->|cut=2 + โ ๏ธ| C2[Reward: penalized!]
C2 --> A2
B2 -->|imbalance reported| D2[Agent learns ฮต is too strict]
D2 --> A2
end
style A1 fill:#f44336
style B1 fill:#f44336
style C1 fill:#f44336
style D1 fill:#f44336
style A2 fill:#4caf50
style B2 fill:#4caf50
style C2 fill:#4caf50
style D2 fill:#ff9800
]
**Without warnings**, the RL agent learns the **wrong policy** โ it thinks tight constraints give good cuts because it doesn't know the constraints were silently violated. The agent converges to a useless configuration. ๐ฐ
---
### Auto-Tuning: Key Equations ๐
**RL objective with silent failure**:
$$ \pi^* = \arg\max_\pi \mathbb{E}_{\tau \sim \pi} \left[ \sum_t R_t \right] $$
where the reward $R_t$ is **contaminated**:
$$ R_t = \underbrace{R_{\text{cut}}}_{\text{low!}} - \underbrace{\lambda \cdot \mathbb{1}[\text{balanced}]}_{\text{always 0 if hidden!}} $$
The agent greedily drives $\epsilon \to 0$, thinking tighter constraints always improve quality โ when in reality, it's just **ignoring broken results**.
**With explicit warnings**, the reward becomes:
$$ R_t = R_{\text{cut}} - \lambda \cdot \text{โ ๏ธ}_t $$
Now the agent learns that $\epsilon$ too low โ warning โ penalty โ **not useful**. ๐ฏ
---
### Real-World Impact ๐
| Scenario | Silent Tool | Tool with Warning |
|:---------|:-----------:|:-----------------:|
| ๐งช **Researcher** | Publishes invalid benchmark ๐โ | Catches issue, fixes ฮต ๐ง |
| ๐ค **RL Tuning** | Learns wrong policy, wastes GPU months ๐ฐ | Learns valid parameter region ๐ฏ |
| ๐ญ **Production** | Silent quality degradation ๐ | Alert โ rollback ๐ |
| ๐ **Reproducibility** | "Works on my machine" ๐คท | Clear failure signal ๐ก |
> **Bottom line**: A warning is not just a nice-to-have โ it's **essential infrastructure** for any research pipeline that uses partitioning as a building block. Without it, every downstream result is suspect. ๐ต๏ธ
---
class: nord-light, middle, center
## ๐งช Experimental Results
---
### Test Setup ๐ฌ
**Hardware**: WSL2 (Ubuntu 22.04) on Windows 11
**Test hypergraph**:
$$|V| = 5, \quad |\mathcal{E}| = 3, \quad \text{weights} = [10^7, 1, 1, 1, 1]$$
**Metric**: Does the tool warn when balance constraint is violated?
| Tool | Version | Epsilon / UBfactor | Result |
|:----:|:-------:|:------------------:|:------:|
| ckpttn | v1.0 | $\epsilon = 0.5$ | โ
Warning |
| hMetis | 1.5.3 (1998) | UBfactor = 1% | โ Silent |
| KaHyPar | 1.6.1 | $\epsilon = 10^{-7}$ | โ ๏ธ Imbalance shown |
---
### Mermaid: Decision Flow ๐
.mermaid[
flowchart TD
A[Run Partitioner] --> B{Balance\nSatisfied?}
B -->|Yes| C["โ
Return Result"]
B -->|No| D{Which Tool?}
D -->|ckpttn-cpp| E["โ ๏ธ Explicit Warning\nin Final Output"]
D -->|hMetis| F["โ Silent Return\nNo Indication"]
D -->|KaHyPar| G["๐ Imbalance Value\nin Final Stats"]
E --> H["User takes action\n(fix weights / relax ฮต)"]
F --> I["User assumes OK โ"]
G --> J["User must interpret\nraw numbers"]
style A fill:#4caf50
style B fill:#ff9800
style C fill:#4caf50
style D fill:#f44336
style E fill:#4caf50
style F fill:#f44336
style G fill:#ff9800
style H fill:#4caf50
style I fill:#f44336
style J fill:#ff9800
]
---
### Code Quality & Maintainability ๐
| Aspect | **ckpttn-cpp** | **hMetis** | **KaHyPar** |
|:-------|:--------------:|:----------:|:-----------:|
| Language | C++20 ๐ | C89 ๐ฆ | C++17 ๐ |
| Build System | CMake โ
| Makefile | CMake โ
|
| Tests | doctest โ
| None โ | Extensive โ
|
| Documentation | Doxygen โ
| Manual (PDF) | Doxygen โ
|
| CI/CD | GitHub Actions โ
| None โ | GitHub Actions โ
|
| Code Coverage | codecov โ
| None โ | codecov โ
|
| Active Issues | Tracked โ
| None โ | Tracked โ
|
---
class: nord-light, middle, center
## ๐ Summary & Recommendations
---
### Summary ๐
.mermaid[
graph LR
subgraph "Hypergraph Partitioning Tools"
A[ckpttn-cpp] --> A1[Modern C++20]
A --> A2[Explicit Warnings โ
]
A --> A3[Active Development]
B[hMetis] --> B1[Ancient Codebase]
B --> B2[Silent Failures โ]
B --> B3[Abandoned]
C[KaHyPar] --> C1[High Quality]
C --> C2[Partial Warnings โ ๏ธ]
C --> C3[Active, Python Bindings]
end
style A fill:#4caf50
style A1 fill:#4caf50
style A2 fill:#4caf50
style A3 fill:#4caf50
style B fill:#f44336
style B1 fill:#f44336
style B2 fill:#f44336
style B3 fill:#f44336
style C fill:#ff9800
style C1 fill:#ff9800
style C2 fill:#ff9800
style C3 fill:#ff9800
]
---
### Recommendations ๐ฏ
| Scenario | Recommended Tool | Rationale |
|:---------|:---------------:|:----------|
| ๐ **New project** | **ckpttn-cpp** | Modern C++, explicit warnings, MIT license |
| ๐ฌ **Research / Benchmark** | **KaHyPar** | Highest quality, Python bindings, multi-threaded |
| ๐ **Legacy / Compatibility** | **hMetis** | Only for reproducing old results |
| ๐ฆ **Need balance warnings** | **ckpttn-cpp** | **Only tool** with explicit final-output warning |
**Bottom line**: ckpttn-cpp is the **only tool** that explicitly warns users when the balance constraint is violated in the final output. For quality-sensitive partitioning, use KaHyPar. For new development with safety checks, use ckpttn-cpp.
---
### What We Learned ๐
1. ๐งฎ **Hypergraph partitioning** is critical for VLSI, EDA, ML, and parallel computing
2. โ๏ธ **Balance constraints** define the quality-vs-feasibility trade-off
3. ๐ **Warning behavior varies wildly** across tools โ from silent (hMetis) to explicit (ckpttn)
4. ๐ **ckpttn-cpp** now has the **best warning behavior** โ a clear message in the final output
5. ๐ **KaHyPar** offers the highest quality but doesn't explicitly warn
6. ๐ **hMetis** is functionally abandoned and silently returns bad results
---
count: false
class: nord-dark, middle, center
## ๐ References
- ckpttn-cpp: [github.com/luk036/ckpttn-cpp](https://github.com/luk036/ckpttn-cpp)
- KaHyPar: [github.com/kahypar/kahypar](https://github.com/kahypar/kahypar)
- hMetis: [karypis.github.io](https://karypis.github.io/glaros/software/metis/overview.html)
- Fiduccia & Mattheyses (1982). "A Linear-Time Heuristic for Improving Network Partitions"
---
count: false
class: nord-dark, middle, center
count: false
class: nord-dark, middle, center
## Q&A ๐ค
## ๐ Thank You!