PowerPoint-presentasjon - School on Parameterized Algorithms and
Download
Report
Transcript PowerPoint-presentasjon - School on Parameterized Algorithms and
U N I V E R S I T Y
O F
B E R G E N
Parameterized Algorithms
The Basics
Bart M. P. Jansen
August 18th 2014, Bฤdlewo
Why we are here
โข To create the recipes that make computers solve our problems efficiently
โ With a bounded number of resources (memory, time)
โข We measure the quality of an algorithm by the dependence of its running
time on the size ๐ of the input
โ For an ๐-bit input, the running time can be ๐2 , 6๐ log ๐ , 2๐ โ
3๐6 , โฆ
โ Smaller functions are better, but as a general guideline:
โข Polynomials are good, exponential functions are bad
โข Unfortunately, many problems are NP-complete
โข We believe that for NP-complete problems, there is no algorithm that:
โ always gives the right answer, and whose
โ running time is bounded by a polynomial function of the input size
2
Dealing with NP-complete problems
Approximation
Sacrifice quality of the solution: quickly find a solution that is provably not
very bad
Local search
Quickly find a solution for which you cannot give any quality guarantee (but
which might often be good)
Branch &
bound
Sacrifice running time guarantees: create an algorithm for which you do not
know how long it will take (but which might do well on the inputs you use)
Parameterized
algorithms
Sacrifice the running time: allow the running time to have an exponential
factor, but ensure that the exponential dependence is not on the entire
input size but just on some parameter that is hopefully small
Kernelization
Quickly shrink the input by preprocessing so that afterward running an
exponential-time algorithm on the shrunk instance is fast enough
3
History of parameterized complexity
PCP
Theorem
Downey &
Fellows book
Kernelization lower
bounds
NP-completeness
1940
1950
1960
MATCHING
algorithm
Simplex
algorithm
4
1970
1980
Graph
Minors
Theorem
1990
2000
Parameterized
(in)tractability
2010
โฆ
Bฤdlewo
school
Planar DOMINATING
SET kernel
Google Scholar Papers on FPT and Kernelization
1200
1000
800
600
400
200
0
1985
1990
1995
FPT
5
2000
2005
Kernelization
2010
2015
This lecture
Fixed-parameter tractability
Kernelization algorithms
โข VERTEX COVER
โข FEEDBACK ARC SET in Tournaments
Bounded-depth search trees
โข VERTEX COVER
โข FEEDBACK VERTEX SET
Dynamic programming
โข SET COVER
6
FIXED-PARAMETER TRACTABILITY
7
Parameterized problems
โข As usual in complexity theory, we primarily study decision
problems (YES/NO questions)
โ OPTIMIZATION: โFind the shortest path from ๐ฅ to ๐ฆโ
โ DECISION: โIs there a path from ๐ฅ to ๐ฆ of length at most ๐?โ
โข Having an efficient algorithm for one typically gives an
efficient algorithm for the other
โข A parameterized problem is a decision problem where we
associate an integer parameter to each instance
โ The parameter measures some aspect of the instance
8
Problem parameterizations
โข PACKET DELIVERY PROBLEM
Input:
A graph ๐บ, a starting vertex ๐ , a set ๐ of delivery
vertices, and an integer ๐
Question: Is there a cycle in ๐บ that starts and ends in ๐ ,
visits all vertices in ๐, and has length at most ๐?
โข There are many possible parameters for this problem:
โ The length ๐ of the tour
โ The number of delivery points |๐|
โ Graph-theoretic measures of how complex ๐บ is (treewidth,
cliquewidth, vertex cover number)
โข Parameterized complexity investigates:
9
Can the problem be solved efficiently,
if the parameter is small?
Fixed-parameter tractability โ informally
โข A parameterized problem is fixed-parameter tractable if
there is an algorithm that solves size-๐ inputs with parameter
value ๐ in time ๐ ๐ โ
๐๐ for some constant ๐ and function ๐
โข For each fixed ๐, there is a polynomial-time ๐ ๐๐ algorithm
โข VERTEX COVER:
โ โCan all the edges of this ๐-vertex graph be covered by at
most ๐ vertices?โ
โ Solvable in time 1.2738๐ โ
๐, so FPT
10
Fixed-parameter tractability โ formally
โข Let ฮฃ be a finite alphabet used to encode inputs
โ (ฮฃ = {0,1} for binary encodings)
โข A parameterized problem is a set ๐ โ ฮฃ โ × โ
โ ๐ = { ๐ฅ1 , ๐1 , ๐ฅ2 , ๐2 , โฆ }
โข The set ๐ contains the tuples ๐ฅ, ๐ where the answer to the
question encoded by ๐ฅ is yes; ๐ is the parameter
โข The parameterized problem ๐ is fixed-parameter tractable if
there is an algorithm that, given an input (๐ฅ, ๐),
โ decides if ๐ฅ, ๐ belongs to ๐ or not, and
โ runs in time ๐ ๐ ๐ฅ ๐ for some function ๐ and constant ๐
11
KERNELIZATION
12
Data reduction with a guarantee
โข Kernelization is a method for parameterized preprocessing
โ Efficiently reduce an instance (๐ฅ, ๐) to an equivalent
instance of size bounded by some ๐(๐)
โข One of the simplest ways of obtaining FPT algorithms
โ Apply a brute force algorithm on the shrunk instance to get
an FPT algorithm
โข Kernelization also allows a rigorous mathematical analysis of
efficient preprocessing
13
The VERTEX COVER problem
Input:
Parameter:
Question:
An undirected graph ๐บ and an integer ๐
๐
Is there a set ๐ of at most ๐ vertices in ๐บ, such
that each edge of ๐บ has an endpoint in ๐?
โข Such a set S is a vertex cover of ๐บ
14
Reduction rules for VERTEX COVER โ (R1)
(R1) If there is an isolated vertex ๐ฃ, delete ๐ฃ from ๐บ
โ Reduce to the instance ๐บ โ ๐ฃ, ๐
(๐บ =
, ๐ = 7)
(๐บโฒ =
, ๐โฒ = 7)
15
Reduction rules for VERTEX COVER โ (R1)
(R1) If there is an isolated vertex ๐ฃ, delete ๐ฃ from ๐บ
โ Reduce to the instance ๐บ โ ๐ฃ, ๐
โข To ensure that a reduction rule does not change the answer, we have to
prove safeness of the reduction rule
โข If (๐บ, ๐) is transformed into (๐บ โฒ , ๐ โฒ ) then we should prove that:
(๐ฎ, ๐) is a YES-instance โ (๐ฎโฒ , ๐โฒ ) is a YES-instance
16
Reduction rules for VERTEX COVER โ (R1)
(R1) If there is an isolated vertex ๐ฃ, delete ๐ฃ from ๐บ
โ Reduce to the instance ๐บ โ ๐ฃ, ๐
(๐บ =
, ๐ = 7)
(๐บโฒ =
, ๐โฒ = 7)
17
Reduction rules for VERTEX COVER โ (R2)
(R2) If there is a vertex ๐ฃ of degree more than ๐, then delete ๐ฃ (and its
incident edges) from ๐บ and decrease the parameter by 1
โ Reduce to the instance ๐บ โ ๐ฃ, ๐ โ 1
(๐บ =
, ๐ = 7)
(๐บโฒ =
, ๐โฒ = 6)
18
Reduction rules for VERTEX COVER โ (R3)
(R3) If the previous rules are not applicable and ๐บ has more than ๐ 2 + ๐
vertices or more than ๐ 2 edges, then conclude that we are dealing with a NOinstance
19
Correctness of the cutoff rule
โข Claim. If ๐บ is exhaustively reduced under (R1)-(R2) and has more than
๐ 2 + ๐ vertices or ๐ 2 edges, then there is no size-โค ๐ vertex cover
โข Proof.
โ Suppose ๐บ has a vertex cover ๐
โ Since (R1) does not apply, every vertex of ๐บ โ ๐ has at least one edge
โ Since (R2) does not apply, every vertex has degree at most ๐:
๐ธ ๐บ โค๐โ
๐
๐ ๐บ โ ๐ โค ๐ธ ๐บ โค ๐ โ
|๐|
โ So ๐ ๐บ โค ๐ + 1 โ
|๐|
โ So if ๐บ has a size-๐ vertex cover, ๐ ๐บ โค ๐ 2 + ๐ and ๐ธ ๐บ โค ๐ 2
S
20
โค๐
Preprocessing for VERTEX COVER
โข (R1)-(R3) can be exhaustively applied in polynomial time
โข In polynomial time, we can reduce a VERTEX COVER instance
(๐บ, ๐) to an instance (๐บ โฒ , ๐ โฒ ) such that:
โ the two instances are equivalent: ๐บ, ๐ has answer YES if
and only if (๐บ โฒ , ๐ โฒ ) has answer YES
โ instance (๐บ โฒ , ๐ โฒ ) has at most ๐ 2 + ๐ vertices and ๐ 2 edges
โ ๐โฒ โค ๐
โข This gives an FPT algorithm to solve an instance (๐บ, ๐):
โ Compute reduced instance (๐บ โฒ , ๐ โฒ )
โ Solve
(๐บ โฒ , ๐ โฒ )
by brute force: try all
2 +๐
๐
2
vertex subsets ๐
โข For each ๐, test if it is a vertex cover of size at most ๐โฒ
Theorem. ๐-VERTEX COVER is fixed-parameter tractable
21
Kernelization โ formally
โข Let ๐ โ ฮฃ โ × โ be a parameterized problem and ๐: โ โ โ
โข A kernelization (or kernel) for ๐ of size ๐ is an algorithm that, given
๐ฅ, ๐ โ ฮฃ โ × โ, takes time polynomial in ๐ฅ + ๐, and outputs an
instance ๐ฅ โฒ , ๐ โฒ โ ฮฃ โ × โ such that:
โ ๐ฅ, ๐ โ ๐ โ ๐ฅ โฒ , ๐ โฒ โ ๐
โ ๐ฅ โฒ , ๐ โฒ โค ๐(๐)
โข A polynomial kernel is a kernel whose function ๐ is a polynomial
Theorem. A parameterized problem is fixedparameter tractable if and only if it is decidable and
has a kernel (of arbitrary size)
22
Kernel for FEEDBACK ARC SET IN TOURNAMENTS
Input:
Parameter:
Question:
23
A tournament ๐บ and an integer ๐
๐
Is there a set ๐ of at most ๐ directed edges in ๐บ,
such that ๐บ โ ๐ is acyclic?
Reduction rules for FEEDBACK ARC SET
(R1) If vertex ๐ฃ is not in any triangle, then remove ๐ฃ
(R2) If edge (๐ข, ๐ฃ) is in at least ๐ + 1 distinct triangles, reverse it
and decrease ๐ by one
(R3) If the previous rules are not applicable and ๐บ has more than
๐(๐ + 2) vertices, then conclude that we are dealing with a NOinstance
Theorem. ๐-FEEDBACK ARC SET IN TOURNAMENTS
has a kernel with ๐(๐ + 2) vertices
24
High-level kernelization strategy
โข Compare to VERTEX COVER:
โ (R1) deals with elements that do not constrain the solution
โ (R2) deals with elements that must be in any solution
โ (R3) deals with graphs that remain large after reduction
25
BOUNDED-DEPTH SEARCH TREES
26
Background
โข A branching algorithm that explores a search tree of
bounded depth is one of the simplest types of FPT algorithms
โข Main idea:
โ Reduce problem instance (๐ฅ, ๐) to solving a bounded
number of instances with parameter < ๐
โข If you can solve ๐ฅ, ๐ in polynomial time using the answers to
two instances ๐ฅ1 , ๐ โ 1 and (๐ฅ2 , ๐ โ 1), then the problem
can be solved in 2๐ โ
๐๐ time
โ (assuming the case ๐ = 0 is polynomial-time solvable)
โข If you generate ๐ subproblems instead of 2, then the problem
can be solved in ๐ ๐ โ
๐๐ = 2๐ ๐ log ๐ โ
๐๐ time
27
A search tree
(๐ฅ, ๐ = 3)
(๐ฅ1 , 2)
(๐ฅ3 , 1)
(๐ฅ7 , 0)
28
(๐ฅ8 , 0)
(๐ฅ2 , 2)
(๐ฅ4 , 1)
(๐ฅ9 , 0)
(๐ฅ5 , 1)
(๐ฅ6 , 1)
(๐ฅ10 , 0) (๐ฅ11 , 0) (๐ฅ12 , 0) (๐ฅ13 , 0) (๐ฅ14 , 0)
Analysis of bounded-depth search trees
โข If the parameter decreases for each recursive call, the depth
of the tree is at most ๐
โข # nodes in a depth-๐ tree with ๐ leaves is ๐(๐ โ
๐)
โ Usually sufficient to bound the number of leaves
โข If the computation in each node takes polynomial time, total
running time is ๐(๐ โ
๐ โ
๐๐ )
29
VERTEX COVER revisited
Input:
Parameter:
Question:
30
A graph ๐บ and an integer ๐
๐
Is there a set ๐ of at most ๐ vertices in ๐บ, such
that each edge has an endpoint in ๐?
Algorithm for VERTEX COVER
โข Algorithm VC(Graph ๐บ, integer ๐)
โข if ๐ < 0 then return NO
โข if ๐บ has no edges then return YES
โข else pick an edge in ๐บ and let ๐ข and ๐ฃ be its endpoints
โ return (VC(๐บโ ๐ข, ๐ โ 1) OR (VC(๐บ โ ๐ฃ, ๐ โ 1))
โข Correct because any vertex cover must use ๐ข or ๐ฃ
โข A size-๐ vertex cover in G that uses ๐ข, yields a size-(๐ โ 1)
vertex cover in ๐บ โ ๐ข
31
Running time for VERTEX COVER
โข Every iteration either solves the problem directly or makes
two recursive calls with a decreased parameter
โข The branching factor of the algorithmโand therefore of the
search treeโis two
โข Tree of depth ๐ with branching factor 2 has at most 2๐ leaves
โ Running time is 2๐ โ
๐๐
โ Much better than 2
๐ 2 +๐
from the kernelization algorithm
โข One way to faster algorithms:
โ Pick a vertex ๐ฃ of maximum degree, recurse on
(๐บ โ ๐ฃ, ๐ โ 1) and (๐บ โ ๐ ๐ฃ , ๐ โ ๐ ๐ฃ )
32
The FEEDBACK VERTEX SET problem
Input:
Parameter:
Question:
An undirected (multi)graph ๐บ and an integer ๐
๐
Is there a set ๐ of at most ๐ vertices in ๐บ, such
that each cycle contains a vertex of ๐?
โข We allow multiple edges and self-loops
โข Such a set ๐ is a feedback vertex set of ๐บ
โ Removing ๐ from ๐บ results in an acyclic graph, a forest
33
Branching for FEEDBACK VERTEX SET
โข For VERTEX COVER, we could easily identify a set of vertices to
branch on: the two endpoints of an edge
โข For feedback vertex set, a solution may not contain any
endpoint of an edge
โ How should we branch?
โข We will find a set ๐ of ๐(๐) vertices such that any size-๐
feedback vertex set contains a vertex of ๐
โข To find ๐ we first have to simplify the graph using reduction
rules that do not change the answer
34
Reduction rules
(R1) If there is a loop at vertex ๐ฃ, then delete ๐ฃ and decrease ๐ by one
(R2) If there is an edge of multiplicity larger than 2, then reduce its
multiplicity to 2
(R3) If there is a vertex ๐ฃ of degree at most 1, then delete ๐ฃ
(R4) If there is a vertex ๐ฃ of degree two, then delete ๐ฃ and add an
edge between ๐ฃโs neighbors
If (R1-R4) cannot be applied anymore,
then the minimum degree is at least 3
Observation. If ๐บ, ๐ is transformed into (๐บ โฒ , ๐ โฒ ), then:
1. FVS of size โค ๐ in ๐บ โ FVS of size โค ๐โฒ in ๐บโฒ
2. Any feedback vertex set in ๐บโฒ is a feedback vertex set in ๐บ
when combined with the vertices deleted by (R1)
35
Identifying a set to branch on
โข Let ๐บ be a graph whose vertices have degree three or more
โ Order the vertices as ๐ฃ1 , ๐ฃ2 , โฆ , ๐ฃ๐ by decreasing degree
โ Let ๐3๐ โ {๐ฃ1 , โฆ , ๐ฃ3๐ } be the 3๐ largest-degree vertices
โข Lemma. If all vertices of ๐บ have degree 3 or more, then any
size-โค ๐ feedback vertex set of ๐บ contains a vertex from ๐3๐
โข So if there is a size-โค ๐ solution, it contains a vertex of ๐3๐
โ For each ๐ฃ โ ๐3๐ recurse on the instance (๐บ โ ๐ฃ, ๐ โ 1)
โข Gives an algorithm with running time 3๐ ๐ โ
๐๐
โ Apply the reduction rules, compute ๐3๐ , then branch
36
A useful claim
โข Claim. If ๐ is a feedback vertex set of ๐บ, then
๐ ๐ฃ โ1 โฅ ๐ธ ๐บ โ ๐ ๐บ +1
๐ฃโ๐
โข Proof. Graph ๐น โถ= ๐บ โ ๐ is a forest
โ So ๐ธ ๐น โค ๐ ๐น โ 1 = |๐(๐บ)| โ |๐| โ 1
โ Every edge not in ๐น, is incident with a vertex of ๐
๐(๐ฃ) + ๐ ๐บ
โ ๐ โ 1 โฅ |๐ธ(๐บ)|
๐ฃโ๐
โข With this claim, we can prove the degree lemma
37
Proving the degree lemma
โข Lemma. If all vertices of ๐บ have degree 3 or more, then any
size-โค ๐ feedback vertex set of G contains a vertex from ๐3๐
โข Proof by contradiction.
By the๐ โฉ ๐3๐ = โ
โ Let ๐ be a size-โค ๐ feedback vertex set with
previous
โ By choice of ๐3๐ we have:
claim
min ๐(๐ฃ) โฅ max ๐ ๐ฃ , so:
๐ฃโ๐3๐
๐ฃโ๐
๐ ๐ฃ โ1 โฅ3โ
๐ฃโ๐3๐
๐ ๐ฃ โ1 โฅ3โ
๐ธ ๐บ โ ๐ ๐บ
๐ฃโ๐
โ Define ๐ + โ ๐ ๐บ โ ๐3๐ . Since ๐ โ ๐ + :
(๐ ๐ฃ โ 1) โฅ
๐ฃโ๐ +
๐ ๐ฃ โ1 โฅ ๐ธ ๐บ โ ๐ ๐บ +1
๐ฃโ๐
๐ ๐ฃ โ 1 โฅ4 โ
๐ธ ๐บ โ ๐ ๐บ + 1 .
38
๐ฃโ๐ ๐บ
+1 .
Proving the degree lemma (II)
โข
๐ฃโ๐ ๐บ
๐ ๐ฃ โ 1 โฅ4โ
๐ธ ๐บ โ ๐ ๐บ + 1
โข The degree sum counts every edge twice:
๐ ๐ฃ = 2 โ
|๐ธ(๐บ)|
๐ฃโ๐ ๐บ
โข Combining these:
4โ
๐ธ ๐บ โ ๐ ๐บ
+1 โค
๐ ๐ฃ โ1 =2โ
๐ธ ๐บ
๐ฃโ๐ ๐บ
โข So 2 โ
๐ธ ๐บ
< 3 โ
|๐ ๐บ |
โข But since all vertices have degree โฅ 3 we have:
2โ
๐ธ ๐บ =
๐ ๐ฃ โฅ3โ
๐ ๐บ ,
๐ฃโ๐ ๐บ
โข Contradiction
39
โ |๐ ๐บ |
A final word on bounded-depth search trees
โข The degree lemma proves the correctness of our branching
strategy for FEEDBACK VERTEX SET
โข When building a branching algorithm for a parameterization
by the solution size:
โ Find an ๐(๐)-size set that contains a vertex of the solution
โ Branch in ๐(๐) directions, trying all possibilities
โ We get a search tree of depth ๐ and branching factor ๐(๐)
โข You can think of the branching process as guessing
40
DYNAMIC PROGRAMMING
41
The SET COVER problem
Input:
Parameter:
Question:
A set family โฑ over a universe ๐ and an integer ๐
|๐|
Is there a subfamily โฑ โฒ โ โฑ of at most ๐ sets,
such that ๐นโโฑโฒ ๐น = ๐?
โข The subfamily โฑโฒ covers the universe ๐
โข SET COVER parameterized by the universe size is FPT
โ Algorithm with running time 2 ๐ โ
๐ + โฑ
โ Based on dynamic
๐น programming ๐น2
1
๐น4
42
๐น3
๐
Dynamic programming for SET COVER
โข Let โฑ = {๐น1 , ๐น2 , โฆ , ๐น๐ }
โข We define a DP table for ๐ โ ๐ and ๐ โ {0,1, โฆ , ๐}
๐ ๐, ๐ = min nr. of sets from ๐น1 , โฆ , ๐น๐ needed to cover ๐
Or +โ if impossible
โข The value ๐[๐, ๐] gives the minimum size of a set cover
โ To solve the problem, compute ๐ using base cases and a
recurrence
43
Filling the dynamic programming table
โข ๐ ๐, ๐ = min nr. of sets from ๐น1 , โฆ , ๐น๐ needed to cover ๐
Base case: ๐ = 0
๐ ๐, ๐ = 0 if ๐ = โ
, otherwise it is +โ
Recursive step: ๐ > 0
๐ ๐, ๐ = min(๐ ๐, ๐ โ 1 , 1 + ๐ ๐\F๐ , ๐ โ 1 )
โข Skip set ๐น๐ , or pay for ๐น๐ and afterwards cover ๐\F๐
โข Each entry can be computed in polynomial time
โ ( โฑ + 1) โ
2 ๐ entries in total
44
More on dynamic programming
โข Dynamic programming is a memory-intensive algorithmic
paradigm that yields FPT algorithms in various situations
โ Here: dynamic programming over subsets of ๐
โ Later: dynamic programming over tree decompositions
โข Research challenge:
โ Determine whether the 2 ๐ factor can be improved to
2 โ ๐ ๐ for some ๐ > 0
45
Exercises
From this lecture ..
โข Prove the safeness that the reduction rules for FEEDBACK ARC SET in
tournaments are safe
โข Improve the running time of the Vertex Cover branching algorithm to
1.6181๐
Kernelization
โข 2.4, 2.7, 2.9, 2.14
Branching
โข 3.2, 3.4, 3.7, 3.8
Dynamic programming
โข 6.2
46
Summary
โข Parameterized algorithmics is a young, vibrant research area
that investigates how to cope with NP-completeness
โข We saw three ways of building FPT algorithms:
1. Kernelization
2. Bounded-depth search trees
3. Dynamic programming over subsets
47