We define and study the Functional Aggregate Query (FAQ) problem, which encompasses many frequently asked questions in constraint satisfaction, databases, matrix operations, probabilistic graphical models and logic. This is our main conceptual contribution. We then present a simple algorithm called "InsideOut" to solve this general problem. InsideOut is a variation of the traditional dynamic programming approach for constraint programming based on variable elimination. Our variation adds a couple of simple twists to basic variable elimination in order to deal with the generality of FAQ, to take full advantage of Grohe and Marx's fractional edge cover framework, and of the analysis of recent worst-case optimal relational join algorithms. As is the case with constraint programming and graphical model inference, to make InsideOut run efficiently we need to solve an optimization problem to compute an appropriate 'variable ordering'. The main technical contribution of this work is a precise characterization of when a variable ordering is 'semantically equivalent' to the variable ordering given by the input FAQ expression. Then, we design an approximation algorithm to find an equivalent variable ordering that has the best 'fractional FAQ-width'. Our results imply a host of known and a few new results in graphical model inference, matrix operations, relational joins, and logic. We also briefly explain how recent algorithms on beyond worst-case analysis for joins and those for solving SAT and #SAT can be viewed as variable elimination to solve FAQ over compactly represented input functions.
翻译:我们定义并研究了函数聚合查询(FAQ)问题,该问题涵盖了约束满足、数据库、矩阵运算、概率图模型和逻辑中的许多常见问题。这是我们的主要概念性贡献。随后,我们提出了一种名为“InsideOut”的简单算法来解决这一通用问题。InsideOut是基于变量消去的约束编程传统动态规划方法的一种变体。我们的变体在基本变量消去方法上添加了几个简单的调整,以处理FAQ的通用性,充分利用Grohe和Marx的分数边覆盖框架,以及近期最坏情况最优关系连接算法的分析。与约束编程和图模型推理类似,为使InsideOut高效运行,我们需要解决一个优化问题来计算合适的“变量顺序”。本研究的主要技术贡献在于精确刻画了变量顺序何时与输入FAQ表达式给出的变量顺序“语义等价”。接着,我们设计了一种近似算法,以找到具有最佳“分数FAQ宽度”的等价变量顺序。我们的结果涵盖了图模型推理、矩阵运算、关系连接和逻辑中的大量已知结果及若干新结果。我们还简要解释了最近的超越最坏情况连接分析算法以及求解SAT和#SAT的算法如何被视为在紧凑表示输入函数上通过变量消去求解FAQ。