dynamic programming on tree decompositions in practice · i any graph admits at least a trivial...

121
Dynamic Programming on Tree Decompositions in Practice Stefan Woltran TU Wien (Vienna University of Technology) August 30, 2016

Upload: others

Post on 06-Feb-2020

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Dynamic Programming on Tree Decompositionsin Practice

Stefan Woltran

TU Wien (Vienna University of Technology)

August 30, 2016

Page 2: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Graphs are Everywhere ...

Page 3: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Let’s Decompose them ...

=⇒

Page 4: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Let’s Decompose them ...

=⇒

Page 5: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Let’s Decompose them ...

Runtime:O (2n)

=⇒

Page 6: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Let’s Decompose them ...

Runtime:O (2n)

=⇒

Runtime:O(2k · n)

Page 7: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

The Whole Story in 3 Minutes ...

Tree Decomposition and TreewidthBy-product in the theory of graph minorsdue to Robertson and Seymour (1984);similar notions appeared even earlier(Bertelè and Brioschi, 1972; Halin, 1976).

Courcelle’s Theorem (1990)

Any property of finite structures which is definablein MSO can be decided in time O(f (k) · n) wheren is the size of the structure and k is its treewidth.

SEQUOIA (2011)A system developed by Rossmanith’s group atRWTH Aachen; SEQUOIA takes a graph andMSO description of problem and does decompo-sition and dynamic programming “inside”.

Page 8: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

The Whole Story in 3 Minutes ...

Tree Decomposition and TreewidthBy-product in the theory of graph minorsdue to Robertson and Seymour (1984);similar notions appeared even earlier(Bertelè and Brioschi, 1972; Halin, 1976).

Courcelle’s Theorem (1990)

Any property of finite structures which is definablein MSO can be decided in time O(f (k) · n) wheren is the size of the structure and k is its treewidth.

SEQUOIA (2011)A system developed by Rossmanith’s group atRWTH Aachen; SEQUOIA takes a graph andMSO description of problem and does decompo-sition and dynamic programming “inside”.

Page 9: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

The Whole Story in 3 Minutes ...

Tree Decomposition and TreewidthBy-product in the theory of graph minorsdue to Robertson and Seymour (1984);similar notions appeared even earlier(Bertelè and Brioschi, 1972; Halin, 1976).

Courcelle’s Theorem (1990)

Any property of finite structures which is definablein MSO can be decided in time O(f (k) · n) wheren is the size of the structure and k is its treewidth.

SEQUOIA (2011)A system developed by Rossmanith’s group atRWTH Aachen; SEQUOIA takes a graph andMSO description of problem and does decompo-sition and dynamic programming “inside”.

Page 10: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

The Whole Story in 3 Minutes ...

But ...

“. . . rather than synthesizing methodsindirectly from Courcelle’s Theorem,one could attempt to develop practicaldirect methods.” (Niedermeier, 2006)

... and, more recently ...“Courcelle’s theorem [...] should be regarded primarily asclassification tool, whereas designing efficient dynamicprogramming routines on tree decompositions requires’getting your hands dirty’ and constructing the algorithmexplicitly. ” (Cygan et al., 2015)

Page 11: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

The Whole Story in 3 Minutes ...

But ...

“. . . rather than synthesizing methodsindirectly from Courcelle’s Theorem,one could attempt to develop practicaldirect methods.” (Niedermeier, 2006)

... and, more recently ...“Courcelle’s theorem [...] should be regarded primarily asclassification tool, whereas designing efficient dynamicprogramming routines on tree decompositions requires’getting your hands dirty’ and constructing the algorithmexplicitly. ” (Cygan et al., 2015)

Page 12: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

The Whole Story in 3 Minutes ...

Our VisionA system that

I supports declarative specifications ofdynamic programming on treedecompositions

I performs reasonably efficientI bothers the user only with the actual

algorithm design

Quick thanks to all collaborators...Michael Abseher, Bernhard Bliem, Günther Charwat, Frederico Dusberger, JohannesFichte, Markus Hecher, Marius Moldovan, Michael Morak, Nysret Musliu andReinhard Pichler.

Page 13: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Outline

Motivation

Tree Decompositions + Dynamic Programming

The D-FLAT System

Further DevelopmentsCustomizing Tree DecompositionsAnytime OptimizationTowards Space Efficiency

Conclusion

Page 14: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

TreewidthI Some graphs are more “tree-like” than others.

I Treewidth measures “tree-likeness”.I Trees have treewidth 1.I The higher the treewidth, the more complex the graph.

I Often “easy on trees” implies “easy on tree-like graphs”.I Many problems are fixed-parameter tractable w.r.t. treewidth k , i.e.

can be decided in O(2k · n).I That is, they become easy when putting a bound on the treewidth.

I It works for many hard problems.I Real-world applications often have small treewidth.

Page 15: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

TreewidthI Some graphs are more “tree-like” than others.

I Treewidth measures “tree-likeness”.I Trees have treewidth 1.I The higher the treewidth, the more complex the graph.

I Often “easy on trees” implies “easy on tree-like graphs”.I Many problems are fixed-parameter tractable w.r.t. treewidth k , i.e.

can be decided in O(2k · n).I That is, they become easy when putting a bound on the treewidth.

I It works for many hard problems.I Real-world applications often have small treewidth.

Page 16: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Treewidth (ctd.)

Example: Treewidth 3.

Still.

Page 17: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Treewidth (ctd.)

Example: Treewidth 3. Still.

Page 18: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Treewidth (ctd.)

Example: Treewidth 3. Still.

Treewidth is defined in terms of tree decompositions.

Page 19: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Tree Decompositions

DefinitionA tree decomposition is a tree obtained from an arbitrary graph s.t.

1. Each vertex must occur in some bag.2. For each edge, there is a bag containing both endpoints.3. If vertex v appears in bags of nodes n0 and n1, then v is also in

the bag of each node on the path between n0 and n1.

Example

ab

cd

fe {b, c, d} {b, c, d}

{a, b, c} {d , e}

{b, c, d}

{c, f}

I Decomposition width: size of the largest bag (minus 1)I Treewidth: minimum width over all possible tree decompositions

Page 20: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Tree Decompositions (ctd.)

Constructing a Tree DecompositionI Any graph admits at least a trivial tree decomposition.I But finding a minimum-width tree decomposition is difficult.I However, there are good heuristics!

Dynamic Programming on Tree DecompositionsI Traverse tree decomposition from leaves to root and compute

partial solutions in each node byI suitably combining partial solutions of child nodes.I Algorithms often exponential only in decomposition width but

linear in the input size.

Page 21: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Tree Decompositions (ctd.)

Constructing a Tree DecompositionI Any graph admits at least a trivial tree decomposition.I But finding a minimum-width tree decomposition is difficult.I However, there are good heuristics!

Dynamic Programming on Tree DecompositionsI Traverse tree decomposition from leaves to root and compute

partial solutions in each node byI suitably combining partial solutions of child nodes.I Algorithms often exponential only in decomposition width but

linear in the input size.

Page 22: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Dynamic Programming on Tree Decompositions

Example: MINIMUM INDEPENDENT DOMINATING SET

Methodology:

1. Decompose instance2. Solve partial problems3. Combine the solutions

ab

cd

fe

{b, c, d} {b, c, d}

{a, b, c} {d , e}

{b, c, d}

{c, f}

b c d cost0 d d s 21 d d - 12 s d d 13 d s d 1

b c d cost0 d d s 11 s d d 22 d s d 23 - - d 1

a b c cost0 s d d 11 d s d 12 d d s 13 - - - 0

d e cost0 s d 11 d s 12 - - 0

b c d cost0 d d s 21 d d d 22 s d d 23 d s d 2

c f cost0 d s 31 d - 22 s d 2

Page 23: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Dynamic Programming on Tree Decompositions

Example: MINIMUM INDEPENDENT DOMINATING SET

Methodology:1. Decompose instance

