Optimizing Optimizations, Declaratively: Optimizing the Higher-Order Functions in Mathematical Optimization with egglog
Hiromi Ishii

TL;DR
This paper demonstrates how egglog can be applied to improve mathematical optimization modeling and constraint detection, leading to more natural notation and faster processing in industrial applications.
Contribution
It introduces novel applications of egglog for better notation and constraint detection in mathematical models, with performance improvements through optimized rule premises.
Findings
Enhanced LaTeX output for higher-order functions in models
Declarative multi-step constraint detection with egglog
Reduced detection time from minutes to seconds
Abstract
We present two applications of egglog to mathematical optimization in JijModeling 2, a mathematical modeller whose internal representation is based on simply typed -calculus. First, we use egglog to improve output for mathematical models expressed with higher-order functions. Python comprehensions are desugared into stream operations such as , \textsf{flat_map}, and ; emitting these terms directly produces unnatural mathematical notation. We reconstruct comprehension syntax by \emph{ensugaring} higher-order terms and use equality saturation with a custom cost model to minimize temporary variable rebindings. Second, we use egglog as a declarative engine for \emph{constraint detection}, extending the previous egg-based approach presented at EGRAPHS '25. Egglog's datalog-style rules let us express multi-step detection logic directly,…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
