a multiple pairs shortest path algorithm 解説

38
A Multiple Pairs Shortest Path Algorithm NTS 2012.5.18 増増 Copyright (C) 2012 Denso IT Laboratory, Inc. All Rights Reserved.

Upload: osamu-masutani

Post on 17-Jan-2015

226 views

Category:

Technology


3 download

DESCRIPTION

National Cheng Kung UniversityのWang氏の多点間最短経路探索(MPSP)に関する論文の解説。 Wang, I-Lin, Ellis L. Johnson, and Joel S. Sokol. "A multiple pairs shortest path algorithm." Transportation science 39.4 (2005): 465-476.

TRANSCRIPT

Page 1: A Multiple Pairs Shortest Path Algorithm 解説

A Multiple Pairs Shortest Path Algorithm

NTS 2012.5.18増谷

Copyright (C) 2012 Denso IT Laboratory, Inc. All Rights Reserved.

Page 2: A Multiple Pairs Shortest Path Algorithm 解説

MPSP

• Multiple Pairs Shortest Path Algorithm–複数の点間の OD 最短距離を求める

http://www.youtube.com/watch?v=PaT1l-mzZtc

http://www.youtube.com/watch?v=87_1K2GQFdU&feature=relmfu

Copyright (C) 2012 Denso IT Laboratory, Inc. All Rights Reserved.

Page 3: A Multiple Pairs Shortest Path Algorithm 解説

Purpose of MPSP• OD-Multi-commodity flow problem (ODMCFP)– 複数のOD需要から最適な最短路を求める– 経路(辺)のキャパシティは決まっている– minimum cost multi-commodity flow problem

• コストを最小にする• NP完全

– 応用• 航空路の最適化• RWA(Routing Wavelength Assignment)

– WDM を利用したフォトニックネットワークの経路選択– 接続を最大化させる

Copyright (C) 2012 Denso IT Laboratory, Inc. All Rights Reserved.

Page 4: A Multiple Pairs Shortest Path Algorithm 解説

紹介論文• Wang, I.-L., Johnson, E. L., & Sokol, J. S. (2005).

A Multiple Pairs Shortest Path Algorithm. Transportation Science, 39(4), 465-476. doi:10.1287/trsc.1050.0124

• 選定理由– MPSP に関する最近の文献–分野を外していない (Transportation)

Copyright (C) 2012 Denso IT Laboratory, Inc. All Rights Reserved.

Page 5: A Multiple Pairs Shortest Path Algorithm 解説

著者• I-Lin Wang 教授 @ National Cheng Kung

University ( 台湾 )– OR 方面の人(特に Network Optimization )– Logistics, Network, Data Mining, Telecommunication,

Bioinformatics など応用– MIT 卒、富士通研究所、ジョージア工科大を経て現

職– http://ilin.iim.ncku.edu.tw/index.html

Copyright (C) 2012 Denso IT Laboratory, Inc. All Rights Reserved.

Page 6: A Multiple Pairs Shortest Path Algorithm 解説

いわゆる経路探索• グループ化• 1) 組み合わせ、ネットワーク探索

– Label-setting methods (Dijkstra 1959, Dantzig 1960, Dial 195)– Label-correcting methods (Ford 1956, Moore 1957, Bellman

1958, Pape 1974)– Their Hybrids (Glober ,Klingman 1984)

• 2) 線形計画法– Primal network simplex methods (Goldfarb, Hao, and Kai

1990, Goldfarb and Jin 1999)– Dual ascent method (Bertsekas, Pallottino, Scutella 1995;

Pallottino and Scutella 1997)

• 3) 代数的、行列計算– Floyd-Warshall (Floyd 1962, Warshall 1962)– Carre’s algorithm (Carre 1969,1971)

SSSP 用

APSP 用

Copyright (C) 2012 Denso IT Laboratory, Inc. All Rights Reserved.

Page 7: A Multiple Pairs Shortest Path Algorithm 解説

Algebraic Method for APSP• APSP が以下の式で表される

– X : n*n shortest distance matrix– C : n*n measure matrix– In: identity matrix

• Bellman 方程式に一致

• Floyd-Warshall, Carrer アルゴリズムのベース

Copyright (C) 2012 Denso IT Laboratory, Inc. All Rights Reserved.

Page 8: A Multiple Pairs Shortest Path Algorithm 解説

MPSP と SSSP,MPSP の関係• SSSP の拡張– 何度も SSSP を行う– Q が N に対して十分小さい場合

• SSSP を q 回やるのが高速

– q が多い場合• SSSP は APSP に近づき、無駄なペアの経路を抽出することになる

• MPSP の応用– 結果からピックアップするだけ– 対象以外のペアも計算している

-> そのままでは無駄が多い

Copyright (C) 2012 Denso IT Laboratory, Inc. All Rights Reserved.

Page 9: A Multiple Pairs Shortest Path Algorithm 解説

各種定義

• cij コスト行列

• xij 距離行列

• xij*

最短距離行列

• succij successor matrix

• succij* 最短 successor matrix  

例:  Succ41 = [3,2]

例:  x41* = 3