2. Solve partial problems3. Combine the solutions

ab

cd

fe

{b, c, d} {b, c, d}

{a, b, c} {d , e}

{b, c, d}

{c, f}

b c d cost0 d d s 21 d d - 12 s d d 13 d s d 1

b c d cost0 d d s 11 s d d 22 d s d 23 - - d 1

a b c cost0 s d d 11 d s d 12 d d s 13 - - - 0

d e cost0 s d 11 d s 12 - - 0

b c d cost0 d d s 21 d d d 22 s d d 23 d s d 2

c f cost0 d s 31 d - 22 s d 2

Page 24: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Dynamic Programming on Tree Decompositions

Example: MINIMUM INDEPENDENT DOMINATING SET

Methodology:1. Decompose instance2. Solve partial problems

3. Combine the solutions

ab

cd

fe

{b, c, d} {b, c, d}

{a, b, c} {d , e}

{b, c, d}

{c, f}

b c d cost0 d d s 21 d d - 12 s d d 13 d s d 1

b c d cost0 d d s 11 s d d 22 d s d 23 - - d 1

a b c cost0 s d d 11 d s d 12 d d s 13 - - - 0

d e cost0 s d 11 d s 12 - - 0

b c d cost0 d d s 21 d d d 22 s d d 23 d s d 2

c f cost0 d s 31 d - 22 s d 2

Page 25: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Dynamic Programming on Tree Decompositions

Example: MINIMUM INDEPENDENT DOMINATING SET

Methodology:1. Decompose instance2. Solve partial problems

3. Combine the solutions

ab

cd

fe

{b, c, d} {b, c, d}

{a, b, c} {d , e}

{b, c, d}

{c, f}

b c d cost0 d d s 21 d d - 12 s d d 13 d s d 1

b c d cost0 d d s 11 s d d 22 d s d 23 - - d 1

a b c cost0 s d d 11 d s d 12 d d s 13 - - - 0

d e cost0 s d 11 d s 12 - - 0

b c d cost0 d d s 21 d d d 22 s d d 23 d s d 2

c f cost0 d s 31 d - 22 s d 2

Page 26: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Dynamic Programming on Tree Decompositions

Example: MINIMUM INDEPENDENT DOMINATING SET

Methodology:1. Decompose instance2. Solve partial problems

3. Combine the solutions

ab

cd

fe

{b, c, d} {b, c, d}

{a, b, c} {d , e}

{b, c, d}

{c, f}

b c d cost0 d d s 21 d d - 12 s d d 13 d s d 1

b c d cost0 d d s 11 s d d 22 d s d 23 - - d 1

a b c cost0 s d d 11 d s d 12 d d s 13 - - - 0

d e cost0 s d 11 d s 12 - - 0

b c d cost0 d d s 21 d d d 22 s d d 23 d s d 2

c f cost0 d s 31 d - 22 s d 2

Page 27: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Dynamic Programming on Tree Decompositions

Example: MINIMUM INDEPENDENT DOMINATING SET

Methodology:1. Decompose instance2. Solve partial problems

3. Combine the solutions

ab

cd

fe

{b, c, d} {b, c, d}

{a, b, c} {d , e}

{b, c, d}

{c, f}

b c d cost0 d d s 21 d d - 12 s d d 13 d s d 1

b c d cost0 d d s 11 s d d 22 d s d 23 - - d 1

a b c cost0 s d d 11 d s d 12 d d s 13 - - - 0

d e cost0 s d 11 d s 12 - - 0

b c d cost0 d d s 21 d d d 22 s d d 23 d s d 2

c f cost0 d s 31 d - 22 s d 2

Page 28: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Dynamic Programming on Tree Decompositions

Example: MINIMUM INDEPENDENT DOMINATING SET

Methodology:1. Decompose instance2. Solve partial problems

3. Combine the solutions

ab

cd

fe

{b, c, d} {b, c, d}

{a, b, c} {d , e}

{b, c, d}

{c, f}

b c d cost0 d d s 21 d d - 12 s d d 13 d s d 1

b c d cost0 d d s 11 s d d 22 d s d 23 - - d 1

a b c cost0 s d d 11 d s d 12 d d s 13 - - - 0

d e cost0 s d 11 d s 12 - - 0

b c d cost0 d d s 21 d d d 22 s d d 23 d s d 2

c f cost0 d s 31 d - 22 s d 2

Page 29: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Dynamic Programming on Tree Decompositions

Example: MINIMUM INDEPENDENT DOMINATING SET

Methodology:1. Decompose instance2. Solve partial problems

3. Combine the solutions

ab

cd

fe

{b, c, d} {b, c, d}

{a, b, c} {d , e}

{b, c, d}

{c, f}

b c d cost0 d d s 21 d d - 12 s d d 13 d s d 1

b c d cost0 d d s 11 s d d 22 d s d 23 - - d 1

a b c cost0 s d d 11 d s d 12 d d s 13 - - - 0

d e cost0 s d 11 d s 12 - - 0

b c d cost0 d d s 21 d d d 22 s d d 23 d s d 2

c f cost0 d s 31 d - 22 s d 2

Page 30: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Dynamic Programming on Tree Decompositions

Example: MINIMUM INDEPENDENT DOMINATING SET

Methodology:1. Decompose instance2. Solve partial problems

3. Combine the solutions

ab

cd

fe

{b, c, d} {b, c, d}

{a, b, c} {d , e}

{b, c, d}

{c, f}

b c d cost0 d d s 21 d d - 12 s d d 13 d s d 1

b c d cost0 d d s 11 s d d 22 d s d 23 - - d 1

a b c cost0 s d d 11 d s d 12 d d s 13 - - - 0

d e cost0 s d 11 d s 12 - - 0

b c d cost0 d d s 21 d d d 22 s d d 23 d s d 2

c f cost0 d s 31 d - 22 s d 2

Page 31: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Dynamic Programming on Tree Decompositions

Example: MINIMUM INDEPENDENT DOMINATING SET

Methodology:1. Decompose instance2. Solve partial problems

3. Combine the solutions

ab

cd

fe

{b, c, d} {b, c, d}

{a, b, c} {d , e}

{b, c, d}

{c, f}

b c d cost0 d d s 21 d d - 12 s d d 13 d s d 1

b c d cost0 d d s 11 s d d 22 d s d 23 - - d 1

a b c cost0 s d d 11 d s d 12 d d s 13 - - - 0

d e cost0 s d 11 d s 12 - - 0

b c d cost0 d d s 21 d d d 22 s d d 23 d s d 2

c f cost0 d s 31 d - 22 s d 2

Page 32: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Dynamic Programming on Tree Decompositions

Example: MINIMUM INDEPENDENT DOMINATING SET

Methodology:1. Decompose instance2. Solve partial problems

3. Combine the solutions

ab

cd

fe

{b, c, d} {b, c, d}

{a, b, c} {d , e}

{b, c, d}

{c, f}

b c d cost0 d d s 21 d d - 12 s d d 13 d s d 1

b c d cost0 d d s 11 s d d 22 d s d 23 - - d 1

a b c cost0 s d d 11 d s d 12 d d s 13 - - - 0

d e cost0 s d 11 d s 12 - - 0

b c d cost0 d d s 21 d d d 22 s d d 23 d s d 2

c f cost0 d s 31 d - 22 s d 2

Page 33: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Dynamic Programming on Tree Decompositions

Example: MINIMUM INDEPENDENT DOMINATING SET

Methodology:1. Decompose instance2. Solve partial problems

3. Combine the solutions

ab

cd

fe

{b, c, d} {b, c, d}

{a, b, c} {d , e}

{b, c, d}

{c, f}

b c d cost0 d d s 21 d d - 12 s d d 13 d s d 1

b c d cost0 d d s 11 s d d 22 d s d 23 - - d 1

a b c cost0 s d d 11 d s d 12 d d s 13 - - - 0

d e cost0 s d 11 d s 12 - - 0

b c d cost0 d d s 21 d d d 22 s d d 23 d s d 2

