30
EDA (CS286.5b) Day 6 Partitioning: Spectral + MinCut

EDA (CS286.5b) Day 6 Partitioning: Spectral + MinCut

  • View
    223

  • Download
    0

Embed Size (px)

Citation preview

Page 1: EDA (CS286.5b) Day 6 Partitioning: Spectral + MinCut

EDA (CS286.5b)

Day 6

Partitioning:

Spectral + MinCut

Page 2: EDA (CS286.5b) Day 6 Partitioning: Spectral + MinCut

Today

• Alternate views of partitioning

• Two things we can solve optimally– (but don’t exactly solve our original problem)

• Techniques– Linear Placement w/ squared wire lengths– Network flow MinCut

Page 3: EDA (CS286.5b) Day 6 Partitioning: Spectral + MinCut

Optimization Target

• Place cells

• In linear arrangement

• Wire length between cells:– distance=Xi - Xj

– cost is sum of distance squared

• Want to pick Xi’s to minimize cost

Page 4: EDA (CS286.5b) Day 6 Partitioning: Spectral + MinCut

Spectral Partitioning

• Minimize Squared Wire length -- 1D layout

• Start with connection array C (ci,j)

• “Placement” Vector X for xi placement

• cost = 0.5* (all I,j) (xi- xj)2 ci,j

• cost sum is X’BX– B = D-C

– D=diagonal matrix, di,i = (over j) ci,j

Page 5: EDA (CS286.5b) Day 6 Partitioning: Spectral + MinCut

Spectral Partition

• Constraint: X’X=1– prevent trivial solution all xi’s same

• Minimize cost=X’BX w/ constraint– minimize L=X’BX-(X’X-1) L/ X=2BX-2X=0– (B-I)X=0– X => Eigenvector of B– cost is Eigenvalue

Page 6: EDA (CS286.5b) Day 6 Partitioning: Spectral + MinCut

Spectral Partitioning

• X (xi’s) continuous

• use to order nodes– real problem wants to place at discrete locations– this is one case where can solve LP problem

• (continuous x’s)

• then move back to closests discrete point

• form cut partition from ordering

Page 7: EDA (CS286.5b) Day 6 Partitioning: Spectral + MinCut

Spectral Ordering

• Midpoint bisect isn’t necessarily best place to cut, consider:

K(n/4) K(n/4)K(n/2)

Page 8: EDA (CS286.5b) Day 6 Partitioning: Spectral + MinCut

Spectral Partitioning Options

• Can bisect by choosing midpoint– (not strictly optimizing for minimum bisect)

• Can relax cut critera– min cut w/in some of balance

• With iteration, can reweigh connections to change cost model being optimized– linear– (distance)1.X

Page 9: EDA (CS286.5b) Day 6 Partitioning: Spectral + MinCut

Spectral Options (2)

• Ratio Cut– minimize (cut/|A||B|)

• idea tradeoff imbalance for smaller cut– more imbalance =>smaller |A||B|

– so cut must be much smaller to accept

• Maybe: encourage “closeness”– by weighting connection between nodes– (have to allow some nodes to not be close)

Page 10: EDA (CS286.5b) Day 6 Partitioning: Spectral + MinCut

Spectral vs. FM

From Hauck/Boriello ‘96

Page 11: EDA (CS286.5b) Day 6 Partitioning: Spectral + MinCut

Improving Spectral• More Eigenvalues

– look at clusters in n-d space – 5--70% improvement over EIG1

Page 12: EDA (CS286.5b) Day 6 Partitioning: Spectral + MinCut

Spectral Note

• Unlike KLFM, attacks global connectivity characteristics

• Good for finding “natural” clusters– hence use as clustering heuristic for multilevel

algorithms (both types)

Page 13: EDA (CS286.5b) Day 6 Partitioning: Spectral + MinCut

Spectral Theory

• There are conditions under which spectral is optimal [Boppana/FOCS28 (1987)]– B=A+diag(d)

– g(G,d)=[sum(B)-n*(BS)]/4

– BS mapping Bx to closest point on S

– h(G) = max d g(G,d)

• h(G) lower bound on cut size

Page 14: EDA (CS286.5b) Day 6 Partitioning: Spectral + MinCut

Spectral Theory

• Boppana paper gives a probabilistic model for graphs– model favors graphs with small cuts– necessary since truly random graph has cut size

