Title: Kernighan and Lin partition algorithm Fideccia and Mattheyses partition algorithm
1Kernighan and Lin partition algorithmFideccia
and Mattheyses partition algorithm
- Presented by Bhanu Rekapalli.
2Papers
- An Efficient Heuristic procedure for Partitioning
Graphs. - By B.W.KERNIGHAN and S.LIN
- ( Bell Systems Technical Journal, 49(2)
291-307, 1970.) - A Linear-Time Heuristic for Improving Network
Partitions. - By C.M.FIDUCCIA and R.M. MATTHEYSES
- (Proceedings of the Design Automation
Conference, pp - 175-181, 1982.)
3TERMS TO UNDERSTAND
- Network-circuit modules
- Terminals-connectors or pins
- Graph
- Vertices-nodes or points
- Edges-net or signal
- Cutset
4(No Transcript)
5Algorithms
- Minimize the costs.
- Effective in finding the optimal partitions.
- Fast enough to be practical in solving large
problems.
6Definition of the problem
- Connection between the FPGAs or modules
(external) have high cost compared to connections
within them(internal). - The object is to minimize the number of external
connections.
7Mathematically
- G is a graph of n nodes of weights wi gt0,i1.n
- Let p be a positive number,such that 0lt wi ltp
for all i. - Partition the nodes of G into k subsets
- Weighted Connectivity matrix C(cij),i,j1,.n
describing the edges of G. - A k-way partition of G is a set of nonempty
pairwise disjoint subsets of G,v1,..,vk such
that Uk i1 viG. - A partition is admissible if mod vi ltp for all
i. - The partitioning problem, is to find the
minimal-cost admissible partition of G.
8Exact Solutions
- Graph G has n nodes of size 1 to be partitioned
into k subsets of size p. - kpn.
- ways to to chose the first subset
- ways to chose the second subset
- The number of cases is 1/k!
- This expressions yields a very large number
- Examplen40, p10 (k4), it is gt1020
9False Starts
- Random Solutions
- Simply generate random solutions, keeping the
best seen to date, and terminating after some
predetermined time or value is reached. - Fast,although it is an n2-procedure
- This approach is unsatisfactory for moderate
size,since few optimal solutions, which appear
randomly with very low probabilities. - Egmatrix of 32X32 there are 3 to 5 optimal
solutions out of partitions giving
probability lt10-7
10Max Flow-Min Cut
- Theorem The maximum flow between any pair of
nodes the minimum cut capacity of all cuts which
separate the two nodes - Cut is a 2-way partition and the cut capacity is
the cost of the partition. - The most severe difficulty of the algorithm is
that the algorithm has no provision for
constraining the sizes of the resultant subsets. - notefor 2-way unconstrained partition,the
minimal cost it produces is a lower bound for
solutions produced by any method.
11Clustering
- Identifying the natural cluster in the given
cost matrix. - Again satisfying constraints on the sizes of the
subsets is a problem - Systematic assignment of the stragglers is not
provided.
12Two-Way Uniform Partitions
- Consider the set S of 2n points,with an
associated cost matrix C(cij), i,j1,.,2n. - Assume C is symmetric and that cii 0 for all i.
- We want to partition S into two subsets A and B,
each with n points, such that the external cost
is minimized. - Start with any arbitrary partition A,B of S and
try to - decrease the initial cost T by a series of
interchanges of subsets of A and B - When no further improvement is possible, the
resulting partition A,B is a local minimum
and has a fairly high probability of being a
global minimum with this scheme - This process is repeated with another arbitrary
partition,to obtain many locally minimum
partitions we desire.
13KL-algorithm
- Let A ,B be any arbitrary 2-way partition
- Subsets with XY
- such that interchanging X and Y produces A and
B as shown below -
- ?
X
Y
Y
X
B
A
B
A
AX-XY BB-YX
14KL-algorithm
15Phase 1 optimization Algorithm
- Compute the D values for all elements of S
- Choose ai and bi such that gain
giDaiDbi-2caibi is maximum. - Set ai and bi aside, and call them ai and bi.
- Recalculate the D values for the elements of
16- Choose a pair a2 and b2 from A-(a1) and
B-(b1) such that the gain is maximum. - Continue until all the nodes have been
exhausted,identifying (a3,b3)..(an,bn) and
the corresponding gains g3,..gn. - If Xa1,.,ak, Yb1,bk, then the decrease in
cost when the sets X and Y are interchanged is
precisely g1g2 gk - Choose k to maximize the partial sum
- If Ggt0,a reduction in cost of value G can be made
by interchanging X and Y, and the resulting
partition is treated as initial partition and the
procedure is repeated. - G0?locally optimum partition is reached called
phase 1 optimal partition.
17(No Transcript)
18Effectiveness of the Procedure
- The procedure sequentially finds an approximation
to the best exchange of lambda pairs. - This technique sacrifices a certain amount of
power for a considerable gain in speed. - The procedure finds the maximum partial sum, the
process does not terminate immediately when gain
is negative. - The probability that it finds an optimal solution
in a single trial p(n)2-n/30,eg30X30 matrix p
is 0.5, 0.2 to 0.3 for 60X60 and .05 to .1 for
120X120.
19Running time of the Procedure
- The upper bound is n2logn.
- The lower bound with fast scan method is
proportional to - This function grows as
20Plot of Running times
21Drawbacks
- It minimizes the number of edges cut not the
number of nets cut. - It does not allow logic cells to be of different
sizes. - It is expensive in computation time.
- It does not allow partition to be unequal.
- It does not allow for selected logic cells to be
fixed in place. - The results are random.
- It does not directly allow more than two
partitions.
22Fiduccia and Mattheyses algorithm
- To deal with cells of various sizes , the
algorithm progresses by moving one cell at a time
between the blocks of the partition while
maintaining a desired balance based on the size
of the blocks rather than the number of cells per
block. - Two cells which share atleast one net are said to
be neighbors. - Each cell is assumed to have a size s(i).Number
of pins p(i). - Given a fraction 0ltrlt1 partition the network in
to two blocks A and B such that A/(AB)r,
and such that the size of the resulting cutset is
minimized.
23The Basic Idea
- The main idea of the algorithm is to move a cell
at a time from one block of the partition to the
other in an attempt to minimize the cut set of
the final partition. - Base cellthe cell to be moved.
- Gain g(i)no. of nets by which the cutset would
decrease if cell i were moved from partition A to
partition B (may be negative).integer range
p(i)ltg(i)ltp(i). - Keep in mind the balance criterion to prevent all
cells from migrating to one block of the
partition. - To prevent thrashing, once a cell is moved it is
locked for an entire pass - Only O(N) passes are possible since the cutset is
bound by the number of nets
24steps
- Choose a base cell having the largest gain in its
block. - Move it.
- Adjust the gains of its free neighbors.
- The total work required to perform one pass is
O(P).
25Cell Gain
- Each cell has its gain in the range pmax to
pmax, pmaxmax(p(i)cell(i) is initially free). - The total amount of work required to maintain
each Bucket array is O(P)/Pass.
26Establishing Balance
- Move the Cell
- Find the first cell of highest gain that is not
locked and such that moving it would not cause an
imbalance - Break tie by choosing the one that gives the best
balance - Choose this as the base cell. Remove it from the
bucket list and place it on the LOCKED list.
Update it to the other partition.
27Computing and Maintaining Cell Gains
- Critical net
- Given a partition (A,B), define the distribution
of net n, relative to this partition, as an
ordered pair of integers (A(n),B(n)) which
represents the number of cells the net n has in
blocks A and B respectively. These can be
computed in O(P) time for all nets. - Net is critical if there exists a cell on it such
that if it were moved it would change the nets
cut state (whether it is cut or not). - Gain of cell depends only on its critical nets
- If a net is not critical, its cut state cannot be
affected by the move - A net which is not critical either before or
after a move cannot influence the gains of its
cells - This observation, and previous locked base
cell,leads to the basis of linear-time claim.
28Net is critical if either A(n) or B(n) is equal
to 0 or 1
29- Let F be the from partition of cell i and T the
to partition i.e. its complimentary block, FA
and TB or vice versa. - The gain of the cell(i) is g(i)FS(i)-TS(i)
- FS(i) no. of nets which have cell i as their
only F cell - TE(i) no. of nets which contain i and have an
empty T side - Requires O(P) work to initialize
- net is critical before the move if F(n)1 or
T(n)0 or T(n)1 - F(n) 0 does not occur because base cell on F
side before - net is critical after the move if T(n)1 or
F(n)0 or F(n)1 - T(n) 0 does not occur because base cell on T
side before
30Propositions
- 1)The total amount of work required to maintain
each bucket array is O(P) per pass. - 2)Initialization of all cell gains requires O(P)
work. - 3)No more than four update operations per net are
performed during one pass of the algorithm. - 4)The total work required to initialize and
maintain cell gains is O(P) per pass. - Theoremthe minimization algorithm requires O(P)
time to complete one pass.
31The interactive, visual bi-partitioning
environment
- Developed and tested in Java
- Netlists are loaded in two formats-.net and
.mon(my own netlist) - The .mon format retains partition and clustering
information not available in .net files - The control panel provides several methods by
which to view the netlist and the current state
of the partitioning - controls for aborting, suspending, and resume
algorithm execution
32Control panel
33Cutsize and the Partition size over time
34The number of nets connected to each node. The
number of nodes connected to each net.
35References
- Lecture notes from eecs244 course of Prof.Kurt
Keutzer from berkley. - Interactive Visual Environment for Bipartitioning
Algorithm Development . CS294-7 Project Report,by
James S. Young - ASIC by smith.