-
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 11 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)の解の容量に等しい。 | ||
|
Collaborator
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. 最大流問題と最小カット問題が双対であることにも言及しておいたほうがよいかもしれません。
Collaborator
Author
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. たしかに書いておきたいです。(あまりよく理解してないから曖昧にして逃げてしまっていました……) しかし「最大流問題と最小カット問題が双対であること」と「最大流最小カット定理が成り立つこと」の関係を私はあまり理解できてないので教えてほしいです。
Collaborator
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. 大雑把に言うと、 一般に、線形計画問題のインスタンス(主問題)に対し、その双対問題というものがあり、主も双対も feasible であれば両方 bounded でその最適解が一致することが知られています。(強双対定理) です。大抵の場合、強双対定理という大道具は使わず、アルゴリズムを持ってきてその有限性の証明とかで独立に示しますが。 |
||
|
|
||
|
|
||
| ## 詳細 | ||
|
|
||
| (省略) | ||
|
|
||
|
|
||
| ## その他 | ||
|
|
||
| - フローの定義では「始点から終点へと向かうフローと無関係な位置に閉路状のフローがないこと」は要求されていない。最大流を求めるアルゴリズムはこのような閉路状のフローを含む出力をすることがあるので、出力されたフローの構成を利用する際には注意が必要である。なお、最大流問題の解から流量を変えずにこのような閉路状のフローを取り除くことは常に可能である。 | ||
|
|
||
|
|
||
| ## 関連項目 | ||
|
|
||
| - [最小カット問題](/minimum-cut-problem) | ||
| - 最大流最小カット定理によって最大流問題の解の流量は最小カット問題の解の容量に等しい。 | ||
| - [Dinic 法](/dinic) | ||
| - Dinic 法は最大流問題を解くアルゴリズムである。最悪計算量は $O(\lvert V \rvert^2 \cdot \lvert E \rvert)$ だが実用的にはかなり速い。 | ||
|
Owner
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. O だとやや違和感がありますが、Θ で評価できるのかが分からない (Dinic の最悪ケースに詳しくないため)。
Collaborator
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. これの真ん中あたりのネットワークで、k^2=Θ(m), p = Θ(n) となるように k と p を調節すれば良さそうな気がします。
Collaborator
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. pk=O(m) も必要なのでもうちょっと非自明でした。s 全体と t 全体の前後にノードを一つずつ、計 4 つ追加して、u/v と s/t 間の辺はそいつらを経由させるとかですかね 🤔 |
||
| - [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,73 @@ | ||
| --- | ||
| 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$ カットの定義としては、大きく分けて以下のみっつがある。 | ||
|
MiSawa marked this conversation as resolved.
Outdated
|
||
|
|
||
| 1. 有向辺の部分集合 $C \subseteq E$ であってどの $s$-$t$ パスも $C$ に含まれるような有向辺を含むもの[^cut-set-of-edges] | ||
| 2. 頂点の部分集合 $S \subseteq V$ であって $s \in S$ かつ $t \in V \setminus S$ なもの[^cut-set-of-vertices] | ||
| 3. 有向辺の部分集合 $C \subseteq E$ であって、次を満たすもの: ある頂点の部分集合 $S \subseteq V$ であって $s \in S$ かつ $t \in V \setminus S$ なものが存在し、$S$ に含まれる頂点から $V \setminus S$ に含まれる頂点への有向辺の全体が $C$ に等しい[^cut-set-of-vertices-as-edges] | ||
|
|
||
| カットの容量は、(1.) と (3.) の定義の場合は $C$ に含まれる有向辺の重みの総和として定義される。 | ||
| (2.) の定義の場合は始点が $S$ に含まれかつ終点が $V \setminus S$ に含まれるような有向辺の重みの総和として定義される。 | ||
|
|
||
| 最小カット問題を考える際にはどの定義を用いても解の容量は同じであるが、カットの定義としてはすべて異なるものである。 | ||
| (1.) の定義と (2.) の定義との違いはカットの容量の最大値について考えれば明らかである。 | ||
| (2.) の定義と (3.) の定義とはほとんど同じものであるが、ネットワークが非連結な場合に異なってくる。 | ||
|
Collaborator
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. 「異なる」が曖昧な気がしていて、もうちょっと具体的に「一般には多対一対応になる」みたいな書き方のほうがよい気がします。あと、有向なので、非連結でなくても多対一になる場合がって、例えば u は接続する辺が (u, s) のみのとき、2. では区別出来る「u が s 側に属するか否か」が 3. では区別できません。
Owner
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. これも自分のミスです、申し訳ない... |
||
| (1.) で定義されるものを (2.) や (3.) で定義されるものから区別したいときには、(1.) で定義されるものを $s$-$t$ 非連結化集合 ($s$-$t$ disconnecting) と呼ぶことがある[^s-t-disconnecting]。 | ||
|
Collaborator
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. s-t disconnecting edge set とかではありませんか? ("非連結化集合" は集合だけれど s-t disconnecting は性質に見えます)
Owner
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. これは私の誤訳だったかもしれません (英語力が無くて判断できない)。
Collaborator
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. その直前は (s-t でないのは) disconnecting arc set とあり、索引では s-t disconnecting arc set という項目名になっているので、やはり「ほげ集合と呼ぶ」と「ほげであると言う」をノリで同一視しているように思います。
Collaborator
Author
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. s-t disconnecting edge set に修正しました。 |
||
|
|
||
|
|
||
| ## 関連項目 | ||
|
|
||
| - [最大流問題](/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. | ||
| [^cut-set-of-vertices-as-edges]: たとえば Schrijver, A. [Combinatorial Optimization: Polyhedra and Efficiency](https://www.springer.com/jp/book/9783540443896), Springer Science & Business Media, 2003. | ||
| [^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,67 @@ | ||
| --- | ||
| 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$ カットを頂点の部分集合 $S \subseteq V$ であって $s \in S$ かつ $t \in V \setminus S$ なものとして定義して最小カット問題を考えるとき、このような広義の燃やす埋める問題と最小カット問題とはほとんど区別が付かなくなる。 | ||
|
|
||
|
|
||
| ## 関連項目 | ||
|
|
||
| - [最小カット問題](/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]: 競技プログラミングのコミュニティ外では通用しない名前であることに注意したい。 |
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.
ありがとうございます。「最大フロー問題」(ついでに「最大フロー」「最大フロー最小カット定理」) で統一するようにしました。
ちなみに「離散凸解析と最適化アルゴリズム」では「最大流問題」(ただし「最大フロー」「最大フロー最小カット定理」) のようです。