Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Dynamic Vehicle Routing のシミュレーションを Streamlitで作ってみた
Search
NearMeの技術発表資料です
PRO
March 15, 2024
Technology
270
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Dynamic Vehicle Routing のシミュレーションを Streamlitで作ってみた
NearMeの技術発表資料です
PRO
March 15, 2024
More Decks by NearMeの技術発表資料です
See All by NearMeの技術発表資料です
AIエージェントのための 隔離された安全なインフラ設計
nearme_tech
PRO
0
23
Claude Code × git worktree で並列開発 (続き) -差分のサービスだけを併設する-
nearme_tech
PRO
1
69
Claude Code × git worktree で並列開発 — サブモジュール構成のリポジトリで成立させる —
nearme_tech
PRO
0
79
LLM + 強化学習
nearme_tech
PRO
0
37
PosthogのA/Bテスト機能の紹介
nearme_tech
PRO
1
110
AIフレンドリーなプロダクトに向けて
nearme_tech
PRO
2
71
初めてのLean言語
nearme_tech
PRO
0
110
Apache Airflow Workflow orchestration without turning cron into spaghetti
nearme_tech
PRO
2
50
実務で役立つ幾何学 ボロノイ図の基礎から グラフ・ネットワーク応用まで
nearme_tech
PRO
1
93
Other Decks in Technology
See All in Technology
スプシの手作業からの解脱 ~更新はClaude Codeに、見せ方と使い方はGASアプリに任せる~
kentarofujii
0
160
hackers_champloo_2026_tidb
makocchi
0
170
「Docker Desktop不要の時代」は 来たのか?
ueponx
0
830
PagerDuty Tech Hub-鳴らすけれど、人は動かない
ezaki
0
180
AIがコードを書く時代に、エンジニアは何で自分の価値を証明するのか / In an era where AI writes code how do engineers prove their value
carta_engineering
3
1.1k
JAWS-UGグッズ職人仕事の流儀
kentapapa
0
120
フロントエンドカンファレンス関西2026 - 速すぎるUIに、待ち時間を
teamlab
PRO
0
190
ブラウザとサーバーから考えるAI時代のフロントエンド監視
shogo4131
3
1k
DevelopersIO 2026 知識の地図を描く ─ オントロジーとは何か?
ishikawa_satoru
1
1.7k
実践! SRE × AI - ABEMA における AIOps -
tetsuya28
8
3.1k
価値について
gree_tech
PRO
0
100
Optunaの最新リリースv5.0について
pfn
PRO
0
120
Featured
See All Featured
Building Flexible Design Systems
yeseniaperezcruz
330
41k
Product Roadmaps are Hard
iamctodd
55
13k
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
69
67k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
1.1k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.6k
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
360
エンジニアに許された特別な時間の終わり
watany
109
250k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
33
5.3k
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.5k
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
330
So, you think you're a good person
axbom
PRO
2
2.2k
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
2
1.6k
Transcript
0 Dynamic Vehicle Routing のシミュレーションを Streamlitで作ってみた 2024-03-15 第82回NearMe技術勉強会 Kenji Hosoda
1 • ⾃動運転キャッチアップしたいな ◦ 「Autoware :⾃動運転ソフトウェア⼊⾨」を読む ◦ 要素技術多すぎて、勉強会ネタとしてはまとめきれない。。 • 要素技術の⼀つであるROSにフォーカスするか
• ROSで複数⾞両のルーティングのシミュレーションやってるのないかな ◦ あった ▪ https://github.com/shineyruan/vehicle-routing-ros2?tab=readme-ov-file ◦ 元のPython実装もあった ▪ https://github.com/lb-robotics/python-vehicle-routing ◦ 元の論⽂もあった ▪ “Dynamic Vehicle Routing for Robotic Systems”(Bullo et al., 2011) ▪ https://stanfordasl.github.io/wp-content/papercite-data/pdf/Bullo.Fraz zoli.ea.IEEEProc11.pdf • ⾯⽩いのでやっぱりDynamic Vehicle Routingにフォーカス • こういうシミュレーション基盤も作りたかったな ◦ Streamlitでマルチスレッド処理できるかな? ◦ https://zenn.dev/ohtaman/articles/streamlit_start_stop ◦ いけそうなので作ってみるか (勉強会ネタのチョイスの紆余曲折)
2 Dynamic Vehicle Routingについて • 動的に変わる環境 ◦ 確率的に出現する注⽂/タスク • 複数⾞両/ロボットによるアサイン
◦ ⾃律的な最適化 ◦ 協調的なコントロール • ポリシーの違いによってパフォーマンスは⼤きく異なる • 協調的なコントロールは必須 • 注⽂の確率分布に応じて⾞両をバランスよく配置するこ とも重要 • 注⽂数/⾞両数のバランスの違いによってもパフォーマン スは異なる ◦ 注⽂数が多い時は、TSPが有効 https://github.com/lb-robotics/python-vehicle-routing
3 シミュレータ作ってみた こちらからダウンロードして実⾏ https://gist.github.com/kenji4569/8da401b4d1bbfe2b0b6be41ac6d3d1a2 以下のコマンドを実行 pip install streamlit numpy scipy
pandas altair readerwriterlock streamlit run app.py (wandb利用の場合は以下も実行 ) wandb login pip install wandb ブラウザでStreamlitアプリが立ち上がったら “Start”ボタンを押下
4 マルチスレッドについて class Vehicle(threading.Thread): def __init__(self, events: Events, location: Location,
**kwargs): super().__init__(**kwargs) self.done = threading.Event() ... def run(self): while not self.done.wait(0): time.sleep(TIME_STEP) self._move() class Timer(threading.Thread): def __init__(self, events: Events, **kwargs): super().__init__(**kwargs) self.done = threading.Event() ... def run(self): while not self.done.wait(0): time.sleep(TIME_STEP) self.elapsed_time += TIME_STEP • Timerのスレッド • Vehicle x nのスレッド 各スレッドが並列動く (Streamlitではグローバルにキャッシュでスレッドのオブジェクトを保持する必要あり) @st.cache_resource def get_root_manager(): return RootManager()
5 マルチスレッドの注意点 • ロック処理をしないとどうなるか def _move(self): diff = self.target_location -
self.location diff_norm = np.linalg.norm(diff) if diff_norm < self.pickup_threshold: self.location = self.target_location self._pickup_demand() else: movement = diff * (self.speed / diff_norm) self.location = self.location + TIME_STEP * movement def _pickup_demand(self): if not self.target_demand: return target_demand = self.target_demand with self.lock.gen_wlock(): if not target_demand.picked_up: target_demand.picked_up = True self.events.append( Event( "pickup_demand", {"demand_uid": target_demand.uid, "vehicle_uid": self.uid}, ) ) ここでロック ロックしないとこの値が 書き変わる可能性がある ピックアップイベントが 複数回記録される可能性がある 距離が近くなったら ピックアップ
6 イベントの記録 • グローバルなイベントを記録 ◦ (ROSのrosbagに倣った) • イベントを集計 • 時系列のメトリクスを算出
◦ Streamlitで表⽰ • WandBに連携 ◦ strategy毎の⽐較がしやすい ◦ 右図が⼀例
7 Thank you