Algorithms, networks and linear programming
導入済み
16:11
意思決定数学 1
WDM01試問:1時間30分、75点。すべての手法はアルゴリズムであり、点はそれを正確に実行するために与えられる:各パス後のリスト、各配置…
英語のナレーション・英語と中国語の字幕を切り替え可能
このレッスンの内容
| English | 意味 |
|---|---|
| Dijkstra's algorithm/ˈdeɪkstrəz ˈælɡərɪθəm/ | A shortest-path algorithm that makes the smallest temporary distance permanent, then updates neighbours; edge weights must be non-negative. |
| algorithms/ˈælɡərɪθəmz/ | A finite sequence of precise steps for solving a problem or carrying out a task. |
| networks/ˈnetwɜːks/ | A set of connected devices or nodes that can exchange information. |
| edges/ˈedʒɪz/ | Connections between vertices in a graph, or boundary segments of a geometric shape. |
| spanning tree/ˈspænɪŋ triː/ | A tree that joins every vertex of a network, with no cycles. |
| vertices/ˈvɜːtɪsiːz/ | The nodes of a graph; in geometry, the corner points where edges meet. |
| cycle/ˈsaɪkl/ | |
| minimum spanning tree/ˈmɪnɪməm ˈspænɪŋ triː/ | 最小生成木 |
| objective function/ɒbˈdʒektɪv ˈfʌŋkʃn/ | The quantity expressed as a function of decision variables that is to be maximised or minimised. |
| constraints/kənˈstreɪnts/ | A condition or limit that a valid solution must satisfy. |
| feasible region/ˈfiːzɪbl ˈriːdʒn/ | The set of points that satisfy all the constraints of a linear programming problem. |
1956年、アムステルダムのカフェでの20分間
- 1956年のある朝、オランダの計算機科学者エドガー・ダイクストラは婚約者とアムステルダムで買い物をしていた。彼はカフェのテラスに座り、2つの都市間の最短ルートを見つける方法を、ペンも紙も使わずに約20分で考案した。衛星ナビゲーションでは今もディクストラ法が使われている。
- D1では、ネットワーク(辺に重みが付いたグラフ)上のアルゴリズムと、最適な計画を選ぶための線形計画法を学ぶ。
ネットワークとスパニングツリー
- ネットワークは、重みが付いた辺で結ばれた頂点からなる。スパニングツリーは、サイクルを作らずにすべての頂点を結ぶ。頂点が$n$個なら、辺は$n - 1$本ある。
- 最小スパニングツリー(MST)は、重みの合計が最も小さいスパニングツリーであり、すべての町をケーブル網で結ぶ最も安い方法を表す。
How many edges does a spanning tree on 9 vertices have?
難易度 2/5 · 140 コイン + 今日初回達成時の小ボーナス
A tree on $n$ vertices has $n - 1$ edges.
クルスカル法とプリム法
- クルスカル法:辺を重みの小さい順に並べ、サイクルができない限り、その都度最も短い辺を加える。
- プリム法:任意の頂点から始め、木に新しい頂点を結ぶ最も短い辺を繰り返し加える。プリム法は距離行列からも実行できる。
Algorithms, networks and linear programming
Kruskal selects edges in increasing weight while avoiding cycles
Compare the model with the worked case and explain one change.
Kruskal's algorithm has chosen $PQ$, $QR$ かつ $ST$. The next shortest edge is $PR$. What happens to it?
難易度 1/5 · 100 コイン + 今日初回達成時の小ボーナス
$P$ かつ $R$ are already joined through $Q$.
計算例:クルスカル法とディクストラ法
あるネットワークには、辺$AB = 4$、$AC = 2$、$BC = 1$、$BD = 5$、$CD = 8$、$CE = 10$、$DE = 2$がある。最小スパニングツリーと、$A$から$E$までの最短ルートを求めよ。
- クルスカル法:$BC\ (1)$ ✓、$AC\ (2)$ ✓、$DE\ (2)$ ✓、$AB\ (4)$ ✗(サイクル$ABC$)、$BD\ (5)$ ✓。5個の頂点に対して辺は4本、重みの合計は10。
- $A$からのディクストラ法:$A = 0$、次に$C = 2$、$B = \min(4, 2 + 1) = 3$、$D = \min(3 + 5, 2 + 8) = 8$、$E = \min(2 + 10, 8 + 2) = 10$の順にラベルを確定する。
- ルート:$E$から逆にたどると$E \leftarrow D \leftarrow B \leftarrow C \leftarrow A$となる。したがって、ルートは$A$–$C$–$B$–$D$–$E$で、長さは10。
Edges: $AB = 3$, $AC = 5$, $BC = 4$, $BD = 6$, $CD = 2$. Find the weight of the minimum spanning tree.
難易度 2/5 · 140 コイン + 今日初回達成時の小ボーナス
$CD\ 2$, $AB\ 3$, $BC\ 4$ — then every vertex is joined: $2 + 3 + 4 = 9$.
ディクストラ法の仕組み
- 始点のラベルを0に確定する。隣接する頂点の仮の値を更新し、その中で最小の値を確定する。次に、その頂点から同じ手順を繰り返す。
- 終点のラベルが確定したら、ラベルの差が辺の重みに等しい辺をたどって逆戻りする。
In the same network, find the shortest distance from $A$ から $D$.
難易度 2/5 · 140 コイン + 今日初回達成時の小ボーナス
$A$–$C$–$D$ is $5 + 2 = 7$; $A$–$B$–$D$ is 9 and $A$–$B$–$C$–$D$ is 9.
線形計画法
- 変数、最大化または最小化する目的関数、制約条件を書く。例えば、$x + y \le 4$、$x + 3y \le 6$、$x, y \ge 0$という条件のもとで$P = 2x + 3y$を最大化する。
- 最適な点は許容領域の頂点にある。$(0, 0)$、$(4, 0)$、$(3, 1)$、$(0, 2)$を調べると$P = 0, 8, 9, 6$となるので、$(3, 1)$で最大値9をとる。
Maximise $P = x + 2y$ subject to $x + y \le 5$, $y \le 3$, $x, y \ge 0$. Find the maximum value of $P$.
難易度 2/5 · 140 コイン + 今日初回達成時の小ボーナス
Vertices $(0, 0), (5, 0), (2, 3), (0, 3)$ give $0, 5, 8, 6$.
In a linear programming problem, the optimal value can be at a point inside the feasible region but not on its edge.
難易度 1/5 · 100 コイン + 今日初回達成時の小ボーナス
A linear objective is best at a vertex (or along an edge) of the region.
サイクルができるか確認せずに、最も短い辺を加えること。 計算例では、$BC$、$AC$、$DE$の次に短い辺は$AB = 4$だが、$A$と$B$はすでに$C$を通じて結ばれている。この辺を加えるとサイクルができるため、選ばない。木にはサイクルがない。
最小スパニングツリーは、すべての頂点を重みの合計が最小になるように結ぶ。クルスカル法はサイクルを作らない最も短い辺を加え、プリム法は1つの頂点から木を広げていく。ディクストラ法は、その都度最小の仮のラベルを確定してから逆にたどることで、最短ルートを求める。線形計画法では、最適解は許容領域の頂点にある。
Use Prim's algorithm, starting at $A$, on the network $AB = 4$, $AC = 2$, $BC = 1$, $BD = 5$, $CD = 8$, $CE = 10$, $DE = 2$. List the edges in the order chosen and give the total weight.
Grow the tree one vertex at a time.
何が問題でしたか?この内容はサイトの運営チームだけが確認します。