The ADPfusion package

[Tags:bsd3, library, test]

generalized Algebraic Dynamic Programming

ADPfusion combines stream-fusion (using the stream interface provided by the vector library) and type-level programming to provide highly efficient dynamic programming combinators.

ADPfusion allows writing dynamic programs for single- and multi-tape problems. Inputs can be sequences, or sets. New input types can be defined, without having to rewrite this library thanks to the open-world assumption of ADPfusion.

The library provides the machinery for Outside and Ensemble algorithms as well. Ensemble algorithms combine Inside and Outside calculations.

Starting with version 0.4.1 we support writing multiple context-free grammars (interleaved syntactic variables). Such grammars have applications in bioinformatics and linguistics.

The homepage provides a number of tutorial-style examples, with linear and context-free grammars over sequence and set inputs.

The formal background for generalized algebraic dynamic progrmaming and ADPfusion is described in a number of papers. These can be found on the gADP homepage and in the README.


[Skip to Readme]

Properties

Versions 0.0.1.0, 0.0.1.1, 0.0.1.2, 0.1.0.0, 0.2.0.0, 0.2.0.1, 0.2.0.2, 0.2.0.3, 0.2.0.4, 0.2.1.0, 0.4.0.0, 0.4.0.1, 0.4.0.2, 0.4.1.0, 0.4.1.1, 0.5.0.0, 0.5.1.0, 0.5.2.0 (info)
Change log changelog.md
Dependencies base (>=4.7 && <5.0), bits (>=0.4 && <0.6), containers, DPutils (==0.0.0.*), mmorph (==1.0.*), mtl (>=2.0 && <2.3), OrderedBits (==0.0.1.*), primitive (>=0.5.4 && <0.7), PrimitiveArray (==0.7.1.*), QuickCheck (>=2.7 && <2.9), strict (==0.3.*), template-haskell (>=2.0 && <3.0), th-orphans (>=0.12 && <0.14), transformers (>=0.3 && <0.6), tuple (==0.3.*), vector (==0.11.*) [details]
License BSD3
Copyright Christian Hoener zu Siederdissen, 2011-2016
Author Christian Hoener zu Siederdissen, 2011-2016
Maintainer choener@bioinf.uni-leipzig.de
Stability experimental
Category Algorithms, Data Structures, Bioinformatics, Formal Languages
Home page https://github.com/choener/ADPfusion
Bug tracker https://github.com/choener/ADPfusion/issues
Source repository head: git clone git://github.com/choener/ADPfusion
Uploaded Thu Sep 1 19:12:12 UTC 2016 by ChristianHoener
Distributions NixOS:0.5.2.0
Downloads 4137 total (59 in the last 30 days)
Votes
0 []
Status Docs available [build log]
Last success reported on 2016-09-01 [all 1 reports]

Modules

[Index]

Flags

NameDescriptionDefaultType
examplesbuild the examplesDisabledManual
debugdump intermediate Core filesDisabledManual
spectestbuild the spec-ctor test caseDisabledManual
develbuild additional testsDisabledManual
btstrucperformance test for backtracking structuresDisabledManual

Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info

Downloads

Maintainer's Corner

For package maintainers and hackage trustees

Readme for ADPfusion

Readme for ADPfusion-0.5.2.0

Build Status

ADPfusion

generalized Algebraic Dynamic Programming Homepage

Ideas implemented here are described in a couple of papers:

  1. Christian Hoener zu Siederdissen
    Sneaking Around ConcatMap: Efficient Combinators for Dynamic Programming
    2012, Proceedings of the 17th ACM SIGPLAN international conference on Functional programming
    paper preprint
  2. Andrew Farmer, Christian Höner zu Siederdissen, and Andy Gill.
    The HERMIT in the stream: fusing stream fusion’s concatMap
    2014, Proceedings of the ACM SIGPLAN 2014 workshop on Partial evaluation and program manipulation.
    paper
  3. Christian Höner zu Siederdissen, Ivo L. Hofacker, and Peter F. Stadler.
    Product Grammars for Alignment and Folding
    2014, IEEE/ACM Transactions on Computational Biology and Bioinformatics. 99
    paper
  4. Christian Höner zu Siederdissen, Sonja J. Prohaska, and Peter F. Stadler
    Algebraic Dynamic Programming over General Data Structures
    2015, BMC Bioinformatics
    preprint
  5. Maik Riechert, Christian Höner zu Siederdissen, and Peter F. Stadler
    Algebraic dynamic programming for multiple context-free languages
    2015, submitted
    preprint

Introduction

ADPfusion combines stream-fusion (using the stream interface provided by the vector library) and type-level programming to provide highly efficient dynamic programming combinators.

From the programmers' viewpoint, ADPfusion behaves very much like the original ADP implementation http://bibiserv.techfak.uni-bielefeld.de/adp/ developed by Robert Giegerich and colleagues, though both combinator semantics and backtracking are different.

The library internals, however, are designed not only to speed up ADP by a large margin (which this library does), but also to provide further runtime improvements by allowing the programmer to switch over to other kinds of data structures with better time and space behaviour. Most importantly, dynamic programming tables can be strict, removing indirections present in lazy, boxed tables.

As an example, even rather complex ADP code tends to be completely optimized to loops that use only unboxed variables (Int# and others, indexIntArray# and others).

Completely novel (compared to ADP), is the idea of allowing efficient monadic combinators. This facilitates writing code that performs backtracking, or samples structures stochastically, among others things.

Installation

Follow the gADP examples.

Implementors Notes (if you want to extend ADPfusion)

  • The general inlining scheme is: (i) mkStream is {-# INLINE mkStream #-}, inner functions like mk, step, worker functions, and index-modifying functions get an {-# INLINE [0] funName #-}. Where there is no function to annotate, use delay_inline.

  • If you implement a new kind of memoizing table, like the dense Table.Array ones, you will have to implement mkStream code. When you hand to the left, the (i,j) indices and modify their extend (by, say, having NonEmpty table constaints), you have to delay_inline this (until inliner phase 0). Otherwise you will break fusion for mkStream.

  • Terminals that capture both, say indexing functions, and data should have no strictness annotations for the indexing function. This allows the code to be duplicated, then inlined. This improves performance a lot, because otherwise a function is created that performs these lookups, which has serious (50% slower or so) performance implications.

Contact

Christian Hoener zu Siederdissen
Leipzig University, Leipzig, Germany
choener@bioinf.uni-leipzig.de
http://www.bioinf.uni-leipzig.de/~choener/