SlideShare a Scribd company logo
1 of 17
Download to read offline
~艦これ航空戦におけるスロット毎の相互関係が引き起こす
悲劇について研究と考察~
基地航空隊 vs 敵艦隊
自艦隊 vs 敵艦隊
制空権争い(St1-1)
触接(St1-2)
対空砲火(St2)
航空攻撃(St3)
艦これの航空戦
計算可能
各ステップに乱数が絡む
• 複数の一様乱数(それぞれの範囲は小さい)
• ただの一様乱数なので標準ライブラリで実装しやすい
乱数と言えばモンテカルロ法
• 思考停止では?⇔他の良い手法が見つかっていなかった
• 試行回数を稼ぐには工夫が必要⇔少ない試行回数でも実用に足りる?
それっぽい解が簡単に出せる
• 質は保証されない⇔実際に戦闘するより遥かに楽
• 解の質よりUI設計の方が重要?
各スロットを「搭載数の確率分布」と考える
• St1撃墜・St2撃墜を確率分布に対する演算だと考える
• 乱数を使っていないので乱数起因の誤差は発生しない
搭載数の分布を制空値の分布に変換
• 制空値の分布同士を畳み込めば制空値の分布が出せる
• 確率分布は連想配列でも使えば簡単に実装できる
モンテカルロより ずっと はやい!!
• C++で比較すると3008[us] vs 223[us] //反復回数1万回の場合
• 誤差がないのに速いのは最高のアルゴリズムだと思わんかね?
画像出典:http://nico.ms/im5423845 画:龍太郎さん
錯厳そ
覚密れ
し解で
てが
い出
たる
?と
分布畳み込みでは誤差が
生じるケースが無数にあ
ることが分かった
ラフな計算ならともかく
厳密解を求めたいのに
これでは困る
発見されたケースや実験
結果などは次以降の
スライドで説明します
 (敵の)スロット毎の初期搭載数と装備対空値はこんな感じ
 ↑にぶつける基地航空隊はこんな感じ
 かなり作為的な設定だが、説明の為ご了承ください。目標としては
「制空権喪失だと稀に搭載数が(10,10)になり、航空劣勢に変化」すること
初期搭載数 装備対空値 初期制空値 合計制空値
11 20 66 132
11 20 66 132
攻撃順 攻撃回数 制空値
1 分散(1) 0
2 分散(1) 43
(11, 11)
(11, 11) (11, 10) (10, 11) (10, 10)
最初の制空争いでは必ず制空権喪失になる。なので撃墜数は
11機スロ相手だと0 or 1機で、1機落とす確率は25%。
各スロットごとに判定があるので、それぞれの遷移確率は
56.25%・18.75%・18.75%・6.25%となる
制空値132
制空値132 制空値129 制空値129 制空値126
(10, 10) (10, 9) (10, 8) (6, 6)
制空値126 制空値123 制空値119 制空値96
・・・・・
次の制空争いでは、スロットが(10,10)だったときだけ
航空劣勢になり、それ以外は制空権喪失にな
る。
すると、(10,10)ならこうして(6,6)までの可能性が
あるが……(次のページに続く)
(11, 11)
(11, 11) (11, 10) (10, 11) (10, 10)
制空値132
制空値132 制空値129 制空値129 制空値126
(10, 11) (10, 10) (9, 11) (9, 10)
制空値129 制空値126 制空値126 制空値123
例えば(10,11)なら次の4通りの可能性しかない。
このことから、2回St1撃墜を経た後の搭載数には
(11,8)など一部のパターンが存在しない。そこから
制空値を計算して分布を数えると、例えば
制空値114・118・122にはなりえないことが分かる。
幅優先探索 6 7 8 9 10 11
6 0.0% 0.0% 0.1% 0.1% 0.0%
7 0.0% 0.2% 0.3% 0.3% 0.2%
8 0.1% 0.3% 0.6% 0.6% 0.3%
9 0.1% 0.3% 0.6% 0.6% 1.5% 3.5%
10 0.0% 0.2% 0.3% 1.5% 10.7% 21.1%
11 3.5% 21.1% 31.6%
畳み込み 6 7 8 9 10 11
6 0.0% 0.0% 0.0% 0.0% 0.1% 0.1%
7 0.0% 0.0% 0.0% 0.1% 0.3% 0.6%
8 0.0% 0.0% 0.0% 0.1% 0.7% 1.1%
9 0.0% 0.1% 0.1% 0.4% 2.3% 3.8%
10 0.1% 0.3% 0.7% 2.3% 11.4% 19.0%
11 0.1% 0.6% 1.1% 3.8% 19.0% 31.6%
左図における「畳み込み」が
提案法、「幅優先探索」があら
ゆるスロット配置を記憶して
計算した新たな「厳密解」
幅優先探索の結果はモンテカル
ロ法によるものと概ね一致する
が、畳込みの方はそうではない
↑はモンテカルロ法の精度に
問題がある……と当初は考えて
いたが、こうして見比べると
むしろ、畳込みの回の質に問題
があると言わざるをえない
明らかに、分布畳み込み(=「畳み込み」、「提案法」)だけ
計算結果が他と異なっていることが分かる
0.000001
0.00001
0.0001
0.001
0.01
0.1
1
95 100 105 110 115 120 125 130 135
制空値とその確率
モンテカルロ法
幅優先探索
分布畳み込み
グラフだと少し分かりにくいが、「モンテカルロ法」は
「幅優先探索」とグラフがほぼ重なっているので読みづらく
なっている
1E-10
1E-09
1E-08
0.0000001
0.000001
0.00001
0.0001
0.001
0.01
0.1
1
65 75 85 95 105 115 125 135
制空値とその確率
モンテカルロ法
幅優先探索
分布畳み込み
 敵艦は36機スロが3つ、それぞ