c f cost0 d s 31 d - 22 s d 2

Page 34: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Dynamic Programming on Tree Decompositions

Example: MINIMUM INDEPENDENT DOMINATING SET

Methodology:1. Decompose instance2. Solve partial problems

3. Combine the solutions

ab

cd

fe

{b, c, d} {b, c, d}

{a, b, c} {d , e}

{b, c, d}

{c, f}

b c d cost0 d d s 21 d d - 12 s d d 13 d s d 1

b c d cost0 d d s 11 s d d 22 d s d 23 - - d 1

a b c cost0 s d d 11 d s d 12 d d s 13 - - - 0

d e cost0 s d 11 d s 12 - - 0

b c d cost0 d d s 21 d d d 22 s d d 23 d s d 2

c f cost0 d s 31 d - 22 s d 2

Page 35: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Dynamic Programming on Tree Decompositions

Example: MINIMUM INDEPENDENT DOMINATING SET

Methodology:1. Decompose instance2. Solve partial problems

3. Combine the solutions

ab

cd

fe

{b, c, d} {b, c, d}

{a, b, c} {d , e}

{b, c, d}

{c, f}

b c d cost0 d d s 21 d d - 12 s d d 13 d s d 1

b c d cost0 d d s 11 s d d 22 d s d 23 - - d 1

a b c cost0 s d d 11 d s d 12 d d s 13 - - - 0

d e cost0 s d 11 d s 12 - - 0

b c d cost0 d d s 21 d d d 22 s d d 23 d s d 2

c f cost0 d s 31 d - 22 s d 2

Page 36: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Dynamic Programming on Tree Decompositions

Example: MINIMUM INDEPENDENT DOMINATING SET

Methodology:1. Decompose instance2. Solve partial problems3. Combine the solutions

ab

cd

fe

{b, c, d} {b, c, d}

{a, b, c} {d , e}

{b, c, d}

{c, f}

b c d cost0 d d s 21 d d - 12 s d d 13 d s d 1

b c d cost0 d d s 11 s d d 22 d s d 23 - - d 1

a b c cost0 s d d 11 d s d 12 d d s 13 - - - 0

d e cost0 s d 11 d s 12 - - 0

b c d cost0 d d s 21 d d d 22 s d d 23 d s d 2

c f cost0 d s 31 d - 22 s d 2

Page 37: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Dynamic Programming on Tree Decompositions

Example: MINIMUM INDEPENDENT DOMINATING SET

Methodology:1. Decompose instance2. Solve partial problems3. Combine the solutions

ab

cd

fe

{b, c, d} {b, c, d}

{a, b, c} {d , e}

{b, c, d}

{c, f}

b c d cost0 d d s 21 d d - 12 s d d 13 d s d 1

b c d cost0 d d s 11 s d d 22 d s d 23 - - d 1

a b c cost0 s d d 11 d s d 12 d d s 13 - - - 0

d e cost0 s d 11 d s 12 - - 0

b c d cost0 d d s 21 d d d 22 s d d 23 d s d 2

c f cost0 d s 31 d - 22 s d 2

Page 38: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Outline

Motivation

Tree Decompositions + Dynamic Programming

The D-FLAT System

Further DevelopmentsCustomizing Tree DecompositionsAnytime OptimizationTowards Space Efficiency

Conclusion

Page 39: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

D-FLATDynamic Programming Framework with Local Execution of ASP on Tree Decompositions

What does it do?1. Constructs a tree decomposition of the input structure2. In each node: Executes user-supplied logic program that

describes the dynamic programming algorithm3. Decides the problem (or materializes solutions)

PropertiesI Relies on Answer-Set Programming (ASP) paradigmI Users only need to write an ASP programI Communication with the user’s program via special predicatesI Uses external libraries for ASP solving, tree decomposition, etc.

Page 40: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Answer-Set Programming (ASP)I Successful declarative programming paradigm in AII Has its roots in nonmonotonic reasoning and datalogI Systems have been developed since the late 90sI Applications in many diverse areas

I Bio-InformaticsI DiagnosisI ConfigurationI LinguisticsI . . .

Page 41: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Answer Set Programming (ctd.)I ASP provides a convenient Guess & Check method

1. Guess a candidate solution non-deterministically2. Check if the candidate is indeed a solution

I Any search problem in NP (even in ΣP2 ) can be solved with ASP

MINIMUM INDEPENDENT DOMINATING SET

Input:Graph G = (V ,E) via predicates vertex/1 and edge/2.

{ in(X) : vertex(X) }.← in(X), in(Y), edge(X,Y).dominated(X) ← in(Y), edge(Y,X).← vertex(X), not in(X), not dominated(X).#minimize{ 1,X : in(X) }.

Page 42: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Why ASP for Dynamic Programming?I Compact declarative description of combinatorial problemsI ASP typically delivers all solutionsI Powerful systems available

Practical Observation:I If ASP is well suited for a problem, it is usually also well suited for

the subproblems required in a decomposition=⇒ allows for rapid prototyping of dynamic programming

on tree decompositions

Page 43: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

D-FLAT at WorkIllustrated by means of INDEPENDENT DOMINATING SET

Store partialsolutions ASP call

Parseinstance

Decompose Done?no

yes

Visit nextnode in

post-order

Printcompletesolutions

Page 44: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

D-FLAT at WorkIllustrated by means of INDEPENDENT DOMINATING SET

Store partialsolutions ASP call

Parseinstance

Parseinstance

ab

cd

f

e

Decompose Done?no

yes

Visit nextnode in

post-order

Printcompletesolutions

Page 45: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

D-FLAT at WorkIllustrated by means of INDEPENDENT DOMINATING SET

Store partialsolutions ASP call

Parseinstance

ab

cd

f

e

DecomposeDecompose

{c, f}n6

{b, c, d}n5

{b, c, d}n2

{a, b, c}n1

{b, c, d} n4

{d , e} n3

Done?no

yes

Visit nextnode in

post-order

Printcompletesolutions

Page 46: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

D-FLAT at WorkIllustrated by means of INDEPENDENT DOMINATING SET

Store partialsolutions ASP call

Parseinstance

ab

cd

f

e

Decompose

{c, f}n6

{b, c, d}n5

{b, c, d}n2

{a, b, c}n1

{b, c, d} n4

{d , e} n3

Done?Done?nono

yes

Visit nextnode in

post-order

Printcompletesolutions

Page 47: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

D-FLAT at WorkIllustrated by means of INDEPENDENT DOMINATING SET

Store partialsolutions ASP call

Parseinstance

ab

cd

f

e

Decompose

{c, f}n6

{b, c, d}n5

{b, c, d}n2

{a, b, c}n1 {a, b, c}n1

{b, c, d} n4

{d , e} n3

Done?no

yes

Visit nextnode in

post-order

Visit nextnode in

post-order

Printcompletesolutions

Page 48: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

D-FLAT at WorkIllustrated by means of INDEPENDENT DOMINATING SET

Store partialsolutions ASP callASP call

Parseinstance

ab

cd

f

eab

cd

f

e

Decompose

{c, f}n6

{b, c, d}n5

{b, c, d}n2

{a, b, c}n1 {a, b, c}n1

{b, c, d} n4

{d , e} n3

Done?no

yes

Visit nextnode in

post-order

Printcompletesolutions

Page 49: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

D-FLAT at WorkIllustrated by means of INDEPENDENT DOMINATING SET

Store partialsolutions

a b c cost0 s d d 11 d s d 12 d d s 13 - - - 0

n1

Store partialsolutions ASP call

Parseinstance

b c d cost0 d d s 21 d d - 12 s d d 13 d s d 1

n2

b c d cost0 d d s 11 s d d 22 d s d 23 - - d 1

n4

a b c cost0 s d d 11 d s d 12 d d s 13 - - - 0

n1

a b c cost0 s d d 11 d s d 12 d d s 13 - - - 0

n1