例:  x41 = 8

例:  Succ41* = [2]

Copyright (C) 2012 Denso IT Laboratory, Inc. All Rights Reserved.

Page 10: A Multiple Pairs Shortest Path Algorithm 解説

各種定義• Triple comparison– s -> k -> t– xsk + xkt と xst を比較–新しい経路の方が短い場合

• xst をアップデート• fill-in arc (s,t) を作る(直接辺が無かった場合)

k st

例:  x42 + x21 = 3 < x41 = 9

fill-in

最短経路アルゴリズムは triple comparisonの繰り返し

最短経路アルゴリズムは triple comparisonの繰り返し

Copyright (C) 2012 Denso IT Laboratory, Inc. All Rights Reserved.

Page 11: A Multiple Pairs Shortest Path Algorithm 解説

各種定義• ノードの順列– Higher / lower i>j– highest / lowest– Upward / downward

Copyright (C) 2012 Denso IT Laboratory, Inc. All Rights Reserved.

Page 12: A Multiple Pairs Shortest Path Algorithm 解説

DLU

• DLU は Carre の APSP アルゴリズムの拡張– LU 分解を利用–密なグラフに有効–最短経路木を作らずにOD距離を計算可能

Copyright (C) 2012 Denso IT Laboratory, Inc. All Rights Reserved.

Page 13: A Multiple Pairs Shortest Path Algorithm 解説

条件• Q 個の要求 OD ペア– Q:={(si,ti): i=1,…q}

• ノード i とノード j の間の暫定距離初期化– [xij] := [cij]

• ノード j へのノード i からの経路行列の初期化– [succij] := [j]

Copyright (C) 2012 Denso IT Laboratory, Inc. All Rights Reserved.

Page 14: A Multiple Pairs Shortest Path Algorithm 解説

DLU の手順手順1.A_LU2.Get_D(si,ti)

Copyright (C) 2012 Denso IT Laboratory, Inc. All Rights Reserved.

Page 15: A Multiple Pairs Shortest Path Algorithm 解説

A_LU

• 対角要素 (k,k) を利用して、 (k,t) for each t>k の要素を消す

• 灰色部分の行列をアップデートまたは fill-ins を作る

Copyright (C) 2012 Denso IT Laboratory, Inc. All Rights Reserved.

Page 16: A Multiple Pairs Shortest Path Algorithm 解説

A_LU でのアップデート• 現状見つかっている (s,t)

間の最短路よりも短い経路が見つかれば Update– xst , succst  を Update

k=1 k=2 k=3

X X3 XX X21

113

43

4

→2

fill-in

Copyright (C) 2012 Denso IT Laboratory, Inc. All Rights Reserved.

Page 17: A Multiple Pairs Shortest Path Algorithm 解説

A_LU の意味• G から G’(augmented graph) を作成– Fill-in 辺を追加–中間ノードは s,t よりも小さいノードのみ考

Copyright (C) 2012 Denso IT Laboratory, Inc. All Rights Reserved.

Page 18: A Multiple Pairs Shortest Path Algorithm 解説

A_LU の産物

• xst は A_LU の後、部分グラフ H(..) 内の最短経路を示す• 自分より小さい index の  ノードを使ったグラフ

Copyright (C) 2012 Denso IT Laboratory, Inc. All Rights Reserved.

Page 19: A Multiple Pairs Shortest Path Algorithm 解説

Get_D(s,t)

• 上三角、下三角行列に分解– Acyclic graph になる

Copyright (C) 2012 Denso IT Laboratory, Inc. All Rights Reserved.

Page 20: A Multiple Pairs Shortest Path Algorithm 解説

Get_D_L(ti)

• 下三角行列への処理–下流への辺をもつグラフ–今度は s,t の間にあるノード を使って triple comparison

st k

Copyright (C) 2012 Denso IT Laboratory, Inc. All Rights Reserved.

Page 21: A Multiple Pairs Shortest Path Algorithm 解説

Get_D_L(ti)

• 下三角行列への処理–下流への辺をもつグラフ–今度は s,t の間にあるノー

ド を使って triple comparison

s tk

Copyright (C) 2012 Denso IT Laboratory, Inc. All Rights Reserved.

Page 22: A Multiple Pairs Shortest Path Algorithm 解説

Min_add(si,ti)

• Get_D_U と Get_D_L 後– ri=max{si,ti}

– H([1,ri]) 中の最短経路が求まっている状態

• Min_add は xst*

を求めるための残りの走査を行う の最短路[ri+1,n] の triple comp

Copyright (C) 2012 Denso IT Laboratory, Inc. All Rights Reserved.

Page 23: A Multiple Pairs Shortest Path Algorithm 解説

• GL の最短経路は H([1,s]) の最短経路に一致 ,s>t

• GU の最短経路は H([1,t]) の最短経路に一致 ,s<t

Copyright (C) 2012 Denso IT Laboratory, Inc. All Rights Reserved.

Page 24: A Multiple Pairs Shortest Path Algorithm 解説

• Get_D_L(t) は H([1,s]) のすべての (s,t) ペアに関して最短路を与える s>t