O(n)– shows high likelihood of bisection being lower

bound

• In practice – known to be very weak for graphs with large

cuts

Page 15: EDA (CS286.5b) Day 6 Partitioning: Spectral + MinCut

Max Flow

MinCut

Page 16: EDA (CS286.5b) Day 6 Partitioning: Spectral + MinCut

MinCut Goal

• Cut find minimum flow cut between a source and a sink– no balance guarantee

Page 17: EDA (CS286.5b) Day 6 Partitioning: Spectral + MinCut

MaxFlow

• Set all edge flows to zero– F[u,v]=0

• While there is a path from s,t – (breadth-first-search)– for each edge in path f[u,v]=f[u,v]+1– f[v,u]=-f[u,v]

• O(|E|*cutsize)• Our problem simpler than general case CLR

Page 18: EDA (CS286.5b) Day 6 Partitioning: Spectral + MinCut

Directionallity Construct

1

Page 19: EDA (CS286.5b) Day 6 Partitioning: Spectral + MinCut

Fanout Construct

1

Page 20: EDA (CS286.5b) Day 6 Partitioning: Spectral + MinCut

Balanced Cut

• Pick a start node and a finish node• Compute min-cut start to finish• If halves sufficiently balanced, done• else

– collapse all nodes in smaller half into one node– pick a node adjacent to smaller half– collapse that node into smaller half– repeat from min-cut computation

FBB -- Yang/Wong ICCAD’94

Page 21: EDA (CS286.5b) Day 6 Partitioning: Spectral + MinCut

Observation

• Can use residual flow from previous cut when computing next cuts

• Consequently, work of multiple network flows is only O(|E|*final_cut_cost)

Page 22: EDA (CS286.5b) Day 6 Partitioning: Spectral + MinCut

Picking Nodes

• Optimal:– would look at all s,t pairs– also look at all nodes to collapse into smaller– could formulate as branching search

• Probably be more clever:– I.e. everything in first group around s (or t) would be

there regardless of which s or t picked as kernal– probably similar observations would reduce

branching factor on picking node to collapse in

Page 23: EDA (CS286.5b) Day 6 Partitioning: Spectral + MinCut

Picking Nodes

• Randomly pick – (maybe try several starting points)

• With small number of adjacent nodes,– could afford to branch on all

Page 24: EDA (CS286.5b) Day 6 Partitioning: Spectral + MinCut

Approximation

• Can find 1/3 balanced cuts within O(log(n)) of best cut in polynomial time– algorithm due to Leighton and Rao– exposition in Hochbaum’s Approx. Alg.

• Bound cut size– Boppana -- lower bound h(G)– Boppana/Spectral cut -- one upper bound– Leighton/Rao -- upper bound

Page 25: EDA (CS286.5b) Day 6 Partitioning: Spectral + MinCut

Min Cut Replication

• After have (once have) kernel sets for each half, determine replication set

• Given: P1, P2

• Determine subset of P1 to replicate into P2

– (and vice-versa)

Algorithm: Hwang+ElGamal / TR CAD v14n1p96

Page 26: EDA (CS286.5b) Day 6 Partitioning: Spectral + MinCut

Min Cut Replication

• To figure out what nodes from P1 to replicate into P2

• Start with P1

• Add nodes adjacent to P1, call these I1,2

• Add a start node (connect to inputs of P1)

• Add a target node (connect to I1,2)

• Keep original edges contained in P1

• Keep edges from P1 to I1,2

Page 27: EDA (CS286.5b) Day 6 Partitioning: Spectral + MinCut

Replication Picture

start target

P1 I1,2

Replication set

Page 28: EDA (CS286.5b) Day 6 Partitioning: Spectral + MinCut

Min Cut Replication

• Perform MaxFlow/MinCut in new graph• nodes unreachable from start node form

new replication set

• (those nodes go in P2, reducing it’s IO)

• n.b. -- cut minimal, but number of replicated nodes not guaranteed to be minimum

Page 29: EDA (CS286.5b) Day 6 Partitioning: Spectral + MinCut

Apply Example?

Page 30: EDA (CS286.5b) Day 6 Partitioning: Spectral + MinCut

Big Ideas

• Divide-and-Conquer

• Techniques– flow based– numerical/linear-programming based

• Exploit problems we can solve optimally