d e cost0 s d 11 d s 12 - - 0

n3

b c d cost0 d d s 21 d d d 22 s d d 23 d s d 2

n5

c f cost0 d s 31 d - 22 s d 2

n6

ab

cd

f

e

Decompose

{c, f}n6

{b, c, d}n5

{b, c, d}n2

{a, b, c}n1 {a, b, c}n1

{b, c, d} n4

{d , e} n3

Done?no

yes

Visit nextnode in

post-order

Printcompletesolutions

Page 50: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

D-FLAT at WorkIllustrated by means of INDEPENDENT DOMINATING SET

Store partialsolutions ASP call

Parseinstance

ab

cd

f

e

Decompose

{c, f}n6

{b, c, d}n5

{b, c, d}n2

{a, b, c}n1 {a, b, c}n1

{b, c, d} n4

{d , e} n3

Done?Done?nono

yes

Visit nextnode in

post-order

Printcompletesolutions

Page 51: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

D-FLAT at WorkIllustrated by means of INDEPENDENT DOMINATING SET

Store partialsolutions ASP call

Parseinstance

ab

cd

f

e

Decompose

{c, f}n6

{b, c, d}n5

{b, c, d}n2 {b, c, d}n2

{a, b, c}n1

{b, c, d} n4

{d , e} n3

Done?no

yes

Visit nextnode in

post-order

Visit nextnode in

post-order

Printcompletesolutions

Page 52: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

D-FLAT at WorkIllustrated by means of INDEPENDENT DOMINATING SET

Store partialsolutions ASP callASP call

Parseinstance

b c d cost0 d d s 21 d d - 12 s d d 13 d s d 1

n2

b c d cost0 d d s 11 s d d 22 d s d 23 - - d 1

n4

a b c cost0 s d d 11 d s d 12 d d s 13 - - - 0

n1

a b c cost0 s d d 11 d s d 12 d d s 13 - - - 0

n1

d e cost0 s d 11 d s 12 - - 0

n3

b c d cost0 d d s 21 d d d 22 s d d 23 d s d 2

n5

c f cost0 d s 31 d - 22 s d 2

n6

ab

cd

f

eab

cd

f

e

Decompose

{c, f}n6

{b, c, d}n5

{b, c, d}n2 {b, c, d}n2

{a, b, c}n1 {a, b, c}n1

{b, c, d} n4

{d , e} n3

Done?no

yes

Visit nextnode in

post-order

Printcompletesolutions

Page 53: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

D-FLAT at WorkIllustrated by means of INDEPENDENT DOMINATING SET

Store partialsolutions

b c d cost0 d d s 21 d d - 12 s d d 13 d s d 1

n2

Store partialsolutions ASP call

Parseinstance

b c d cost0 d d s 21 d d - 12 s d d 13 d s d 1

n2

b c d cost0 d d s 21 d d - 12 s d d 13 d s d 1

n2

b c d cost0 d d s 11 s d d 22 d s d 23 - - d 1

n4

a b c cost0 s d d 11 d s d 12 d d s 13 - - - 0

n1

d e cost0 s d 11 d s 12 - - 0

n3

b c d cost0 d d s 21 d d d 22 s d d 23 d s d 2

n5

c f cost0 d s 31 d - 22 s d 2

n6

ab

cd

f

e

Decompose

{c, f}n6

{b, c, d}n5

{b, c, d}n2 {b, c, d}n2

{a, b, c}n1

{b, c, d} n4

{d , e} n3

Done?no

yes

Visit nextnode in

post-order

Printcompletesolutions

Page 54: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

D-FLAT at WorkIllustrated by means of INDEPENDENT DOMINATING SET

Store partialsolutions ASP call

Parseinstance

ab

cd

f

e

Decompose

{c, f}n6

{b, c, d}n5

{b, c, d}n2 {b, c, d}n2

{a, b, c}n1

{b, c, d} n4

{d , e} n3

Done?Done?nono

yes

Visit nextnode in

post-order

Printcompletesolutions

Page 55: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

D-FLAT at WorkIllustrated by means of INDEPENDENT DOMINATING SET

Store partialsolutions ASP call

Parseinstance

ab

cd

f

e

Decompose

{c, f}n6

{b, c, d}n5

{b, c, d}n2

{a, b, c}n1

{b, c, d} n4

{d , e} n3{d , e} n3

Done?no

yes

Visit nextnode in

post-order

Visit nextnode in

post-order

Printcompletesolutions

Page 56: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

D-FLAT at WorkIllustrated by means of INDEPENDENT DOMINATING SET

Store partialsolutions ASP call

Parseinstance

ab

cd

f

e

Decompose

{c, f}n6

{b, c, d}n5

{b, c, d}n2

{a, b, c}n1

{b, c, d} n4{b, c, d} n4

{d , e} n3

Done?no

yes

Visit nextnode in

post-order

Visit nextnode in

post-order

Printcompletesolutions

Page 57: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

D-FLAT at WorkIllustrated by means of INDEPENDENT DOMINATING SET

Store partialsolutions ASP call

Parseinstance

ab

cd

f

e

Decompose

{c, f}n6

{b, c, d}n5 {b, c, d}n5

{b, c, d}n2

{a, b, c}n1

{b, c, d} n4

{d , e} n3

Done?no

yes

Visit nextnode in

post-order

Visit nextnode in

post-order

Printcompletesolutions

Page 58: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

D-FLAT at WorkIllustrated by means of INDEPENDENT DOMINATING SET

Store partialsolutions ASP callASP call

Parseinstance

b c d cost0 d d s 21 d d - 12 s d d 13 d s d 1

n2

b c d cost0 d d s 21 d d - 12 s d d 13 d s d 1

n2

b c d cost0 d d s 11 s d d 22 d s d 23 - - d 1

n4

b c d cost0 d d s 11 s d d 22 d s d 23 - - d 1

n4

a b c cost0 s d d 11 d s d 12 d d s 13 - - - 0

n1

d e cost0 s d 11 d s 12 - - 0

n3

b c d cost0 d d s 21 d d d 22 s d d 23 d s d 2

n5

c f cost0 d s 31 d - 22 s d 2

n6

ab

cd

f

eab

cd

f

e

Decompose

{c, f}n6

{b, c, d}n5 {b, c, d}n5

{b, c, d}n2 {b, c, d}n2

{a, b, c}n1

{b, c, d} n4{b, c, d} n4

{d , e} n3

Done?no

yes

Visit nextnode in

post-order

Printcompletesolutions

Page 59: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

D-FLAT at WorkIllustrated by means of INDEPENDENT DOMINATING SET

Store partialsolutions

b c d cost0 d d s 21 d d d 22 s d d 23 d s d 2

n5

Store partialsolutions ASP call

Parseinstance

b c d cost0 d d s 21 d d - 12 s d d 13 d s d 1

n2

b c d cost0 d d s 11 s d d 22 d s d 23 - - d 1

n4

a b c cost0 s d d 11 d s d 12 d d s 13 - - - 0

n1

d e cost0 s d 11 d s 12 - - 0

n3

b c d cost0 d d s 21 d d d 22 s d d 23 d s d 2

n5

b c d cost0 d d s 21 d d d 22 s d d 23 d s d 2

n5

c f cost0 d s 31 d - 22 s d 2

n6

ab

cd

f

e

Decompose

{c, f}n6

{b, c, d}n5 {b, c, d}n5

{b, c, d}n2

{a, b, c}n1

{b, c, d} n4

{d , e} n3

Done?no

yes

Visit nextnode in

post-order

Printcompletesolutions

Page 60: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

D-FLAT at WorkIllustrated by means of INDEPENDENT DOMINATING SET

Store partialsolutions ASP call

Parseinstance

ab

cd

f

e

Decompose

{c, f}n6

{b, c, d}n5 {b, c, d}n5

{b, c, d}n2

{a, b, c}n1

{b, c, d} n4

{d , e} n3

Done?Done?no

yes

Visit nextnode in

post-order

