Polymorphic dynamic programming by algebraic shortcut fusion

被引:0
|
作者
Little, Max A. [1 ]
He, Xi [1 ]
Kayas, Ugur [1 ]
机构
[1] Univ Birmingham, Comp Sci, Birmingham, W Midlands, England
关键词
Dynamic programming; combinatorial optimisation; shortcut fusion; semiring;
D O I
10.1145/3664828
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
Dynamic programming (DP) is a broadly applicable algorithmic design paradigm for the efficient, exact solution of otherwise intractable, combinatorial problems. However, the design of such algorithms is often presented informally in an ad-hoc manner. It is sometimes difficult to justify the correctness of these DP algorithms. To address this issue, this article presents a rigorous algebraic formalism for systematically deriving DP algorithms, based on semiring polymorphism. We start with a specification, construct a ( brute-force) algorithm to compute the required solution which is self-evidently correct because it exhaustively generates and evaluates all possible solutions meeting the specification. We then derive, primarily through the use of shortcut fusion, an implementation of this algorithm which is both efficient and correct. We also demonstrate how, with the use of semiring lifting, the specification can be augmented with combinatorial constraints and through semiring lifting, show how these constraints can also be fused with the derived algorithm. This article furthermore demonstrates how existing DP algorithms for a given combinatorial problem can be abstracted from their original context and re-purposed to solve other combinatorial problems. This approach can be applied to the full scope of combinatorial problems expressible in terms of semirings. This includes, for example: optimisation, optimal probability and Viterbi decoding, probabilistic marginalization, logical inference, fuzzy sets, differentiable softmax, and relational and provenance queries. The approach, building on many ideas from the existing literature on constructive algorithmics, exploits generic properties of (semiring) polymorphic functions, tupling and formal sums (lifting), and algebraic simplifications arising from constraint algebras. We demonstrate the effectiveness of this formalism for some example applications arising in signal processing, bioinformatics and reliability engineering. Python software implementing these algorithms can be downloaded from: http://www.maxlittle.net/software/dppolyalg.zip.
引用
下载
收藏
页数:32
相关论文
共 50 条
  • [21] Semantics and pragmatics of new shortcut fusion rules
    Voigtlaender, Janis
    FUNCTIONAL AND LOGIC PROGRAMMING, 2008, 4989 : 163 - 179
  • [22] A Library Writer's Guide to Shortcut Fusion
    Harper, Thomas
    ACM SIGPLAN NOTICES, 2011, 46 (12) : 47 - 58
  • [23] A Library Writer's Guide to Shortcut Fusion
    Harper, Thomas
    HASKELL 11: PROCEEDINGS OF THE 2011 ACM SIGPLAN HASKELL SYMPOSIUM, 2011, : 47 - +
  • [24] A Shortcut Fusion Rule for Circular Program Calculation
    Fernandes, Joao Paulo
    Pardo, Alberto
    Saraiva, Joao
    HASKELL'07: PROCEEDINGS OF THE ACM SIGPLAN 2007 HASKELL WORKSHOP, 2007, : 95 - 106
  • [25] Multiple Intermediate Structure Deforestation by Shortcut Fusion
    Pardo, Alberto
    Paulo Fernandes, Joao
    Saraiva, Joao
    PROGRAMMING LANGUAGES, SBLP 2013, 2013, 8129 : 120 - 134
  • [26] POLYMORPHIC REWRITING CONSERVES ALGEBRAIC CONFLUENCE
    BREAZUTANNEN, V
    GALLIER, J
    INFORMATION AND COMPUTATION, 1994, 114 (01) : 1 - 29
  • [27] Signature restriction for polymorphic algebraic effects
    Sekiyama, Taro
    Tsukada, Takeshi
    Igarashi, Atsushi
    JOURNAL OF FUNCTIONAL PROGRAMMING, 2024, 34
  • [28] Signature Restriction for Polymorphic Algebraic Effects
    Sekiyama, Taro
    Tsukada, Takeshi
    Igarashi, Atsushi
    PROCEEDINGS OF THE ACM ON PROGRAMMING LANGUAGES-PACMPL, 2020, 4 (ICFP):
  • [29] An algebraic theory of polymorphic temporal media
    Hudak, P
    PRACTICAL ASPECTS OF DECLARATIVE LANGUAGES, 2004, 3057 : 1 - 15
  • [30] A SUPER SHORTCUT - PROGRAMMING TIP MAKES LIFE EASIER
    BAKER, RW
    MICROCOMPUTING, 1983, 7 (02): : 16 - &