branching algorithms - inria ?· branching algorithms are also called i branch & bound algorithms...

Download Branching Algorithms - Inria ?· Branching Algorithms are also called I branch & bound algorithms I…

Post on 31-Mar-2019

213 views

Category:

Documents

0 download

Embed Size (px)

TRANSCRIPT

Branching Algorithms

Dieter Kratsch

Laboratoire dInformatique Theorique et AppliqueeUniversite Paul Verlaine - Metz

57000 Metz Cedex 01France

AGAPE 09, Corsica, FranceMay 24 - 29, 2009

1/122

I. Our First Independent Set Algorithm:

mis1

2/122

Independent Set

Definition (Independent Set)

Let G = (V ,E ) be a graph. A subset I V of vertices of G is anindependent set of G if no two vertices in I are adjacent.

Definition (Maximum Independent Set (MIS))

Given a graph G = (V ,E ), compute the maximum cardinality ofan independent set of G , denoted by (G ).

[or a maximum independent set of G ]

a

b

c

d e

f

3/122

Standard Branching Rule

I For every vertex v : there is a maximum independent setcontaining v , or there is a maximum independent set notcontaining v

I Branching into two smaller subproblems: select v anddiscard v to be solved recursively

I discard v: remove v

I select v: remove N[v ]

I branching rule:

(G ) = max(1 + (G N[v ]), (G v)).

4/122

Algorithm mis1

int mis1(G = (V ,E ));

{

if ((G ) 3) choose any vertex v of degree d(v) 3

return max(1 + mis1(G N[v ]),mis1(G v));

if ((G ) 2) compute (G ) in polynomial time

and return the value;

}

5/122

Intro Branch & Recharge Lower bounds Sort & Search

The branching rule

The branching rule is really simple. Given a vertex v on which wewant to branch :! select v and recursively build all (, ")-DS containing v! discard v and recursively build all (, ")-DS not containing v

v

v

select v

v

discard v