Printcompletesolutions

Page 61: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

D-FLAT at WorkIllustrated by means of INDEPENDENT DOMINATING SET

Store partialsolutions ASP call

Parseinstance

ab

cd

f

e

Decompose

{c, f}n6 {c, f}n6

{b, c, d}n5

{b, c, d}n2

{a, b, c}n1

{b, c, d} n4

{d , e} n3

Done?Done?no

yesyes

Visit nextnode in

post-order

Printcompletesolutions

Page 62: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

D-FLAT at WorkIllustrated by means of INDEPENDENT DOMINATING SET

Store partialsolutions ASP call

Parseinstance

b c d cost0 d d s 21 d d - 12 s d d 13 d s d 1

n2

b c d cost0 d d s 11 s d d 22 d s d 23 - - d 1

n4

a b c cost0 s d d 11 d s d 12 d d s 13 - - - 0

n1

d e cost0 s d 11 d s 12 - - 0

n3

b c d cost0 d d s 21 d d d 22 s d d 23 d s d 2

n5

c f cost0 d s 31 d - 22 s d 2

n6

ab

cd

f

e

Decompose

{c, f}n6

{b, c, d}n5

{b, c, d}n2

{a, b, c}n1

{b, c, d} n4

{d , e} n3

Done?no

yes

Visit nextnode in

post-order

Printcompletesolutions

Printcompletesolutions

Page 63: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

D-FLAT at Work (ctd.)Illustrated by means of INDEPENDENT DOMINATING SET

Current table

Answer sets

ASP solver

User-supplied program1 { extend(R) : childRow(R,N) } 1 ← childNode(N).← extend(R1;R2), childItem(R1,in(X)),

not childItem(R2,in(X)).← removed(X), extend(R),

not childItem(R,in(X)), not childItem(R,dom(X)).item(in(X)) ← extend(R), childItem(R,in(X)),

current(X).item(dom(X)) ← extend(R), childItem(R,dom(X)),

current(X).{ item(in(X)) : introduced(X) }.← edge(X,Y), item(in(X;Y)).item(dom(X)) ← item(in(Y)), edge(Y,X),

current(X).

Instancevertex(a;b;c;d;e).edge(a,b). edge(a,c). edge(b,c).edge(b,d). edge(c,d). edge(d,e).

Bag

Child rows

1st child table

Child rows

nth child table

. . .

. . .

Page 64: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Another Example: Boolean Satisfiability (SAT)Although SAT is not a graph problem, we can still decompose it.

I Use the incidence graph of the formula:I One vertex for each variable and each clause.I Edge (v , c) if variable v occurs in clause c.

D-FLAT encoding% Extend c o m p a t i b l e rows from c h i l d nodes .1 { extend(R) : childRow(R,N) } 1 ← childNode(N).← extend(R;S), atom(A), childItem(R,A), not childItem(S,A).% R e t a i n e x t e n d e d a s s i g n m e n t and g u e s s on i n t r o d u c e d atoms .item(X) ← extend(R), childItem(R,X), current(X).{ item(A) : atom(A), introduced(A) }.% A d d i t i o n a l c l a u s e s migh t have become s a t i s f i e d .item(C) ← current(C;A), pos(C,A), item(A).item(C) ← current(C;A), neg(C,A), not item(A).% K i l l a s s i g n m e n t s t h a t l e a v e some c l a u s e u n s a t i s f i e d .← clause(C), removed(C), extend(R), not childItem(R,C).

Page 65: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

What about Performance?

Time for a Demo!

Page 66: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

What about Performance?

Time for a Demo!

Page 67: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

D-FLAT Features

I Special predicates in LP allow the user to delegate tasks toD-FLAT

I Additional D-FLAT features for arithmeticsI Different modes for decision, counting, optimization and

enumeration problemsI Support of different normalizations of the decompositionI Support of hypergraphsI “Default Join”I Two modes for storing and handling solutions of subproblems

Page 68: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

D-FLAT Features (ctd.)

“Table-Mode” for Problems in NPI We compute a table at each nodeI We guess rows using ASPI . . . yields all accepting computation branches of an NTM

I D-FLATˆ2 frontendI designed for minimization problems on top of “table-mode”I DP is automatically obtained from simpler principles

“Tree-Mode” for Problems in the Polynomial HierarchyI We compute a tree at each nodeI We guess branches using ASPI . . . yields all accepting computation branches of an ATM

(D-FLAT appropriately handles the trees inside).

Page 69: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

D-FLAT Features (ctd.)

“Table-Mode” for Problems in NPI We compute a table at each nodeI We guess rows using ASPI . . . yields all accepting computation branches of an NTMI D-FLATˆ2 frontend

I designed for minimization problems on top of “table-mode”I DP is automatically obtained from simpler principles

“Tree-Mode” for Problems in the Polynomial HierarchyI We compute a tree at each nodeI We guess branches using ASPI . . . yields all accepting computation branches of an ATM

(D-FLAT appropriately handles the trees inside).

Page 70: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

D-FLAT Features (ctd.)

“Table-Mode” for Problems in NPI We compute a table at each nodeI We guess rows using ASPI . . . yields all accepting computation branches of an NTMI D-FLATˆ2 frontend

I designed for minimization problems on top of “table-mode”I DP is automatically obtained from simpler principles

“Tree-Mode” for Problems in the Polynomial HierarchyI We compute a tree at each nodeI We guess branches using ASPI . . . yields all accepting computation branches of an ATM

(D-FLAT appropriately handles the trees inside).

Page 71: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

General Applicability

Recall Courcelle’s theoremAny problem definable in MSO can be solved in linear timeon graphs of bounded treewidth.

It is such problems that decomposition is usually employed for.

Good newsD-FLAT can be effectively used for all such problems

I It can evaluate MSO formulas in linear time if the treewidth isbounded

I Encoding for MSO is not overly complicated(approx. 30 lines of ASP code)

I However, expressing the problem at hand via MSO and then feedto D-FLAT is not recommended

I instead, D-FLAT is designed for problem-specific dynamicprogramming solutions

Page 72: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

General Applicability

Recall Courcelle’s theoremAny problem definable in MSO can be solved in linear timeon graphs of bounded treewidth.

It is such problems that decomposition is usually employed for.

Good newsD-FLAT can be effectively used for all such problems

I It can evaluate MSO formulas in linear time if the treewidth isbounded

I Encoding for MSO is not overly complicated(approx. 30 lines of ASP code)

I However, expressing the problem at hand via MSO and then feedto D-FLAT is not recommended

I instead, D-FLAT is designed for problem-specific dynamicprogramming solutions

Page 73: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

A First Conclusion

SummaryI Hard problems often become tractable when instances exhibit

certain properties.I Especially bounded treewidth often leads to tractability (problems

expressible in MSO).I The “D-FLAT” method [TPLP 2012, JELIA 2014] allows to specify

dynamic programming algorithms in a declarative way.I This works for all MSO-definable problems [JLC 2016]

Page 74: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Outline

Motivation

Tree Decompositions + Dynamic Programming

The D-FLAT System

Further DevelopmentsCustomizing Tree DecompositionsAnytime OptimizationTowards Space Efficiency

Conclusion

Page 75: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Outline

Motivation

Tree Decompositions + Dynamic Programming

The D-FLAT System

Further DevelopmentsCustomizing Tree DecompositionsAnytime OptimizationTowards Space Efficiency

Conclusion

Page 76: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Motivation

Lesson LearntI Generation of decompositions rather cheap (compared to the

runtime of dynamic programming)I Shape of decomposition crucial for performance

(it’s not the width only!)I Better understanding needed how “good tree decompositions”

look like

GoalI Identification of features for tree decompositions (rather than on

the actual input instance)I Development of system that allows to customize tree

decompositions

Page 77: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Motivation

Lesson LearntI Generation of decompositions rather cheap (compared to the

runtime of dynamic programming)I Shape of decomposition crucial for performance

