Genetic Algorithms vs Sim ulated Annealing A

Comparison of Approac hes or f Solving the C ircuit

P artitioning roblem P

b y

Theo dore W Manik as

James T C ain

T ec hnical Rep ort

y

Departmen t f o E lectrical Engineering

The niv U ersit y o f P ittsburgh

Pittsburgh P A

Abstract

An imp ortan t s tage in circuit design is plac ement here w comp onen ts are assigned

to ph ysical lo cations on a c hip A p opular con temp orary metho d for placemen tis

the use of simulate daenn aling While this approac h has b een sho wn to pro duce o g o d

placemen t solutions recen tw in genetic lgorithms a has pro duced promising results

The purp ose of this study is to determine whic h approac h ill w result in b tter e placemen t

solutions

A implid s mo del of the placemen t problem cir cuit p artitioning as tested on

three circuits with b th o a g enetic lgorithm a and a sim ulated annealing lgorithm a

When compared with sim ulated annealing the enetic g algorithm w as found o t pro duce

similar results for one circuit and b e tter results for the ther o t w o circuits Based on

these results genetic algorithms ma y lso a y ield b tter e results than sim ulated annealing

when applied to the placemen t problem

ork

MaGroup A

Group B

Figure Graph represen tation of circuit artitioning p

In tro duction

An imp o rtan t stage in circuit design is plac ement where comp onen ts are a ssigned to ph ysical

lo cations on a c hip A p opular con temp orary metho d for placemen t is the use of simulate d

anne aling ec hen While t his approac h as h pro duced go o d results recen tw ork in ge

netic algorithms has also pro duced promising results Coho on Shaho o k ar Sait

The purp ose of this study is to determine whic h approac h genetic lgorithms a or sim ulated

annealing will result in b etter placemen t solutions

A simple mo del of the placemen t roblem p is the cuit p artitioning problem A circuit

ma y b e represen ted b y a graph GV where the v ertex set V represen ts the comp onen ts

of the circuit and edge set E represen ts the in terconnections b et w een c omp nen o ts The par

titioning pro cess splits the circuit i n to groups o f r elativ ely equal sizes he T ob jectiv e is assign

comp onen ts to groups s uc htatth he n um ber of in terconnections b et w een groups is minim al

An example of a c ircuit partition is sho wn in Figure The n um ber fo in terconnections

bet w een groups is called a cutsize h us thegalo istomiiinm ze the c utsize

P artitioning w as tested on three circuits u sing b oth genetic a lgorithm nd a sim ulated

annealing approac hes This rep ort describ es the metho d u sed for t his exp erimen t

discusses the results

and

cir Metho d

Both a genetic algorithm and sim ulated annealing approac hw ere tested on a set of circuits

This c hapter explains b o th approac hes and d escrib es the metho d used for testing these

approac hes

Genetic Algorithm

A g enetic algorithm olland is an iterativ e pro cedure that main tains a p o pulation of

individuals these individuals are candidate solutions to the problem b eing solv ed Eac h

iteration of the algorithm is called a gener ation During eac h generation he t individuals

of the curren t p opulation are rated for their ectiv eness as solutions Based on these

ratings a new p o pulation of candidate solutions is formed using p s eci genetic op erators

Eac h individual is represen ted b y a string or chr omosome ca h string consists of c haracters

genes whic hha v e sp e ci v alues al leles The rdering o o f c haracters on the string is

signian t the p s eci p sitions o on the string are called lo ci

A genetic algorithm for artitioning p ased b on Bui pproac a h w as used for this study

igure A raph g partitioning solution is enco ded s a a binary string of C genes where C

total n um b er of omp c onen ts Eac h gene represen ts a comp nen o t and the allele represen ts

the group or where the comp onen t is ssigned a F or example the c hromosome

represen ts a raph g of e comp nen o ts comp onen ts nd a re a in partition while comp o

nen ts and a re in partition The f ollo wing sections explain the steps of the genetic

algorithm

Create Initial P opulation

A p opulation of P c hromosomes are randomly generated to create an initial p opulation

C

Individuals are created b y enerating g a random n um b er n i t h

individual m ust represen ta valid partitioning solution Av alid partitioning solution is

b alanc e dac h g roup has appro ximately the same n ber of pocom enn ts

Select P aren ts

Eac h individual has a ness value ihc h s i a measure of the qualit y of the solution

represen ted b y the individual The form ula from B ui s i u sed to calculate the ness v alue

F for individual i

um

eac to range he

GENETIC ALGORITHM

b egin

create initial p opulation of size P

rep eat

select paren t nd a paren t from the p opulation

opring crosso v eraren t paren t

m utationpring

up date p opulation

un til stopping criteria met

rep ort the b est answ er

Figure Genetic a lgorithm

C C

w b

F C C

i w i

where C is the largest cutsize in the p opulation C is the smallest utsize c in the p opu

w b

lation and C is the cutsize f o ndividual i i

i

Eac h individual is considered for selection as a p ar the probabilit y of selection of

a particular individual is prop ortional t o ts i ness v alue Bui recomme nds that the

