CS 401
Max Flow Applications
Xiaorui Sun
1
CS 401 Max Flow Applications Xiaorui Sun 1 Survey Design Survey - - PowerPoint PPT Presentation
CS 401 Max Flow Applications Xiaorui Sun 1 Survey Design Survey Design Survey design. Design survey asking n 1 consumers about n 2 products. Can only survey consumer i about a product j if they own it. Ask consumer i between c i and c i '
Xiaorui Sun
1
Design survey asking n1 consumers about n2 products. Can only survey consumer i about a product j if they own it. Ask consumer i between ci and ci' questions. Ask between pj and pj' consumers about product j.
1 3 1' 3' 2 4 2' 4' [c1, c1’] = [2, 4] [2, 4] [2, 4] [2, 4] [p1, p1’] = [2, 4] [2, 4] [2, 4] [2, 4]
consumers products
Design survey asking n1 consumers about n2 products. Can only survey consumer i about a product j if they own it. Ask consumer i between ci and ci' questions. Ask between pj and pj' consumers about product j.
Include an edge (i, j) if customer own product i. Demands = 0 for all vertices Integer circulation Û feasible survey design.
s
1 3 5 1' 3' 5'
t
2 4 2' 4' [c1, c1'] [0, 1]
consumers
[p1, p1'] [0, ¥]
products
Given an image we want to separate foreground from background
7
Label each pixel as foreground/background. ! = set of pixels, " = pairs of neighboring pixels. #$ is the original image. #$ ≫ 0 means we prefer to label ' in foreground. ($,* ≥ 0 is separation penalty for labeling one of ' and j as foreground, and the other as background. Goals: Find partition (-, -) that minimizes: − 0
$∈2
#$ +
$,* ∈4 $∈2,*∈2
($,* where - is the foreground.
8
9
pij pij pij
s t
i j
pij *+ if *+ > 0
!′
−*+ if *+ < 0
10
%&' ", " = )
*∈,
−&* 1/012 + )
*∈,
&* 1/042 + )
*,5 ∈6 *∈,,5∈,
'*,5 = − ∑*∈, &* + ∑*∈, &* 1/042 + ∑*∈, &* 1/042 + ∑⋯'*,5 = − ∑*∈, &* + ∑* &* + ∑⋯'*,5 = − ∑*∈, &* + ∑⋯'*,5 + constant Precisely, what we want to minimize.
s t
i j
pij
?′ "
&5 if &5 > 0 −&5 if &5 < 0
11
values to (positive) capacities
12
13
a g c d e f
b c d e a
2 matches, 8 gaps
a
c d e f f b c d e
Common subsequence = acde 4 matches, 2 gaps, 1 mismatch
14