(it’s not the width only!)I Better understanding needed how “good tree decompositions”

look like

GoalI Identification of features for tree decompositions (rather than on

the actual input instance)I Development of system that allows to customize tree

decompositions

Page 78: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Methodology

Given a specific problemI Training data:

I 70 random instances with rather low treewidthI 40 decompositions for each problem instance

I Obtain regression models (16 different methods) for rankingdecompositions using specific tree decomposition features

I Apply model to real-world instances (treewidth up to 8)I Generate 50 tree decompositions per instanceI Model selects the best-ranked decomposition

Page 79: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Experimental ResultsI Accelerating Minimum Dominating Set using Machine Learning

MINIMUM DOMINATING SETD-FLAT

Minimum Improvement: 7.39 % Average Improvement: 21.80 %Maximum Improvement: 31.15 % Median Improvement: 24.25 %

Statistical Significance: ≥ 99.95 %

11

5

10

15

20

25

30

35

40

Pre

dict

ed R

ank

2 3 4 5 6 7 8 9 10 11 12 13 14 15 16Model

1

1.0

0.9

0.8

0.7

0.6

0.5

0.4

0.3

0.2

0.1

0.0

Run

time

Impr

ovem

ent

2 3 4 5 6 7 8 9 10 11 12 13 14 15 16Model

Page 80: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Experimental ResultsI Accelerating Minimum Dominating Set using Machine Learning

MINIMUM DOMINATING SETSEQUOIA

Minimum Improvement: 11.39 % Average Improvement: 16.24 %Maximum Improvement: 19.65 % Median Improvement: 17.39 %

Statistical Significance: ≥ 99.95 %

11

5

10

15

20

25

30

35

40

Pre

dict

ed R

ank

●●●

2

●●

3

●●

4

●●

●●●

5

●●

●●

●●

●●●●●●

●●

6

7

●●

●●

8

●●

●●

●●

●●

●●

9

●●

●●

10

11

●●

12

●●

●●●

●●

●●

13

●●

●●

●●

14

●●

●●

●●

●●

15

●●

16Model

●●●●●●

1

1.0

0.9

0.8

0.7

0.6

0.5

0.4

0.3

0.2

0.1

0.0

Run

time

Impr

ovem

ent

2 3 4 5 6

●●●●

7 8 9 10 11 12

●●●●●●●

13 14 15 16Model

Page 81: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Towards exploiting Decomposition Features

New decomposition library: htdI htd provides efficient implementations of well-known algorithmsI htd allows to fully customize the tree decomposition via several

strategiesI htd offers a wide range of convenience functions like the

possibility to access the subgraph induced by each bag at almostno cost (Performance boost for large graphs!).

I 3rd place in recent tree-decomposition competitionI https://pacechallenge.wordpress.com/

I Available at: https://github.com/mabseher/htd

Page 82: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

DiscussionI We conducted huge test series [IJCAI 2015] for several problems

and two state-of-the-art systems (D-FLAT and SEQUOIA)I Feature-based ML successfully identified good decompositionsI However, crucial features are in general not problem independentI New decomposition library allows the user to specify what kind of

tree decomposition she prefers

Page 83: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Outline

Motivation

Tree Decompositions + Dynamic Programming

The D-FLAT System

Further DevelopmentsCustomizing Tree DecompositionsAnytime OptimizationTowards Space Efficiency

Conclusion

Page 84: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Motivation

Lesson LearntI Drawback of classical DP on TDs: Always computes all solutions

even if only one is required.I Optimization problems: Sometimes table rows have higher costs

than optimal solution.

IdeaI Materialize tables “in parallel”.I Realization in D-FLAT: modern ASP technology (external atoms)I Use coexisting ASP solvers that communicate with each other.

GoalsI Anytime behavior (ability to report solutions when interrupted)I Understand feasibility of this approach

Page 85: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Motivation

Lesson LearntI Drawback of classical DP on TDs: Always computes all solutions

even if only one is required.I Optimization problems: Sometimes table rows have higher costs

than optimal solution.

IdeaI Materialize tables “in parallel”.I Realization in D-FLAT: modern ASP technology (external atoms)I Use coexisting ASP solvers that communicate with each other.

GoalsI Anytime behavior (ability to report solutions when interrupted)I Understand feasibility of this approach

Page 86: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Motivation

Lesson LearntI Drawback of classical DP on TDs: Always computes all solutions

even if only one is required.I Optimization problems: Sometimes table rows have higher costs

than optimal solution.

IdeaI Materialize tables “in parallel”.I Realization in D-FLAT: modern ASP technology (external atoms)I Use coexisting ASP solvers that communicate with each other.

GoalsI Anytime behavior (ability to report solutions when interrupted)I Understand feasibility of this approach

Page 87: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Example: “Lazy” DP on TDs

DP specification in ASP#external childItem(in(X)) : childNode(N), bag(N,X).#external childAuxItem(dom(X)) : childNode(N), bag(N,X).

item(in(X)) ← childItem(in(X)), not removed(X).auxItem(dom(X)) ← childAuxItem(dom(X)), not removed(X).{ item(in(X)) : introduced(X) }.auxItem(dom(Y)) ← item(in(X)), edge(X,Y), current(X;Y).← removed(X), not childItem(in(X)), not childAuxItem(dom(X)).← edge(X,Y), item(in(X)), item(in(Y)).

Avoiding Re-grounding via Assumption-based SolvingI The clingo system supports external atoms.I Truth value of externals can be set “from the outside”.

1. Freeze a certain truth assignment on externals.2. Compute all answer sets under this assumption.3. Repeat with different assumption.

I Grounding only happens once.

Page 88: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Experimental ResultsSearch and optimization problems on real-world graphs

“Lazy” vs. “eager”I Search problems: “Lazy” usually finds a solution much quicker.I Optimization problems: “Lazy” mostly finds optimum faster

(and able to print solutions along the way)

Comparison to clingo (without decomposition)I Search problems: Clingo finds a solution much quicker.I DOMINATING SET, VERTEX COVER: Clingo is clearly faster.I STEINER TREE: “Lazy” is faster . . .

I “Lazy” often finds optimum when clingo times out.I “Lazy” offers better suboptimal solutions until timeout.

Page 89: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

DiscussionI DP on TDs via “lazy evaluation”I At each table, an ASP solver is used for computing rows

I Multiple coexisting ASP solvers that communicate with each otherI Assumption-based solving: avoids excessive re-grounding

I “Lazy” outperforms “eager”I Outperforms state-of-the-art ASP systems on some problems

(w.r.t. anytime performance)

Page 90: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Outline

Motivation

Tree Decompositions + Dynamic Programming

The D-FLAT System

Further DevelopmentsCustomizing Tree DecompositionsAnytime OptimizationTowards Space Efficiency

Conclusion

Page 91: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Motivation

Lesson LearntI Bottleneck of D-FLAT (resp. DP in general): size of tables

I size grows exponentially with treewidthI Can we find a match to logic (truth-table vs. formula)?

IdeaI Employ Binary Decision Diagrams (BDDs):

I compact representation of truth-tablesI can be treated like formulas

GoalsI Understand feasibility of this approachI Understand limits in describing DPs as formula manipulation

Page 92: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Motivation

Lesson LearntI Bottleneck of D-FLAT (resp. DP in general): size of tables

I size grows exponentially with treewidthI Can we find a match to logic (truth-table vs. formula)?

IdeaI Employ Binary Decision Diagrams (BDDs):

I compact representation of truth-tablesI can be treated like formulas

GoalsI Understand feasibility of this approachI Understand limits in describing DPs as formula manipulation

Page 93: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Motivation

Lesson LearntI Bottleneck of D-FLAT (resp. DP in general): size of tables

I size grows exponentially with treewidthI Can we find a match to logic (truth-table vs. formula)?

IdeaI Employ Binary Decision Diagrams (BDDs):

I compact representation of truth-tablesI can be treated like formulas

GoalsI Understand feasibility of this approachI Understand limits in describing DPs as formula manipulation