• Get_D_U(t) は H([1,t]) のすべての (s,t) ペアに関して最短路を与える s<t

Copyright (C) 2012 Denso IT Laboratory, Inc. All Rights Reserved.

Page 25: A Multiple Pairs Shortest Path Algorithm 解説

• DLU は OD pair の最短路を計算する• Get_D は xij

* 、 succij

* を正しく求める

Copyright (C) 2012 Denso IT Laboratory, Inc. All Rights Reserved.

Page 26: A Multiple Pairs Shortest Path Algorithm 解説

DLU の注意点• 特徴–正しさは、 Triple comparison の順序に依存し、

パスのトレース順序には依存しない–それゆえ、 successor アップデートは行わな

くても機能する– Floyd-Warshall 法と似ている

Copyright (C) 2012 Denso IT Laboratory, Inc. All Rights Reserved.

Page 27: A Multiple Pairs Shortest Path Algorithm 解説

Trace もほしい場合• Get_P(s,t)– S から t に到達するまで最短路をたどってい

Copyright (C) 2012 Denso IT Laboratory, Inc. All Rights Reserved.

Page 28: A Multiple Pairs Shortest Path Algorithm 解説

計算複雑性• Triple comparison の回数• A_LU

• Get_D_U

• Get_D_L

• Min_add

Copyright (C) 2012 Denso IT Laboratory, Inc. All Rights Reserved.

Page 29: A Multiple Pairs Shortest Path Algorithm 解説

高速化テクニック• ワーストケース O(n3)–完全グラフに対する APSP– Floyd-Warshall, Carre Algorithm と同様– SSSP よりは良い

• 疎な無閉路グラフ–ノードの順序が性能に影響– Fill-in をいかに減らすか– Fill-in reduction は NP 完全だが、多くのテク

ニックが存在

Copyright (C) 2012 Denso IT Laboratory, Inc. All Rights Reserved.

Page 30: A Multiple Pairs Shortest Path Algorithm 解説

生来持っている高速性• OD ペアが s や t を共有する場合–重複を避けることができる

• OD ペアの経路途中のノード– Get_P では再利用できる

• MPSP に応用した場合、全ペアの計算を行わなくて良い–必要なODペアだけ探索する–他の” algebraic” なアルゴリズムでは全ペア計

Copyright (C) 2012 Denso IT Laboratory, Inc. All Rights Reserved.

Page 31: A Multiple Pairs Shortest Path Algorithm 解説

評価• 完全グラフの場合の机上検討– Triple comparison

• Floyd-warhsall に比べた性能向上

Floyd-Warshall (n-1)2(n-2)+(n-2)

Label-correcting SSSP O(n4)

DLU (2/3)n(n-1)(n-2)

Copyright (C) 2012 Denso IT Laboratory, Inc. All Rights Reserved.

Page 32: A Multiple Pairs Shortest Path Algorithm 解説

実装での比較• 複数の SSSP アルゴリズムと比較

Copyright (C) 2012 Denso IT Laboratory, Inc. All Rights Reserved.

Page 33: A Multiple Pairs Shortest Path Algorithm 解説

• SPGRID-SQ–自動生成されたグリッド型データ–正方形–最速版の 3-10倍

Copyright (C) 2012 Denso IT Laboratory, Inc. All Rights Reserved.

Page 34: A Multiple Pairs Shortest Path Algorithm 解説

• SPGRID-WL–自動生成されたグリッド型データ–長方形–最速版の 3-5倍

Copyright (C) 2012 Denso IT Laboratory, Inc. All Rights Reserved.

Page 35: A Multiple Pairs Shortest Path Algorithm 解説

• Flight Networks–ノード数 130-1000 、アーク数  700-8000– DLU が最速

Copyright (C) 2012 Denso IT Laboratory, Inc. All Rights Reserved.

Page 36: A Multiple Pairs Shortest Path Algorithm 解説

結果• 人工データでは性能が出ない

• 実データでは他のアルゴリズムを凌駕

Copyright (C) 2012 Denso IT Laboratory, Inc. All Rights Reserved.

Page 37: A Multiple Pairs Shortest Path Algorithm 解説

性能向上の指針• 性能は OD ペアの分布と順序による–分散していると非効率(それでも APSP よりは良い)

–ノードの順序が悪いー> fill-in 増加– Fill-in が増えると、 dense になり遅くなる

• 改良–右下よりにODが集まっていれば速く終わる– Reordering

• なるべくグループ化させて、 fill-in を発生させないようにする

Copyright (C) 2012 Denso IT Laboratory, Inc. All Rights Reserved.

Page 38: A Multiple Pairs Shortest Path Algorithm 解説

まとめ• 比較的単純なアルゴリズム– MPSP の厳密解が得られる

• 改良の余地–性能向上のための reorder が効く– LU 分解での各種テクニックが使える

• 動的なコストへの適用– DLU の初期のグラフ最適化は DLU のための最

適化であり、コストの変化に依存しない–→ 1度の高速化でOK

Copyright (C) 2012 Denso IT Laboratory, Inc. All Rights Reserved.