CSE 4308 - Assignment 1
CSE 4308 - Assignment 1
Listofassignmentduedates.
Figure1:Avisualrepresentationoftheroadsystemdescribedinfileinput1.txt.
Task:UniformCostSear ch
Implementuniformcostsearchforaprogramthatcanfindaroutebetweenanytwocities.Yourprogramwillbe
calledfind_route,andwilltakeexactlythreecommandlinearguments,asfollows:
find_routeinput_filenameorigin_citydestination_city
Anexamplecommandlineis:
find_routeinput1.txtMunichBerlin
Argumentinput_filenameisthenameofatextfilesuchasinput1.txt,thatdescribesroadconnectionsbetween
citiesinsomepartoftheworld.Forexample,theroadsystemdescribedbyfileinput1.txtcanbevisualizedin
Figure1shownabove.Youcanassumethattheinputfileisformattedinthesamewayasinput1.txt:eachline
containsthreeitems.Thelastlinecontainstheitems"ENDOFINPUT",andthatishowtheprogramcandetect
thatithasreachedtheendofthefile.Theotherlinesofthefilecontain,inthisorder,asourcecity,adestination
city,andthelengthinkilometersoftheroadconnectingdirectlythosetwocities.Eachcitynamewillbeasingle
word(forexample,wewilluseNew_YorkinsteadofNewYork),consistingofupperandlowercaselettersand
possiblyunderscores.
IMPORTANTNOTE:MULTIPLEINPUTFILESWILLBEUSEDTOGRADETHEASSIGNMENT,FILE
input1.txtISJUSTANEXAMPLE.YOURCODESHOULDWORKWITHANYINPUTFILE
FORMATTEDASSPECIFIEDABOVE.
Theprogramwillcomputearoutebetweentheorigincityandthedestinationcity,andwillprintoutboththe
lengthoftherouteandthelistofallcitiesthatlieonthatroute.Forexample,
find_routeinput1.txtBremenFrankfurt
shouldhavethefollowing:
distance:455km
route:
BrementoDortmund,234km
DortmundtoFrankfurt,221km
and
find_routeinput1.txtLondonFrankfurt
shouldhavethefollowingoutput:
distance:infinity
route:
none
Forfullcredit,youshouldproduceoutputsidenticalinformattotheabovetwoexamples.
Suggestions
Thecodeneedstorunonomega.Ifyouhavenoteventriedlogginginonomegauntilthelastday,thereisa
highprobabilitythatsomethingwillgowrong.Youmayfinditconvenienttodothecodedevelopmentand
testingonyourownlaptoporhomemachine,butitishighlyrecommendedthatyoulogintoomegaand
compileatoyprogramASAP,andthatyoucompileandrunanintermediateversionofyourcodewellbeforethe
deadline.NotifytheinstructorandTAforanyproblemsyoumayhave.
Paycloseattentiontoallspecificationsonthispage,includingspecificationsaboutoutputformat,submission
format.Evenincaseswheretheprogramworkscorrectly,pointswillbetakenofffornoncompliancewiththe
instructionsgivenonthispage(suchasadifferentformatfortheprogramoutput,wrongcompressionformatfor
thesubmittedcode,andsoon).Thereasonisthatnoncompliancewiththeinstructionsmakesthegrading
processsignificantly(andunnecessarily)moretimeconsuming.
Grading
Theassignmentswillbegradedoutof100points.
40points:Theprogramalwaysfindsaroutebetweentheoriginandthedestination,aslongassucha
routeexists.
30points:Inadditiontotheaboverequirement,theprogramterminatesandreportsthatnoroutecanbe
foundwhenindeednorouteexiststhatconnectssourceanddestination(e.g.,ifsourceisLondonand
destinationisBerlin,intheaboveexample).
30points:Inadditiontotheaboverequirements,theprogramalwaysreturnsoptimalroutes.Inother
words,noshorterrouteexiststhantheonereportedbytheprogram.
Negativepoints:penaltypointswillbeawardedbytheinstructorandTAgenerouslyandatwill,forissues
suchas:codenotrunningonomega,submissionnotincludingpreciseandaccurateinstructionsforhowto
runthecode,wrongcompressionformatforthesubmission,orotherfailurestocomplywiththe
instructionsgivenforthisassignment.PartialcreditforincorrectsolutionswillbegivenONLYforcode
thatiswelldesignedandwelldocumented.Codethatisbadlydesignedandbadlydocumentedcanstill
getfullcreditaslongasitaccomplishestherequiredtasks.
Howtosubmit
ImplementationsinC,C++,Java,andPythonwillbeaccepted.Ifyouwouldliketouseanotherlanguage,please
firstcheckwiththeinstructorviaemail.Pointswillbetakenoffforfailuretocomplywiththisrequirement.
TheassignmentshouldbesubmittedviaBlackboard.SubmitaZIPPEDdirectorycalledassignment1.zip(no
otherformsofcompressionaccepted,contacttheinstructororTAifyoudonotknowhowtoproduce.zipfiles).
Thedirectoryshouldcontainonlysourcecode,nobinaries.Thesubmissionshouldalsocontainafilecalled
readme.txt,whichshouldspecifyprecisely:
NameandUTAIDofthestudent.
Whatprogramminglanguageisused.
Howtorunthecode,includingveryspecificcompilationinstructions,ifcompilationisneeded.
Instructionssuchas"compileusingg++"areNOTconsideredspecific.
Insufficientorunclearinstructionswillbepenalizedbyupto20points.Codethatdoesnotrunonomega
machinesgetsATMOSThalfcredit(50points).
Submissionchecklist
Isthecoderunningonomega?
Didyousubmityoursourcecode?
Doesthesubmissionincludeareadme.txtfile,asspecified?