Page 94: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Binary Decision Diagrams

Example (OBDD representation)Let formula ϕ = (a ∧ b ∧ c) ∨ (a ∧ ¬b ∧ c) ∨ (¬a ∧ b ∧ c).

a

b1 b2

c1 c2 c3 c4

> ⊥

Figure : OBDD of ϕ.

a

b

c

> ⊥

Figure : ROBDD of ϕ.

Page 95: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Binary Decision Diagrams

Example (OBDD representation)Let formula ϕ = (a ∧ b ∧ c) ∨ (a ∧ ¬b ∧ c) ∨ (¬a ∧ b ∧ c).

a

b1 b2

c1 c2 c3 c4

> ⊥

Figure : OBDD of ϕ.

a

b

c

> ⊥

Figure : ROBDD of ϕ.

Page 96: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Binary Decision Diagrams (ctd.)Advantages of BDDs:

I Well-studied and mature concepts that are successfully applied toplanning, verification, etc.

I Efficient implementations availableI Delegate burden of memory-efficient implementation to data

structureI Logic-based algorithm specification

Page 97: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Comparison

Table-based Dynamic Programming

>

> ⊥

> ⊥

> ⊥

> ⊥

>

> ⊥

>

BDD-based Dynamic Programming

Page 98: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Comparison

Table-based Dynamic Programming

>

> ⊥

> ⊥

> ⊥

> ⊥

>

> ⊥

>

BDD-based Dynamic Programming

Page 99: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

DP of Independent Dominating Set via BDDs

Blt =

∧(x ,y)∈Et

(¬ix ∨ ¬iy ) ∧∧

y∈Vt

(dy ↔

∨(x ,y)∈Et

ix)

Bit =∃D′t ′

[Bt ′ [Dt ′/D′t ′ ] ∧

∧(u,y)∈Et

(¬iu ∨ ¬iy ) ∧(

du ↔∨

(x ,u)∈Et

ix)∧

∧(u,y)∈Et∧

u 6=y

(dy ↔ d ′y ∨ iu

)∧

∧y∈Vt∧(u,y)6∈Et

(dy ↔ d ′y

)]

Brt =Bt ′ [iu/>,du/⊥] ∨ Bt ′ [iu/⊥,du/>]

Bjt =∃D′tD′′t

[Bt ′ [Dt/D′t ] ∧ Bt ′′ [Dt/D′′t ] ∧

∧x∈Vt

(dx ↔ d ′x ∨ d ′′x

)]

Page 100: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

DP of Independent Dominating Set via BDDs

Blt =

∧(x ,y)∈Et

(¬ix ∨ ¬iy ) ∧∧

y∈Vt

(dy ↔

∨(x ,y)∈Et

ix)

Bit =∃D′t ′

[Bt ′ [Dt ′/D′t ′ ] ∧

∧(u,y)∈Et

(¬iu ∨ ¬iy ) ∧(

du ↔∨

(x ,u)∈Et

ix)∧

∧(u,y)∈Et∧

u 6=y

(dy ↔ d ′y ∨ iu

)∧

∧y∈Vt∧(u,y)6∈Et

(dy ↔ d ′y

)]

Brt =Bt ′ [iu/>,du/⊥] ∨ Bt ′ [iu/⊥,du/>]

Bjt =∃D′tD′′t

[Bt ′ [Dt/D′t ] ∧ Bt ′′ [Dt/D′′t ] ∧

∧x∈Vt

(dx ↔ d ′x ∨ d ′′x

)]

Page 101: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

DP of Independent Dominating Set via BDDs

Blt =

∧(x ,y)∈Et

(¬ix ∨ ¬iy ) ∧∧

y∈Vt

(dy ↔

∨(x ,y)∈Et

ix)

Bit =∃D′t ′

[Bt ′ [Dt ′/D′t ′ ] ∧

∧(u,y)∈Et

(¬iu ∨ ¬iy ) ∧(

du ↔∨

(x ,u)∈Et

ix)∧

∧(u,y)∈Et∧

u 6=y

(dy ↔ d ′y ∨ iu

)∧

∧y∈Vt∧(u,y)6∈Et

(dy ↔ d ′y

)]

Brt =Bt ′ [iu/>,du/⊥] ∨ Bt ′ [iu/⊥,du/>]

Bjt =∃D′tD′′t

[Bt ′ [Dt/D′t ] ∧ Bt ′′ [Dt/D′′t ] ∧

∧x∈Vt

(dx ↔ d ′x ∨ d ′′x

)]

Page 102: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

DP of Independent Dominating Set via BDDs

Blt =

∧(x ,y)∈Et

(¬ix ∨ ¬iy ) ∧∧

y∈Vt

(dy ↔

∨(x ,y)∈Et

ix)

Bit =∃D′t ′

[Bt ′ [Dt ′/D′t ′ ] ∧

∧(u,y)∈Et

(¬iu ∨ ¬iy ) ∧(

du ↔∨

(x ,u)∈Et

ix)∧

∧(u,y)∈Et∧

u 6=y

(dy ↔ d ′y ∨ iu

)∧

∧y∈Vt∧(u,y)6∈Et

(dy ↔ d ′y

)]

Brt =Bt ′ [iu/>,du/⊥] ∨ Bt ′ [iu/⊥,du/>]

Bjt =∃D′tD′′t

[Bt ′ [Dt/D′t ] ∧ Bt ′′ [Dt/D′′t ] ∧

∧x∈Vt

(dx ↔ d ′x ∨ d ′′x

)]

Page 103: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Dynamic-Programming based QBF-solving

MethodI Use the presented ideas for solving quantified Boolean formulas in

prenex CNF form

∃ab ∀cd ∃ef (a ∨ c ∨ e) ∧ (¬b ∨ d) ∧ (e ∨ f ) ∧ (c ∨ ¬e) ∧ (¬d ∨ f )

I We consider primal graph of the CNFI Datastructure used is a recursive set of BDDs (recursion depth

depends on number of quantifier alternations)I Some further optimizations required to be competitive

