42 Pages

Lecture 5 Spanning Tree Algorithms

Course: ECTE 962, Fall 2009
School: Allan Hancock College
Rating:
 
 
 
 
 

Word Count: 1705

Document Preview

C Minim Algorithm um ost s Whe sim x is too difficult n ple C putation of Table om au putation for a LP Wewill focus on thecom proble m udocodefor a com r programto writea pute Thepse ne table give that wehavea basic fe w au, n asible solution could beas follows e ct n st S le colum with highe valueof zj cj. This is colum k (Pk to beintroduce n d) e ct ctor in S le basis ve with m xi/xik for xik > 0....

Register Now

Unformatted Document Excerpt

Coursehero >> California >> Allan Hancock College >> ECTE 962

Course Hero has millions of student submitted documents similar to the one
below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.

Course Hero has millions of student submitted documents similar to the one below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.
C Minim Algorithm um ost s Whe sim x is too difficult n ple C putation of Table om au putation for a LP Wewill focus on thecom proble m udocodefor a com r programto writea pute Thepse ne table give that wehavea basic fe w au, n asible solution could beas follows e ct n st S le colum with highe valueof zj cj. This is colum k (Pk to beintroduce n d) e ct ctor in S le basis ve with m xi/xik for xik > 0. This is basis ve l (Pl to bere ove frombasis) ctor m d i l xij = xij xlj*xik/xlk (transform ations for ve ctors P0 to Pn) xkj = xlj/xlk z = c1x1 + c2x2 + ...+cmxm Num r of C be alculations Thefirst com parison should taken ste ps These cond com parison should takemste ps Thetransform ation take m + 1) ste s (n ps Thecalculation of z take mste s ps Ne twork Proble m be ps (n Thetotal num r of ste is n + m+ m + 1) + m = m + 3m+ n n twork proble , thenum r of constraints m be I n a ne is like to bee ly qual to thenum r of links, L, and be thenum r of variable m bethenum r of be s ight be flows plus constraints, pe rhaps N(N 1) + L LargeNe twork Thus thetotal num r of ste would beLN2 be ps LN + L2 + N2 + 4L N n twork be e ve large (e N = com s ry , g Whe thene 1000, L = 3000) this is dom inate by LN2 d e I f weassum that L is proportional to N, wehave com puting tim ~ N3 e Num r of Ite be rations be quire is ofte of d n Thenum r of basic solutions re theorde of N to 3N r ake ple e This m s thecom tesolution tim for such a proble ~ N4 m Tim C ple e om xity I n shorthand wesay com puting tim is O(N4) e r s Othe possibilitie areO(2N), O(N!) and O(NN) n , se r r ple s Whe N is large the highe orde com xitie m it im ake practicableto solvein re asonabletim e C putation Tim om e Orde of com xity r ple O(N2) O(N4) O(2N) O(N!) O(NN) Tim for N = 100 with 1 e GHz m achine 10-5 se conds 10-1 se conds 4*1013 ye ars - Polynom Proble s ial m ple e Wearelucky that thesim x m thod is "polynom in tim com xity ial" e ple m d asily Not all proble s can besolve so e se dge With our pre nt stateof knowle , weclassify proble s as follows m C s of Proble s lasse m m ial e Easy proble s polynom in tim m Probably difficult proble s O(2N) algorithmis known, but it is not known whe r a polynom the ial algorithme xists m re I ntractableproble s wecan provethe is no polynom algorithm ial cidableproble s cannot besolve m d Unde Probably Difficult Proble s m se m long to a class of proble s calle m d The proble s be "NP com te or "NP hard" ple " a re ing d This is an are whe a lot of work is be carrie out by m m athe aticians s re Weavoid such algorithm whe wecan Lim on I te it rations be xtre e Thenum r of e m points on a solution space for a sim x proble is thenum r of ways we ple m be can se ct mbasic ve le ctors fromn ve ctors This is n n! = m (n - m)!m! ore ial This is m than polynom Num r of Route be s rage be Theave num r of links in a routewill be be e N and N twe n ach , be At e nodein a route thenum r of possible ne hops will be(L/N - 1) on theave . I n a xt rage re alistic ne twork this will bebe e about 2 twe n o be s S thenum r of possibleroute will beof the orde of 2N to 2N r LargeNum rs of Route be s o m s ach S a proble which include a condition for e possibleroutewill beprobably difficult re any s The areso m ways of putting theroute toge r that theproble can be e the m com astronom ically large Avoiding theNP C ple om te e ve ple e Wese that e n thesim x m thod could involve us in NP com tealgorithm ple s Wehavetwo ways of avoiding this situation spe cialist solutions to particular proble s and m he uristics Minim S al panning Tre e a cialist algorithm is "m al s inim Oneare for spe spanning tre s" e cte cte I n a conne d, undire d graph which has costs associate with e e , find thetre which d ach dge e conne all thenode so that thetotal cost of the cts s e s use is m ise dge d inim d Minim S al panning Tre e ost ngth in this spanning tre e C = le Minim S al panning Tre e re ve s The arese ral algorithm for finding the m al spanning tre inim e y pe sult alle The de nd on there that st thesm cost e incide to any nodeof G is a part of any dge nt m al spanning tre inim e Prim Algorithm 's tarts fromonenodeand adds ne e s to the w dge S e xisting tre until it include n 1 e s e s dge i is de d as thecost of thee be e one fine dge twe n nodewithin thee xisting tre and onenode ni, not e , ye include t d i = ni Prim Algorithm 's aintain value of s During thealgorithmwem and for e nodenot ye in thetre ach t e ach ration wechoosethelowe cost e st dge At e ite crossing fromthetre to there of thegraph, and e st thenodeto which it conne cts Prim Algorithm 's k=1 te e S p 1: Find thenodenj* not in thetre , such that j* = m j). Movenodenj* and thee in( dge conne cting it, into thetre e te S p 2: If k = n 1, stop te e in( s S p 3: S t j = m j, cjj*) for all node not in thetre . S t k = k + 1 and re e e turn to ste 1 p Exam ple n1 2 n2 3 1 7 n3 5 8 4 n5 6 n4 inim Find m al spanning tre for this e ne twork dge Thee costs are shown tart S with noden5 First I te ration n1 2 n2 3 1 7 n3 5 8 4 n5 6 n4 Valueof , = 1, 2, 3, = , , 5, hoosen = 4 C = 1, 2, 3 = 6, 3, 5 4 4 S cond Ite e ration n1 2 n2 3 1 7 n3 5 8 4 n5 6 n4 Valueof , = 1, 2, 3 = 6, 3, 5 hoosen = 2 C = 1, 3 = 2, 5 Third Ite ration n1 2 n2 3 1 7 n3 5 8 4 n5 6 n4 Valueof , = 1, 3 = 2, 5 hoosen = 1 C =3 =1 Fourth I te ration n1 2 n2 3 1 7 n3 5 8 4 n5 6 n4 Valueof , =3 =1 Only choiceis n = 3 UniqueS olution? sult e ve There will bethesam , whate r nodewe start from ve e e re Howe r, if som link costs arethesam , the m bem than onem al spanning tre ay ore inim e C ple of Algorithm om xity te quirea num r of ope be rations S ps 1 and 3 re proportional to n at theworst re rations The aren 1 ite re ple The forethecom xity is O(n2) C TV able le m inim e I n te com unications, them al spanning tre is re quire to de how to providecableTV to a d cide se of custom rs t e e s ach Thesam traffic flow passe along e link, and thele ngth of therouteis not im portant Lowe Cost Path st n twork, we Whe weroutetraffic through a ne want to do so with thelowe possiblecost st d rtain cost and the Each link is associate with a ce proble is to find theroutewith thelowe cost m st froma sourcenodeto any (all) othe node r s S horte Path Algorithm st s e ral s e d, S ve algorithm havebe n propose such as the Be an-Ford, algorithmand Floyd's algorithm llm ost ly d Probably them wide use algorithmis theone propose by Dijkstra d Dijkstra's...