SlideShare a Scribd company logo
1 of 25
Download to read offline
メタヒューリスティクスと巡回セールスマン問題
2013/7/12
2
実験の目的
●
巡回セールスマン問題を解く
– プログラムの作成
– 複数の手法の比較
– 問題についての考察
●
レポートや発表の方法を学ぶ
3
研究計画
●
4月から6月終わりまで
– 厳密算法とヒューリスティックの実装
●
それ以降
– レポートの作成
4
研究計画
●
4月から6月終わりまで
– 厳密算法とヒューリスティックの実装
●
それ以降
– レポートの作成
_人人人人 人人人人_
> 突然のHDD死亡 <
 ̄Y^Y^Y^YY^Y^Y^ ̄
5
研究計画(再)
なんとかする
バックアップはこまめに
6
実験の手法
●
定性的な理解
– 山本芳嗣・久保幹雄(1997)“巡回セールスマン 
問題への招待”を読む
●
計算による理解
– 与えられた実験キットの形式にそって実装
– TSPlibのbayg29とtestDataTspを入力とした十回の 
実行結果の平均を取り、実行時間、経路長を比べる
注:以降、都市数をn、巡回セールスマン問題をTSP
近似解のコストをA、最適解のコストをOPTと略すことがある
8
実装した4つの手法
●
厳密算法
– 列挙法
– 動的計画法・Dynamic Programming(DP)
●
ヒューリスティック
– 2-opt
– 焼きなまし法
9
手法の説明 1/3 厳密算法
●
列挙法
– すべての解を列挙する
– オーダーはO(n!)
– もちろん、現実的でない
●
DP
– オーダーはO(n^2*2^n)
– これもあまり現実的でない
10
手法の説明 2/3 2-opt
●
2-opt(λ=2-opt)
– フリップ操作(後述)による近傍を用いた局所探索
– λ-opt算法においてn>=8でλ<=n/4であれば近似解
のコストAと最適解のコストOPTは次の等式を満たす
– 実装ではフリップの初期点をランダムにn個の点から
選んでいるため解はn通りとなり、決定的なプログラ
ムではなくなっている
A
OPT
=2−
2
n
11
手法の説明 3/3 焼きなまし法
●
焼きなまし法
– 温度Tというパラメタを用い、局所最適解に陥りにく
いようにした2-opt
– 周知の問題:パラメタチューニングが難しい
●
今回のプログラムではパラメタは「最初の温度
T」、「冷却速度T_FACTOR」、「計算を終える温
度T_END」、「近傍を探索する速度SIZE」の4つ
12
フリップ操作
● ABCDは経路の中の一つの都市を示し、AとC、BとDの間には複数
の都市が存在してもよいが、AとD,BとCの間にはひとつの都市も存
在しない
● 列挙法における近傍は経路の順が一つだけ入れ替わっているもの
であり、異なる
Fig.1 フリップ操作の模式図
13
緩和問題
●
緩和問題(条件を減らした問題)の最適解は元の問題の
最適解よりよい
– うまい解空間の拡張と縮小が肝心
●
解きやすい緩和問題から出てきた不完全な解に、
足りない条件を足して、うまくいったらそれを解
にすることで計算量を減らす
14
解空間の性質
●
解空間の性質は問題に強く依存する
– ただし、性質の定義にも依存することに注意
●
2-optでの近傍と列挙法を局所探索として考えた場
合の近傍は明らかに違う
●
近傍の定義により解空間内での位置関係が変わる
15
実験結果 1/3 testDataTspの結果
列挙法 DP 2-opt 焼きなまし法
平均経路長 736 736 803.2 740.6
実行時間
(milisec)
0.1243 0.0777 0.0236 0.3309
●
焼きなまし法のパラメタT_START1000、ある時刻の温度Tと一単位ステップ時間後の
温度T'の関係はT' = T_FACTOR*T = 0.95Tで表され、T_END = 1、SIZE = 1である
●
都市数はn=7、最短経路長は736
Table.1 testDataTspの実行結果
16
実験結果 2/3 bayg29の結果
●
焼きなまし法のパラメタは同じ 
●
都市数はn=29、最短経路長は1610
2-opt 焼きなまし法
平均経路長 15346.3 10203.2
実行時間(millisec) 0.2134 13.0031
最短距離(十回のうちで) 9307 9131
Table.2 bayg29の実行結果
17
実験結果 3/3 解のヒストグラム
●
testDataTspの解について、50刻みで、500から1500
の経路長のなかで、ある経路長を持つ経路が何通りある
かを表すヒストグラム
●
解は合わせて                   
720通り
500
550
600
650
700
750
800
850
900
950
1000
1050
1100
1150
1200
1250
1300
1350
1400
1450
1500
0
20
40
60
80
100
120
140
160
Fig.2 解空間のヒストグラム
経路長
経路の数
18
考察 1/6 厳密算法とtwo-opt法
●
列挙法とDPはtestDataTspしか計算していない
– 列挙法は速度の問題
– DPも速度の問題がある(今回はC言語のインデックスの最大値の
問題があったが本質的なものではない)
●
2-optは定性的な性質を満たすように見える
– testDataTspでは非常に良い経路長が出る
● A/OPT 1.091≒
– bayg29ではあまり良くない
● A/OPT 9.532 > 2-2/n 1.931 (n=29)≒ ≒
19
考察 2/6 2-optと焼きなまし法
●
2-optなどの局所探索は局所最適解に陥ることがある
– 最適解を得るには近傍の適切な定義、初期解の改善が必要
– 解空間すべてを網羅することはまずない
●
経路長が短くなる方向にしか動かないため
●
解空間に局所最適解が存在するため
●
そもそも網羅してしまったら近似算法の意味がない
●
焼きなまし法は2-opt法とくらべて局所最適解で終わることは減るは
ず
– 解空間をよりうまく探索できる
20
考察 3/6 解の改善
●
近似算法は、解空間に何らかの性質(局所最適解が存在
する、あるいは少ないなど)があり、その性質を用いて
解を改善することが目的
→ 必要なら緩和問題を使ってうまい性質を引っ張り
だす
●
そもそも改善があまり               
見込めない問題は?
500
550
600
650
700
750
800
850
900
950
1000
1050
1100
1150
1200
1250
1300
1350
1400
1450
1500
0
20
40
60
80
100
120
140
160
再掲 Fig.2 解空間のヒストグラム
経路長
経路の数
21
考察 4/6 解が改善できないTSP
●
最適解の経路長=初期(可能)解の経路長である(改善が全
く不可能な)TSPは存在するか?
→ある
22
考察 5/6 ハミルトン閉路とTSP
●
ハミルトン閉路問題:すべての点をちょうど一回だけ通っ
て元に戻る経路が存在するか?
– グラフ上で辺が存在するときに0、ないときに1という
距離をとればTSPとみることができ、解いた結果が0
であればこれはハミルトン閉路を持つ
●
ハミルトン閉路が存在するグラフをTSPと見る
と、明らかに最適解および可能な解の経路長は固
定である
23
考察 6/6 グラフから見た改善性
●
ユークリッドTSPの頂点と辺の作るグラフは完全グラフである
– 完全グラフでないTSPは(直感的に)改善がしにくそうだが
解空間も小さくなる
●
完全グラフ:任意の2頂点間に辺が存在
●
グラフの辺の多さが解の改善性を操作する?
– 多ければ解も多く、改善しやすい・しなければならない
– 少なければ解は少なく、改善しにくい・しなくてよい
24
まとめ
●
近似算法に必要なのは、解空間内での探索手法と解空間
自体の操作
– 例えば焼きなまし法はパラメタにより解空間を広げて
いるといってもよい
●
経路長が改善不可能なTSPの存在が示せる
– 例えばハミルトン閉路を持つグラフ
25
気になること・知らないこと
●
局所探索において、フリップ以外の近傍をとるとどの程度
効率が変わるか?
●
解空間の拡張と縮小になんらかの戦略は存在するか?
– どの程度拡張して、どの程度縮小すればよいか?
●
解のヒストグラムの分布を形式化することはできないだろ
うか?=解空間の性質を一元して扱える構造はないか?
– TSPは独立性システム、最小全域木はマトロイド
– もっといい構造はないか?
26
感想
●
アクシデントもあったが、当初の目的は達成できた
– TSPの理解
– スライド・レポートの作成、発表の練習
●
解空間に関する考察は直感が多いのでより精緻にする必
要があると思うがTSPと様々な分野(計算量やグラフな
ど)の関連が存在することが実感できた。いろいろな道
具で考えることは面白かった

More Related Content

Featured

PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...DevGAMM Conference
 

Featured (20)

Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 

Tsp