Page 104: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Experimental Results2-QBF (∀∃) competition instances (#instances = 200)

0 20 40 60 80 100

010

020

030

040

050

060

0

Instances solved

Tim

e (s

ec)

Solved instances with small width (w ≤ 50, #instances = 55):I dynQBF: 54, EBDDRES: 31, DepQBF: 28, RAReQS: 19

Uniquely solved (#instances = 200):I DepQBF: 43, dynQBF: 41, RAReQS: 5, EBDDRES: 2

Page 105: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Experimental Results2-QBF (∀∃) competition instances (#instances = 200)

0 20 40 60 80 100

010

020

030

040

050

060

0

Instances solved

Tim

e (s

ec)

RAReQS 1.1

Solved instances with small width (w ≤ 50, #instances = 55):I dynQBF: 54, EBDDRES: 31, DepQBF: 28, RAReQS: 19

Uniquely solved (#instances = 200):I DepQBF: 43, dynQBF: 41, RAReQS: 5, EBDDRES: 2

Page 106: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Experimental Results2-QBF (∀∃) competition instances (#instances = 200)

0 20 40 60 80 100

010

020

030

040

050

060

0

Instances solved

Tim

e (s

ec) EBDDRES 1.2

RAReQS 1.1

Solved instances with small width (w ≤ 50, #instances = 55):I dynQBF: 54, EBDDRES: 31, DepQBF: 28, RAReQS: 19

Uniquely solved (#instances = 200):I DepQBF: 43, dynQBF: 41, RAReQS: 5, EBDDRES: 2

Page 107: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Experimental Results2-QBF (∀∃) competition instances (#instances = 200)

0 20 40 60 80 100

010

020

030

040

050

060

0

Instances solved

Tim

e (s

ec)

BDD (naive)EBDDRES 1.2RAReQS 1.1

Solved instances with small width (w ≤ 50, #instances = 55):I dynQBF: 54, EBDDRES: 31, DepQBF: 28, RAReQS: 19

Uniquely solved (#instances = 200):I DepQBF: 43, dynQBF: 41, RAReQS: 5, EBDDRES: 2

Page 108: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Experimental Results2-QBF (∀∃) competition instances (#instances = 200)

0 20 40 60 80 100

010

020

030

040

050

060

0

Instances solved

Tim

e (s

ec)

dynQBF (QBFEval'16)BDD (naive)EBDDRES 1.2RAReQS 1.1

Solved instances with small width (w ≤ 50, #instances = 55):I dynQBF: 54, EBDDRES: 31, DepQBF: 28, RAReQS: 19

Uniquely solved (#instances = 200):I DepQBF: 43, dynQBF: 41, RAReQS: 5, EBDDRES: 2

Page 109: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Experimental Results2-QBF (∀∃) competition instances (#instances = 200)

0 20 40 60 80 100

010

020

030

040

050

060

0

Instances solved

Tim

e (s

ec)

dynQBF (current)dynQBF (QBFEval'16)BDD (naive)EBDDRES 1.2RAReQS 1.1

Solved instances with small width (w ≤ 50, #instances = 55):I dynQBF: 54, EBDDRES: 31, DepQBF: 28, RAReQS: 19

Uniquely solved (#instances = 200):I DepQBF: 43, dynQBF: 41, RAReQS: 5, EBDDRES: 2

Page 110: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Experimental Results2-QBF (∀∃) competition instances (#instances = 200)

0 20 40 60 80 100

010

020

030

040

050

060

0

Instances solved

Tim

e (s

ec)

DepQBF 5.0dynQBF (current)dynQBF (QBFEval'16)BDD (naive)EBDDRES 1.2RAReQS 1.1

Solved instances with small width (w ≤ 50, #instances = 55):I dynQBF: 54, EBDDRES: 31, DepQBF: 28, RAReQS: 19

Uniquely solved (#instances = 200):I DepQBF: 43, dynQBF: 41, RAReQS: 5, EBDDRES: 2

Page 111: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Experimental Results2-QBF (∀∃) competition instances (#instances = 200)

0 20 40 60 80 100

010

020

030

040

050

060

0

Instances solved

Tim

e (s

ec)

DepQBF 5.0dynQBF (current)dynQBF (QBFEval'16)BDD (naive)EBDDRES 1.2RAReQS 1.1

Solved instances with small width (w ≤ 50, #instances = 55):I dynQBF: 54, EBDDRES: 31, DepQBF: 28, RAReQS: 19

Uniquely solved (#instances = 200):I DepQBF: 43, dynQBF: 41, RAReQS: 5, EBDDRES: 2

Page 112: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Experimental Results2-QBF (∀∃) competition instances (#instances = 200)

0 20 40 60 80 100

010

020

030

040

050

060

0

Instances solved

Tim

e (s

ec)

DepQBF 5.0dynQBF (current)dynQBF (QBFEval'16)BDD (naive)EBDDRES 1.2RAReQS 1.1

Solved instances with small width (w ≤ 50, #instances = 55):I dynQBF: 54, EBDDRES: 31, DepQBF: 28, RAReQS: 19

Uniquely solved (#instances = 200):I DepQBF: 43, dynQBF: 41, RAReQS: 5, EBDDRES: 2

Page 113: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Experimental EvaluationQBF Gallery 2014 competition instances (#instances = 276)

System Solved SAT UNSAT Timeout Memout UniqueDepQBF 5.0 103 48 55 169 4 42RAReQS 1.1 83 36 47 193 0 22dynQBF (current) 21 6 15 250 5 8EBDDRES 1.2 7 5 2 4 265 2BDD (naive) 3 1 2 273 0 0

dynQBF is not yet competitive:I 27 out of 276 instances were not decomposed within the time limitI Solved instances have an average width of 55, 3 quantifiers, 4711

atoms and 16409 clauses

Page 114: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Experimental EvaluationQBF Gallery 2014 competition instances (#instances = 276)

System Solved SAT UNSAT Timeout Memout UniqueDepQBF 5.0 103 48 55 169 4 42RAReQS 1.1 83 36 47 193 0 22dynQBF (current) 21 6 15 250 5 8EBDDRES 1.2 7 5 2 4 265 2BDD (naive) 3 1 2 273 0 0

dynQBF is not yet competitive:I 27 out of 276 instances were not decomposed within the time limitI Solved instances have an average width of 55, 3 quantifiers, 4711

atoms and 16409 clauses

Page 115: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

DiscussionI dynBDD is a first prototype that performs DP algorithms on tree

decompositions via manipulation of BDDs [LPNMR 2015]I allows for realization of more advanced DP algorithms (“wild

cards” etc)I preliminary results indicate significant decrease of space usedI particularly successful for QBF solvingI currently, algorithms have to be implemented in C++ on top of

CUDDI Systems available:

I dbai.tuwien.ac.at/proj/decodyn/dynbdd/I dbai.tuwien.ac.at/proj/decodyn/dynqbf/

Page 116: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Outline

Motivation

Tree Decompositions + Dynamic Programming

The D-FLAT System

Further DevelopmentsCustomizing Tree DecompositionsAnytime OptimizationTowards Space Efficiency

Conclusion

Page 117: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

SummaryI Tree-Decompositions known as a promising tool to exploit

structure in hard problemsI D-FLAT: a system for rapid prototyping of DP algorithms

I takes care of the decomposition taskI declarative specifications of dynamic programming via ASPI ASP systems used to solve subproblemsI general applicabilityI able to outperform standard technology

I Many ongoing developments

Page 118: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Ongoing + Future WorkI Automatic generation of D-FLAT code from “standard” encoding

I Exploit smarter ways to store solutionsI BDDs a promising optionI easy-to-use interface still missing

I Tighter integration of D-FLAT with ASP solversI communication between D-FLAT and ASP solver is bottleneck

I Incorporation of other decomposition methodsI Straight forward for clique width, branch width, . . .I Lack of efficient heuristics for obtaining decomposition

Page 119: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Try it out! D-FLAT is free software, available at

http://dbai.tuwien.ac.at/proj/dflat/

. . . and have fun with decompositions . . .

Thanks for your attention!

Page 120: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Try it out! D-FLAT is free software, available at

http://dbai.tuwien.ac.at/proj/dflat/

. . . and have fun with decompositions . . .

Thanks for your attention!

Page 121: Dynamic Programming on Tree Decompositions in Practice · I Any graph admits at least a trivial tree decomposition. I But finding a minimum-width tree decomposition is difficult

Main ReferencesJELIA 2014 M. Abseher, B. Bliem, G. Charwat, F. Dusberger, M. Hecher,

S. Woltran: “The D-FLAT system for dynamic programming on treedecompositions”. Proceedings JELIA 2014, pp. 558–572. Springer,2014.

JLC 2016 B. Bliem, R. Pichler, S. Woltran: “Implementing Courcelle’s Theorem ina Declarative Framework for Dynamic Programming”. Journal of Logicand Computation, 2016.

IJCAI 2015 M. Abseher, F. Dusberger, N. Musliu, S. Woltran: “Improving theefficiency of dynamic programming on tree decompositions viamachine learning”. Proceedings IJCAI 2015, pp. 275–282, AAAIPress, 2015.

IJCAI 2016 B. Bliem, B. Kaufmann, T. Schaub, S. Woltran: “ASP for AnytimeDynamic Programming on Tree Decompositions”. Proceedings IJCAI2016, pp. 979–986, AAAI Press, 2016.

LPNMR 2015 G. Charwat, S. Woltran: “Efficient problem solving on treedecompositions using binary decision diagrams”. ProceedingsLPNMR 2015, pp. 213–227, Springer, 2015.

TPLP 2012 B. Bliem, M. Morak, and S. Woltran: “D-FLAT: Declarative problemsolving using tree decompositions and answer-set programming”.Theory and Practice of Logic Programming, vol. 12, pp. 445–464,2012.