probabilit y hat t the b est individual is c hosen should b e times the probabilit y that the w orst

individual is c hosen Th us the P c hromosomes are sorted in ascending order according to

their ness v alues and a probabilit y distribution function i s created The probabilit y factor

r is found b y

P

r

Assume that the probabilities assigned to eac h i ndividual is a eometric g progression

where the sum of all these probabilities S en b y

P

r

P

S r r r

r

Therefore the probabilit y hatt c hromosome i is selected Pr f i g sfondu b y

giv is

ent

endParent 1

0 1 1 0 1 0 1

Parent 2

1 1 0 1 0 1 1

Offspring 1 0 1 1 1 0 1 1

Offspring 2 0 1 1 0 1 0 0

Figure Crosso v er example

i

r

Pr f i g

S

Crosso v er

After t w o aren p ts are selected ossover is p erformed on the aren p ts to create t w o o

spring Ac hromosome split p in o t is randomly selected nd a is used to split eac h paren t

c hromosome in half The st opring i s created b y concatenating the left h alf f o the st

paren t and the righ t alf h of the second p aren t while the second opring i s created b y con

catenating the left half of the rst aren p t a nd the c omplement of the righ t h of t

paren t An example of crosso v er is sho wn in Figure

Mutation

Eac h opring m ust meet the same constrain ts as its aren p ts the n um b r e o f ones and

zero es in the bit attern p s hould b e n early equal Ho w ev er the crosso v er op eration ma y

pro duce an opring that do not meet this requiremen t An opring is altered via mutation

whic h randomly adjusts bits in the opring so that i ts bit p attern is v T m utation

pro cedure determines the v alue b whic h s i the absolute v alue of the d irence i n the n um ber

of ones and zero es A bit lo cation on the opring is randomly elected s then starting at that

lo cation b bits are compleme n ted ero es b ecome ones ones b ecome zero es This op eration

results in opring that r epresen tv alid partitions

Up date P opulation

he alid

second he alf

crThe creation of t w o pring o increases the size o f the p pulation o to P S ince w ew an t

to main tain a c onstain t p opulation size f o P w o individuals will need to b e eliminated from

the p opulation The goal of the algorithm i s to con v erge to the b est qualit y solution th us

the t w o individuals with the lo w est ness v alues are remo v ed from the p opulation

Stopping riteria C

Bui uses a swing value W o t d etermine when the algorithm stops If there is n o

impro v em en t after W generations then the algorithm stops No impr ovement means that

there are no c hanges in the maxim um ness v alue of the p opulation The al solution is

the individual with the ighest h ness v alue

Sim ulated Annealing

Sim ulated annealing irkpatric k is an iterativ e ro p cedure that con tin uously up dates

one candidate solution un til a termination condition s i reac hed Asim ulated annealing

algorithm for circuit partitioning w as created nd a is sho wn in Figure A andidate c solution

is randomly generated and the algorithm starts a t a high starting t emp erature T The

follo wing sections explain the steps of the sim ulated annealing algorithm

Calculate Gain

The gain of a p artitioning solution is calculated b y use of the r atio cut formula ei

cutsiz e

Gain

j A j j B j

where j A j eh n ber of v ertices in group A nd a j B j the n um ber of v ertices in

group B

Accepting V ertex Mo v es

M is the n um ber of move states p er iteration F or eac hmo v e state a v ertex is randomly

selected as a candidate o t mo v e from its original group to the other group When a v ertex V

is randomly selected for m o v em en t f rom one p artition to another its or e or a cceptance of

sc

um

b egin

T T

t t

stop s

Curren t Gain C alculate Gain

while t do

stop

Accept Mo v e F ALSE

for i to M do

randomly select v ertex V to mo v e f rom one artition p to another

New Gain Calculate Gain

Gain New Gain C ur r Gain

if Accept Gain Change Gain then

Curren t Gain ew N

Accept Mo v e TR UE

else

return V to original partition

if Accept v e then

t t

stop s

else

t t

stop stop

T T

Figure Sim ulated annealing algorithm

end

Mo

Gain

entA c c ept Gain Change Gain

b egin

if mo v e r esults in un balanced partition then

reject mo v e

else if Gain then

accept mo v e

else

R random n um ber

Gain

T

Y e

R Y then

accept mo v e

else

reject mo v e

Figure Sim ulated annealing scoring function

mo v e is ev aluated according to t he function sho wn in Figure A o m v e s i alw a ys rejected

if it will result in an un balanced partition while a o m v e s i alw a ys accepted if it will impro v e

the solution Otherwise a mo v e is randomly a ccepted with the probabilit y f o acceptance

dep enden t o n the system temp erature T The higher the temp erature the greater the prob

abilit y that an inferior mo v e w ill b e selected This ro p cess allo ws the candidate solution to

explore more regions of the solution space at the early stages of the a lgorithm The o b jectiv e

is to k eep the solution from con v erging to a lo cal ptim o um

Stopping riteria C

After eac h iteration the temp erature T i s scaled b ya c o oling factor w here

