You are on page 1of 237
pyar lala ede Edexcel AS and A Level Modular Mathematics D | ons Use LiveText to view the textbook onscreen and access the additional resources. (« >) Use these buttons to turn the pages. eg Use the hotspots on the pages themselves to launch extra content. Or click on the ‘Resources’ button to explore the resources for the lessons. Baiting This product requires MathPlayerTM or other MathML renderer to be installed. Welcome to LiveText This CD-ROM has been created to make it even easier for you to study Decision Mathematics 1 and to revise for the unit examination. Every question in the textbook has its worked solution in Solutionbank. Exam Café is a unique resource with comprehensive exam practice and guidance from examiners. Edexcel AS and A-level Modular Mathematics Pre Cra Alter completing this chapter you should be able to: 1 use and understand an algorithm given in words 2 understand how flow charts can be used to describe algorithms 3 camy out a bubble sort, quick sort and binary sort carry out the three bin packing algorithms and understand their strengths and weaknesses Algorithms An algorithm is a predise set of instructions that is 30 dear that itwillallowr anyone, or even a computer, to use # to achieve a particular Goal ina specified number of steps. Ideally, an algorithm should bewritten in such a way that itis easy to convert into a computer program, There are strong links between the development, of computer technology and the development of Decision Mathematics Although we shall only be looking st srrall- “scale examples, remember that most of the “algorithms in this book have been developed to enable computers to solve large-scale problers, OUTER | .] Youneed to be able to understand and use an algorithm given in ward, You have bean using algorithms singe you started school, Some examples of mathematical algorithms you have bean taught are + howto add several wo digit numbers + haw to muy two twostigit numbers | > howto ad, subtract, multiply or divide ragions, It econ be quite challenging to wre st of instructions that would enable @ young eit to dothesetads arredty Here are some mare examples. ‘Ate end ou ea tn sehen {gostraight over the ems road, tale She third ater the schoo), then, ice two larg: onions Slice 100g rmchanorte Grate Oi gcheese Altec tase D0 leg @) ang mw) and ‘You wil not have towsteslgontins in the ecamination. You lllneed to maplanent ther, The tay agri s ite comany integer {saw ap end te san oe ares + continue wi hisramber ‘+ sepeat untl either theanswer is 1 (in which case the number is happy’) or until you get ‘rappel in a cycle Gra which casethe rmurnter is ‘not happy’) show that a Dishappy b disunhapgy. a P+ =49 b #=8 =| e+ P= a e+ ene += 60 e+ ress Ol Pt F+E=10 + 89 TI += BPMs Tt 0 70 is happy fee e ear || #42 =20 Ete bl a= 6 — 5046 unhappy algorthne Implement this algeuthn, Vletn= 14-1221 2 Wate down and 2letC=A+E ahd c Th Ingncton tos cong Sletnant1a + rephcen by n+ 1 (did 1 109) 2 take: 82 curent ali 6 En <8 gotos, Babes Ce curent value, 7 En=Ssep, Ir Atrcatable E used ” Use trace table, tr the vals of ach varie ae | insertion Wee Gece einer Hep a AES eae 1 tia 2 "1 3 2 - 2 oo 5 2[1[2 Soe coranehee @_[ovoateps cane ES 2 3 oe 4 3 3 al2}s @___[Gavosteps 3 3 | 4 5 5 Alesalee @ | Gotoateps 3 8 4 2 2 oe Young teased @ | Continue step? pase eoee aos 7 [top ‘This algorithm produces the first few numbers in the Fizonnacoi sequence, ‘This algorithm multiplies the twn murabersA ard, 1 Make a table with two colurans White alin the top som of the Jef land cclumnand Bin the top sowof thesight hare ccluran, 2. in the smxt so othe table vaste + inthe left hard columsy the number that The frat slorthm ¢ someting: clad ‘stall 4, igooning rmainders is Retenpenanes Se rin orthe + iragtt londccan te numbertint SBE" mulipistion agora is double 2. Repeat step 2 until you seach the so which hasa 1in thelef band column, 4 Delete all ows where the susmberin the left hand ccluman is even. 5 Bier thesum of the nondeleted numbers in thesight Hand ealumn, ‘This is the product AB, Implement this algonthm when eu iui 2 a geese ng i ze | \, setpeman oie = ees ; = ea tae 0 29 XB4 = 986 Step 4 mare that all ewes share the: umber inthe et hare column i ven rit be debt before cumming the night hae colar, 0 06 X58 = 5696 algorthne 1 Wntethe factions in the fom @ ant § 2 ieten at 2B Lethe be 4 Pou answers f Implement tisalgenthn th te factions iQ ay Wat dos thisalganiehm dc? 2) a Implement thisagaith Tiedeinel rma Asm alawene Sueee. Hh 1 Wt does tseiontie oie’ 24 tnput 4,7. 5 lety “This algorithm requires 4 eee ae oe eee eee cow, eee Re! ee ee ca) ee ae Arp oermipes ose fea a Usea traetable toimplement the alyeritlim above when id= W8anir= 2, H A= Bands= 10, ih A427 ancdy = 50. 1b What does the algorithm produce? 4) Uke thealgorithm in ample 3 toraluate a Md x 125 b Bsx 244 256 123, ‘2 Youneed to be able to implernent an algorithm given in the forrn of a flow chart, 1m Flow charts are often used to design computer programs 1m Thare are three shapes of box es which are used in the examination, << and emai Dession, The boxer in a flow chart are linked by arrowed lines, mt Acwith an algorithm writte ‘words, you need te follow each step in order UTE | ws [lures z wet [Tazo £ wxs [rane Ea Bo axz {Sep fa Implement thisalgcnithm using a trace table, b slr box 4 tosead ‘Le E acting ae 2 counter. tencures that we stop after 10 tars. Adecco be will contain a question 2 hich the anawer é ether yore rf andlimplement the algorithm. again, Ho dos this alter the algorithm? - 1 E box & t E PRS oO oO 4 2 fo 4 3 no 2 [4 |e 2 | ¢ |» Dis |e@rs [ear 2 | 9 | he a to 4 42 no S 0 fo 2s 15. no 6 | 2 | w Selecmlire Fan |e [Fe 7alaanles e | « |» a | # | 2 ® Ld 9 27 no 2 20 | yee © Bo | yee Output i 2, 4, 6, 8,10, 12, 4.16, 18.20 Output & 5, 6,9, 12, 8,18, 21 24,27, 50 ‘This gues che first tem muteiples of B rather chanthe first ten rmubiples of 2 Ina trace ble each step murt be rade cae algorthne ‘This flow chast can be used to fie the roots of an equation of the fom a +x +c=0. an ao eco, | Demonstzate this algorithm for these equatices, add S- 1 bat br 49-0 dat + ae 48 IES & 6 4 [axle eo oa EE m9 a = e 4 [a a a <0F ea es 1 6 2 mo 3 3 Equal roots are x = 3. oF) linea 6 4 4 [acon 4 3 a | -no | yes No teal wore, = Zopiy elytra som by the ow hast onthe gh tote y= 10, wy = 15, = 9,4 = Zs = 11. This & quite complicated because: ‘What dogs the alyonitamn do? ithas questions and a let of data Tackle one tap at time | a [alt] real nese boat | 4 [10 baz | 2 ae bons 6 sie bond No boxe Ye Box 3 baz |S bond 2 eee box Yee box 2 Box S bone Ye bone | + Bee bons 7 aa Yes pox? [Dune Ourpure” A boo Z baxe Ye baz |S bond 4 ae No ‘The bow number have bean inciced ta help yout follow the algorithm, bone No Youds not nasd te include thar inthe eo EED examination. ‘The algorithm seleote the smallest: number from a let. 1) Apply the flow chact in Example tothe following equations a4 +9 =9 D6? +15 +5= 9 6 8H - & +11=9 algorthne 2) a Apply the flow ckast in Example tothe dllowing data. i y= 28, m= 26, = 23, me= 25, = 21 Wa y= 8,4 =9, 4-8 =S b itox assareed n> ‘how wil this affect the output? (© Which bor would nesd 10 be altered ifthe algorithm had to beapplied 10 a list of enue? 2) Buca’ algo sapped to ‘wo none integers gad a dpstyBecabalgedtuato tS 1 97,2 4,38 £ ah LAP mtegerpatat eb 1b What does the algorithin do? mat (ae) 44) The equation 2? + 2! — 15 sm = SE susing the chast opposite, a Used = 210 finda toot of the eatin b Used = 20 tofind a scotat the equation Whaat da you sctine? say be solved by the iteration “oy 2omiie>S [haate (Sm) De late= — OUTER | 1.3 You need to be able to carry aut a bubble sort. 1m Acommon data processing task is sorting an unordered list into alphabetical or numerical arder, Ina bubble sort we compare adjacent Items, Je Tepe omen algotn See 1 seratthe bighing ofthe Pesthrougnthe) (Eee can iitand ompueadecatvaies foraaa pare! | gaamebhetie abby tard fa eee ee “8 they are in order leave ther ‘Theelement’ inthe fet‘bubble to + thay are nt in order, swap them: theendof the et in thesa me way 2 When you gat tothe and of he lit, repeat stop 1. ewsttorspctihegme THe E 3 When a pass is completed without any sw aps, he "2 #he2!gorithm got As rare, lst isin order, ‘hea Dubble sort to assange thislistintoascendiny cater mw Bo Ub @ GEBI7 1 16 20 tet compareon: swap See eat ae Companion for one pas, Put GERD 16 20 _2ndconparsonbeae gnenly you wil oye Fequimd t give the state of 8 2a 49 20 Sed compancon: sa tbe ltateresch pee 8 24 th 20 thoomparson swap B24 1 1 Sthoomparzor: aap B24 1 1 20.O7 _ Emoffretpase After the second pass the list becomes foc 8 1 1% 24 0 37 st After bhe tht pass the bebe Thine ot as won The N15 8 24 30 37 SER OREL SI. The fourth pass produoes no swaps, so the list is in order, algorthne ‘Ubea bubble sort to asainge these letters intoalphabetica ender ALG OR ITT HM ‘After one passat ast the ast Aftertopass AG LO | RH M Too fiegnemmet nie Mar2pae A OL 1 OW MR TN seceseontian amt Laterordpass KO 1 LH MO RT | Meer molterarein Merdth pues A @ | HL MO RT sfterothpacs A @ OH | LM ORT AfterOth pace A GH | L MOK Tee Nbstop, 0 ktisinoner Be camful not to ‘bse! any item daring the son! ‘hea Dubble sort to assnye these numbers into demening orden, B 7 mR 3 1 Mm 48 CBR 20 7 049 20<8750 snap eX D207 2440 29< 720 en 97 GS EDT 24.40 50% 20soleaw 97 72 3060 B24 48 0941750 base 97 72.30. 9K7 Bae 17 < 2450 map 97 72.30.20 CT AD 17 < 40s0-2Nap 97 72 30.20 24 48 7 Aftertet pass: 97 72 09 59 24.48 7 Afver 2nd pase: 72 97 99.59 40 24 7 CERES between thatwo 33. Do at trent the Wo 20: Aver Std pass: 72 97 39 49 59 24 7 |_Afterstth pase: 72 97 48 39 29 24 7 No swaps in neve pase, $0 list i morder. OUTER | 14. You need to be able to carry out a quick sort. we Als name sugges, 2 quik sort is quick and ef dent, Mepesencraghot maierspittietenstMtowoanut ae. those then the pivot and those greater than the pivot oe | Risteaecn abit cuaerumer ni 1m Hore isthe quick sort algorth m, used to sort alist into ascending ord a, 1 Choose the item at the mid-point of the ist to Ifthe let tas an even number af be the fir pivot “nr eek SEB item to the Aight of the mide 2 Write down allthe tems that are less than the Pivot, keeping their order 3 Write down the pivat 4 Wirite down the remaining ems (thase greater than the pivot in asub.list 5 Apply steps 7 to dte each cubist 6 Whan all tamshave been chosen a: pivots, stop, “hie & 2 recurve algorithm. tee Tie ‘rooming in’ on the ewer. The number of pivotshasthe potential to double at each pate. There ie 1 pivot at th etirst pe, Pass, there could be 2 at thesecond, 4 at the third, 8 at the fourth, and so on, ‘iar abe wet nt ascending, or cescending, omer Gee Bampk 11). ‘isa que ot to anenge the nuns bow ini mending ode, 2 4M 2 9 2 Re mw “Th se tn fe found by 241} und w tree 224 2 20D) 1B 8 39 oo “Theme am 9 numbers inthe let so the 21 8 miata [241] = 5, nen ieee ee i. ‘Wineallthe numba bebw 2 SIM 21 5 Bl 21 a2 2 20 SBS pasttapnet oe Now add memaining number a @ s Bw 2 @ 0 ot” coe ee [5] @b a] @b 42 GB) 28 theme are now foursub-lets 50 we schoore 4 pivots (ringed), ae 25] GD BE] we canontycncore topos the tne ng, 3839 42 Spach umber hae bean chosen as 2 phot, so the it & ine (3 21 29 24 ot algorthne ‘Ube quick sort to aurange thelist belon into descending ceder. 37 20 17 26 44 41 27 28 SO 17 ThersaretDitene in thelet:o ieehooee the nur bert the Mo the midi. Thee the numb rom th et 37 20 7 26 44 Gil) 27 20 50 7 (SE 20 TF 26 AK AD 27 22 50 urna grater than the phot arto tha bof the pot theca “OM 727 ww es Erol thon the plot ame the fight, feep ng the euriber inorder Noro ental 20 the vot may o> either side, but Imust Be aah wth consent |) @ yo & 20 Be] w a Bn @ =e Fa SD EAE] Eo Now tse pinot re coated ss 50 44 #1 37m 27 26 wo OP hats ewan thesUb TE Wo plots are chosen, one for each sublet Tharfral phos are chosen © che the et in onder (Colours wed here to male the method clear, but (olen: shoudl ot he weet in the earn, 41) Tee thebubble sort to arrange the list @a4 65 7 2 into a ascencling cuder, b demending creer, 2) Urea quick sont to-auange the List 2 oy s 0 1 bo M7 into a ascending cuter, b demending creer, 2) Scat the levers below into alphabetical ender using a abubblesort, D aguick oot NHR KF 8 C J EMPL 4A) The is chowe thetes sels of a group of students, dix 2 Hyp 9 ‘Aison $6 Janelle 6 Amy 9% Josh 7 gone Sl Lay 7 Dom 77 Myler B | Gey 81 Sam B Hasy 4 Sophie 77 Preducea lin of students, ndenending cer of thie manks using a abubble sort, D aquicksar OUTER | eee ceictanerocnonnaseag eg | sae, aguctoan, Sumy emp iso m0 0S Be Se we 46s aL or te Ma a MF a m3 a2 aL “7 23 7 au oo os Baas 22 The quent 482 02 9 868 Mt 65 471 990 76 as ec | Me ot oe wo eS? evince tthe two abonituas He SIP 2 231 oe 1.5. You need to be able to implement a binary search. im Abinary search will search an ordered fst ta tind out ‘thet ienot order you may ‘whether a particular tem i inthe Bat ite nthe bat, fave to usea seningabartim ie wil locate itz postion inthe bt i im Abinary search concentrate: on themid:point of an The mie: point found in exactly ‘everhabing lit sR ievery quick the sme ney forthe auch Were i theinary seat algorithm, To sear an ordered lst of nitemstoratarget 7 1 select mide te nt tn (use 2-2 and round up itm acesny 21H T=0,thetrgetis located and the search is complete, U1 Tisbetore ay, eannot be inthe send hat ot the is, so that hal and are ciscardes Foeie meer mas Mi Tis after m, iteannot bein the first half of, pee erat the list, so that half, and m, are discarded: 2 Repeat stops 1 and 2to the remaining let until Tisfound, CF Tienot found iis notin thelist) ‘Ube the binary searchalgonitm to ty 40 locate a Robinson, D Davies inthe list below, Loree Remnemberthata saarch can be 2 Blackstock, Ureurcestul You tay bashed to try to 2 Brown loemesornething that & notin the It. You ime rust demnonsrate that ite at the et 5 Fowler 6 Laing Inmagine he name: are in rc, but 7 Leung, sealed in numbered envelopes. Fach time 8 Robirecn you choasea pinot It tke opening that jaa emebpe, 10 Seadaing a. The middle name is Robinson’ after Laing. so the list reduces to ? 2 ‘0 ‘The middle name is [2 Leung Robinson Saludo Soadding ce 2 = [25] = 2 Salute, Robinsons before Galudo, so the lst reduces to ? 2 ‘The middle name te Leung Robinson, +8) z ‘The seatoh i complete. Robireom has been found at 8. b The middle name is ) = 751 Robinson Davies is before Laing, 50 the lt reduces to 1 oren ‘The middle name is Bennett Blaokstock Brown Ebenezer Fowler Brown, Davies is after Brown, so the lets reduces to 4 5 ‘The middle name is Ebenexer Fower, 44s z [45] 9 ower. Davies is before Fowler, go the list recuces. to 4 Ebenezer, ‘The list & nowonly one tem and the items not Daves. We conclude that Davies i not in the I, algorthne [a] wed t0 mann the tlle ineeger= 2 Since Robinson afer Laing, fabinson cannot be in the ‘ist part of the lst Soe: dake the phot, 5, ard the “ist part of the fst Robinson & bef Salo 20 iteannat bein the econd paror the let We there debts the phot Sand ‘renting afer Delite the phot, 6and the second fait of the Ket Delete the pivot, 2, and ‘everyting bebe Delete the plot, 5, and eenything afer aud UTE ‘Use-thebinary serch algositam to loeate the number 12in the list cpposite, 1-2 23 as ‘The middle number in position number a7 The 6th number & 1 ai | 613 ‘1Boomes before 18,50 the lab reduces to oe Ue ‘Theatgorthm find a3 29 ‘thepostion of ach 2 pet, than compares 10 28 38 fhe pivot withthe 131 inner tora 47 6 tt ‘The middle number & in position number ‘The Sra nurber 5. $Boomes after 5, so the list reduces to ‘7 61 We rad to dete ee ‘he mdde number ¢ mostonnunter[4£9] = jasy =o | apa | Theos ander 6 ee AZ comes after H, 50 the list reduces to nothing. wasting, nines Wecorcude tha 2 noc nthe et sare ee 1) Use thebinay sarchlgortn ty teste a compe, Hate, o Fatoy fre bow Tes 2 conte Basle 4 Say 5 Tones ater 7 Haat 8 Wien algorthne 2) Use thebinary sexch algonthe to ty to locate a2l, bs inthe ist below, 13 a7 510 zs ow mai 24 ag 6B ay 10 0 1204 4 2) Ue thebinary search algonitaim to ty to locate a Preto, D Matt, © Eliot inthe ist below, 1 Adam 6 Baily 1 Yatie 16 Manda 2 ie 2 ecko 121s 17 OK 2 Des 8 Gange 1a latte 18 Farin, 4 Dow 9 Hassy 1 lows 19s oid 10 Jes 15 Matt 20 Simon, 44) The 26 etters cf the English alphabet aze listed, inorder a Apply the binary search algonitam to lorate the leterP 1b What is the maximum nisnber of iterations needed to locate ary Letter? 99) The binary arch alycuthm is applied to an crcered lit of w items Determine the maximum nurmber of tertions need Sees eval ie Yourtay find it hepful to eri ie areal record the madraara length: a Do 1000 © 10000, tthe ist stir esch iteration, oe enacts aware of their lirnitations, 1m Bin packing refers to a whole class of prablerne, The easiest isto imagine stacking boxes of fixed width a and length &, but varying height, jo bins of width a and length 6, using the minimum number of bins, 1m Similar problems could be: loading cars onto aterry with several lanes of equal length, 2 plum ber neading to cut section from lengths of capper pipe, or pladng music tracks onto a sat of CDs, OUTER | ‘The lower bound ne boxsof et ccs actenInvenghis inne sows 08, 07, 08 08, 19, 1, 11, 12, 18 Thy ret eae ics with ee ed te ution en igh oe ee Sum the highs and vie by he bint You 03+07+0B+0B+10+11 ust absaye rd pt deter the wer +1112 +19 = 85m eo Be gr eee ‘Hote Tay not be posible to pak these bones {ngs Stine Thatwil dependion the mimater: ‘llthat th lower bound i telling we, i that at iuartfive tine wil be nace. Go a minimum ofS bins willbe Mesded, At present theres no knewn algorithm that will always give an optimal solution 1m With small amounts of data i is often possible ‘spot! an optimal answer, mt Thare are'three bin packing algorithms in common user flest-ft, flest-fit eecreasing and S) fulltbin packing, First-ft algorithm 1 Biketheitemsin the order given, 2 Place each iter in the frst available bin that can take it, Sst from bin Leach tiene, Jddvantage: Itisquick toda. Disadvantage: It sen ikely to ead to.a good solution ‘Ube thesis st algorithm to park the flowing items into bins of size 20. (The numbers in, lWatkets are the size ofthe item )State the numberof bins used and the amount of wasted space 1, 48) 2) ca) De FH FS) Co HOD 16) IH ke C2) goss into bin 1, leaving space af 12, ee & 87) goes ime bin 1, leaving space et S. Binz: Cla) ES) (14 g08: inte bin 2, lenving spare ot 5. Bnd: _O@) FS) 9) goes into bin, lenving space 11 Bing: H(5) £6) goes ino bin 2, leaving spare of O FE) gos ito bin 3, lanving space of 2 (5igoe: into bin 1, lenving space of Pins: 1@) I) Bing: KE) HC15) goes into bin 4, lanving space 5. ‘This used 6 bins and there are 16) goss ito bin 5, lenving space of 14 ZHEO+T +E = 26 units of mastect space I(F)goes imerbin 5, kenvingspace ot 7 K(@) goes into bin é, lanving space of 12 algorthne ‘Fitst-fit decreasing algorithm Inthe examination you may 1 Recidertheitemssothat they aeindescentiny coder, Sealed appl a zoning 2. apply the fist algenithn tothe sccxeeseal list aterm eco vantages: € sitet Trealgorithm i sometimes Selvantages: You usally get a fainly gocel salut ase This easy todo. mathematica’: way of packing: Disadvantage: Tou may nct get an optimal solution. 3 sufcoae pur the be thing: fn Apply the ont decreas algestan to the data givenin ample 5 ore the data inv descending one: Hee) ett Bo) FO) 0) KO) Gigeehe n desnciae [EAC CE) __| apse no bin, ving epcet 1 tho ice) FS) goss ito bin 3, leaving space of 2 Bin ca) EG) ‘@).g0=: into bin 4, leaving space of 12. Bind DG) FS) (@) 900: into bin 4, lenving space of 4 Bind: AG) _K@) BCT) goss ima bin 5, leaving spore of 13 = JQ) 92ee inte bin 5, leving space 6 nee ee) (6) goes nto bin 2, leaving space of. ‘This used 5 bine and there are IGS) g0es mo bin 5, leaving space of 0 24 4 = 6 units of wasted space, G(5)g0e inte bin 1, leaving spare af Full bin packing 11 Ube choervation to find combinations of items that wil lla bin, Tack these stems fist 2. Any semaining items are packed using the fst-t al gonitm. Jdelvantage: You uswally get a good solution, Disadvantage: It is dificult ta do, epeeially when dhe mumbere ate plentiful and awhwasd, 4) BO) CO «DAN Ms) FAR 6) HEY 102) Jag) RE) ‘The stems abovease to be packed in bine cf 92225, a Determine the lower hound for the rmmber of bir. 1b Apply the full-bin algonittam, 6 Is yoursolution eptimal? Give a season for youransiet a Lover bound = 11-25 = 444, 505 bins ate needed. OUTER | b 74a =25 B+e=s 4th =o 20.8 solution © Bint Fr) AG) Binz E(B) IC) | Bin 3 Jay rt Bind BO) cr Bind: HE) KO ‘The lower bound & 5 and bins were used, 50 the solution & optimal ‘The fine three bine ame ful bie. ‘We row appby the fist algarthen to the rennin (goer inte bin 4, lenving space of 18 (10) goes inte bin 4 leaving spare af & (4) goe inte bin 4, leaving spare at 4 HCE) goes into bin 5, lenving space of 19, Ke) g0e" into bin 5, lenving space of 10, plumber resis tocut the following lengths of copper pipe. Lengtis are in metres) 40.8) BOS) CA4 DOD) E12) FOS GOs) HOS) 10.8) 109 ‘The pipe comes in Jengths of 2.$mn, fa Calculate the lower hound of the number of m lengths needed, Db Ube thesis sit decreasing algorithm 10 determine kaw the requied lengths may bectt fom © Ube ful:bin packing to fied an optimal salution, (14), EC12), PLLA), FO.2), HO). OM, MOE). BO), C12), (02) ctl) + DEL) = 25 JO.9) + 608) + A fultbin solution Bint: C14) Bin2 FO) Bind JO) Bina: E(t) \8) = 25 Pe 402) BOA) 6e@2) 102) Hom the 2S m lengths a OBFOB 414411 413409405 409408402. 505 28 Go at east bngehe ae routed Sincea son yes nt tke, ¥ Gortng ito descending order the can bedore by epecton. Bint ola) DAD goes int bin, ving spacet 1. Bind E¢12) FO) Egos: ito bin 2, leaving spaceof 1.2. and 100.2) J) ges nw bin 1, leaving spare of. Bina N02) BOB) O08) F gos: ito bin 2, leaving space of 0.3 P Bins: 108) H aces into bin 2, lenving spare 1.6 a mein | gee to bin’, laving space cf 07. Primes A goes into bin 4, lenving space of 1.7. eee eee dometes goes into bin 4, lsving spar2ct 0. C gces into bin 4, leving space of 0.1 I.gpes into bin 5, lapving spareot 1.7 In para ve found that at net 4 tire woul be naoc, 22 ‘thi solution ts optimal since tee 4 bine algorthne 1 18 4 2% 8 27 1B 3 me a a 2B ‘Te abovestems ate to be packed in bins cf size fa. Calate the looser bonind forthe rakenbes of bine 'b Pack the iterns ito the bins using £ thefictitalgorthm, i the est. dereasng algorithm, 2) Laws wishes to second the following telenison programmes onto DVDS, each of which can nid up to Shoussef programmes Programme [a TB [clo[e[F[c{a|i [i [e[c iu frengeh (niawes| 0] 0] a} } as] | cof 0 feo) 7 | 20 [ofa a Apply the fist. algonithen, in thecader J to M, to deterraiee the nuraber cfDVDs that ‘eed tobe used, State which programmes should be serceded cn each dix Repeat past ausing thefist At deseasing algorithm Ts your answer to part boptimal? Givea seascn fr your answer Tara finds that her DVDs wil only hold up 10.2 hows of programmes 4. Use theul-bin algorithm to determine the mimber cf DVDs she needs to use State ‘which programmes should be recrded on each dis the fulldbinalgeuthe, 2) Asmal ferry has three car lanes, each 201m long. There are 10 vehicles waiting 40 use the fey. Wehisde | Te Vehicle [Te a le ‘am eas ‘4m B fear + wale 7a Bem c Tea Tas Dan 6 én E iam iim a dpply the firs At algouthi, in theasder A to].Isit posable to load all the vehicles using ths metho? 1b Apply the fist st decreasing algcritham. Is st possibleto lead all the vehicles sing this meted? © Use full-bin packing to load all of the vehicles, @) The ground ficor cf anovice block is to be fully recaspeted, with specially made carpet ‘which incorporate the farm's ogo, Thecaspet comes in sols of Sm ‘The flowing Iength are sequiced, Aan Dam Gsm J 7m Bam Bam HSm Rem cam Fam 1 Sm Lem Determine how the lengths should be cut from the llsusing x a the fist.t algosthm AtoL, b the fist. deseasing algonithen, 6 Ail-bin packing In sash cape state the mamber of role weed and the amount of wasted carpet, OUTER | 15) Tight computer programs need tobe enpied onto 40 MB discs Tre aze of each program is given below, Progam [a]®]C]>]=]F] 6] a size omy [8 [a5 [a7 [2 | | [os [os a Use thefisn st dscisasing alyrithm to determine which piogams should be seccaded conto each dix, Calcwlate a lower bound for the mum hero discs nese, ine: Consider the © Beplain why itis not possbleto sexed these progams on, pagans our 20 ME ‘the number of disesfcvund in past b. ine ‘hace aster a avant Eonsimaenna” anor enree® 4) Ue thebubblecr eget w sr needing cde et 7 2 aying the sate cf thet at cach age a 2) a Usethebubblesort algorithm to sort, in descending cde, the list 42 2 2 Ad ping the sate of the ist cneach oxasicn when two values are itehange. Dp Rail themermman number ofintercanges nested fost ist of ax pistes of data using ‘the bubble sort algouthm, oe a e482 7 8 os ‘This is of nurabers i to be sted into amending nde. esfoun a quick sotto obtain the sorted hit, ving the satect the is aftereach ceatrangeinete e a Me 77 al 98 ok oS 2 The ist of numbers above iso be sorted into derening order Pexfrm a qaik-sot 10 ' obtain the sorte I, giving the sate of thelist after ach rearangement and indiating the pnt erent wa Di Vee the sent decreasing bin packing slycathe toSt thease ino bins of se 700 4B Beplan tow you dead in which binto ple then be 7, e 'S) Tisha wishes to video eight television proweammes, The lengths of thepingm mmes, in. smunuate, ase ws 1m $2 92 3 a 2 ‘Dishna denies to ws 2-hour (120 minute) video tapescnly to secon allof these programmes a Beplain how to we afirs-ft decreasing bin-gacling algonithin to fird the solution that ‘uses the fewest tapes and determine the total amount of unused tape, 1b Determine whether tis posable for Thshra to sexed an additional two 25-rairaste ‘programmeson these 2-hour tapes, without using another video tape. algorthne 6) ADIVenthusast squiresthe flowing M pieces of wood as show in the table. Length in metzes [04 e]ipPelmuyi Number of pieces | _@ a ee ‘The DIY store sells wood in2.m and 24m lengths. He considers buying sx 2m. lengths of weed, ‘a plain why he wall not he able to cst all cf the lengths he sequites froma these x 2mm lengths bb Heevertly decides buy2.4m lrg, Usea fit. decreasing hinpcking alge 19 Show b coud ue a 24. lengths tooblasn the fees ne ees €Obin a sation tat only eqs ive2.dmn ergs e 7)" Note: This question uoesthe modulus function fx # 9, k — 9] is the postive difference eiwsens andy, ea, |S 6.1 1. The algoritam descaibed by the flow chart below is 0 be applied to the five pices of data belom, va) 61,02) 9,08) 7, 0) 53 48, U6) ‘2 Obtain the final output of the algorithm usiry the five values given for (1) t01U(S). Db In genesal, for any set of values U()) 40 US), explain what the algorithen achieves, Box Box? Box’ Bows Bas Bows: Ba? No iD ‘we rea fee ai 128 ae Tanta 6 Bax in the flow chasis altered 1 IsM> Emap? colon Aan e Summary of key points 1 Algerithens can he given in words ce lawehats, 2 Uncasencl lists car be sorted using a buble sort ora quick: sar. 2 Ina bubble sort, you compare adjanert stems ina ist, + they ae in caer, leave them, + Hithey are not inondes swap them, 4+ Tre list isin order when a passe completed without any ewaps, 4. Ina quick sort, you select a pivot ancl then oplit the items into twosub-lsts: tone less ‘han the pivot afd thooe greater than the pavot + Resp doing this to each sesulting sub Lt 5 Tnaquick sort, the stem at the mid point of theists choren as the pavot + ems les than the pavotare wenitten devin, leeping thear cele, + The pivots mitten set + ems geeater than tae pivot arewnitten down, Keeping their onder, 6 Abinary search willseuchan ordered list (0 find out whether anitem isin the bist. If ‘tis in the list, itll ocate is position in thelist 7 na binasy seach, the pivot is the muddle stem in the lit. Tf the target stem is rot the favo, the pivot and half the list are discarded, The lst length halves at each pass Ltn 8 Tie middieoénitemsisfoundy [1+ sovureling up if recessxy. 9 The three bin packing alyonitlans are: firs, frst-t decreasing, arc full-bin, 10 + Fistsit algorithm ales temsin thecwer given. + Fist-fit decreasing algonithm sequices the tems to be in descending order before applying thealgcaitam, + Pullin packing uses inspection toda items that will combine to fll bins, Remaining tems ase packed using the fist-italgosthe, ‘11 The thoee bin packing alyonitlans have advantages and disadvantayes, ‘Adantage Dimdvantage Bestat | Quckeda Nok iiely led toa good salation Bistat | Usually a good sclution | May nce getan optimal salution: decreasing | Easy todo Filltin | Usually a good sclution | Dishes to do, epesally when Inteot numbers or awkward rm bers After completing this chapter you should: 1. know how graphs and netwvorks can be used to create mathematical models know sore basic terminology used in graph theory know sore special types of graph understand how graphs and networks can be represented using matrices, Bw Graphs and networks Friendship Helahisy Graph theory isa branch of mathematics which is used to model, analyse and solve many real-ife problems. You will have met the word ‘graph’ before, in connection with drawing curved lines on squared paper, but in graph theory the word ‘graph’ has a much broader meaning, Di Youneed to know how graphs and networks can be used to ereate mathematical| models, 1m Agraph consists of points (called vertkeas or nodes which are connected by lines Kedges or ares) Ir a.graph has a number associated with each edge (usually called ts weight), then the graph is known 2c welghtedl graph or natwork, a Why is thisa graph Adis stata D What arei the vettices,itheelge? © Dow, ‘© What is the puspore of this graph? Higa 2 Iehas vertioas co mented by foajaatera edges. b 1 Cities Saved by an airing 1 Fight routes connecting ities @ To male route planning on the ailine possible Ie does not show any distances ohana or the correct geographical positon of the oie. nao oD ‘a Why is thisa graph (Cac = Dyn Gage = Hed kan, x Nea Olt 1b What does it sepaesent? (© What doi the vestives, i the G R Subgsph 1 Graph, yeeble—+ subgraphs _f - Subgaph 2 tn 1m Thedayrae or valency or order of a vertex isthe number ef edger inddent to it All three words aan K,_ dipeea beans jrtex | Degree | tte tome' capes ote Vertex | Deg ee 1 2 2 Inanygephtte sum x 2] otthedagres Be pect equal L 1 Benet Sige The Fbeae, ; ¥ M 4 | iiimtnccim tere, a w LN 1 Segre aney Ifthe degree of avartex is even, we sy ithasevan dagiee, Feieoant 20], Kand Mhave even degree Hanahokig eos Simian vertices Land Nhave odd deg ee. Gansectonat) mA path is finite sequences of edgas, such that the and vertex of one edge in the sequen is {the sartyertec of the next, and in which no vertex appears more than once, § v For example, in the graph above, ane posible path eS U WT and another iol VWT RS, 1 Awalk is path in which you are permitted to return to vertices mare than on ca, For ‘example in the graph abeve, a walkcould be RU VSRTW UY. mt Acycle (or clrcutt) isa clozed ‘path’, je, the end vertex of the lat edgaisthe start vertax ot a thefirst edge. For example in the graph above, a possible cycle RU ¥W'T Ry % m_ Two vertices are connactad i there is a path between them. Agiaplhisconmactad # all its i vvertcas are connected This ie a connected graph. Apath can be teund betwaen any two vertions i # This shows a graph that is not connected, ‘Thera ieno path from R to ¥,for example, 0 mt Aloop isan edge that carts and finizhes at the same vertex This contains 2 loop trom to C 2 oop mAslmple graph is ane in which there arene loops and nat have mare than one edge ‘eonnecting any pair of vertices, alte D ae The graph above is not a simple graph because = . contains a loop. This nat a simple graph because ithastwo B edges fram D to E fc 1m Ifthe edges of @ graph havea direction associated with them thay areknawn ar directed feeiges and the graph isknawn ara digraph. 3 1 Dawaconnece graph th a one vetefdoges and detces of eg B tarevetinsf depos? cof degeedandcnecldegee 1 € twovercescfdepte 2, coat depe 3a aner dee ¢ ‘raphe networs Whichof the graphe below are not siraple? Tt xr - ay In questicn 2, which gaphs are not connected? From the gps, sate A 2» Thao monycomect Renee ties neies a four putts from BIO, bp acyele pasting through Fan, © thedegsee ofeach vatex Ue thegraphto a crawa: straps Alemrm 6 a matherratical comfirm the handshaking lemma (hat the sum, Aan ae of the egress equa to twie the number cf edges), ta morsimpartant ru. a Repeat question 4 pasts 0, d and e using this graph 1 Confiem that there is only on path betwen any tr vertices, Show that itis possibleta drawa graph with, a aneven number of vestices of even degree, 1b anodd nuraber of vertices of enen deyse. tis rot prenbleto drama graph with anodd auraber ‘Use the handthaking orn, of vertices of odd degree, Bxplain why rt. % 7) Bievoluntees, Ann, Baan, Conor Dave and Bun Jung are going to una help desk fom k Monday to Friday next eck (ne person is reqsised each day. ‘ion isavailable on Tuesday are Boia, Brian isavalable on Wecineaay, _— Goncr s available cn Meeray, Thussiay and Friday, x Daveisavalable cn Monday, Welnesiay and Thussay, © Bun Jung ssavailableon Tuesday, Welnesiay and Taussiay Drawa graph tomodel this stuation Tookat Bampte 8 Apsoject consists of'ax activities A,B, C,D, Eand E and Ban start immediatly, but C cannot stast until iecom pleted, Deanne slast until oth Band Care complete, Reaneot stast ntl D is complete are Feanros tas ntl Eis complete, Drawa digmph tomedel this situation. Look st Beaople 6, ‘ou need to know some special types of graph mt Attee isa connected graph with no cycles, R ¢ Atree This isnot atree, Weantainza qeleRTU SR mA spanming tree of a graph, 6, is 2 subgraph which incude allthe vertices of G and icalso a trae, For example, starting with this graph, Gi B D Possible spanning trees are B D B D There are many otherspanning tess ‘raphe networs Abipattita graph consists of tw sete of verticos, X and ¥. The edges onby join verti cas in X to vertices in ¥, not vertices within a set ‘You saw an example of a bipartite graph in Example 2 Another one is drawn below, A 3 1 Notice that each edge connects aleft hand vertex set ony z 2 ta aright hand vertex set. There are noedgas that = ‘ 3 ea nnact verticas inthe same set Acomplate graph isa graph in w hich every vertex is directly connected by an edge to each ‘of the ath ar vertices, I the graph has nverticas the connacted graph i danoted by Jy DX , a he Acomplate bipartite graph (denoted ty &,) in which there are rverticas in set X and s vertices in set ¥. a 7 i FE B 0 K co © v 1 Sas og somorphik graphs are graphs that show the sare information but are drawn differently, For example a > Ic = B ic sommorphicto ; Pl 1 x L v y and a Ww M i > Q& 2 Bt For twa graphs to be isornorphie, they must have the same number of vertices of the same ‘degree, but these vertices must also be conn ected together in the sameway It graphs are isomorphic I ie possible to pair equivalant vertios in this care ‘Acan be paired with in the first graph and R in the second, B can be paired with M in the first graph and Tin the second, ‘Cean be paired with N in the first graph and Sin the second, DD can be paired with Lin the first graph and V in the sacond, can be paired with Q in the frst graph and W in the second. F can be paired with Pin the first graph and U in-the second, ‘Gan be paired with K in the first graph and X in the second, a OF erase kay ctan San ages RAAT cen en matrices, An adipce ncy matrixrecords the number of direct links betwean vertices. mt Adistance matrix recordsth eweights on the ed ges. Wherathereis no edge, wewrte Ubean adjacency mative to sepnesent this grag. 8 ss 2 F c DE > A (On omome ‘You should beable to woe down the BJ to 120 2a4 safjcency mats gen the gaph, and raya gph given the adjaseney nate, iG \tou eo a 1 #0) ep hums sey plo o 1004 “The indiana: thot there are 2 drat connections bewean @and Epo 2 1-0-0 4 lee ae a es The indintes a hop from Fs F Iteould be ‘rave in etherdiection, aed hence counts as 2 ‘Ubea distancemmatsx to sepresent this netwcak Bc DE You shouldbe abla to write dem the A‘ (a | ee A eee ser, é sears 3 : : ee fA Br Se E o E (Using OD and cE) (Using OD and DE} Theweight ofewhtres a+ 8+ D+ N +12 1) Ue atalino ind anima spanning weer ah ct news Sate the waht ofen tee bu musts teasintheonen whic hyon conse te bee i Ee 2 i ed Gc mF es Er ‘Ube Reuskal’s algorithm fo find the three possible minimum connestoxs (MST) for this cretioork, Ext rast list the eds in the caer in which you consider them. Dawa networkin wich fa the thee shestest elyes form past of the minimum connector (MMS, 1 root all ofthe thnce shertest ages ftom part of the minimum connecter ‘The diagsam shows nineesates and the distances, in a, between them, dicable TF company wishesto link-up the estates. Find a minimum spanning tree for the netwoek using euskal’ algcuithm. You must list thearcs in thecader in which you consider them, State she weight of your te, chiver Aborihnson nto 3D You can use Prim’ algorithm on 2 network to find a minimurn spanning tree 1m Like Kruska algorithm, Prim’ algorithm finds the minimum spanning treo, but it uses a sliferent approach Hare is Prim’s algorithm. 1 choose any vartexto start the trea 2+ Select an arcof lest weight that joins avert x that already in the trea to avertax ‘that isnot yet in the tree {c + Itthareis@ choice of arce of aqual weight, choose randomly 3 Rapeat stop 2untilallthe vertices are can nacted es ss = bia ‘use Prims or Krwskal’s sane & 5%, ‘now which is which. ‘Ube Prins algorithm to find a minimum spanning tree for the networkabave, List the ares in the cider in which you add therm to your te Choose to start the tree at A, ‘Add the ato of least weight, AP; to the tree. ‘The ans wecansider are thoselinking & toarother vertex. AF), #809), ADC), AE{IT) and ACCT). Adel the one ot Kt went, Af, to thee, The ars linking Aor Fra other verte are ABCD), ADC), AE(IT), ACEI), FEZ) and FECTS). ‘Add the hast ar, tom A or, that innrodocee 9 new wert t2 the tr, In the cre there are wa to chanrs from, AD or Af, Wie need to choose rancor, ro we can chan AD, Aad DE to the tree, Be Thears inking A, Fand D tothe remaining varices ome ABQ), AE(I1), C02, FED, F2(15), DOLE), DEC 4), ‘Tha-one of kart weight & DC. Theans inking A, §, Dand Cto the remaining varices (Band fare ABS), AEN), FE12), F8(15), DECI), CHO), The-one of eect weight & AB. Thears linking A, D, Cand 6 w the remaining vartax, © 276 AEC), FEZ, DEC 4). The one of hast weight & AE, [Novice that with Pam’ algoritha the tee ‘ang grow! i. acommeree frhicn, ‘The-acs do ro "jump around a they ‘Aros added inthis order. AE AD, DC, ASB, AE. somatime do in Kral algorihan. ‘The netwcak shows the distance, in kilometces, betwen eight weather monitoring stations, ‘The eight sations nee tobe linked together wath undergrenra cables, a UsePrim's algorithm, stating at A, 0 finda minimum spannang tree, You must snake ose order cf amr se tion cles, 1D Given that cablecorts $850 per Iilomete 1 hy, find theccs of linking ther weather stations Aborihnscn nto ‘with a re enetgy supply. ‘Ube Print’s algorithm starting a, to find the minimum cost eneiyy supply network that ‘would contest all ten villages Draw your minimum conrectorard stateits cost ‘The network shows ten villages and the ons, in thousands of pours, of ecnnecting them iC 4) Ue Pam’salgcrithe, stating at A, tofind four distinct minimum connectors for the netwcal below Ineach casedlaw your spanning tree, and make your order of are selection cleat 33 You can apply Prim algorithm to 8 distance matrix Networks (particulary large ones) are often descrived in distance matrix form, 1m Networks can be inputted into computers in this form. 1H Prim algorithm (untka Kruskats algorithm) is easly adapted to adistance matrix, so is Prim'salgarithrn, in matrb< form, that is best cuted to computerisation, m Hore ithe distance matrix form of Prim's algorithm, 1 Choose any vertex start the trae, 2 Delatethe raw in the matrix for the chosen vertex 3. Number the column in the matrix forthe chosen vertex, 4 Put aring round the lowest und eleted entry in the numbered columns, there is an ‘equal choice, chose randomly) ‘5 The ringed antry become: the next arcto be added to thetree, 6 Repeats steps 2,3, 4 and 5 until all raws are deleted. dpply Peisn'salgosthm ¢o the distanre sated above to finda suinim um spanning te, Stat at Delete row 4 and number column A, ‘We nov seak thesmalt entry in the Acalumn =uhich & 12, ‘The beet undektad ntryin column AGE 12,50 puta fing ound it The fi ae AC, ‘The naw vertex & C, Date the raqand number thecal umn, C ‘The west undletad ety in columee Aand Ce 2, s0 puta fing round f. The scondare & AD. Aborihnscn nto 1 2 ‘The naw vertex D. Delte row, and number cknin D. 5 fe > 2 — 47 @ nL — alma Cam orate ng 26 the ae elm iC ‘The naw vertex B, Delete mB, and number colin & The bwest undletad erty in columns A.C, Dand Be 7. Puta Ting found it The fourth ar BE The naw vertex & E Dolte mw E and number cok E Youcbnetneed to showallofthese he. ‘he fia abled table plus alistot asin pee een ‘onder, i suffcient to make your methed dear, ‘algorithm & comp! ‘The minimum connector ie z ams ee weight is 2 + 254+ +71 = 21 Photocopy masters are available for the questions marked * in this exercise. 11? dipgly Pain’ gente to the distance satsices below Lis the arcs in order cf selection arel ‘gate the weight of your te. ‘The table stows the distance, in miles, between S cities, It is intended to ink there S cities Iya transit system, ‘Ube Paim’salgonithm, sasting at Birmingham, to finda minimum spanning tee for this etioork, Tex rast list the afes in order of selection and state the waight of yous tee, ‘The table shows the costs in euros per 1000 words, of tanslating DVD player instruction smanwals between eight languages, a Use Paim’s algorithm, tasting from D, to find the cos of translating an instruction, ‘nanval of 200) words from D into the seven oer languages 1b Draw yoursnininum spanning te. rom the table we see that t costs 169 eusoe per 1000 words totarelate from language E10 G.A marmul is witten in language Band ness to betranslated into language ©. © Givea season why i itmight bedenided not a trandate dive fora B10 G, ii itanight be derided to translate direrly Aborihnscn nto ‘The table stows the distances, in miles, between rine oi sigs and the depet X. Pipes are to be lid to connect the sigs and the depot. a Use Prin salyorithan, starting at X, 10 find a minimum connector forthe netwenk, Soa. mst make the curler of are selecticn clear Oil sig A exhausts tesupply and is closed down, 5 D Use Prin salgorithan to ind a minimum connecter exclufing A. Sou must male the onder of ace selection cleat 34 You can use Dijstras algarkhmto find the shortest path between two vertices in| a network, 1m _Dijkstra’ algorithm izused te find the shortest, cheapest or ee ‘quickest route betw eon two vertioas, An example could be finding Seesaier the shortest eyele raute from John O'Grosts to Lands End, Diet, Hore i Dijkstra algarth m \tofind the shortet path trom S to T through network) 1 Labolthe start verte 5, with the final bel 0 is sean 2 Record awo rkng value at overyverta, that cnactly Scie ned ee connected to the vertex, x, that has just received tefinal Iba, 2nd move through the network puttin + Working value at Y= fin alvalue at X + weight of are XY Ae eet oes + Hf there is already 3 working value at Y, itis only replaced if call temporary ‘the new value is smaller, Ihbat) on each vere, + Ones avertex hae final label itis not revisited and ite pein fet he) shonert route t2 ‘waking values ar no longer conideced ae 2 Lookat the working values ata vertices witout fnallabe, Sd rior fa Sele theses working value This now becxmesthe fina balla e e label that verte (1 two viet havethe same small” BUMS PD working value ether may be given Ratna abe et) footie 44 Repeat tape 2and3 unt the destination verte, rcwiverite Me werng final etal considered. Continue 5 To tn the shortest path, trace bade tfom ToS. Given that 8 Inthe vy ute already fies on the route, incude arc AB wheneverfinal label of ostnation vertex & B= final labol of A= weight of arcaB, ‘To mabe the working dear we mplace the sorts with tee ike ta vere ‘Order oftateling | Hinal value ‘Wlorking values ano Inthe examination the bower al be dram far you t complete Give vanex $a fra Bbel of Ireista thatthe the fit ‘aren tp recat Re fnal bel by completing thetop boxes ats Tia the Give working values tA B Band ince thay are det 9 ae connactad t 5 Loakat the working alum: at, Band. Thesmalist is 2(@tC). The will bacome the next fral hbal. CE now completed. It the 2nd verex tobe completed ela ia a = 4 Bia eas shia Bala 2 e4 2 : a he ie ez cf z aa = 4 BIs[s Ve sppy's EEE 64 8 2 rT ha 12 Aborihnscn nto ‘Add working values t ch verter that & dimcthy Connected tC. [Note that the algorthm hac picked up the shontcutto BSB 6, but Sac = BE Ay ‘The mallet working whe 4388, The barn the fina hhbelat B. @ becomes the Set complatad vertex ‘eid working valuas to Dand Theaure the ame diecty connected 19 8 “The erolet working value ie the Sat, tecome: the 4th vena be completed. Ie as 2 final value of 5. The only wo king vals to ackt woul bea 9atD. However the E biger than the 8 already ‘there, $0 8 doe not nesd to be mode The smallet working valueis thea at D.The bacome: De firel hbel The anby working valusto add & the 11 at T. D becomes the Sth vertex to becompleted alas 5 4 5 BEES Ve shb/'« PRE \ 6a 8 Bn ez fz z ‘The length of the shortest route ftom toT i Th ‘ofind the shortest route, start at T and trace back booking st final values and awe lengths. Check the ares into. W-2# eo OTe noton the routs, {f= 4 # 850 Bris not on the route. 1-8 = 320 DT won the roue. o.get to T intl we must have come from D. Continue working back from D, The working W-a=5 or B-4 eb 4-222 ce 220 ec sothe shortest route & 8 CB DT length tt vertex completed on the way to the destination vertex, mo) ese Dijksta'salgesthen in thas netwcrk © fel thelengthf the choetex route a form 10H, b fora A to. List the sont you we The finalciagiam Loe the th Youdo nat need to daw bie of dagrams to show your working, Working though just one diagram and completa allthe bores will mate the ‘method clan (Sea bxample $) 1m_Dijkstras algorithm finds the shortest route between the start vertex and each intermediate Aborihnscn nto “The weet wo ring value 2 Thefinal diagram boks ike this. fe shows all Tee ae a ‘the working needed to make the method oar Bee IEE is Baal = aa 4 2 6 ’ apy 1 BR 2 STE] FEI 18 16 15 be i * 4s é 1 6 Check tht your method eE[s Fs canbe plowed dary, $ = — fo 5 The length of tte ehorteee ewe fom to HB 22 hter = 715 8 eH a ‘There are tio shortest routes: 2-155 6 OE 15+ 8= 7 BD ABDEHanACFH, Rote orca or B= m= 9 FH » From the diagam abo the shots ute fom Bas 9 FH ee 2-129 06 @- O= 8 AC The routes ABD, 15-827 6D 6- 0=8 48 itis possible to use Dijkstra’ algorithm on networks with directed arcs “This is lke trying te find aroutewhera some of the roads are oneavay streets ‘The network represents past ofa ooad eytemn in a city. Some roads arecne-way an these are snclicated by disected arcs. The number on each ase sepreserts the time, in mirates, totravel along that are a Show that there aretuo quiches soutes from ato. Explain how you found yous soutes fem yous labelled diagram, Road His closed due to scadworks, D Fir thequichest soute ftom & 101, avoiding Hl @ Thefinaldiagram boks tke thé Check it your mathod can be Undetnd fom thie diagram, ERE] os) PEE) ou ep a 3 isis 4 . y Z s| *\eERE Fs] s fash] 2 YO he 1917 4 4 aDpy , \eETE EE t_P rr po 1 ‘The two quibkest routes are framines check ACDFGHImACDEFGH the order in which t9-7=2 ti to-7=2 Hi oe Towe2 oh ou oe e-t4=1 FS Fo I imporentio 14-5=2 DF EF eatery bozes oe oo 20022 86 ob ae Both are of length 19 mimics, Removing Hl ftom the network would leave 4 finalvalueof 20 at |. Start at | ‘and find the route of lengeh 20. 20-6=4 El 6-S=1 DE 8-2-3 2-0-2 A 20 the quickest route ftom Ato | avoiding Hl, B ACD E | length 20 minutes, Photocopy mastersase avalabe fr the questions marke * inthis exec. 1" Ux Dylon elgatin feria sts ute kano Tinea te lang eat coo Jour wong Slate ou dee ote and resin ou Sad how thw jou chanel you sents sou ton jou bale ages Aborihnscn nto Bind —_—— baad Demetri asc gives the travel time, in minutes, it 4 Mieomemmine 2A sme ’ Se seme eeE se anvuinieky “AES See cere 2 Ue Dyomlgoutim ae fs fird theshowtest route and So kay fa korn Be we FO ee : 4 D Se | j 44 The network represents the distances, in metres cf all the roads ina building site, A crane ‘sreeted for oneday at T. There atetwo cranes avaiable on ate, cneat, and thectherat 8, One cf these taceranestwill te moved tT. Inorder to minimise the ect it is decided 10 movethe crane that iscloses toT. Use Dijkoua's algorithm to determine which esare show be moved, Ieisposible to solve this problem with only one sprliction of Diet’ algouthme Think carefully about the starting paint a Ube Dijhotia’salyoithim 40 find the stort soute from J 10H, Indkieate how you obtained yous shortest aite from yous labelled diagram, b Fire theshortest outefiom A to H wa @. © Bird theshortet soutefiom Ato H, zot using CE. L ee Photocopy masters are available for questions marked * in this exercise. 1) The network represents a theme park with seven zones. Thenumber on each ast shows disarein meter, ‘Tamvays ate tbe bust 10 ink the seven zones and the cas path at theEntrance. a Riera minimum conmeetor usiey i Reuskalsalgoaitarn, Hi Prim’salgorithi, sasting at the Entrance. Yin must male your cider of ae section cleat 1 Draw your tree and state its weigh Aborihnscn nto 1 Rea a EERIER Ee arena non A caniy a eae So wee tedene nlm, stay Gaipetsn Samat gL OS Senco pansy ata bu ee shaun angel hb lente Gonantoee iatteal ence Pre mina gece cece i numsalentn sringatt, Fro aectin ic tnech cama theamsin cx bon commer hem coven tht pots Tan Palealy end wl erm ph D state which algorithm, Trim’s or Rruskal’s, you would select to complete the spanning eed nceania prea a). i sa? ss 87 pf - ua im us 44 c | so ue - 67 m3 98 pjey om 6 - 41 us ze | se us m3 41 - al Blo? 4 98 7 wo - A eh team opamanen in eaipememioncenmncionuaamuere a Vin hou eslpriin) osnie 2 Ges ie ranean cannes el ateae lati oftices (ou te pal you need cacy arn uuu tat he ort invhachyousaeced Oran by Drawa shach song te murs spanning ea fed ssength ° 4 "Its intended to network five computersata lage theme path. Thee is oneccm puter at she office and.one at each of the four different erattances, Cables need tobe laid to lik the computers. Cablelaying is expensive, soaminimim total length cf eable i equired, ‘The table shows the shortest distances, inmetes, between the vatious ates Ofce | Entrance 1 | Erasance2 [Erasance 3 | Entrance 4 Office = Isl 488, 980 EG Eotrarcel | _1S1d = 1a ae 2125 Eewrame2 | 488 PA = 284 S87 Eetrame3 | 980 Daas ae = 528 Eetrareed [94S 2195 S87 oa = a SatingatEntance3, denonstaate te se of Fa slgntan a hence ida ey ee ee Die een era i aus imturamum oanenen ar abe si e eT i ore ctu nearer anach jou slated ip te ee ae ede gn od eal ls GB Ream one in, RIOR ee b Wate dom thereatinstp bere Far 7 e 6) Acompary ist install poms lines to buildings on alasge industsia esate, The ines are to be laid ty the ade of the roads on the ciate, The tates showmasa setwotk opposte The buildings are deagnated A,B, ¢, . N and the diances between them ae given inhunveds of meltes, Themanager ‘wanks tomninirasse the toa length pesmer line 1 be wed. Use KeustaY'salgonthm to obtaina minimum spanning tee for the retold hence determine the minima length of power kine reed. ming to a change of circumstances thecompany randifes its plans for the estate, The sesilts thatthe toad from F to Grow asa length of 700 sneses 'b Determine the new minimum total length of power lee. weighted netwoak is show above, The number on each ase indicates the weight of that ar. a Use Dijhstia'salyoriti to fin a path of least weight from A. 10%. Aborihnscn nto Slate cleaaly i theories in which the vestices eve labelled, ii Tow you determined the path of least weight from yous labeling, D Listall alternative paths of least weight. © Dessibea practical problem that could be modelled by theabove netwodk and salved, ‘using Dylatza’s lgcaithi, = ‘The netwcak above shams the distances, in mailes, betwen nine cites, Use Difstra’s algorithm to deteanine thesbortest seste, and is length, between cities § ana T. You must sechcate cleasly i thecmier in which the vertices are Labelled, ii how you used your labelled diagram to decide which cities toinelude in the shortest sents After completing this chapter you should be sble to: 1 determine whether a graph is traversable 2. usethe route inspection (Chinese postman) algarithrn to find the shortest inspection cycle ina network, Route inspection (Chinese inn problem) The Chinese postman problem was first studied byy the Chinese rrathernatician Mato Kwan in 1962. lt can beused to find the shortes. distance travelled each day by a postal worker UTR Fmine whether 2 1m In Chapter 2, you learnt that the degiee or valency or ordar of a vertex iethe mumber of arcs Inckdent to It, A vertex is odel (even) ift has odd (even) valency 1m Ira the valencies in a graph are even, then the graph is Eulerkan, 2 4 4 Fach vertx fas an ven vabrcy, 4 4 5 1m If precisely two valoncias are odd, and all the rest are oven, then the graph is somi-Eulerian, eB Tisnotpossble to drawy ‘Sgephwithjwt one odd 4 ‘valency. Ges Bample 2) ? 2 a Pratbaly 2 vention: have ed valency. mt Agraph is traversable If itis possible to traverse (travel along) every arc just once without ‘taking your pan from the paper. mt Agraph is traversable i allthe valencies are even, im A.graph is samitrarersable if it hae precisely two odd valencias, In this care the cart point ‘nd the finish point will beth etwo vertices with odd walencies, 1m Agraph is not traversable if t has more than two odd valencies, i a Verify that the graph is Ewlenan, b Hirvla soute, sasting and finishing at A, ‘hat tavese thegsaph D 2 vere | alelelole|r vaeney [2 4[4[2[4[4 Allalencies are even, 50 the graph & Eulerian b A possible romeis ABCDEFBCEFA ‘Them are any otherroutes AI of tem wlbe Il ter bg. out igpeton (cite postoran pr en) Rind a route that traverseseach ar of this yrapa just once. z ‘iu may start and finish at different points, 5 verex | Al e[ cl] oer vaeney | 2. o[o[2]4]2 ¥ ‘This has precisely tyo odd valencies, so i & sem-Eulrian A possible route is BAFEDCEBC, ‘The odd voencias am at Band, = strtat ‘one ofthare and frich at theother, Trove that these mustal ways bean even (cr 2e10) “hic called Euler tandshng saber cf vertices mith cd valency in every gag. tere Each ato has tuo ends and so viloontribice two ‘0 the sum of the valencies of the whole graph. The sum of the \alencies = 2 X number of arcs + The sum of the valencies is even The manne that in any amph, = Any odd numbers: must ocour in pais. there willbe 2, oF tO, oF fou, fst, oreight, varices with cid = There & an even number of odd valence. vbr, 1) steve oft yer ant hen detemine ache tegraphsbowa ifiewn = Hi semiBulesan iii mather Forthose that are Fulerian or semi Fulesian, find a cute that tmversos each ate just once. Sa YY oN Nn UTR a Show that eachof the graphs below is Bulenan, 1 Inch case, find a route that starts and finishes at A and travenses each ar just ore. ip 6 i i x in 0 i ve Jw a Show that eachof thesegraphe iscemiBuleran —-N D Ineach case, find a route, starting and finishing at different vertices, that raverseseach edge just once, Explain why each of the graphs below is not taverssble, ane 2 ac db wx or <7» a 1 ® os Considering the valencies of each vertex in Questions 1104, vesify the hand shaking lemma, [Explain why a travessable graph has ether a all ofits vertices with even valenty or bb precisa two vertices of add valency, these being the sast and finish points. ‘The diagtam represents the city of Ronigsberg (rusia, now Kaliningmad, Rusia), Te Drege siver suns hongh the city and creates two lage ilaelsin the centse. The two isanels (Cand Dy mere linked to each ctherand the mainland (A and BY by seven boidges out igpeton (cite postoran pr en) ‘The problem for the citizens of Rovigsheny was to decide whetherce tet thei the stwas posible to walka routethat ciossal each bridge jus crceand = farm “Bridger returned to its tasting point ot Konig a Using four vertines , B, Cand Dito represent the four partsof the ty, and seven ages to sepmesent the bnidyes, deawa graph to model the problem, 1b Show that the graph és ct travessble, ‘There isa continuation of the problem, Johannes works at J, Gregor works at Band Peter ‘works atD. There isa hotel at ¢. Johannes builds an eighth baidgeso that hecan stast at sland finish at hishome at C, ‘roeing each bilge ence, Homeres, be does net want Gregor tobeable finda similar smute from B to C. Where should Johannes bud his eighth bridge? Gregor devices to build a ninth boidye so that he can start at Band finishat his home reas C, ciresiny each badge once, Hedoes not want Johannes to be atleto finda similar soste fiom A tC, Where should Gregor build his nish bridge? Peter decides to bud a tenth bnilge, 9 that evexy person in thecity can cscs all the badges in tum and setum to thee stating pent, Where should Peter build the tenth bridge? 1m Thie algorithm can be used to find the shortest route that traverses every arc at least once and retums to the starting pont mI af the verticos have even valency the network is traversable, The length of the shartest route will be equal to the weight of the natwork In giner ther: wll be many difernt shores inspection route, but all wil ave the are rnin length Solve the route inspection problem for the network below, stanting are finishing at A. a @ Allyalencies are even, 90 the network & traversable.A possible route is ‘There are seer ather solutions such as ABECDEA ABEDCEMorAEDCEBA banal ill length 4748+ 2494 10-97 hove nat 57 UTR 1m Ir thore are only two odd vertices, repoat the shortest path between them, and add ito the netwark, Daren i Ae SN ‘that traverses each edge at east ance. State your routeanad its length, Vieight of neta BSPaR Sr Tee t2 434 Theodd wlenoiss ate at verives Q and T Me have to 1h te eaminatinthe repeat the shortest path Qt0 T QST of length. ae es fe a an 1¢ diagram #0 it becomes | eee We ade GB and ST to the diagram 0 # be. ete Poca ea cater Adding the esta ee eeu aD rework Eurand Sse A possibe rows ie sarsarteure for this example a Conma ute wit have length = 27 (Weight of network) + 9 (engeh of repeat) s————_ Seyret ue wl fa 46 tell knee bra wm Ir thereare marethan two odd valendes, you need to consider | You wilonlyhave to all possible complete pairings and select the one that gives the eonsiderat most four ad valnsier in the smallest total and then add this pairing to the network, See covets unexpected ag 6 gs Weiget ofnenwose Brett? +S+6+44? out igpeton (cite postoran pr en) A.B.Cant D hve odd vale “ou canpairallcese four rode Ineves ways Awe Band Cvith 2 Awe Cand Bwith D te eatnaon yout A weh Band But. contd toe ang ot These que Che tolang ents B+ O84 0=17 M4 BD = 12410 = 22 AD + EC m7 +6 = 15 least sum ddd AD and BC othe network, 4 2 z For this erampleallshorten routes will ip Veen Bie rales be of enath 65 and be 11 letier: lng. ABCEBCDEADA length 92 + 15 = 65 im Hore isthe route inspection algorithm, 1 Identify any vertices with odd valency. 2 Consider all posible complete pairings of these vertices, 3 Select the complete pairing that has the leact sum 4 Add a repeat of the ares indicated by this pairing ta the network, fa Salve the souteinspection peoblem fer this etwctk sasting and finishing at A. Given that itis now permitted tostart and finish at different venice: 1b Seles the start and finish vertices that give the shortest route, explaining your reasoning State the length of yous gout UTR ‘There are odd valencies, at AEF and @. By inspection pach lengths ate: AE TFG = 26 +22 = 40 Shortt paths 2: follows ALG AGE= 26 AF LEG = 2847 =42— kastsum REET 2S AG +EF = 19428 =47 APE AHF = 35 We need to repeat ates AH, HF and ES sand add chem to the network, The shonast path AF & AHF ‘The weight of the nepwork is B02, ‘The weight ofthe natwerk found by The length of the shortest route willbe uring the weights ofthe are, 209 +42 = 251 Modify the network by adding the extra arcs AH, HF and BB, A possible rows is ABCDBGCEGAHEDFEGHFHA, Onevertexwich odd valency x6 the start verter and a second as the frish verbex. ‘That leaves just one pai oF vertices with oda valency Repeat the path between them, choose the pair which has the shortast path between chem. Lookng st the figures at the start ota, ‘the smallest-of the sic numbers & 7, which corresponds t0 ES. Choose to repeat EG,so we & and Fas the start and finishing vertices ‘The lengoh of the new route ie You vere nat asked to fre the mute, 20947 = 36 soyoudon' naad to ett out igpeton (cite postoran pr en) 11) Salve the souteinspection problem for each of the networks below In each case, state yous ‘minimal route ard its length 2) Each of the diagiams belowshow a network of roads that need to benspected_ Ineach cave, find thelength of the shorten soute that traverses cach age at least once arr] setusre ta the ast vertex, State ou soe. ag uo Ef im ¢ (Weight of network 208) (Weight of netoosk 528) (eight of network 206) UTR ‘The diagsam shoe the paths ina patk, The mumbercn each ase gives the length, in metzes, cf that path The vertices show the park entrances, A, BC, D,E and, ‘A gatdener needs to inapect each path for mess She wil walk along each path once and wishes to minimise hersoute. Ube thesoute inapection al gonthm to finda minisnmn soute, sasting and finishing at coirance A, Sate the length of your coute, Given that itis now permitted tostart and finish at tna different entrances, > fied thestast and finish points that would givetheshortest saute, and state the length of the taut. ‘The diagsam represents a sytem caf roads, 5 (eight of netvcr ax) ‘The number oneachar gives the distarce, in ilometses, of that oad. ‘The towm conureil nesds to renew thescad maskinys. Chessy willbe renewing the lesbaide markings ared Mac wll new the centrescad madkings. Chery ness to travel along cach soad twice, once cn each side of the soad. a Bplain Low this difiers from the standard rowteinspection paoblem and fie the length cof Cherry route ‘Mac mst travel along each scad ome, 1b Ube thesoute inapection al gouthm to finda minimal route, You should state the seadshe ‘wil avetse tice andthe length of is cate, Road EGis being resusfaced scon and it is decided not to senew its oad mashings until ater ‘he sesusfacing, Given that EG may be omitted frcan his soute, ¢ find thelength of Mac's minimal soute out igpeton (cite postoran pr en) 11) The netwcuk af pats in a garcen is shown below, The numbers on the paths givethee lengths in metes, The gardener wishes to inspect each of the paths tocheck for broien faving Slabs 90 that they can he sepaised hefcee the gasden is opened to the public. The asters as to walk along each of the paths at least once, ‘a Wate down thedeysee (valency) off each of the ten vertices. B,J 1b Here finda soute of minimum length, You sheuld cleatly state, with sasens, ‘which, if ang, paths will be covered twice € Sate the toa Iengthot your swt route, ° Stating and Anishing at P, sve the soute inspection (Chinese postman) problem for the setwork shown above, You must male your method and working deat. state a your rout, using vetoes todeahe thease, D the otal engtict your ste e UTR ‘The diagram shows thenetwonk of pathe in a garden to beopened to the public, The smumberon each path gives its length in metses. The gasdenss washes to inspect eachof the paths tocherk for backen paring slabs, so that they can be sepaised befoue the garden is pened. ‘a Wate down thedeysee (valency) of the seven vattices A, B, CD, E, Band @. 1b Ubean appropriatealgoritam to fie a soute of minimum length which starts and finishes at and which traverses each path atleast once, Writedonn Which pats, any, wil be ssaverseal tunic. € Caleate thecal engin your sates roe ° ‘The network shows the major roads that ae to be gritted by a council in bad weather The sum beron each afcis thelengthof the sead in kileractss. a List the valerey of eichof the vertices, Starting ard finishing at A, we analgentam to finda soute of minimum length that coverseach scad atleast once, You should clearly state, with seasons, which Gf any) soads ‘will be traversed twice, © Obtain the total lengthof your shortest saute, There is mince ad BD (apt shown) between B and oflength 6.4hm, Tuisnota major sad sot does not aed gutting urgently Decide whether cr not itis seraibleto include RD asa past of the main gutting saute, ging your reasons, (Zou may ignore the cost ofthe git.) out igpeton (cite postoran pr en) '§) The network oppesite represents the tees ina village. The niaber on cach afc sepresents the length ofthe street in mete. ‘Te junctions ave been labelled 4,3, C.D, 3,5, Gand. Jin aes photographer has taken photographs of the housesin the village, Acalesman visits each tense to seeif the cecipants would ike to bay a phckoyraph of theis house, He meds to travel along each see a last once He parks his car at and Starts and finishes these, He wishes ‘minimise the total sare be hast walk a Desi an appropriate algonitlm that can be used to find the miranmm distance the salesnan ness to walk 'b Apply the algosthi and hence fel a route that the ileanan could take, tating the total distance fe has to walk © Asie offers to daivethe slesnan to Bat the start of theday andlocllet Iam froma C Jater inthe day. eflaining your seasoning, carefully determine wheter this would increase ce desea the total distance the sulesnan bas tovwalk ‘a Desesibe an algorithm that is used to solve the route snapertion (Chinese postman) pecker, 1b Apply the algosithm and fire a soute, starting ard finishing at A, that solves the cote inspection problem for thenetosk shown, 6 State the total ength of your route, ‘The situation s now altered oo that, instead of stasting are finishing at A, the sate stasts at one vertecard] finishes at anciher vertex i State the staring vertex amr thefinishing vertex which minim ses the total length of the saute, Givea reason foe yous se tons Hi Ste the length of your mate Ecplain why, inany netwonk, thereisalmaysan even number of vesines of odd deysee. 8 Review Exercise Photocopy masters are available for the questions marked * in this exercise. ‘Alotal eourei is sesonable or Tetable cpposte [Tard o doguenos ‘Colnbroaike maintaining pavements in a distict, Claimed beach [Datghe [ag] Te Soar whch ts seponsbleare ef theteamsin, Fite Par] SPreantel byarsin the diagram. The trad junctions are labelled A,B,C, ., ©. afoctballgee [Hated [9 afer they fad each Tre number cn eachare rpresntsthe pays! éyanes Tre OS £. length of that sendin kan, = Poyle s famsaeistelin Pe =—P ay] The coureil hes seceived a number alpbabescalcaier ESB IS |r ccmplaintsatout the comition cf ct a qu 3 pavements, In crdertoirapect the quick = thea Inarder toirapect th cent fo prunea ist of teams in pavements, a enuneil employee mats 10 dexenlingosterf panscbanea @} ——hnlkalong cach oad tne (one oneach side of the road) starting and ening at fhe ccunel ites at C. Taelengthof the smateis tobe minimal Ignorethe widths cf the reads a Baplain bow this situation disers from the satan route irapecticn, problem, Dp Bind a route of muimum length, ann sateits length, Ey © a veemeninary eaten gest to toy to loeate the mame SABINE inthe following aiphabeical ist. Explain each step of the algonitin 1 ABLE 2 BROWN COOKE Daniel Downe EW OSBORNE Pac SWET 1p TURNER Rind themaximam rumberof stration the binary saath algeniti, reel tolotte a amneina ist of 1000 names ‘The diagsam shome a netwctk of scads ‘The nuraber on each edge gives thetine, in gates, t9 travel along that cad, virash mishesto travel fom Sto Tas ‘quickly as possible fa Use Dijkstaa’salyenitlam to find the shortest time to travel fom $ to. 1b Rindasoutesoe dined to tard rc Sto ‘Tan he dhortes tie. State, wth aseasan, wholes this ruteisa unigee elution. Ona particular day Avinash must snelude Cin his ete Fitvla soute of minimal time fon $ ta T ‘thatiecludes C, ard sateits ume a Sate biely f Paavalgentan, HL Reashals alyontim, 1b Fitvla minimum spanning tee for the snetinnak below sing i Prim’salgonithe, sasting with verter G, Reashal’salgerth, Tneach case unite down the creer in ‘which you made your selection of acs 6 State the weight of a minisnira spanning tee a State, giving aseason for your answes, ‘hich algonithm is prefer le fora lagge netic ee: Da Fond Goynch ue mbecennetan pe Deco e ny fates Treanor encarhar gives the Got nthe of pounds of apg Seinen oan a Us Brual'salgerithe obtain eee ec tulips pesalieats 8 brew powemsenuspectng le den olnasae “ie ree Aas ales pamcnel one glows 4B, BG,10, 2S, U, Wand ¥ a Use Dyn Sager oi he gnc tenon G5 coke Seid 3 theo puch you Bb verte, toe Eocene ae oa ol ing sik the pacesc the sates cn, ie tne trees deae 1 Hephto to gu acount competes te tance ‘MoScnddalss have been tae without further calculation (You are Imtrejurel ofnd tuscan). GBF Thenewar shows the pooubleroutes etween ces A, 6 D5, Gandit ‘The tumiberomn chase gives thecost in pounds of taking that part of te aoute ‘Ube Dijkstra’ algceithan todeternine the cheapest mute fam A {oH and is co. Sbursclution must indicate deal hove yas have applied thealgonitaen, Site cleasly a the oder in whieh the vertices are labaled, 1b bayp you used yous labelled diagram, so denideon the che pex soute, ‘The network abore meres the roads linking ten tovms 4B, C,D, EB GH, Land]. The number on each are isthe journey timeinminites along the rad, ‘lice hives in town A and works i town. fa Ube Dijkstra’ algoritia 40 find the (quickest soute for ice to travel to work each morning State cleasly i thecnder in whichall the verines ‘were labelled, ii how you determined the quictest seute om your labellirg, 1b Onhersetusn joumey ficen woek one day Alice wishesto call inat the ssupernnashes located in tom C. Explain belly howyou would fired the quichest route in this case, Eo a Beplain why itisimporsbletodsaw a retone mithewacly three odd vestices 2 eoL D minimum spanning tree oe a connected retwcak has elges fi Sate the rumber of vertices in the, etc Ba Descihe the differences betwen Dsim’s algorithm and Rrusbal algorithm for faving a minimum connecter of etc ¢ 25 F z 15 ‘The routeinepection problem is solved for a Ls ‘he netwcek above and the length of the soute is found tobe 100 'b Determine the value cf x, showing your waking clean, “ @M-_ [as coerr zP- le 21s a9 alo - 7 un 7 c[p 7 -u we piv un - 27 8 zr] nwo - Flo 73 @ 8 - ‘he table stows the distances, in rete, teen sx nodes, B,¢,D, Band Fafa etc F Voetrnnsalgontim, stating at, tosalve the minimum connect ecb fr this tablet distances, Feplan your method and indicate ‘heorierin whch you mec the sigs: fi Dia your minimum spanning ee ard find is total Feng, fii Site whether your minima sparing tees unique, justify our 1b Aconnested netuotk Nas seven vertices. i Sate the numberef edyesina minimum spanning tse for N, sino seer het fees i HL Fruskal agente, 6 DB ss ssa7m 46 woes a sree ai = es ge, Sa nn = cc somneniss GD Tee satcming list gives the names of ene students uo have sepesenteal Britain in the International Mathematics Olympia. Roper @, Palmer (), Boase @),Youry @, Thomas (D, Kenney @), Mees 0), Fallswal Weber ), Grexiingam (6) a Use the quick sort algenithan t-scrt the samesatove into alphabetical order, 1 Use the binasy search algorithm to lnaate the name Remy, Chasgow Nemasle Manchester Tok leicester Biemingharn Candtt Exeter Southampten 10 Plysnoutta Abinaty ssurchis to bepaformed onthe ‘ames in the list above to Iecate the name Newrasile, a Beplain by a binary cach cannot be eforrned nth thelist nits present soem, Db Using an appropriateal gorithm, alter ‘he lis sothata binary search ean Depetiosmed State the mame ofthe algorithm you use, Ube the binary search algoeithm on your new list tolcrate the name Newraste. ‘The weighted retcek shown atove models ‘theaseain which Bl hives, Each vestex sepremnts atovm Theedges epreent the sas between the towns. The weights are ‘helengths, in ha, of thescadk, fa Use Dijkstia’s alert to find the shortest route fica Bil’s Lomeat 0 T. Completeall the texes on the ‘wcrksheet and explain clearly how you. determined the path of least weight scm yous labellig, ul desides that cn te way to The must vista stop in twa Obie hs shortest routenow, ging ‘telenghanr explaining your method clea e The diagmam showsa network of mads Enea wishesto tare ftom & to Las quickly as posable, The mumberon each, Gige gives the time, in minutes, 1 travel along that cad, a Use Dijksta’s algorithm 10 find the quickest seute ftom dito L, Complete all the boxes on theanswer sheet and explain cleasly how you deteamined the quiches soute from your labeling 1b Show that there is another route which also takes the minimum time. dn engineer ness to check thestate ct anumber of roads to see whether they sed senasficing. The soads that cesd to be checked aresepresented by thears inthe diagram, The number cneach ase sepoesents thelengthof that sad in ka, ‘Toekerk all thesoas, heneats taotsavel along each scad at least cree. Hewishes 10 ‘minimise the total distance travelled, ‘Tre engineers office is at @, so be oats ard ends las journey at G. fa Usean appropriatealgonitam to fed a sate for the engineer to follow State pose route and itslength. TheenginesivesatD, Hebei ne can seduce the dtance travelled ty tating from ome ane iropeting all ae cndscn themay tons ofteeat @ b Sate whether theengineeriscoret inthis beet, ro, caedate how mach Shorterhis nev reutes Irnot, explain why net e ‘The diagsam shows thenetwatk of paths ina countyy park, The umber on each, path gives itslength in km, The veries & ard [represent the to gates inthe pas, ard the vertices, ©, D, EB Gard H sepregent places of arteres. fa Use Dijkstia’sayaitlm 10 find the shortest ute fom A tol. Show all eeesssy woking in the bexes en the ‘worksheet and sate your shoot sate and its length ‘The path wurden wishes to inspect each of she paths tocherk for frost damage, She Insta cycle along each pathat lest cnee, sasting and frashing at A. bi Treen appropniatealgonitien 10 fine which paths will be covered ‘yneeand sate these paths Rinda reute cf minimum length i Rand the total length of this shortest saute, 99 50 S$ 40139 235 39 25 45 a Ube the bubble sot algenthm to scr the ist of numbers above into descending onder hovmny the rearanged onderater ech pass Jesica wants to record a umber of television apanesontovideo tapes. ah pe is 2hcurslong, The engths in mmtes, ofthe FHapmanesshe wishes tocar ae 55 45.29 20 20 40 29 90 25 38 and 35 1 ind the tal ergo programmes to Ye mccided ain me deerite alot oun forthenumterof apes ited Ube theft st decreasing algontam ‘oft the programmes onto her 2 tot ‘apes Jessica's frien Amy say se can ft all the grammes onto tapes €4 Stew bev thsi prsatle 0 weighted network is daoin above, Given that theshastest path from Sto Tis Wand thatz = 0,9) =0: ai explain wy Aand cannot lie on the dastes path, fi fied the value. 1D Given that = 12and y= 0, find the pessiblesange of values fos the length of the shostes path, © Giveanevample ofa practical problem ‘that could be solved by dawn a snetincak and fircling the dhowtest path, sheoughit @" a Devine tte tems ite, ii gaming te, isi minimum spanning tc. Ste cre diference between Krustal’s algerithm and Prins algeritn, 10 fila minimum spanning te © UseRiustals ayonithm toed the sinimum sparring tice for the netwoak shomalove, datethe omer which, you included the acs. Ds the minimum Spaming teeard sateitslengh, ‘This network models a car par. Currently ‘here are two pay stations, coe at Band cre at N, These two arelinked by a cableas shown, New pay-tations areto be installed atB, HA, Fand C.Thenumber an each st represents the distance between the paystations in metees. Jl of the pay. ations new to be connetted by cables, ether diseelly or indisetly. The cusrent cable betneen E are N must beineluded in thefieal netwcel, The minimum amour cf reweable is tobe wed, Using your anmoer to past 6, of cahertnse, determine the minirnmn aaaunt of new cable nesiled, Dravp a diagram to show where these cables shonld be wrotlled, Statethe minimum amount of new cable needed. i ite pieces of wood aresequited tobuald ‘acmalleabine. Tuelen gts in om, of the pisses of wood are listed bec 20 20 20 35 40 $0 6 70.75 Pans, cme mete in length, canbe pschaved ata com of £3 ach, aa The fist ft deeseasing algeithin is tua fo deteaminelow many of these planks areto be purchased to male this cabinet. Biel the total cost and the amount of wood wasted Panis of wood can alsa bebought in Sma lengths, ata cos of £4 each. The cabinet can bebuilt using a mixture oF Lm aed LS planks bird the msnimum com of making thiscabinet. Justify your answer a Uke Dijhstra’s algorithm to find the shortest souteficm § toTan this etocak, Sho all necesaay working by dawinga diagram, State pour shortest souteandits length, 1b Beplain how you determined the shontestsoutefrcm peuslabelling. © Ik is rem necesay to goftom $10 via H, Obtain the shoves soute and its length, GS" sagen is denrived by the few chast bela £ Tae L$ a Ovven theta = 648 andb = 255, daw able to stow te sels bated aueach aep when the ages cena D Bepin Yewsyoursnluton © pasta tel betwen you had bez rentData = 2SSend b= 6 ¢ Sate what ealgentnm echines, ss 8025 4 25 9417 53S a The lit of numbers above is tobe sorted into dexerring cider. Fever a babble sort toobian the soe i, ging the sate of the Istafter each complete pass ‘The nunbers in thelist represent eights, ingrams, cfobjets whichare ode picked ino bins that hold upto 100g D Determine he least mmberof bins resiel ¢ Uoethefist st decsensng ageithm 10 fit teobjets into ins which hala apo 100g Teter nites to minimise the time gent diving rom hisheme tH, coacampate a0. The netwnk above shows a number cf oom and thetime, in minutes, taken ‘odie between them, Te velumect teaffe cn th rads into O's vasable, ad sothelengthof tare alento dave slang these made is expresed intemsors, vere 0 a Ue Dijtstesalgorithm to find wo roster fon H te @ (ne via A ana one via B that minirase te traveling time from HioG. State thelengthof each sbutein tems D Rint therange of values of for which, Teter stud fellow theroutewa A. ‘The mateix sepesents a netwedk of rads betwmen six vilages ,B, C,D, Band B The valuein each cell represents the distance, inken, along these scads, a Show this infoernation ona diagsm. The loval authority decides to build Ube Krusta’salonthmn to determine a road bridge over the ser at. The the minimum spanning te Statetne --Splough wll beable tocross the send cede in whichyea indudethearsand Midge ‘helength ofr minimum, spanning —_‘ Reapply the algonthan to find the tee Drawtheminimam spanniny tt. srungnnan digerce tae mcrmcicngh wll © Sartingat D we Pris algontan on have to travel (gnare the lengthct the matic given tofnd te miraimim the new bride) spanning tse, State tects in ‘which you incudethe acs ©)" Tas aiagta dexibes analgonitim in them ofa fowchat,wherea isa postive integer, ‘The diagsam shome a netwodk of scads connecting villages. The length of each, sad, in km, is shown. Village B has only ssnall footbridge aver theniver which sans ‘rough the milage. It can be accessed by ‘a roads, from and The daveraf asecwplough, based at E fs planning a owt 10 emble her to clear List B whichis refared ton the flow all the ronds of see. The soute should eat tramps tae prime cima eof minimurn length. Bach toad ean 23,87,11 217, be cleared by daiving along it once. The snowplough cannot cross the footbridge a Stating with a= 90, implement this Miyoitemeapanmnpan aig, Semeur eng na appropiate algositam, a find theroute the daiversculd fllom, Beeline Sepseenesce Cae ext sasting and ending at F, to cleapall dhe sais of soon Give tne length ofthis Wite down the final value of for ste, any initial value of @ EBD" The set work oppoate sepresentsthe journey time, in minutes, bermeen ten Midland towns Use Dijksta’s algorithm to find the quickest route betwwen A ara J “our station mast inecate deasiy how you applied the algorithm, including f thearderin whith the vertices wee bell, how you determined your quicken route fiom your labeling, Dis the wate you have Sond the oly aqsickes rent? Girea season for your ane After studying this chapter you should be able to: 1. model a project by an activity network from a precedence table 2 understand the use of durnmies camry out 3 forward pass and a backward pass using esrly and late event times identify crtical activities determine the total float of activities construct cascade (Gantt) charts use cascade (Gantt) charts construct a scheduling diagram, Critical path analysis aN awe The techniques of citical path analysis may be applied to the management of complex tasks to improve overal efficiency, Recent applications in healthcare, for example, have resulted ina reduction in the time that patients spend in emergency departments, wi 5 | 5,1. You can model a project by an activity network, froma precedence table. 1m Imaging that you hare responsibility forthe completion of a complex project, The tatal amount of workto be dene i dWvided into separate activities and some of thase cant bo started until athers have been completed. You ara expacted to organise the actirties sfficiantly in orderto avoid any unnaceszary delay. In orderta plan the project atedively you would nead te represent the activities in some. ‘wey that makes any dependen des dear. It would be helpful to make use of some suitable Notation and to apply a systematic approach, The activities may be written into @table wh ich shows which ones must be completed bofore others are started. The table is callad a pracedence table, or, sometimes, a apendanca table Tenanufetrf sont he constucton cf woten ame chsh te ath ug Inefaiestmnconaedonhptgantimetaal Cuenta thea wich ust the Desulet led Te gveny tet scomplee yatahirg Gcucns fs tmp be bg mappa! ne pte coreg ely fer arp Represent the information above ina systematic way that makes any deperiencies deat. ‘This process may be broken dovm into separate activities ‘ypicaly, these ars labeled A,B,C, D,... for ease of reference later Build wooden frame Cub out material for cushions hitch and Fil cushions ‘Actach springs to wooden frame corer frame Complete assembly Ins pot Weap The activities may now be wrcten in a precedence table ae Se zo mmg9R> depends on D. The fact that D depends On clear from the antryabove and ienot shown again Le, on immediate depancenea & showin in the tab oth active Cand D mut be competed betore work on acttyF may be tated rial path nabs The otucioncfa nentetinnk maybe bien down maces Ato & Jdetivitic: Mand B donot depend on any other activities, Bot activities Cand D can only bestarted cnce Aas been completed. Jdetivity Ecangot be sated ntl actinty B has been completed and activity Feannck bestatea ‘until antinties Cand Ehave been completed. dctinty G can omly beyincnceal ctheractinties have been completed, Drawa precedence tableto represent this information, . Aetity | Depends on 5 = 3 = cE A D A E 8 F cE ‘This appears to be the tricky part to. complete, g ia Jurihescocivte tot pot lesen i ts 1m The production of a precedence table goes some way towards representing a project in @ ‘orm that can halp you to coordinate the acthties effectively However, a diagram may be a lot easier to understand, espe cally ithe projects more complex. 1m You have already sean (in Chapter 2) how network diagrams may be used to reprasant and hholp analyse a varity of problem types. The information provided in a precedence table may be transferred to an activity network to give a viswal representation of the project 1m Thare are two types of activity network but only the activity on are type will be used here, In an adivity on are network, the activities are reprasentad by ares and the com pl those adivities, known az avents, are shown asnades net Each arcs labelled with an activity letter, The beginning and end of an activity are shown at the ands of the are and an arrow iz used to dafine the direction, The convention isto use straight lines for ars, The nodes are numbered starting fram 0 for the first node which is called the source ode Number each node as iti ad dad to the network, The final nade called the sinke node Draw an activity netork for the pascedence table givenin Bvaragle 2, Ttoftenient exryto get the Jayoutof thenstwerkight fist time. Ia good ida to ddiw the networien pene snd have an erver te banal Activities Aad Blo rot ‘dependon any previous Activities Cand D both depend onactiiy A. Nede T represents the end of actiiy A ‘Activ £ dependent on aety Activ F& cepereient on Detieies Cand £ te row ‘lenrthatwesnesd t2 avap the postions of actvtie Cand D Inthe netwarkta haw the Finally, sctvty clepands onactiitie Dard F3 thelr aes reed to mest ata node. With prcticg to efter to anticipate how the atwork roads beset out ands there & les need for adjutant rial path nabs 1) Tt nvtretn arin car rt mong formats ina sag near piven ow 1 chek tateais inne 3 sn ergre Dees uch D set At pat che tat issue oman telus titan 6 Yan in ctchand depos tease Brae pceterre bls pres Cine nae arte posibesion) 2) The development ofa ccmmerial computer program is divided into activities J 10, Jetarity A. does nck depend on any cher actity. ‘setapitice B, C and D all sequise that Activity ss completed before they can stat ‘ctivitie Band F depend cnactivity B ‘detsety G cannot be started untl activities C and E have heen complete. ‘detivity H sajuites thecompleticn off actiity D, while activity I sequies that both activites and Gare completed fs, ‘setavity J sequizes the completion of al acuvities before st may be saste. a Drawa precedence tableto represent the development of the computer program. 1 Use the precedence table t0 draw the comesponding actnity netwcak, 2) The precedence tablesfor apanject is shown baow, Draw the corresponding activity neti, ‘Activity | Depends on y = mlo}almlolole el zlel- 2 wi 5 4) Hee isan activity nemerk fora pooject. Drawa precedence table to sepresert the pacjet 5.2 Youneedto understand the use of durnmies, 1m The precedence table givan below appears te be very simple and yat the corresponding activity network cannot be completed using the methads daseribad so far ‘Activity | Depends on A — 8 — c AB D A a Activities A ane @de not depend on any other actives and so they are linked tothe ource node, z The problem ham é hew to represent activity C which depends on both actviy nl acti To resolve this problem we introduce what is called a dummy actlvlty between evant: ‘Vand 2.The dummy adivity har no time or cost and is sole purpose, in this case, to show ‘that activity C depends on activ A as wall as activity 8, Aum activity show n using 2 domed lie, Therion of the arrow im porant, IRehowe that activity immediately proce activty. rial path nabs Draw an activity network using actinty cn age for this precedence table, Use exactly fvo dummies. aay Tramedintely pr eveding activities fine of ef ef] of a] |The bel forthe colurnn my be vwtean in diferent waye ‘Activy E depends on actiuity 8 Coy, but athity F depend on gh activity Bad activiy C. Th indieste the raed fra durin. The fiet dummy ieshon betwen nade 2 and 3 Activ H depends on aetity Dany, bat aetity depend fn beth actinty D andactsty F. The indicate the need for 2 secone duran. ‘Activ | depends on dethtie: Gand. Extend the ar for acti Eto thesink: needs f0 thot there only onmend point. wi 5 1m Evory sctivty must be uniquely mpresented in terms of ts avents, This requires that there ean bbe at most one acthity batween any two avents, Once again, a dummy may be required to satisfy thie condition, Here isan example te show how this works. ‘This diagram shows patt ofan activity netmork, Suppose that event S depends on activitiesP, ©. ard Thi rot allowed berms there rete activi barca event Gand ‘Uninga dummy allows the deperrience to be shown while ensuring that all activitiesase ‘uniquely determined by their enents Explain the puspose of the dumany. 2) This activity network comtainsa dummy. Drawa precedence table for the network, rial path nabs 2) Drawan activity on are network to represent the precedence table below, ‘Dur network should contain exactly onedumamy. Acivity | Mua bepreced aby z a 2 z ¢ 7 D z E ABE ¢ # 4) Draw an activity on are network to represent the precedence table below, ‘Dur network should contain exactly two dummies, Acivity | Depends on a = 2 = c 4B D 2 z 2 E c @ ©p a z 15) Draw an activity yy om are network for this precedence table sing exactly two dummies, [Explain the purpose of each dumsay. ‘Aaivity | Depenason P = @ = R P S P T BQ wi 5 | 5.3 Youneedto be able to carry out 2 forward pass and a backward pass using early and late event times, 1m Soar, activity nebworks have been used to represent the information given in a precsdence table, im Each adivity takes a certain amount of time to complete, which is rf errad to asthe uration of the actWlty, The next sep ista adapt the adivity network to alow us to work ‘with this information ‘The activity setwcak opporite mas used in Exercise SB (Question. 1 bat noweach activity asa figure in ‘rackets representing its dusation in hows. ‘Activity A takes 2 hours to complete Thedummy take: 0 fours to complete, ca) Each node (verted, of the network represents an event, itis usefulta consider two separate tines tsnated wth enh event, i Theeaty event me the carfe tine of arivlat the event allwing forthe completion tal preceding atte wt Thelate event time the latest neta the event con bet wou extending thetine reded forthe prjed ee 2 een vate Lite wantin The early event times are calculated starting from 0 at the source node amt ‘working towards the sink nad, This ie called @ forward pass, oF forward scan, The hes ot 642 M7 44 = Nand 7H The ate event times are calculated starting from the sink nade and working ba chwards ‘towards the source node, This is called a backward pass or backward scan, ‘The teaver timaat the sauce rode & abe 0 The antyevent time aleys becomes the bio eventtineat ‘The stall of: the sink pode WoT = and 7— rial path nabs The diagram shoe past ofan activity network, Calculate the valuect mo} a ‘The dom line indents a dummy. ‘The diagram shoe past ofan activity netwenk, Calculate the valuect . ea Tpesnali ee oe lose 7a yes a “= 2” Gee wi 5 1) Trediageam shows past ofan activity netwen, py Calculate the value of 2) The activity network foe a projects given opponte, The time in bonus nesied 10 complete each antvity i shown inn rackes, Basly and late times age shown at cash vestex Calculate the values cf w, x, grand z 2) The actinty network for a project is prenopponte ‘Te time in days newled 9 complete each activity is showin, wacket. Calculate the early and latetimes ateach vertex 5,4 You need to be able to identify critical activities, An activity is described as ac itil activity if any inereace in Re duration rasultsin a rorrespan ding increase in the duration of the whole projedt. mt Apath from the source nadeto the sink nade which entirely follows ertcal act ities is ‘called acritieal path, A critical path is the longest path contained in the network, tis possible for a project te have more than one crtical path, in which case the total projedt ‘time isthe sam eon each one, At each node (vertex) on a critical path the early event tIme Is equal to the late event time, rial path nabs ‘The dagmam shone an activity network with caly and late event times shawn at thenodes. enify theeritical activities. r 1g) The oriboal actinbies are A.D, G, and L Adding the dursbions of the orical actanties ghes the total duration for the project, as shown by the early and late event times at the sink nade. Notice thatateach vertexon the erica ath, theeaityand MER EH 7 4 947 = 20. Inte event time ae equal These indicate the rita evens Hbewhar, there ¥ a dierence between the two value, man activity connecting two critical events in't necessarily a ertical activty. Past ofan activity neticek is show below ineluciry theecaly afd late event mes given in, vrours, Which are the critical acuvities? 7] fy z is FHSS 12 (ertind 124 6= 18 Gita) 6 a 7+ @# 18 (notertcal) 2 ‘The critical actutics ate Band @. Fie nota oritieal activity even though i connect Ho orkieal events, Any inotease in the duration of activey E ot activity © vill increase the total time for the project, whereas the duration of acthity F may be increased Wy up 10 hours and have no effect onthe total time Inthe amination, you may nesd bind roore than one catial ath and to Bentityalod the cxtcal tive: Find thecatical paths in ths actinty 3] Oy retinsk and identi the catcal 3 actinic. B sit 6, 60) Ao a a ae | cone, a4 ‘There are tweorivval pathe:A BDGand AB H. ‘The critical actuties are A.B, D,G and H 11) Part ofan activity network is shovm opposite including the ‘ely and Inte event times given in. Bours, Activities J and Kare cxitial Bind the values of, yard z. 2) The diagram shows an activity network with eatly and late event times, in hours, shown at the pestices a entity the cstical a tinties, 1b Name an activity that links two cntical erents but is nck esstical, co BLO fa M8 eal 2s Bl 3 Han) saa, 0) sof rd Fay x Ce (| o 25 xO) 00) Bey, r7 Ere 2a 2) The activity network: Sor a project is shown below Activity times are given in days and are shown in brackets, fa Copyand complete the activity neta ‘0 showthe ely and late evert tres, Dis Gacutcal activity? Ecplain your answer © Desesibe the cnt cal path. rial path nabs 55 You can determine the total float of activities. 1m Thetotal float of an activity affecting the duration of the project. he amount of time that its start may be delayed without total float = latest finish tire - duration — earllest start time 1 Thatotal float of any critical activity i 0. Determine the tla float of each activity inthisactivig network, Acey A 3] AO [3] 3 | ovine B, and @ otiey C z Bh CON ha] peony E 3 may 1 z. i Acthity F - RO i Actey 3 2] aan fie 6 = i z BH 26, 7] 49 fs eed 7 z 21H) CONE hal a Fe ‘hie 9 ential activty, Any clay inthe stor time will acct the duation ofthe project Total fat = 0. ‘Thesereallcitzalactiti 20 the total feat ofeach one EO) The hey valuss bere are shown in rod 3 isthe salt tre that theactivy can stan, 11 E the fast time thatthe ac tity can benched by. 4 isthe dumtion of thectvy. tomltbat =11- 4-324 ig the earlost time that theactivtyean star, 12. the iat time thatthe ac tity can betinished by. ‘is the dluntion of theactvty, topltbat =12-1-7= 4 isthe earls time tha theactivhycan star, 16 & the fat time thatthe ac tity can betnished by. {4 isthe duntion of thenctiry tomlthat =16-4-7= 5 9 isthe eoret time that theetivtycan sar 16 6 the btest time thatthe ac tity con be ished by. 44 isthe dution of thenctity, tol tbat =16- 4-923 11) Determine the total float of each activity in this activity netwreak MO mw ao fa —* = Je Ka) Ae, my a x Bl ce (ET a eI $ fie) 28) i mH Bl 2) The diagsam shows past ofan activity netwoak withactiity ‘imnes meaner in Eos. Pisa critical activity, Qtasa total oat of 3 hows. a Wook cut the values ofa, b,x andy. 1D Whatis the minimum possible value of ¢? (© What s the maximum possible value of the total flcat o£ F? You need to be able to construct cascade (Gantt) charts. ‘Accas cade (Gantt) chart provides 9 graphical way to represent the range of possible start and finigh times for al activins on a single diagram. The number scala shows elapsed time. So, the first hour is shown between Dand Ton the scale, the second hour is shown between 1 and 2 and s0 on, The critical activities are shown as rectangles in a line atthe top. He isan activity network fora paoject. sly ant late event tanes areshown in howss at the nodes, Drawea Gantt chart tosepresent the project. z De ia i hl B © Fay ua) Dao a el 4 Fay | cane i 2 t@ 0129456782 wnmieHiss rad TH ry ra c EL DEL® rial path nabs -ctviey 8 has duration’ ho us, an ‘sation start tina ef heute ard & Tater fingh time of 12 hour, -rctvgy D hae duration 2 hour, an tH ‘Sater start tina af 7 hours and a Tater tingh time 14 hour, ON, etsy Gar dation 3 an fier start tina cf andy test Feb timaet 1s 1m The Gantt chart ilusrates clearly that theres ne flexibility in thatiming of the citical activities, also ilustratas the degree of flexibility in the timing of each of the remaining adivities, 1 Thatotal float of each activity represented by the range of movement of ts rectangle on ‘the chart cwhich is shown as a dotted bos) 1) Tre diagram shows an activity network fora paject, Barly ane late event tines are shown in, ays at the neeles, Diaw a Gantt chast to sepassent the pacjert fe] FO faa] <@) * Pte! a + He) aay’ ~ dss im ra : jas ee fel a o 1@) gy} = aloe 2) Amactivity netwnd fr a project is shoo below, a Calkwlate the values cf, yatad 2 List the ential activities, © Callate the ttal float for atinties G andN, 4 Drawa Gantt chast tosepaeoent the project co FSO fel Mo py acl z 3 x Han) FQ) CO aay’ Dé\ fg z rH is} i) ra] a ¢ _ Are _ Axa Pe) my, ey, 7] 5 Ble ' wi 5 | 5,7 You need to be able to use cascade (Gantt) charts, The overview of a project provided by a cascade (Gantt) chart allows you to determing ‘which activities must be happening at any given time and those that «aay be happening at 2 sgivan time, In practice, once a project is und erway, this providas a useful mean # of checking ‘that non-critical adivities have not been delayed to the point that they hava became critical ‘The Gantt chast below sepresentsa pioyeet that must be completed within 25 days. ‘a Which activities must be happening at midday onday 10? 1b Which activity may be lappering onday 10? 111218 1618 16.17 6 19.20 21.22 232425 Activ’ C must T Cachan be happening t Coe | semidchyon day 0. Active D must be fap pening at midchy on day 10. Active € must be ap pening se midchy on day 0. ‘The recive indicates the ‘ctivty F may be happaning at position of miscby an day 10, midday on day 10, but i start could be debyed unti day 14 a The actities that muse be happening ao ite the ened of doy 12 on the sake midday on day 10 ate ©,D and E. r b The actinty that may be happening at midday onday 10 6 E because ite duration 10 days and & has to fnéh at the end of day 23, 1 Fer tothe Catch siomnin Hagler ths quston. a Whuen ctuesmat behappeangat may cnday& 1 ue ines mat behappenng at msny ony 2? € hic cttiesmay Dekagpnngatmitayon dy 722 rial path nabs 2) The Gantt chast below sepresents an engineering project, Jn engineer denies to cary out some spot checks on the pmgsess cH the pac et ‘a Which actiities miet be happening at 12 noon on day &? 1b Which actiities may hehappenirg at 12 ncoricn day 15? rs DLA IODA A ama DE \ AIT lat Pe H 2) Drawa Gant chart to sepresent theactivity stonotk opposite Use your chast to AQ, determine: ic Bal hs] we bd a which activities maybe fF rappening at midday HE onday 5, 7 1b which astvites mvt be happening at midday on day 7. Fao) 58 Youneedto be able to construct a scheduling diagram, 1m The people responsible er oo mpleting the adivitiasin a praject are referred to as workers, ‘You assume that “+ each activity is completed by’a single worker in the time given ae the duration of the activity “+ once an adivity hae started, it must be completed by the worker, + once aworker has complet ad an activity he/she becomes immediately avaitableto start another acthvity You should always use the first available worker, 1m Ir theres chaice of tasks for a worker, asign the one with the lowest value forts latest finish time ae shown on the acthity network. The procose of assigning workere to activities ie known ae scheduling, Typicaly, the object 0 find the minimum number of workers needed to completa a projed in the citieal time, Starting from a Gantt chart, a schadullng dlagram may be constructed which shows the activities assigned to each worker, The dagmam shomea Gantt chast for a project. Schesule the actiities to be completed in the critical time by theminimum number of weokers, T I I i | [ $. Cen | i} ‘This Gants chart information may be braneferted to a scheduling diagram in stages, i i in i ‘weeiar 1 I TT I (Cre worker & panded ta complete thecrtical atin: Depa Worker’? sane with acy Band, on completion, sorts actity D. Athi Werkeré-netdled tant activity Ean tre. B14 16.16 17 16 19.20.21 1 22426 Byclebying activity Fas te 23: posit, the actny may be stared by worker Zon completion of actviy D. rial pat nabs Allof che actives have now been sesigned and so the fy carting actiy Ha soon scheduling diagram & complete, Shading is used to as rssibeand acto | be indioate any penods of maotutty for each worker. See a eee ey At this stage tthe information é available, it worth doing final chesk to ensue that alot ‘the dependkncy conditions fr the activites ae aise bythe schechling agram, In Example 12, the minimum number of workars raquired te complete the project within ‘the critical time of 25 days wae In general, a lower bound for the numberof workars needed fo complete a project within Its cxttkal time is given by the smallast Integer greater than oF equal to sum ot all of the activity times critical time of the project. Apply this to Example 13: acety | ale }clofefr falta] | a | tot puraton} 2} se | a} 7|utoals|2]a]a] oe Scsun salle adel ine: Boke Ths gheolower bound athe matestnegegreterthan or equals $6 $6 264ands00 bverbeurdis > “This sim ply moans that itis impossible to complate the project in the citical time using ‘ewer than 3 workers, However, since the calculation takes no acovun tof the degree of ‘overlap of the adivities t doesn't guarantee that 3 workers is sufficient, 1m When the number of available workers is fewer than the minimum required to complete ‘project within its ential time, the information shown on @ Gantt chart can nat ba relied ‘upon as some activities wil be delayed further than shown, In this stuation it is better ta eanstrud the seheduling diagram direct from the activity network because spacial care iz needed to ensure tat the dependency conditions are satisfied Tre dagmam shomean activity retinork representing a project ‘with a minimnmn time of 31 days, Ubea schesuling diagram to nd AQy ‘he new completion timefor ‘he pacject given that only a ‘yo tedkers are avaiable, o Be) ‘Worker care actvty And workr 2 stare activ B Worker 2 fiche fet anc some aetity E Worker | sons actinty C7 = 21), ‘Worker’? sar actvty i} workar | stare acti F Continuing in che same way produces the follwing schedule diag CoH i pet te i ‘wooss 1 [7 a Terry = | 1 I ag I I ‘The minimum time to complete the projact using tro vo rkers 6 BA days. 7) Te canadecant onthe aware pentane wth ential neat 2 tos a en at he total duration he aa s hs, caltea em bouned fete munterof mates mel ocomplee te poten ne b dn unemenpechem mans tint Ary Beane bear ral? fnasino projet Dos ths mean at tuner ee wile popes dey? ¢ Whuchcinty mt beappeing 1 nousino te poe @ complaee sinful dagen compete the pope n22 hous, ae be mente vatesmqaiel rial path nabs o-pact ect popes oan apiaie leaky zee a aan T 2) The activity network used in Example 14 is shown again here m7 17 oe) ae! pan aye | > I | 7 a J, o He) n~E my Br > tela bel a Drawa Gantt chast tosepnesent the project 1b Schetle the project to becompleted by the minimurn numberof workers in the caitical time, State the number f workers se] ire8, 2) Construct a scheduling diagsam based on the actinity netinedk below, given that ory 2 vwerkers are avaiable. Rind thenew minimus tse for completion of the pacject. Zz] FO fal avr * 4 He) 2a f ~ DONE fa a a) o ro 1@) 2) a ‘The precedeme table for activities irclved in. proucing a compu ter game is shown cppceite. Anactinty on ar netwonis 0 be dawn to sede this production pccess a Beplain way itis nenesmry to use at least ‘wo dummies when drawing the activity etek 1b Draw the activity netwoek using exactly toro durante, ‘Must be preceded b: z DE Gl Gl HE a Draw the activity netwoth destribed.n this precedence table, using activity onage anh exactly tw duramies, Activity | Tauinediataly prece ding actties a = 2 = © x D B E Bo E Be 1b Beplain why each of thetwo dummies is recess, 1g6. in expitmesing projects modelled by the activity netwouk show above, The acti ties aresepresented by thearcs, The number in brackets crieach are gives the time, indays, 40 complete theactivity Eachactinity squires one werker, The pucject isto beccmpletal in the shortest time, Calculate the ealy time and late time foreach event 1 State the citcal activities ¢ Bind thetota foat on activities D andl F You must show your working @ Drawa casade Gantt) chart sor this project. rial path nabs The cis engine vist ie pnect on dey 1S anvtday25 to cask Ue popes of Che wat Cen tat the pret on els, which aries mot be tappening cncachot thes (30 ays? ° “Apeoject ismedlled by the activity network shown above. The acivitiesase sepresenteal ty theascs, The mumber in brackets cn each ate gives the tne, in hows to coraglete the activity. The numbers in cules are the event rum bers, Each activity requizesone waaket. a Explain the puspose of the dotted ine from event 6 to event 1 Calcwlate the early time and latetime for each event. © Calculate the total float on activities D, Baral B Determine the estical activites, fe Given that the sum of all thetimes ofthe activities is 9S hours, calculate a lower bound for the mum berof workers resded tocomplete the project in the minimum time, To smust how your woking, £ Given that unrkers may not share an activity, schedule the activities so that the process completed inn the shortest time using the mitinumn numa ber cf wees The network shows the activities that nesd. tobe unlestaken tocom plete a project. Jah activity s represented by an ar. The smaan berin backets isthe dusation of the activity in days, The aay andlate event smesareto he showmat cach vertex and some bare been comnpleted for you, fa Calctlate the missing easly ata late sirnes, List the two oxtical paths for this network, event ee © Beplain what is meant by a citical path, ‘The sum cf all the activity times is 110 days and each activity sequizes just one neaker. The project must De completed in the minximuna tine, 4 Calcdlatea lower bound for the number cf workers needed tocomplete the puoject in the srinimum time, Ke must show your working List the actinites that must be Lappening on day 20, £ Comment on youranswer 0 past e with seyasd to the lower bound you found in past 1g Schelde the actinties, using the minimum number of woelexs, 9 that the paoject is completa in 30 days, wi 5 Summary of key points 1. Accmplex project may be backen dwn into a raurtber of separate activities ‘The completion cf anantivity isdesabed asan event. 2. Sonne activities may only be started ance other activities are completed, This infeamation. say te shown in a precedence table, sometimescallel a dependence table. 2 dn antivity network provisesa visual sepresentation of the information gwen ina precedencetable which males teaser to vcr with, ‘The type of activity net work used on this coussess called an activity om aro network. In this type cf network, theactivates are sepresented by arcs ard events aresepresented as roves 4 Tach event hasan early event time ania late event time, The sudy erent timeis the cashes! timeat which all of the dependent events may be completed. The late event imeis the atest time at which ary of the dependent events may be comapleted without delaying the project. Banly event times are calelated using a forward scan ata late event times are calculated using a backward sean, 5 An activity is described asa eritical activity if any increase in ts duration esults ina contespomding iresease in theduration cf the whole peojest 6 Apath from the source node to the sink node which entirely fllomsesticl activities ‘scalled a critical path. A critical path is the langest path contained in the network This possible for a prcjet to havemore than onecritical path, in winich case te total sojext time isthe sameon each one 7. se cach vertex ona cstical path the early event time is equal tothe late event time 8 Thetotal float ofan activity is the amcunt of time that sts last may bedela yet ‘without affecting the duration of the project. ‘otal float = latestfinish time — duration — earliest stat time. ‘The toa float of any estial atinty is 260, 9 Acascade (Gantt) chart provides a. gapihical way to represent the mrye of possible Sart andl finish times fr all activities Ona single dia gram, 10 Ascheduling diagram isuset to show how tasks areallrated to wnkersinoiesto Completea pect subject to constraints om the time required cr the rm ber of workers available 11 In general, a Lower bound for the number of wankers nese to com pletea project ‘within its critical time is given by thesmallest integer greater than cr equal to sim of all ofthe activity ames critical tine oF the picject 12. Adummy activity is shown by a dotted line It has an arow toindicate diction, but ro weight 12 Dummies are need for to seasons + Sorerample, if antinty D depends onp on activity B but actavty E depends on actinies Bavdc + to enable the unique representation of antiities in tems of their end events After studying this chapter you should be able to: 1 2 3 This chapter will show you howto formulate a practical problem as linear programming problem and how to solve a two-variable linear programming problern graphically. Linear programming is used to solve problems in 9 wide variety of areas including finance, planning, contral, design, management and Fesourcing, Itis often used to help maximise profits or minimise cost, formulate a prablem az a linear programming problem ilustrate 2 two-variable linear programming problem graphically locate the optimal point in a feasible region using the objective line (ruler) method use the vertex testing method to lacate the optimal point determine solutions that need integer values, Linear PE fe ee eee m1 Thedeciston varlables in a linear programming problem arate numbers of each af the ‘things that can be varied. Far example, the numberof fruk cakes mada, the number of teddy bears made, ete, The variables, which are often ealled.#,y, z, ete, will batho ‘lettre! he inequalities and objective function, 1m The abjective function is the aim of the problem, It may be to maximise profit erta minimise snst, Thare are two parts: aw ord ‘maximize! or ‘minimise, and an algebraicexpression, ‘which iz often written ae an equation in terms of the dedzion variables, for example, Aw + 2y, C= det Ty 43, 1m Theconstralnts are the things that will pravent you making, or using, an infin te number of ‘each of the variables, Examplas of constraints are the quantity of raw materials available, the time available, the fad that you cannot have anegative quantity, etc. Each constra Int will give ria to. one Inaquallty, 1m Iryou find valugsfor the dedsion variables that satisy each constraint you have a feastb ke solution. mn graphical inear programming problem, the region that contain athe feasible solutions i called the feastble region. 1m The optimal solution the easible solution that meets the objective, There right be more than one optimal sohution. To formulate a problam ae alinear programming problem. 1 define the decision variables (x,y,z, ett) 2 state the objective (manimise or minimise, tagether with an algebraic expression 3 write the constraints as inaqualitcs. Mire Qook is making cakes to sll forchanty, Shemales two typse of cae, fruit and chocolate Jdmongst other ingrediens, cach frst cake requires 1 egg, 260, of fous are 200g of sugas Bach, chocolatecake requites 2 exe, 250 g of lous and 2004 of swat Mss Cook kas 36 x5, Thy of fas and 6g of sagas ‘She wil sll the fiuit cakes for £8.50 and the chocolate cakes for £. She wishes to maximise the money shemales from these sales, Thi & anaesumption “ins may asourne she sells all she sakes, ‘thot E mode in Iinsar programming problems Formulate this as linear programming problem. Snide not weil sata. Ie sornetime usu twectoate | tage | Flour | Sugar | free +-— tosummathe | Frit: 1 | 209 | 200g | 2550 Choootate 2__| 209 | B00 | 2900 Total waiale | 26 | 72009 | eo00g You need to make the unis agree, Liner pregrning The deciion vara ble Firstdefine the ders onseriatles, datas stat ‘Let ate the Let Phethe numier offre cakes made nunietet tee Let cle the number of chovolate oakes made SS ext state the objects, theobjathera word Die just 9 watul way anes oc minee Maximise bacnuce of raring to the ic Miz Cook wie to expresion. Wis Cook expression, usualy in rmaxiniee her income. want to mim her terms of y etc prot, matinze P= 250+ 56 Me Cook will ge £2 50 Each choco cle sol ote that thereare no for eich fuk cake ste rise £5.11 conker unit, inthe axes, Zell, Isha se fof them fold, Mis Cock wil be shown in theabjactie she will male £3. 5 5c furetin. Finally. identify che constraints »—______________Thasewill be inequalities eggs: f+ 20= 56 Mr Cook msc 1 agg for each fru cake and 2 te npheeach chacobte flown 280F + 2808 = 7000 fealoeech checonte This simplifies to of 36 ager thatean be (+6228 ea ch fruitcake muir 280g and each chocobte sugar 200 + 2006 < 6000 1) ~ cole 250g. There are up to 7o0Dg avaiable, ‘This simplties to 2 2+ 36260 Ech fruitcake mcquies [2009 ard each chocolate cate 2009, There are 6t00g avaiable non-negarwiy: f= 04 = 0 These ae often wrtten together 36 You cannot have Ras negative value for forc. texo (Anegative cake is not A formal summary of the problem ie espe) Tet Fle the number offre oes made See ec anal eesar te ee maumee 7 =280+ 50 Tai te formal fae — ea (4206 es te onze arise" 60 tase Accmnpaxy bays two ty pes of diary to sere tots customers, a desk top diary axel a pocket diay, ‘They will need to placea minimum orclee of 2) desk top and 80 pocket diasies. ‘They wil need at least twnce as many pocket diaries as desks top diaiss ‘They wil nese a total of a least 400 discs, Tach desk top diaxp costs £4 andeach pocket diary costs £2 ‘The company wishes to minisnise the cost of buying the diasis. Formulate this as near programming problem, Summarse the information in a table Algo require: + tHice a6 many pocket a5 des k top + votalof at least 400. Dt the dorm variables fachdak op diycosv es Let xbe the number of desk top dares bought eee ee Lety be the numte of pocket dares bout Thine tha co Stats the objective, Thecompany mus orler minimise =e = Ort By atest M0 derk tap daze Br at kt pocket State the constraints wei ares rum ower x= 200 The pe of compare Li amine ablease wrens many pocket. as desk top LS woseps ti scar thealgeba comectard poe then gatting the inequality To gatthe algebra come, change the statement sea to md ‘exact ties Se many peelet ae dark tay The tall ouwhicho ne neat: to be doubled. The hhumber of pocket dies (y) & double the number of desktop (9.50 eget 22> y To ost the diction ofthe inequality you nes Yo 208 which arm of theeecan te made brger Here the numberof pocket diaries a total of ab hast 400 diarles: fan nemaceco 225 y SOR non-negat iy! ee ieee Since wee have already stated that x ® 200 and y = BO. is do not need to state that x= Oand y> 0. Go the non-negativey constraint is not needed here. Liner preg ning Here i the summary, Let xe the number of desk top diaries bought Let y be the number of pocket dariss bought minimise ¢ = 6x+ oy subjectto x= 200 yee 2eey xt+y=400 Accmnpaxy produces tw types of eysup, A and B. The sysupsasea blend ef sugar, fruit are juice Syrup A contains 20% sugar, S09 fruit and 2095 juice Syrup B contains 20% sayas, 2596 fruit and 45% juice Tach live of syrup A enets SOparel cach hse of yiupB comts 40p, There isa maximum daly preeluction cf 40.000 Ltses of sprup A and 45000 lites of syrup Aconfetionery manuactuser places an ord e for 60000 litres of syrup but seqices + velow 25% sugar + at east 40% fruit + resmode than 2695 juice ‘The company wil blend syrups A and B to mest the confectionery manufacture’ requirements ‘The company wishes to minisnise is cots letting » bethe mumber of ites of sup Asused, and y be the rumber of lives of sprup B used, sbrmulate tas asa linear programming pecblem, Summarise the informacion, eye Pangaea | pice | mou | Oe @_|" AG w | x | a | coo | omy BY) zo | 2 | 4 | #00 | am Raquel in| oon | 3.40 | 20 | coco Define the warables ‘This has already been done in the question State the objects, minimise 6 = 05%+ Ody Each tte of syrup & costs S0p ard each tre of syrup 8 casts 40p. The company warts to Mocethe arc inequality, eer State the constraints. Pe Rs ofr + oy 05 Soa bel ie 4 oy 2005 Ot er i eee oes Pectin Boone | meson | vert: ) come! lod riuet be supe, oaxtozy cory >me +e Fegon & tadudog Bef, + ll the points that ie belowthe Ine, in region B, ‘Mou epmsented are represented by Secon mets ax +by-) are reprosanted by a dashed (or dotted) line. This indicates that the tne Hsetf is m¢ Included In the ragion, “+ Inequalities using x or a are reprasentad by a soll line to show that the line kx Inchaded In the region, ‘The convention iethat the region that doos mot satisty the inequallty ie shaded, ‘To dove which ste of theline oes not sats the inequality, choove aconveniantpointin each segion and subritcteit coominate: into the inecualityto see whether @rnct) tates the ‘quality. Stade the mon containing the point that dows sat the equality ‘The ease region satistying several inequalties ‘wil therefore be the one left unehaded, _ Th thetenble region “forthese thre inequaitis, ‘Wate doum theinequalities shown by segions &,B, C,D, E,E G, H, land] sa thediagrams Ss a Regan +9510 ——— RegonB 292401 b Regence aye RegonD — 2yex 1 Region E 2 Region F #29 4 Regn << Region H yet i Region 1 540-6 Region J ae By- 6 A broken ling so < and > therthan = and =. Taatng point (0, 0) +0 «10. Tasting point (10, 10) 10 + 10 > 10, A solid ling, 30S and & rather than < and >: Tasting (1, 92x 620. Tasting (5, 92 x0 85. ‘A ben ling so strict inequality. Tasting ©, 90 <5 Tasting @, 8 > 5. Azole, Tasting ©, 1S)ghe 15211 Tasting ©, gives 6511 Azali line, Tasting ©, 30 53x 3-6. Tang ©, )O=3x0-6. Liner preg ning ‘= Yy ~ Scould be written in mang different forms, suchas dy =x + 50rd — x= 6. onsen ae ree eae, or He yn teen ene Nee the posity sonthe ieater than' side, Tlustrate cna diageam the sgion, R, for which, neo dey < 12 Ban 2950 label the region B ‘There ate fhe inaqualivies here and binee ines to add to the anes, xe2 . Draw = 2, a pees bop dat Oye 2 Drawan+ Sy = Basa trot lin. When x = O.y a Wheny = 0. fee elt be ay Dy. et y = E000. ney Draw = y (broken) pass ing through (0. 0), (OOO, 19008), (60000, 60000) y ery, - a Oar oxmzy | Thalines ty = e000 ps ea ‘theugh (0, €0C00 and (60000, 0). J Teng (0) pute Rin the ea Sec e a) Combine all these on one diagram. jena aneeeaeeo" andy Ore notacualy igguntrnng haat mgen 11. Tlustrate the inequalities four in Example 1 (pages 114-115) om ga ph paper label the feaaible eyion, R 2, Repeat Question Lusing the inaqualities found in Bvample 2 (payes 116-112. Liner preg ning 2 Repeesent the following snequalities graphically. label the reyor bounded by these srequalitiesR ty > 18 yen yas ay =0 4 The fcllowning inequalities were found when solving a lineas progsam ming problem, ney why ed nea gel Repoesent these inequalities cn a graghh Inicate the feasible repion by labeling it 5) Region R is bounded by the following inequalities xty aD Seb ey = 60 ey y#10 By deawing suitable sta ght lines, draw a graph toshow segion R. 6 Indicate ona graph thereyicn, B, sor which Bm -a

You might also like