-
Notifications
You must be signed in to change notification settings - Fork 12
最大流問題や最小カット問題などについて記事を足す #140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: gh-pages
Are you sure you want to change the base?
Changes from 6 commits
830c6ed
8e7647e
939b6c8
72a04da
a7b0dfa
e238ccd
0bebc77
0cf9a30
7864a12
04a9665
7b593e3
f84a44b
a8a1488
ec17ece
0f45a6e
f391590
d6e4a1d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
--- | ||
layout: entry | ||
changelog: | ||
- summary: 記事作成 | ||
authors: kimiyuki | ||
reviewers: | ||
date: 2021-04-01T00:00:00+09:00 | ||
algorithm: | ||
input: | ||
output: | ||
time_complexity: | ||
space_complexity: | ||
aliases: ["最大フロー問題", "maximum flow problem"] | ||
level: blue | ||
description: > | ||
最大流問題とは、与えられたネットワークのフローであって流量が最大のものを求めるという問題。 | ||
最大流最小カット定理によって最大流問題の解の流量は最小カット問題の解の容量に等しい。 | ||
--- | ||
|
||
# 最大流問題 | ||
|
||
## 概要 | ||
|
||
最大流問題とは、与えられたネットワークのフローであって流量が最大のものを求めるという問題である。 | ||
最大流最小カット定理によって最大流問題の解の流量は[最小カット問題](/minimum-cut-problem)の解の容量に等しい。 | ||
|
||
|
||
|
||
## 詳細 | ||
|
||
(省略) | ||
|
||
|
||
## その他 | ||
|
||
- フローの定義では「始点から終点へと向かうフローと無関係な位置の閉路状のフローがないこと」は要求されていない。最大流を求めるアルゴリズムはこのような閉路状のフローを含む出力をすることがあるので注意が必要である。なお、最大流問題の解から流量を変えずにこのような閉路状のフローを取り除くことは常に可能である。 | ||
|
||
|
||
## 関連項目 | ||
|
||
- [最小カット問題](/minimum-cut-problem) | ||
- 最大流最小カット定理によって最大流問題の解の流量は最小カット問題の解の容量に等しい。 | ||
- [Dinic 法](/dinic) | ||
- Dinic 法は最大流問題を解くアルゴリズムである。最悪計算量は $O(\lvert V \rvert^2 \cdot \lvert E \rvert)$ だが実用的にはかなり速い。 | ||
|
||
- [Ford-Fulkerson 法](/ford-fulkerson) | ||
- Ford-Fulkerson 法は最大流問題を $O(F \cdot \lvert E \rvert)$ で解く代表的なアルゴリズムである。 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
--- | ||
layout: entry | ||
changelog: | ||
- summary: 記事作成 | ||
authors: kimiyuki | ||
reviewers: | ||
date: 2021-04-01T00:00:00+09:00 | ||
algorithm: | ||
input: | ||
output: | ||
time_complexity: | ||
space_complexity: | ||
aliases: ["minimum cut problem"] | ||
level: blue | ||
description: > | ||
最小カット問題とは、与えられたネットワークのカットであって容量が最小のものを求めるという問題。 | ||
最大流最小カット定理によって最小カット問題の解の容量は最大流問題の解の流量に等しい。 | ||
--- | ||
|
||
# 最小カット問題 | ||
|
||
## 概要 | ||
|
||
最小カット問題とは、与えられたネットワークのカットであって容量が最小のものを求めるという問題である。 | ||
最大流最小カット定理によって最小カット問題の解の容量は[最大流問題](/maximum-flow-problem)の解の流量に等しい。 | ||
|
||
|
||
## 詳細 | ||
|
||
(省略) | ||
|
||
|
||
## その他 | ||
|
||
- $s$-$t$ カットは、有向辺の部分集合 $C \subseteq E$ であってどの $s$-$t$ パスも $C$ に含まれるような有向辺を含むものとして定義される場合[^cut-set-of-edges]と、頂点の部分集合 $A \subseteq V$ であって $s \in A$ かつ $t \in V \setminus A$ なものとして定義される場合[^cut-set-of-vertices]とがある。カットの容量は、前者の定義の場合は $C$ に含まれる有向辺の重みの総和として定義され、後者の定義の場合は始点が $A$ に含まれる終点 $V \setminus A$ に含まれるような有向辺の重みの総和として定義される。最小カット問題を考える際にはどちらの定義を用いても解の容量は同じであるが、前者の定義のカットと後者の定義のカットは厳密には一致しない。両者を区別したいときには、前者を $s$-$t$ 非連結化集合 ($s$-$t$ disconnecting) と呼び後者のみを $s$-$t$ カットと呼ぶことがある[^s-t-disconnecting]。 | ||
|
||
|
||
## 関連項目 | ||
|
||
- [最大流問題](/maximum-flow-problem) | ||
- 最大流最小カット定理によって最小カット問題の解の容量は最大流問題の解の流量に等しい。 | ||
- [燃やす埋める問題](/moyasu-umeru-mondai) | ||
- 燃やす埋める問題は最小カット問題へと帰着できる。 | ||
- [project selection problem](/project selection problem) | ||
- project selection problem は最小カット問題へと帰着できる。 | ||
|
||
|
||
## 外部リンク | ||
|
||
- [最小カットについて - よすぽの日記](https://yosupo.hatenablog.com/entry/2015/03/31/134336)<sup>[archive.org](https://web.archive.org/web/20210401023012/https://yosupo.hatenablog.com/entry/2015/03/31/134336)</sup> | ||
- <a class="handle">yosupo</a> によるブログ記事。最小カット問題はグラフの $2$ 彩色だと思うとよいことが説明されている。 | ||
- [最小カット問題と充足最大化問題 - うさぎ小屋](https://kimiyuki.net/blog/2020/03/07/minimum-cut-and-maximum-satisfiability/)<sup>[archive.org](https://web.archive.org/web/20210401023109/https://kimiyuki.net/blog/2020/03/07/minimum-cut-and-maximum-satisfiability/)</sup> | ||
- <a class="handle">kimiyuki</a> によるブログ記事。最小カット問題は $\bigvee\mkern-12.5mu\bigvee _ i p_i \to \bigwedge\mkern-12.5mu\bigwedge _ j q_j$ の形の論理式たちの充足最大化問題と見ることができると主張している。 | ||
- [燃やす埋める問題と劣モジュラ関数のグラフ表現可能性 その① - 私と理論](https://theory-and-me.hatenablog.com/entry/2020/03/13/180935)<sup>[archive.org](https://web.archive.org/web/20210401023205/https://theory-and-me.hatenablog.com/entry/2020/03/13/180935)</sup>, [燃やす埋める問題と劣モジュラ関数のグラフ表現可能性 その② グラフ構築編 - 私と理論](https://theory-and-me.hatenablog.com/entry/2020/03/17/180157)<sup>[archive.org](https://web.archive.org/web/20210401023147/https://theory-and-me.hatenablog.com/entry/2020/03/17/180157)</sup> | ||
- <a class="handle">theory_and_me</a> によるブログ記事。$3$ 変数までの劣モジュラ関数の和 $\sum_i \theta_i(x_i) + \sum _ {i \lt j} \phi _ {i, j} (x_i, x_j) + \sum _ {i \lt j \lt k} \psi _ {i, j, k} (x_i, x_j, x_k)$ で表される関数の最小化問題は最小カット問題に帰着できることを説明している。 | ||
- [燃やす埋める問題を完全に理解した話 - koyumeishiのブログ](https://koyumeishi.hatenablog.com/entry/2021/01/14/052223)<sup>[archive.org](https://web.archive.org/web/20210401023419/https://koyumeishi.hatenablog.com/entry/2021/01/14/052223)</sup> | ||
- <a class="handle">koyumeishi</a> によるブログ記事。$2$ 変数間の制約からグラフ表現可能な劣モジュラ関数を自動導出するライブラリを提案している。 | ||
|
||
|
||
## 注釈 | ||
|
||
[^moyasu-umeru-local-name]: 競技プログラミングのコミュニティ外では通用しない名前であることに注意したい。 | ||
[^cut-set-of-edges]: たとえば R. J. ウィルソン. グラフ理論入門. 近代科学社, 2001, [ISBN978-4-76-490296-1](https://iss.ndl.go.jp/api/openurl?isbn=9784764902961). | ||
[^cut-set-of-vertices]: たとえば R. Diestel, [Graph Theory](https://www.springer.com/jp/book/9783662536216), 5th ed. Berlin Heidelberg: Springer-Verlag, 2017. | ||
[^s-t-disconnecting]: たとえば Schrijver, A. [Combinatorial Optimization: Polyhedra and Efficiency](https://www.springer.com/jp/book/9783540443896), Springer Science & Business Media, 2003. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
--- | ||
layout: entry | ||
changelog: | ||
- summary: 記事作成 | ||
authors: kimiyuki | ||
reviewers: | ||
date: 2021-04-01T00:00:00+09:00 | ||
algorithm: | ||
input: | ||
output: | ||
time_complexity: | ||
space_complexity: | ||
aliases: | ||
level: blue | ||
description: > | ||
燃やす埋める問題は最小カット問題に帰着できる問題のひとつである。 | ||
ただし、これは競技プログラミングのコミュニティの中でだけ通用する用語であることに注意したい。 | ||
--- | ||
|
||
# 燃やす埋める問題 | ||
|
||
## 概要 | ||
|
||
競技プログラミングのコミュニティにおいて「燃やす埋める問題」という名前[^moyasu-umeru-local-name]で呼ばれている問題は、次のような形の問題である: | ||
|
||
- $N$ 個のゴミ $0, 1, 2, \dots, N - 1$ があり、それぞれについて「燃やす」か「埋める」かを選んで処理しなければならない。 | ||
ゴミ $i$ は燃やすと $a_i$ 円 ($a_i \ge 0$) かかり埋めると $b_i$ 円 ($b_i \ge 0$) かかる。 | ||
さらに、ゴミ $x_j$ を燃やしたときにゴミ $y_j$ を埋めると罰金として $c_j$ 円 ($c_j \ge 0$) かかるという形の条件が $K$ 個与えられている。 | ||
このときゴミをすべて処理するのに必要な費用の最小値を求めよ。 | ||
|
||
|
||
## 最小カット問題への帰着 | ||
|
||
燃やす埋める問題はある $N + 2$ 頂点 $2N + K$ 辺のネットワークを考えることで[最小カット問題](/minimum-cut-problem)に帰着できる。 | ||
$N$ 個のゴミをそれぞれ頂点とし、始点 $s$ および終点 $t$ を追加する。 | ||
始点 $s$ からそれぞれのゴミ $i$ へ容量 $a_i$ の辺を張り、それぞれのゴミ $i$ から終点 $t$ へ容量 $b_i$ の辺を張り、それぞれの制約 $j$ ごとに頂点 $y_j$ から頂点 $x_j$ へ容量 $c_j$ の辺を貼る。 | ||
このネットワーク上での最小カットの容量は燃やす埋める問題の答えに等しい。 | ||
このネットワークを図示すると以下のようになる。 | ||
|
||
 | ||
|
||
|
||
## その他 | ||
|
||
- 広義には燃やす埋める問題は「選択肢とそれに関わる制約が与えられて最大化や最小化をする問題であって、最小カット問題へと帰着できるもの」を指すことがある。$s$-$t$ カットを頂点の部分集合 $A \subseteq V$ であって $s \in A$ かつ $t \in V \setminus A$ なものとして定義して最小カット問題を考えるとき、このような広義の燃やす埋める問題と最小カット問題とはほとんど区別が付かなくなる。 | ||
|
||
|
||
## 関連項目 | ||
|
||
- [最小カット問題](/minimum-cut-problem) | ||
- 燃やす埋める問題は最小カット問題へと帰着できる。 | ||
- [project selection problem](/project-selection-problem) | ||
- project selection problem は燃やす埋める問題と比較されることが多い。 | ||
|
||
|
||
## 外部リンク | ||
|
||
- <del><a href="http://topcoder.g.hatena.ne.jp/CKomaki/20121019/1350663591">最小カット - CKomakiの日記 - TopCoder部</a></del> (Internet Archive にも保存されておらず現在は閲覧不能) | ||
- <a class="handle">Komaki</a> によるブログ記事。燃やす埋める問題という問題はこの記事で提案されたようである。 | ||
- [最小カットを使って「燃やす埋める問題」を解く - SlideShare](https://www.slideshare.net/shindannin/project-selection-problem)<sup>[archive.org](https://web.archive.org/web/20210401023045/https://www.slideshare.net/shindannin/project-selection-problem)</sup> | ||
- <a class="handle">shindannin</a> によるスライド。燃やす埋める問題について分かりやすく説明している。 | ||
|
||
|
||
## 注釈 | ||
|
||
[^moyasu-umeru-local-name]: 競技プログラミングのコミュニティ外では通用しない名前であることに注意したい。 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
--- | ||
layout: entry | ||
changelog: | ||
- summary: 記事作成 | ||
authors: kimiyuki | ||
reviewers: | ||
date: 2021-04-01T00:00:00+09:00 | ||
algorithm: | ||
input: | ||
output: | ||
time_complexity: | ||
space_complexity: | ||
aliases: | ||
level: blue | ||
description: > | ||
problem selection problem は最小カット問題に帰着できる問題のひとつである。 | ||
--- | ||
|
||
# project selection problem | ||
|
||
## 概要 | ||
|
||
problem selection problem[^project-selection-problem-name] とは、次の形の問題である: | ||
|
||
- $N$ 個のプロジェクト $x_0, x_1, x_2, \dots, x _ {N-1}$ と $M$ 個の機械 $y_0, y_1, y_2, \dots, y _ {M-1}$ がある。 | ||
プロジェクト $x_i$ を実行すると利益 $a_i$ 円を産む。 | ||
機械 $y_i$ は購入に費用 $b_j$ 円かかる。 | ||
さらに、プロジェクト $x _ {c_j}$ を実行するためは機械 $y _ {d_j}$ が購入されていなければならないという形の条件が $K$ 個与えらている。 | ||
ただし機械は複数のプロジェクト間で共有できる。 | ||
実行するプロジェクトと購入する機械を適切に選択したときの利益の最大値を求めよ。 | ||
|
||
|
||
## 最小カット問題への帰着 | ||
|
||
project selection problem はある $N + M + 2$ 頂点 $N + M + K$ 辺のネットワークを考えることで[最小カット問題](/minimum-cut-problem)に帰着できる。 | ||
$N$ 個のプロジェクトと $M$ 個の機械をそれぞれ頂点とし、始点 $s$ および終点 $t$ を追加する。 | ||
|
||
このネットワーク上での最小カットの容量を $F$ とすると project selection problem の答えは $F + \sum_i a_i$ となる。 | ||
このネットワークを図示すると以下のようになる。 | ||
|
||
 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
y_{M-1}, b_{M-1} There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 直しました。ついでに N と M が異なるかもしれないことが分かりやすいように頂点の位置をずらしておきました。 |
||
|
||
|
||
## 関連項目 | ||
|
||
- [最小カット問題](/minimum-cut-problem) | ||
- project selection problem は最小カット問題へと帰着できる。 | ||
- [燃やす埋める問題](/moyasu-umeru-mondai) | ||
- project selection problem は燃やす埋める問題と比較されることが多い。 | ||
|
||
|
||
## 外部リンク | ||
|
||
- [『燃やす埋める』と『ProjectSelectionProblem』 - とこはるのまとめ](http://tokoharuland.hateblo.jp/entry/2017/11/12/234636)<sup>[archive.org](https://web.archive.org/web/20210401023114/http://tokoharuland.hateblo.jp/entry/2017/11/12/234636)</sup> | ||
- <a class="handle">tokoharu</a> によるブログ記事。燃やす埋める問題という問題クラスではなく project selection problem という別の問題クラスを利用することを提案している。 | ||
- [最小カットを使って「燃やす埋める」問題を解くスライドのフォロー - じじいのプログラミング](https://shindannin.hatenadiary.com/entry/2017/11/15/043009)<sup>[archive.org](https://web.archive.org/web/20210401023113/https://shindannin.hatenadiary.com/entry/2017/11/15/043009)</sup> | ||
- <a class="handle">shindannin</a> によるブログ記事。燃やす埋める問題と project selection problem とを比較している。 | ||
|
||
|
||
## 注釈 | ||
|
||
[^project-selection-problem-name]: TODO: 出典を探す | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
「最大流問題」と「最大フロー問題」のどちらを使うべきかはかなり迷っています。おすすめがあったら教えてほしい。
This comment was marked as off-topic.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
組合せ最適化、アルゴリズムイントロダクション、グラフ・ネットワーク・組合せ論は「最大フロー問題」でした。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ありがとうございます。「最大フロー問題」(ついでに「最大フロー」「最大フロー最小カット定理」) で統一するようにしました。
ちなみに「離散凸解析と最適化アルゴリズム」では「最大流問題」(ただし「最大フロー」「最大フロー最小カット定理」) のようです。