The algorithm stops if there ha v e b een no c hanges to the solution a fter t iterations

s

Exp erimen t nd a Results

Three circuits w ere elected s for data sets the g raphical represen tations o f these circuits are

sho wn in Figures nd a F or the genetic lgorithmhe a p pulation o size P and swing

v alue W w v aried during testing F or sim ulated annealing the starting temp erature T

co oling factor um ber of mo v e state M and stopping v alue t ere v aried d uring testing

s

Eac h set of parameter com binations f orms a tr e atment there w ere appro ximately trials

ere

end

if

Circuit P W

f g f g

f g f g

f g f g

T able Exp erimen tal parameter ranges for t he genetic a lgorithm

Circuit T M t

s

f g f g f g f g

f g f g f g f g

f g f g f g f g

T able Exp erimen tal parameter ranges for sim ulated annealing

p er treatmen t The parameter ranges used for eac h circuit are sho wn in T able for the

genetic algorithm and in T able for the sim ulated annealing algorithm

F or eac h raph g the ean m cutsizes of the g enetic a lgorithm and sim ulated annealing are

compared W ew t o t estimate the dirences b et w een the m eans with a degree of

conence According o t F reund i f x and x t v alues f o the means of i ndep enden t

random samples of size n and n from the n ormal p opulations with kno wn v ariances

then

s s

x x z x x z

n n n n

is a conence in terv al for the dirence b et w een he t p pulation o means

F or a conence in terv al s o a nd F rom

the zables for standard ormal n distribution able I I I in F reund z F or this

study index refers to the genetic algorithm while ndex i refers to the sim ulated annealing

metho d T able s ho ws the results whic h re a used to calculate the conence in terv als A

bar graph that compares the mean cutsizes i s sho wn in Figure

F or data set the conence in terv al is

Circuit x n x n

T able T able of results

and

he are

an

Mean Cutsizes

9

8

7

6

5

4

3

2

1

0

Circuit 1 Circuit 2 Circuit 3

Genetic Algorithm

Simulated Annealing

Figure Comparison f o ean m cutsizes

Since b oth limits are negativ e w e can conclude t hat with onence c the genetic

algorithm pro uces d a solution ith w a smaller a v erage cutsize than sim ulated annealing

F or data set the conence in terv al is

Both limits are p o sitiv e but the irence d is less than one Since cutsizes are in teger

v alues no signian t dirence can b e found b e t w een the genetic algorithm a nd sim ulated

annealing

F or data set the conence in terv al is

Since b oth limits are negativ e w e can conclude t hat with onence c the genetic

algorithm pro uces d a solution ith w a smaller a v erage cutsize than sim ulated annealing

Th us the genetic a lgorithm pro duced a smaller a v erage cutsize than sim ulated annealing

for circuits and while no s ignian t dirence w as found b et w een the metho ds when

applied to circuit

1 3

2 4

5

Figure raph G

1

9

2

10

3

11

4

12

5 13

6

14

7

15

8

16

Figure raph G

Conclusion

Based on the results of the tudy s the genetic algorithm w as sho wn to pro duce solutions equal

to or b etter than sim ulated annealing when applied to the circuit partitioning problem

Recall that the circuit partitioning problem w as used to mo del the placemen t roblem p

Sim ulated annealing is a p opular con temp orary placemen t m etho d ho w er t he results of

this study indicate that genetic algorithms ma y lead to b etter results

References

Sec hen C and angio S v anniincen telli A The Tim b erW olf lacemen P t and Routing

P ac k age IEEE Journal of Solidtate Cir cuits ol S C No p p April

Coho on J nd a P aris W Genetic lacemen P t IEEE T r ans on Computer ide d

Design of Inte gr ate dCir cuits ol AD C No p p No v em ber

Shaho ok ar K nd a Mazumder P Genetic Approac h to tandard S Cell Placemen t

Using Metaenetic P arameter Optimization IEEE T r ans on Computer ide d Design

of Inte gr d Cir cuits ol No p p Ma y

Sait et al iming Driv en Genetic lgorithm A for S tandardell P lacemen t In Pr o c

th Pho enix Conf on C omputers and Communic ations p p IEEE

Holland John H A daptation in Natur al and A rtiial Systems A n Intr o ductory A nalysis

with Applic ations to Biolo gy Contr ol and A rtiial Intel ligenc inv e ersit y f o Mic higan

Press

Bui T and Mo on B enetic Algorithms for Graph B isection T ec hnical Rep ort

CS P ennsylv ania State Univ ersit y Dept of Computer Science April

Kirkpatric k Gelatt and V ecc hi ptimization b ySmi ulated Annealing Scienc e ol

No p p Ma y

W ei Y and Cheng C Ratio Cut P artitioning for Hierarc hical Designs IEEE T r

on Computer ide d esign D of Inte gr ate dCir cuits ol No pp July

F reund John Mathematic al Statistics hapter P ren ticeall th edition

ans

ate

ev1 4 7 10 13

2 5 8 11 14

3 6 9 12 15

Figure raph G

## Comments 0

Log in to post a comment