Scenario-Based Robust Optimization of Tree Structures

Spyros Angelopoulos, Christoph Dürr, Alex Elenter, Georgii Melidi

Introduction

In classical computer science, data structures like Binary Search Trees (BSTs) and Huffman codes are typically optimized for a single, known frequency distribution of keys. However, in many real-world applications, the exact access pattern is uncertain or variable. This paper introduces a framework for scenario-based robust optimization, where a single tree structure must perform well across a set of $k$ potential scenarios.

The Problem of Uncertainty

Standard algorithms fail to provide guarantees when the underlying distribution is unknown. For instance, a Huffman code optimized for English text may perform poorly if the input is actually Finnish. The authors address this by constructing trees that minimize either the competitive ratio (performance relative to the best possible tree for a specific scenario) or the regret (the additive difference in cost).

Algorithmic Framework

The authors prove that finding the optimal robust tree is NP-hard even for $k=2$ scenarios. To address this, they propose two primary heuristics:

  • R-BST Algorithm: A recursive approach for BSTs that selects candidate roots based on their levels in individual scenario-optimal trees. It achieves a guaranteed competitive ratio of $\lceil \log_2(k+1) \rceil$.
  • R-HT Algorithm: For Huffman trees, this algorithm aggregates optimal codes by prepending bits to identify the most favorable scenario for each key, achieving a regret of at most $\lceil \log_2 k \rceil$.

Multi-Objective Optimization and Fairness

When scenarios represent different user groups, the problem becomes one of fairness. The authors provide a dynamic programming algorithm to identify the Pareto frontier—the set of trees where no single user group's performance can be improved without degrading another's.

The Pareto frontier for two scenarios, illustrating the trade-off between minimizing regret for different access patterns.

Empirical Results

While the theoretical bounds provide a safety net, empirical tests on European language datasets show that the algorithms perform much better in practice. The R-BST algorithm, for example, achieved a competitive ratio of ~1.2, far below its theoretical worst-case of ~3.4. This suggests that real-world data distributions are significantly less adversarial than the theoretical worst cases.

Performance comparison of R-BST and R-HT against optimal solutions. The proposed heuristics achieve near-optimal results with significantly lower computational overhead.

As shown in the table above, the robust heuristics (R-BST and R-HT) maintain costs and competitive ratios very close to the absolute optima found via Mixed Integer Linear Programming (MILP). Crucially, these heuristics run in less than 0.1 seconds, whereas exact MILP solvers can take up to 15 seconds for standard alphabets.

Key Insights and Future Work

A major takeaway is the "logarithmic price of robustness": preparing for $k$ different futures only incurs a logarithmic penalty. This mirrors results in other areas of online algorithms and robust optimization. Future research may extend these principles beyond binary structures to B-trees used in databases and quad-trees used in spatial data analysis.

Summary updated

BibTeX
@inproceedings{angelopoulos2025scenario,
  author = {Spyros Angelopoulos and Christoph Dürr and Alex Elenter and Georgii Melidi},
  title = {{Scenario-Based Robust Optimization of Tree Structures}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2025},
  doi = {10.1609/aaai.v39i25.34894},
}
Figure