El Lenguaje de Programación C 2a Edición Kernighan, Brian W., Ritchie, Dennis
Kernighan lin
-
Upload
tanvi-prabhu-dessai -
Category
Data & Analytics
-
view
282 -
download
0
Transcript of Kernighan lin
Kernighan-Lin Method
What is it?
• Kernighan-Lin is a method of partitioning a graph containing nodes and vertices into separate subsets that are connected together in an optimal manner. Since a graph can be used to represent an electrical network containing blocks, the Kernighan-Lin algorithm can be extended to partitioning circuits into sub-circuits.
Application
• Important application to VLSI circuits. Used to find minimal numbers of connections between partitions to improve speed or decrease power consumption.
• Kernighan-Lin is an iterative algorithm. This means that the graph/circuit may already be partitioned, but application of Kernighan-Lin will try to improve or optimize the partition. Kernighan-Lin is iterative as opposed to constructive.
• Kernighan-Lin is a greedy algorithm. This means the algorithm will make changes if there is a benefit right away without consideration to other possible ways of obtaining an optimal solution.
• Kernighan-Lin is a deterministic algorithm because the same result will be achieved every time the algorithm is applied. The same result will be the same number of nets crossing the bisection, but not necessarily the same nets.
• One bisection or cut is made to the partition only, so partitioning using Kernighan-Lin will result in only two partitions. Partitions must be equal size.
Steps…
• Draw a line separating your graph into two halves (partitions) with an equal number of vertices (blocks or cells) in each partition.• Count the number of edges that cross the
line. This number is called your net cut and the goal is to decrease this number. In terms of VLSI circuits, you will be decreasing the number of connections between blocks, which could increase the speed of the circuit, decrease power consumption, and depict other desirable results.
• Find the edge cost of all vertices in the graph. Finding edge cost is done by finding the number of connections each vertex has within its own partition and subtracting that from the number of connections each vertex has with vertices in the other partition.
• Determine the maximum gain by swapping any two nodes. The gain equation is given below:
G = D1 + D2 – 2C12
• Swap the two nodes with the maximum gain. Note that if all node pairing gains have been calculated and the maximum gain is zero or negative, the nodes with the highest gain should still be swapped.• Subtract the gain from the original net cut
to get the new net cut.• Fix the nodes that were just swapped in
place• Repeat steps until the maximum gain is
zero or negative
Advantage
• Algorithm is Robust.
Disadvantages• Results are random because the algorithm
starts with a random partition• Computationally intensive which makes the
algorithm slow• Only two partitions are created• Partitions have to be equal in size so the
algorithm does not attempt to find optimal partition sizes when they may (and probably do) exist• Does not allow cells to remain fixed in place
when they may need to be for timing or other reasons
• Does not solve problems with weighted edges very well• Solution largely dependant on the first
swap
Solved Example
• After initial partitioning
Step 1:Initial
PartitionA={ 2, 3, 4 } B={ 1, 5, 6 }
Step 2: Compute D
Partition A Ea Ia Compute D Partition B Eb Ib Compute D2
2 1 2 -1 1 1 0 1
3 0 1 -1 5 1 1 0
4 2 1 1 6 1 1 0
Step 3: Computing GainPossible Pairs C(a,b) Gain
G21 1 -2G25 0 -1G26 0 -1G31 0 0G35 0 -1G36 0 -1G41 0 2G45 1 -1G46 1 -1
Largest G value G41 = +2
A' = A' - { 4 } = { 2, 3 }B' = B' = { 1 } = { 5, 6 }
Iteration 2:
D values connected to ( 4, 1) are 2 in A'
5, 6 in B'
Step 1:Computing
new DA' B' CA'4 CA'1 CB'4 CB'12 5 1 1 1 03 6 0 0 1 0
D'2 -1D'5 -2D'6 -2
Computing Gain
Step 2:Possible
Pairs C(a,b) GainG25 0 -4G26 0 -2G35 0 -3G36 0 -3
Since all Gain values are equal, we arbitrarily choose any one,
A' = A' - { 3 } = { 2 }B' = B' - { 6 } = { 5 }
we choose G36
Iteration 3:( 3 , 6 ) connected to 2 in A'and 5 in B'
Step 1:Computing new D
A' B' CA'3 CA'6 CB'3 CB'62 5 1 0 0 1
D''2 0D''5 0
Therefore last pair (2,5) and gain is 1
Determining KStep 5: G1 = +2
G2 = -3 i.e G1 + G2 = -1
G3 = 1 G1 + G2 + G3 = 0
References:
• COMPARATIVE STUDY OF CIRCUIT PARTITIONING ALGORITHMS Zoltan Baruch1, Octavian Creţ2, Kalman Pusztai3 .
• Network decomposition using Kernighan Lin strategy aided harmony search algorithm G.A. Ezhilarasi,K.S.Swarup.
Thank You