1. Problem Definition of WIS in Graph:
-- Input: A path graph G = (V , E) with nonnegative weights on vertices.
-- Output: Subset of nonadjacent vertices (an independent set ) of maximum total weight.
2. Different Aproaches :
-- Brute-force search requires exponential time.
-- Greedy Approach: Iteratively choose the max-weight vertex not adjacent to any previously chosen vertex. ==> not correct
-- Divide & Conquer Approach: Recursively compute the max-weight independent set of 1st half, ditto for
2nd half, then combine the solutions. ==> not clear how to fix the conflict of recursive sub-solutions
3. Optimal Substructure
-- Critical step: Reason about structure of an optimal solution. [In terms of optimal solutions of smaller subproblems]
-- Motivation: This thought experiment narrows down the set of candidates for the optimal solution; can search through the small set using brute-force-search.
-- Notation: Let S subset of V be a max-weight independent set (IS). Let vn = last vertex of path.
4. Case Analysis
-- Case 1: Suppose vn not in S. Let G' = G with vn deleted. ==> S must be a max-weight IS IS of G' because if S* was better, it would also be better than S in G. [contradiction]
-- Case 2: Suppose vn in S. ==> Previous vertex vn-1 not in S then let G'' = G with vn-1 and vn deleted. ==> S - {vn} must be a max-weight IS of G'' because if S* is better than S-{vn} in G'', then S* U {vn} is better than S in G. [contradiction]
-- A max-weight IS must be either
(i) a max-weight IS of G' or
(ii) vn + a max-weight IS of G''
Try both possibilities + return the better solution.
5. Running Time Analysis
-- Problem size only reduce 1 or 2 in each recursive call ==> exponential time in all
-- Only O(n) distinct subproblems ever get solved by this algorithm (Only 1 for each "prefix" of the graph) [Recursion only plucks vertices off from the right]
6. Eliminating Redundancy
-- Obvious fix: The first time you solve a subproblem cache its solution in a global table for O(1)-time lookup later on.
-- Even better: Reformulate as a bottom-up iterative algorithm:
a) Let Gi = 1st i vertices of G.
b) Populate array A left to right with A[i ] = value of max-weight IS of Gi .
c) Initialization: A[0] = 0 , A[1] = w1
d) Main loop: For i = 2, 3, ... , n:
A[i ] = max{ A[i - 1] , A[i - 2] + wi }
-- Running time : O(n)
7. A Reconstruction Algorithm :
-- Algorithm computes the value of a max-weight IS, not such an IS itself.
-- Correct but not ideal: Store optimal IS of each Gi in the array in addition to its value.
-- Better: Trace back through filled-in array to reconstruct optimal solution.
-- Key point: A vertex vi belongs to a max-weight IS of Gi <==> wi + max-weight IS of Gi-2 >= max-weight IS of Gi-1.
-- Implementation:
a) Let A = filled-in array.
b) Let S = empty set.
c) While i >= 1 [scan through array from right to left]
- If A[i - 1] >= A[i - 2] + wi [i.e. case 1 wins]
- Decrease i by 1
- Else [i.e., case 2 wins]
- Add vi to S, decrease i by 2
d) Return S
-- Running Time: O(n)
8) Principles of Dynamic Programming
-- Fact: Our WIS algorithm is a dynamic programming algorithm!
-- Key ingredients of dynamic programming:
(1) Identify a small number of subproblems
[e.g., compute the max-weight IS of Gi for i = 0, 1, ... , n]
(2) Can quickly+correctly solve "larger" subproblems given the solutions to "smaller subproblems"
[usually via a recurrence such as A[i ] = max { A[i - 1],A[i - 2] + wi } ]
(3) After solving all subproblems, can quickly compute the final solution
[usually, it's just the answer to the "biggest" subproblem]
相关推荐
1.1.1. 图与网络 Graph and Network 1.1.2. 图的术语 Glossary of Graph 1.1.3. 路径与回路 Path and Cycle 1.1.4. 连通性 Connectivity 1.1.5. 图论中特殊的集合 Sets in graph 1.1.6. 匹配 Matching 1.1.7. 树 ...
but their full implications must be understood and carefully weighed before choosing to do so Should not"means that there may be valid reasons in particular circumstances that make the specifie ...
Programming assignments As you can see from the syllabus, there will be seven assignments (Assignment 1 – Assignment 7). The assignments will become slightly more difficult and require more time as...
The past decade has witnessed a huge development in economy owing to the reform and opening-up policy being carried out, bringing some problems at the same time, with the following one being the ...
如:“Up to ten people can sleep in this tent.” - 意为“不多于,不迟于”。例如:“Read up to page 109.” - 表示达到某种要求或水平。如:“Is their spoken English up to the company's standard?” ...
在cover了基本的 LP 和 LP 对偶理论后,我们对 LP-based Branch-and-Bound(BAB)算法进行了详细的介绍,该算法用于解决混合整数线性规划(Mixed Integer Linear Programming,MILP)问题。然后,我们通过 CG 概念对...
The guilt of his deceit weighed heavily upon him, and the image of Nabor's selfless act began to erode his cunning facade. Nabor continued, "My horse is more than just an animal; it represents trust ...
- "See you later."是告别时的用语,而"I look forward to seeing you in China soon."则表达了期待再次见面的意愿。 2. 介绍: - 询问对方姓名可以用"What's your family name?",回答可以是"My family name is ...
- 句子81:"We should act to protect the animals in danger in the world." 可以用 "take action" 替换 "act",保持句意不变。 9. **对重量提问**: - 句子82:"The baby weighed about 3 kilograms when she ...
- `date of birth` 和 `birthday` 都表示生日,"At birth, he weighed 3 kilos." 表示出生时的体重。 7. **年龄和体重**: - `tall` 和 `weighs` 用于描述身高和重量,如"She's 165 cm tall and weighs 45 kg." ...
--- I’d like to have this box weighed and post it to Paris. (先生,您需要什么帮助吗?我想把这箱东西称一下重量并寄到巴黎。) 3. **情感表达与搭配** - `feel/be ashamed of`:表示“对……感到羞耻”。如...
7. 分别时,用“See you later.”或“I look forward to seeing you in China soon.”表达期待再次相见。 二、介绍 1. 询问对方姓名:“What's your family name?”。 2. 自我介绍:“My name is Wang Xiaoya. This...
The thought of Mum working tirelessly to provide for us, sacrificing her own comfort, and the reality that we would have no Christmas celebration this year weighed heavily on my heart. I recalled the...
- 当希望出生的时候,他只重达 100 克并且看上去像一只白鼠:When Xi Wang was born, she weighed only 100 grams and looked like a white mouse. - 一开始,希望喝她母亲的奶水:At first, Xi Wang drank her ...
在句子1-9中,我们可以看到非谓语动词的各种形式,如动名词(exploring, leaving)、现在分词(looking, following)、过去分词(decided, disappointed, weighed)以及不定式(to help, to lose)。非谓语动词在...
AC02 cylinder weighed lighter than normal weight.” - “Third Officer: I replace it now!” #### 对话B: 灭火演练 - **情景**: 火警响起后,船员们迅速穿戴好防护装备,并按照指示行动。 - **表达**: - ...