35
1 A Variation of Minimum Latency Problem on Path, Tree and DAG Author: Yung-Hui Hu ang, Yaw-Ling Li n, Chuan-Yi Ta ng

A Variation of Minimum Latency Problem on Path, Tree and DAG

Embed Size (px)

DESCRIPTION

A Variation of Minimum Latency Problem on Path, Tree and DAG. Author: Yung-Hui Huang, Yaw-Ling Lin, Chuan-Yi Tang. Problem Definition. Given a graph G(V,E) with a distance matrix d i,j and the weight function of each vertices v i - PowerPoint PPT Presentation

Citation preview

Page 1: A Variation of Minimum Latency Problem on Path, Tree and DAG

1

A Variation of Minimum Latency Problemon Path, Tree and DAG

Author:

Yung-Hui Huang,

Yaw-Ling Lin,

Chuan-Yi Tang

Page 2: A Variation of Minimum Latency Problem on Path, Tree and DAG

2

Problem Definition

Given a graph G(V,E) with a distance matrix di,j and the weight function of each vertices vi

If the vertex vi wants to be completed, at least one ancestor of vi must be finished.

Let defined to be the distance traveled before first visiting vi

The problem is to find out the minimum latency tour traversal all vertices.

The objective function:

Page 3: A Variation of Minimum Latency Problem on Path, Tree and DAG

3

Problem Sample

BA

C D

E

GF

Weight of vertices

Working Time of vertices t(vi) is zero.A ll edge distance d(ej) is 1

Result:T = {A,C,E,G,F,B,D}L(T) = 1*30+2*45+3*42+4*101+5*65+6*0+7*50

= 1325

A B C D E F G

w(vi) 30 0 45 50 42 65 101

Page 4: A Variation of Minimum Latency Problem on Path, Tree and DAG

4

Compare with original MLP

The new problem is equivalent to the original MLP with no edge distance but vertex latency time and vertex weight.

In other words, we assume that the walk back latency of completed jobs be “0”.

Page 5: A Variation of Minimum Latency Problem on Path, Tree and DAG

5

Our Result

Given a starting point of G– K-path : O(n log k) where k is a constant– Full k-ary tree with constant weight: O(n)– Tree : O(n log n)– DAG : NP-Hard (Reduce from 3-SAT)

Find the best starting point of G– Path : O(n) to find the best starting point.

Page 6: A Variation of Minimum Latency Problem on Path, Tree and DAG

6

Inseparable Property

Let (vi)= w(vi)/d(vi) be the ratio cost of vi If u and v are inseparable, then there exist an o

ptimal solution containing uv sequence contiguously. (uv)= w(u)+w(v)/ d(u)+d(v)

Inseparable property:– If v is the only decedent of u, and (v) (u) then u

and v are inseparable.– If u have multiple decedents V. Let vV has the ma

ximum ratio cost among all others and (v) (u). u and v are inseparable.

Page 7: A Variation of Minimum Latency Problem on Path, Tree and DAG

7

Inseparable Sample

3 4 2

Single decedent

Multiple decedents

2

5 4

7/2

4

11/3

2,5,4

Shrink 3 and 4

3 4 2

7/2

Page 8: A Variation of Minimum Latency Problem on Path, Tree and DAG

8

Right Skew property

If a vertex sequence <v1,v2…vn> is right skew then (<v1…vi>) <(<vi+1…vn>) for all n i 1

The Inseparable is right skew.

2

5 4

2 5 4

Page 9: A Variation of Minimum Latency Problem on Path, Tree and DAG

9

Decreasing right skew Property

G has decreasing property if for all u,v in G, u is the ancestor of v, then (u) (v) and u,v are both right skew.

4 8 5 3 9 3 7 6

4 8 5 3 9 3 7 6

12/2 17/3 16/3 Also, if G is a tree then G is a max-heap tree.

Page 10: A Variation of Minimum Latency Problem on Path, Tree and DAG

10

Problem on K-path

We say a connected graph is the K-path if there exist a vertex has degree k and all other vertices have degree 2.

3-path

Page 11: A Variation of Minimum Latency Problem on Path, Tree and DAG

11

Algorithm

1.Partition each paths into decreasing right skew.

2.Iterative select and output a maximum ratio cost from k candidate.

Page 12: A Variation of Minimum Latency Problem on Path, Tree and DAG

12

Partition a path into several inseparable - O(n)

4 8 5 3 9 3 7 67 > 6

3 < 7

(3+7)/2 <6

4 8 5 3 9 3 7 6

4 8 5 3 9 3 7 6

4 8 5 3 9 3 7 6

4 8 5 3 9 3 7 6

Page 13: A Variation of Minimum Latency Problem on Path, Tree and DAG

13

Partition a path into several inseparable - O(n)

After the partition steps, a path will be partition into several inseparable and the partition result will meet the decreasing right skew property.

We partition each paths in k-path graph individually. And get k decreasing right skew partition.

Page 14: A Variation of Minimum Latency Problem on Path, Tree and DAG

14

Merge k decreasing right skew

S

13

1

10

5

6

2

S 13 10 6 5 2 1Result :

Time Complexity: n log(k)

Page 15: A Variation of Minimum Latency Problem on Path, Tree and DAG

15

Problem on Tree

Observation: A node have maximum ratio cost is inseparable with its parent.

Algorithm:1.Build a Fibonacci heap

2.Select a maximum vertex v and shrink with its parent.

If v is the root, then output v.

Page 16: A Variation of Minimum Latency Problem on Path, Tree and DAG

16

Example on Tree

5

3 10