(, ")-DScontaining v

(, ")-DSnot containing v

13/406/122

Correctness

I standard branching rule correct; hence branching does notmiss any maximum independent set

I graphs of maximum degree two are disjoint union of pathsand cycles

I (G ) easy to compute if (G ) 2 [exercice]

I mis1 outputs (G ) for input graph G

I mis1 can be modified s.t. it outputs a maximum independentset

7/122

Time Analysis via recurrence

I Running time of mis1 is O(T (n)), where

I T (n) is largest number of base cases for any input graph G onn vertices

I Base case = graph of maximum degree two for which iscomputed by a polynomial time algorithm

I branching rule implies recurrence:

T (n) T (n 1) + T (n d(v) 1) T (n 1) + T (n 4)

8/122

Solving the Recurrence

I Solutions of recurrence of form cn

I Basic solutions root of characteristic polynomial

xn = xn1 + xn4

I largest root of characteristic polynomial is its unique positivereal root

I Maple, Mathematica, Matlab etc.

9/122

Running Time of mis1

Theorem: Algorithm mis1 has running time O(1.3803n).

Question: Is this the worst-case running time of mis1? [Exercice]

10/122

II. Fundamental Notions and Time Analysis

11/122

Branching Algorithms

are also called

I branch & bound algorithms

I backtracking algorithms

I search tree algorithms

I branch & reduce algorithms

I splitting algorithms

The technique is also called Pruning the search tree

(e.g. in Woegingers well-known survey).

12/122

Branching and Reduction Rules

Branching algorithms are recursively applied to instances of aproblem using branching rules and reduction rules.

I Branching rules: solve a problem instance by recursivelysolving smaller instances

I Reduction rules:

- simplify the instance- (typically) reduce the size of the instance

13/122

Search Trees

I Search Tree:

used to illustrate, understand and analyse an execution of abranching algorithm

I root: assign the input to the root

I node: assign to each node a solved problem instance

I child: each instance reached by a branching rule is assigned toa child of the node of the original instance of the problem

14/122

A search tree

Select Discard

S

S S

S D

D

D

D

V1

V2 V4

V3 V5

15/122

Analysing a Branching Algorithm

I Correctness:

Correctness of reduction and branching rules

I Running Time:

Upper Bound the (maximum) number of leaves in any searchtree of an input of size n:

1. Define a size of a problem instance.

2. Lower bound the progress made by the algorithm at eachbranching step.

3. Compute the collection of recurrences for all branching rules.

4. Solve all those recurrences (to obtain a running time of theform O(cni ) for each).

5. Take the worst case over all solutions: O(cn) with c = max ci

16/122

Analysing a Branching Algorithm

I Correctness:

Correctness of reduction and branching rules

I Running Time:

Upper Bound the (maximum) number of leaves in any searchtree of an input of size n:

1. Define a size of a problem instance.

2. Lower bound the progress made by the algorithm at eachbranching step.

3. Compute the collection of recurrences for all branching rules.

4. Solve all those recurrences (to obtain a running time of theform O(cni ) for each).

5. Take the worst case over all solutions: O(cn) with c = max ci

16/122

Analysing a Branching Algorithm

I Correctness:

Correctness of reduction and branching rules

I Running Time:

Upper Bound the (maximum) number of leaves in any searchtree of an input of size n:

1. Define a size of a problem instance.

2. Lower bound the progress made by the algorithm at eachbranching step.

3. Compute the collection of recurrences for all branching rules.

4. Solve all those recurrences (to obtain a running time of theform O(cni ) for each).

5. Take the worst case over all solutions: O(cn) with c = max ci

16/122

Analysing a Branching Algorithm

I Correctness:

Correctness of reduction and branching rules

I Running Time:

Upper Bound the (maximum) number of leaves in any searchtree of an input of size n:

1. Define a size of a problem instance.

2. Lower bound the progress made by the algorithm at eachbranching step.

3. Compute the collection of recurrences for all branching rules.

4. Solve all those recurrences (to obtain a running time of theform O(cni ) for each).

5. Take the worst case over all solutions: O(cn) with c = max ci

16/122

Analysing a Branching Algorithm

I Correctness:

Correctness of reduction and branching rules

I Running Time:

Upper Bound the (maximum) number of leaves in any searchtree of an input of size n:

1. Define a size of a problem instance.

2. Lower bound the progress made by the algorithm at eachbranching step.

3. Compute the collection of recurrences for all branching rules.

4. Solve all those recurrences (to obtain a running time of theform O(cni ) for each).

5. Take the worst case over all solutions: O(cn) with c = max ci

16/122

Analysing a Branching Algorithm

I Correctness:

Correctness of reduction and branching rules

I Running Time:

Upper Bound the (maximum) number of leaves in any searchtree of an input of size n:

1. Define a size of a problem instance.

2. Lower bound the progress made by the algorithm at eachbranching step.

3. Compute the collection of recurrences for all branching rules.

4. Solve all those recurrences (to obtain a running time of theform O(cni ) for each).

5. Take the worst case over all solutions: O(cn) with c = max ci

16/122

Simple Time Analysis : Search Tree

I Assumption: for any node of search tree polynomial runningtime.

I Time analysis of branching algorithms means to upper boundthe number of nodes of any search tree of an input of size n.

I Let T (n) be (an upper bound of) the maximum number ofleaves of any search tree of an input of size n.

I Running time of corresponding branching algorithm:O(T (n))

I Branching rules to be analysed separately

17/122

Simple Time Analysis : Branching Vectors

I Application of branching rule b to any instance of size n

I Problem branches into r 2 subproblems of size at mostn t1, n t2, . . . , n tr for all instances of size n

I ~b = (t1, t2, . . . tr ) branching vector of branching rule b.

18/122

Simple Time Analysis: Recurrences

I Linear recurrence for the maximum number of leaves of asearch tree corresponding to ~b = (t1, t2, . . . tr ):

T (n) T (n t1) + T (n t2) + + T (n tr ).

I Largest solution of any such linear recurrence (obtained by abranching vector) is of form cn where c is the unique positivereal root of the characteristic polynomial:

xn xnt1 xnt2 xntr = 0.

I This root c > 1 is called branching factor of ~b:

(t1, t2, . . . , tr ) = c

19/122

Properties of Branching Vectors [Kullmann]

Let r 2. Let ti > 0 for all i {1, 2, . . . r}.

1. (t1, t2, . . . , tr ) (1,).

2. (t1, t2, . . . , tr ) = (t(1), t(2), . . . , t(r))

for any permutation .

3. (t1, t2, . . . , tr ) < (t1, t2, . . . , tr )

if t1 > t1.

20/122

Balancing Branching Vectors

Let i , j , k be positive rea