れに制空値12・5・5の艦戦を
装備していた
 こちらは、制空値153および
33の基地航空隊を用意し、敵
艦にぶつけた
 前ページも同様だが、モンテ
カルロ法の試行回数は100万回
とした
幅優先探索は確かに完璧だが、計算コストが掛かりすぎる
(計算時間が指数的に増加するため)
畳み込みはモンテカルロ法よりも速く計算できるが誤差あり
(制空状況が変化しない際にはまあまあ有効)
モンテカルロ法はベタながら速さと精度の妥協案だと確認
(畳み込みが精度で上回れない以上、現状これしかない)
次以降はモンテカルロ法の高速化について触れます
「細かい効率のことは忘れて、時間の97%について考えよう。
時期尚早な最適化は諸悪の根源だ。それでも残り3%についても
機会を逃すべきではない」 - Donald Ervin Knuth
しかし、モンテカルロ法を高速化することは、ユーザー(提督)
にストレスを与えず試行回数を稼げるので非常に重要
また、保守性が高い良いコードを書いた後なら、最適化を行っ
ても「諸悪の根源」になりえないと思われる
「私が一番? やっぱり? そうよね! だって速いもん! 」
- Japanese destroyer Shimakaze
Knuth先生の金言にもある通り「時間の97%」について考える
必要があるが、そのために一番手っ取り早いのは計算時間を
測定することである
特に、Visual Studio等で利用できるプロファイリング機能は、
「どの関数やどの処理が高コストか」を分かりやす
く示してくれる。高コストな部分にだけ集中して最適化を施す
ことで、効率よくアプリケーションを高速化することができる
制空値を計算する際は、搭載数や装備の対空値だけで
なく、「装備改修度」や「艦載機熟練度」による影響
を考慮する必要がある
しかし、シミュレーション中は搭載数以外の値は変化
しない。つまり「装備改修度合いを反映した対空値」
や、「艦載機熟練度による制空ボーナス」などは
事前に計算できる
ゆえに、制空計算時に配列等で用意したそれらを読み
込むことで、無駄な計算を避けることができる
St1撃墜の際は、(厳密に言うと)2つの整数一様乱数を参
照し、撃墜量を複雑な計算で求める必要がある
しかしながら、事前計算による最適化を突き進めれば
1つの整数一様乱数と1回のテーブル引きで、St1撃墜の
計算を行うことができる
整数一様乱数を計算する処理は(マトモな質のものなら)
そこそこ高価なので、大幅に高速化することができた
ちなみに.NET標準の乱数アルゴリズムはアレなので、
別途外部ライブラリからメルセンヌ・ツイスタを使用
するように自作ツールでは対処している
単純な分布畳み込みでは厳密解を出すことはできない
(場合分けなどで対処できそうだが発展途上)
たぶんモンテカルロ法を極めた方が楽に要件を満たせる
モンテカルロ法には速度チューニングというこだわり要素が
あり、実アプリではプロファイラーなどを使って極めた
基地航空隊をシミュレーションするソフト「航空戦シミュ
レーター改(AWSK)」は次のURLから配布しています
https://github.com/YSRKEN/AWSK/releases/

More Related Content

Featured

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
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
 

Featured (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
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...
 

「畳み込み」が無敵だといつから錯覚していた?~艦これ航空戦におけるスロット毎の相互関係が引き起こす悲劇について研究と考察~