8 11 2

Select 11

5

14/2 10

8 2

Select 10

15/2

14/2

8 2

Select 8

15/2

22/3 2

Select and output 15/222/3 2

Select and output 22/3

2Select and output 2

Result : 5,10,3,11,8,2

Page 17: A Variation of Minimum Latency Problem on Path, Tree and DAG

17

Time Complexity

Construct a Fibonacci heap - O(n) Select maximum - O(1) Increasing Key - O(log n)

The time complexity is O(nlogn)

Page 18: A Variation of Minimum Latency Problem on Path, Tree and DAG

18

Problem on full k-ary tree

If G is a full k-ary tree and external nodes have the constant weight we and the internal nodes also have the constant weight wi, then the problem can be solved in linear time.

1

1 2

2 2

Full k-ary tree

Page 19: A Variation of Minimum Latency Problem on Path, Tree and DAG

19

Related Lemma

1. Any sub tree of full k-ary tree is inseparable

1

1 2

2 2

Page 20: A Variation of Minimum Latency Problem on Path, Tree and DAG

20

Related Lemma

2. Let T1, T2 be the sub trees of full k-ary tree. If the T1 has more nodes, then (T2) (T1) and T2 will be visited before T1.

1

1 2

2 2(T1) 5/3

T1

(T2) 2/1

T2

Page 21: A Variation of Minimum Latency Problem on Path, Tree and DAG

21

Algorithm

1.Compute the internal node number of each sub trees.

2. Use a radix sort to sort all nodes by the internal node number of sub tree rooted by each vertex.

3.According to the sorting result, we can build priority queues in each internal nodes.

4.Use a DFS to traversal the full k-ary tree.

Page 22: A Variation of Minimum Latency Problem on Path, Tree and DAG

22

Example

A

B C

D E

F G 00

0

10

2

3 Sorting Result: G,F,D,C,E,B,A

G

A

B C

D E

F G

F

D

C

E

B

Page 23: A Variation of Minimum Latency Problem on Path, Tree and DAG

23

Example

G

A

B C

D E

F G

F

D

C

E

B

Page 24: A Variation of Minimum Latency Problem on Path, Tree and DAG

24

Problem on DAG

The problem on DAGs is NP-Hard. We can reduce from the 3-SAT. Given a 3-CNF F=C1 C2 …. Ck [k clauses]

with n literals {x1, x2,... xn} we can construct a DAG with 1+3n+4k vertices and 2n+6k edges.

Page 25: A Variation of Minimum Latency Problem on Path, Tree and DAG

25

Construct a DAG

Given an instance of 3-SAT=(x1v x2v x3) (x3v x2v x4)...

S

x1 x1 x2 x2x3 x3 x4 x4

0 0 0

0 0 0

… n literals

… k clauses

Page 26: A Variation of Minimum Latency Problem on Path, Tree and DAG

26

Constructing Step

1. If F has n literals.

S

x1 x1

x2 x2

x3 x3

x4 x4

… n literals

1 literal

Page 27: A Variation of Minimum Latency Problem on Path, Tree and DAG

27

Constructing Step

2. If F has k clauses.

0 0 0

0 0 0

… k clauses

1 caluse

Page 28: A Variation of Minimum Latency Problem on Path, Tree and DAG

28

Construct a DAG

Given an instance of 3-SAT=(x1v x2v x3) (x3v x2v x4)...

S

x1 x1 x2 x2x3 x3 x4 x4

0 0 0

0 0 0

… n literals

… k clauses

Page 29: A Variation of Minimum Latency Problem on Path, Tree and DAG

29

The problem on DAG is NP-Hard

Let the w(xi) =0 If F is satisfiable the result of problem on DAG

is match the following format:

...S 0 0 0 0 0 0 ... 0 0 0...

2n vertices 2k vertices n+2k

Page 30: A Variation of Minimum Latency Problem on Path, Tree and DAG

30

Find the best starting point on Path

The simplest way to find out the best starting point is perform the O(n) algorithm n times and select the starting point of the minimum result as the answer.

The simplest way cost O(n2). We propose an O(n) time algorithm to solve

the problem.

Page 31: A Variation of Minimum Latency Problem on Path, Tree and DAG

31

Example to demonstration O(n) algorithm

4 8 5 3 9 3 7 6

3.Iterative select the minimum inseparable from Step 1 and 2 and remove it from 1 and 2

4 8 5 3 9 3 7 6

1.Find the partition starting from left point

4 8 5 3 9 3 7 6

2.Find the partition starting from right point

Page 32: A Variation of Minimum Latency Problem on Path, Tree and DAG

32

Iterative select the minimum

4 8 5 3 9 3 7 6

4 8 5 3 9 3 7 6Result : 4

8 5 3 9 3 7 6

8 5 3 9 3 7 6Result : 358,4

Page 33: A Variation of Minimum Latency Problem on Path, Tree and DAG

33

Iterative select the minimum

9 3 7 6

9 3 7 6Result : 376,358,4

9

9Result : 9,376,358,4

Page 34: A Variation of Minimum Latency Problem on Path, Tree and DAG

34

Our Result

Given a starting point of G– K-path : O(n log k) where k is a constant– Full k-ary tree with constant weight: O(n)– Tree : O(n log n)– DAG : NP-Hard (Reduce from 3-SAT)

Find the best starting point of G– Path : O(n) to find the best starting point.

Page 35: A Variation of Minimum Latency Problem on Path, Tree and DAG

35

Future Work

Find the best starting point of Tree Consider the on-line version. Consider the parallel version.

Q & A

Thank you!