Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Model Building in Mathematical Programming #1
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Shuhei Fujiwara
April 26, 2020
Technology
0
140
Model Building in Mathematical Programming #1
Shuhei Fujiwara
April 26, 2020
Tweet
Share
More Decks by Shuhei Fujiwara
See All by Shuhei Fujiwara
数理最適化を知ろう
shuheif
2
1.4k
Model Building in Mathematical Programming #2
shuheif
0
80
Nesterov #2
shuheif
0
84
TensorFlow Docs Translation Proofreading
shuheif
0
920
Nesterov
shuheif
2
190
tbf07-seat-optim.pdf
shuheif
1
9.9k
AdaNet
shuheif
1
420
Google Cloud Next Extended 2019 ML Day
shuheif
4
1.2k
TensorFlow Docs Translation JA
shuheif
1
990
Other Decks in Technology
See All in Technology
進化するBits AI SREと私と組織
nulabinc
PRO
1
250
モジュラモノリス導入から4年間の総括:アーキテクチャと組織の相互作用について / Architecture and Organizational Interaction
nazonohito51
1
350
今のWordPress の制作手法ってなにがあんねん?(改) / What’s the Deal with WordPress Development These Days?
tbshiki
0
510
Claude Code 2026年 最新アップデート
oikon48
14
11k
Agent ServerはWeb Serverではない。ADKで考えるAgentOps
akiratameto
0
120
AlloyDB 奮闘記
hatappi
0
150
S3はフラットである –AWS公式SDKにも存在した、 署名付きURLにおけるパストラバーサル脆弱性– / JAWS DAYS 2026
flatt_security
0
1.8k
Postman v12 で変わる API開発ワークフロー (Postman v12 アップデート) / New API development workflow with Postman v12
yokawasa
0
140
PMとしての意思決定とAI活用状況について
lycorptech_jp
PRO
0
140
詳解 強化学習 / In-depth Guide to Reinforcement Learning
prinlab
0
290
AI実装による「レビューボトルネック」を解消する仕様駆動開発(SDD)/ ai-sdd-review-bottleneck
rakus_dev
0
160
Zero Data Loss Autonomous Recovery Service サービス概要
oracle4engineer
PRO
2
13k
Featured
See All Featured
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.6k
Game over? The fight for quality and originality in the time of robots
wayneb77
1
140
How to make the Groovebox
asonas
2
2k
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
エンジニアに許された特別な時間の終わり
watany
106
240k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
3.4k
Building Flexible Design Systems
yeseniaperezcruz
330
40k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
Into the Great Unknown - MozCon
thekraken
40
2.3k
Context Engineering - Making Every Token Count
addyosmani
9
760
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
200
Automating Front-end Workflow
addyosmani
1370
200k
Transcript
Model Building in Mathematical Programming #1 @shuhei_fujiwara
今日の範囲 Chapter 1 • 線形計画の簡単な例 Chapter 2 • 最適化のパッケージ(ソフトウェア)に関する話など Part
2: Section 12.1 • Chapter 1 の例に近い問題
Chapter 1
Section 1.1: The concept of a model 読み物なのでほぼ skip •
“model” という言葉の使い方について ◦ 最適化の文脈では抽象的な定式化などを指す • モデルを作る利点について ◦ 分析や意思決定だけでなく課題への理解が深まる利点もある など
Example 1.1: Product Mix Product 1~5 を生産すると得られる利益: 各 product の生産に必要な工程:
PROD 1 PROD 2 PROD 3 PROD 4 PROD 5 £550 £600 £350 £400 £200 PROD 1 PROD 2 PROD 3 PROD 4 PROD 5 Grinding 12 20 - 25 15 Drilling 10 8 16 - -
Objective function x1 ~ x5: product 1 ~ 5 の生産量
max 550 x1 + 600 x2 + 350 x3 + 400 x4 + 200 x5 • 利益 × 生産量 の総和 • いくつかの制約下でこれを最大化するのが目標
Constraints: grinding, drilling 12 x1 + 20 x2 + 25
x4 + 15 x5 ≦ 288 • Grinding 作業の機械が 1 週間に 96 時間まで稼働できる ◦ 今回は 3 週間の計画なので 96 × 3 = 288 が上限 10 x1 + 8 x2 + 16 x3 ≦ 192 • 同様に Drilling の機械は 192 時間まで稼働できる
Constraints: assembly, not negative quantities 20 x1 + 20 x2
+ 20 x3 + 20 x4 + 20 x5 ≦ 384 • Product 共通の最終組み立て工程があって 20 時間かかる • この機械は 8 台あって 48 時間ずつ稼働できる ◦ 合計で 48 × 8 = 384 時間 x1, x2, x3, x4, x5 ≧ 0 • 当たり前だが各 product の生産量は負の値にはできない
Formulation 以下を達成する x1 ~ x5 を求めれば良い: max 550 x1 +
600 x2 + 350 x3 + 400 x4 + 200 x5 s.t. 12 x1 + 20 x2 + 25 x4 + 15 x5 ≦ 288 10 x1 + 8 x2 + 16 x3 ≦ 192 20 x1 + 20 x2 + 20 x3 + 20 x4 + 20 x5 ≦ 384 x1, x2, x3, x4, x5 ≧ 0
補足 • 今回の例は目的関数も制約も全て線形 ◦ Linear Programming (LP) というクラスの問題 ◦ 制約は
≦ だけでなく ≦ や = を使って定義しても良い • 変数 x1 ~ x5 は 2.36 のような整数以外の値でも大丈夫? ◦ ビールを何ガロン生産するかみたいな問題なら OK ◦ 車を何台生産するかというような問題だとマズい ◦ 変数 x1 ~ x5 が整数の場合は Integer Programmin (IP)
Example 1.2: Blending 次の表の油を混ぜて作った商品を販売したい: • 1 トンあたり £150 で販売する •
混ぜると硬度は線形に変化する ◦ VEG 1 と OIL 3 を半々で混ぜると 0.5 × 8.8 + 0.5 × 5 = 0.69 ◦ 低すぎても高すぎても良くない VEG 1 VEG 2 OIL 1 OIL 2 OIL 3 Cost £110 £120 £130 £110 £115 Hardness 8.8 6.1 2.0 4.2 5.0
Objective function x1 ~ x5: VEG 1 ~2, OIL 1
~ 3 の生産量 y: 混ぜて作った油の量 max 150 y - 110 x1 - 120 x2 - 130 x3 - 110 x4 - 115 x5 s.t. y = x1 + x2 + x3 + x4 + x5
Constraints: hardness 8.8 x1 + 6.1 x2 + 2 x3
+ 4.2 x4 + 5 x5 ≦ 6 y 8.8 x1 + 6.1 x2 + 2 x3 + 4.2 x4 + 5 x5 ≧ 3 y • 最終的な硬度は 3 ~ 6 でなければならない
Constraints: capacities x1 + x2 ≦ 200 x3 + x4
+ x5 ≦ 250 • VEG は合わせて 200 までしか生産できない • OIL は合わせて 250 までしか生産できない
Formulation max 150 y - 110 x1 - 120 x2
- 130 x3 - 110 x4 - 115 x5 s.t. y = x1 + x2 + x3 + x4 + x5 x1 + x2 ≦ 200 x3 + x4 + x5 ≦ 250 8.8 x1 + 6.1 x2 + 2 x3 + 4.2 x4 + 5 x5 ≦ 6 y 8.8 x1 + 6.1 x2 + 2 x3 + 4.2 x4 + 5 x5 ≧ 3 y x1, x2, x3, x4, x5 ≧ 0
まとめ • 色々な問題を Linear Programming (LP) として表現することができる ◦ LP はコンピュータで効率的に解けることが知られている
• 変数が整数値という制約が付くものは Integer Programming (IP) ◦ IP は LP と比べて非常に難しい ◦ Chapter 8 ~ 10 で紹介 • 線形でないものは Non-Linear Programming (NLP) ◦ これは Chapter 7 で紹介
Chapter 2
2.1 Algorithms and packages 最適化では解決したい課題を LP のような問題に落とし、実際にその解を求める部分は 既存のソフトウェア (packages) に任せるのが王道
• 既存のソフトウェアは非常に時間をかけて作り込まれており高機能 • 自前で実装するのは大変 この section ではよくある機能の例を紹介
Reduction • 問題を解く前に冗長な部分を削除してくれる • REDUCE, PRESOLVE, ANALYSE といった名前の機能 • 詳しくは
section 3.4
Starting solutions • 初期解を与えることができる • 最適解に近いものを渡せば計算時間を大幅に 減らすことができる
Constraints いくつかの単純な制約は簡単に書けるように設計されている Simple bounding constraints: • L ≦ x ≦
U Ranged constraints: • Σ aj xj ≦ b1 and Σ aj xj ≧ b2 Generalized upper bounding constraints: • x1 + x2 + … + xn ≦ M
Sensitivity analysis • 目的関数や制約式の定数などが変わったときに 解がどう変化するかを分析することができる • 感度分析という有名な話で詳しくは Section 6.3
2.2 Practical considerations ちょっとした tips など • 入力の形式の例 • 結果を保存する機能を活用すると良い
◦ 少し数値を変えた問題を解く時の初期解として有用 ◦ 途中で計算を止めて再開したいケースもある
2.3 Decision support and expert systems • 最適化の応用は decision support
system や expert system と近い • ユーザーにはアルゴリズムやモデリングを意識させること無く 適切な意思決定をできるようなインターフェースも重要
Constraint programming (CP) IP とは別に制約充足問題という文脈で研究されている手法もある • 解きたい問題はだいたい同じだったりする • IP の流儀とは制約の表現の仕方が違ったりする
• CP の流儀の方がきれいに書き表せるケースも有る 開発されているアルゴリズムにも差がある • CP の方が少ない実行可能解を見つけるのは得意だが、巡回セールスマン問題の ような大量の実行可能解から最適なものを見つけるのは苦手
Chapter 12
12.1: Food manufacture 1 • 次回までの宿題 ◦ 時間が余ったら今日議論 • Example
1.2 と同じような問題設定