COMP 8042程序 辅导、C/C++,Python编程 写作

” COMP 8042程序 辅导、C/C++,Python编程 写作Put your Name Idon the reportFinal ProjectDue April 12th, 2021 11:45pmCOMP 8042All work should be done individually.Geographic Information SystemGeographic information systems organize information pertaining to geographic features andprovide various kinds of access to the information. A geographic feature may possess manyattributes (see below). In particular, a geographic feature has a specific location. Thereare a number of ways to specify location. For this project, we will use latitude and longitude,which will allow us to deal with Geographic features at any location on Earth. Areasonably detailed tutorial on latitude and longitude can be found in the Wikipedia at https://en.wikipedia.org/wiki/Latitude and https://en.wikipedia.org/wiki/Longitude.The GIS record files were obtained from the website for the USGS Board on GeographicNames ( https://geonames.usgs.gov). The file begins with a descriptive header line, followedby a sequence of GIS records, one per line, which contain the fields provided in Table 1 inAppendix in the indicated order.Notes: See httpss://geonames.usgs.gov/docs/pubs/Nat State Topic File formats.pdf for the fielddescriptions. The type specifications used here have been modified from the source (URL above) tobetter reflect the realities of your programming environment. Latitude and longitude may be expressed in DMS (degrees/minutes/seconds, 0820830W)format, or DEC (real number, -82.1417975) format. In DMS format, latitude will alwaysbe expressed using 6 digits followed by a single character specifying the hemisphere, andlongitude will always be expressed using 7 digits1followed by a hemisphere designator(for more information look at [This Link]). Although some fields are Mandatory, some may be omitted altogether. Best practice isto treat every field as if it may be left unspecified. Certain fields are necessary in orderto index a record: the feature name and the primary latitude and primary longitude.If a record omits any of those fields, you may discard the record, or index it as far aspossible.In the GIS record file, each record will occur on a single line, and the fields will be separatedby pipe (|) symbols. Empty fields will be indicated by a pair of pipe symbols with nocharacters between them. See the posted VA Monterey.txt file for many examples.1While latitude lines range between -90 and +90 degrees, longitude coordinates are between -180 and+180 degrees.1Put your Name Idon the reportFinal ProjectDue April 12th, 2021 11:45pmCOMP 8042Hassan S. ShavaraniGIS record files are guaranteed to conform to this syntax, so there is no explicit requirementthat you validate the files. On the other hand, some error-checking during parsing may helpyou detect errors in your parsing logic.The file can be thought of as a sequence of bytes, each at a unique offset from the beginningof the file, just like the cells of an array. So, each GIS record begins at a unique offset fromthe beginning of the file.Line TerminationEach line of a text file ends with a particular marker (known as the line terminator). InMS-DOS/Windows file Systems, the line terminator is a sequence of two ASCII characters(CR + LF, 0X0D0A). In Unix systems, the line terminator is a single ASCII character (LF).Other systems may use other line termination conventions.Why should you care? Which line termination is used has an effect on the file offsets for allbut the first record in the data file. As long as were all testing with files that use the sameline termination, we should all get the same file offsets. But if you change the file format (ofthe posted data files) to use different line termination, you will get different file offsets thanare shown in the posted log file(s). Most good text editors will tell you what line terminationis used in an opened file, and also let you change the line termination scheme.In Figure 1, note that some record fields are optional, and that when there is no given valuefor a field, there are still delimiter symbols for it.Also, some of the lines are wrapped to fit into the text box; lines are never wrapped inthe actual data files.Figure 1: Sample Geographic Data Records2Put your Name Idon the reportFinal ProjectDue April 12th, 2021 11:45pmCOMP 8042Hassan S. ShavaraniProject DescriptionYou will implement a system that indexes and provides search features for a file of GISrecords, as described above.Your system will build and maintain several in-memory index data structures to supportthese operations: Importing new GIS records into the database file Retrieving data for all GIS records matching given geographic coordinates Retrieving data for all GIS records matching a given feature name and state Retrieving data for all GIS Records that fall within a given (rectangular) geographicregion Displaying the in-memory indices in a human-readable mannerYou will implement a single software system in C++ to perform all system functions.Program InvocationThe program will take the names of three files from the command line, like this:./GIS database file name command script file name log file nameNote that this implies your main class must be named GIS, and be able to be compiledsimply using a g++ compile command. Preferably, you are encouraged to create make filesfor the project and provide the required dependency files in your submission.The database file should be created as an empty file; note that the specified database file mayalready exist, in which case the existing file should be truncated or deleted and recreated.If the command script file is not found the program should write an error message to theconsole and exit. The log file should be rewritten every time the program is run, so if the filealready exists it should be Truncated or deleted and recreated.3Put your Name Idon the reportFinal ProjectDue April 12th, 2021 11:45pmCOMP 8042Hassan S. ShavaraniSystem OverviewThe system will create and maintain a GIS database file that contains all the records thatare imported as the program runs. The GIS database file will be empty initially. All theindexing of records will be done relative to this file.There is no guarantee that the GIS record file will not contain two or more distinct recordsthat have the same geographic coordinates. In fact, this is natural since the coordinates areexpressed in the usual DMS system. So, we cannot treat geographic coordinates as a primary(unique) key.The GIS records will be indexed by the Feature Name and State (abbreviation) fields. Thisname index will support finding offsets of GIS records that match a given feature name andstate abbreviation.The GIS records will also be indexed by geographic coordinate. This coordinate index willsupport finding offsets of GIS records that match a given primary latitude and primarylongitude.The system will include a buffer pool, as a front end for the GIS database file, to improvesearch speed. See the discussion of the buffer pool below for detailed requirements. Whenperforming searches, retrieving a GIS record from the database file must be managed throughthe buffer pool. During an import operation, when records are written to the database file,the buffer pool will be bypassed, since the buffer pool would not improve performance duringimports.When searches are performed, complete GIS records will be retrieved from the GIS databasefile that your program maintains. The only complete GIS records that are stored in memoryat any time are those That have just been retrieved to satisfy the current search, or individualGIS records created while importing data or GIS records stored in the buffer pool.Aside from where specific data structures are required, you may use any suitable STL libraryimplementation you like (but not other libraries).Each index should have the ability to write a nicely-formatted display of itself to an outputstream.Name Index InternalsThe name index will use a hash table for its physical organization2. Each hash table entrywill store a feature name and state abbreviation (separately or concatenated, as you like)and the file offset(s) of the matching record(s). Since each GIS record occupies one line inthe file, it is a trivial matter to locate and read a record given nothing but the file offset atwhich the record begins.2You are not allowed To use std::map here. You may use and modify any of the lab provided startercodes as your own implementation of a hash table.4Put your Name Idon the reportFinal ProjectDue April 12th, 2021 11:45pmCOMP 8042Hassan S. ShavaraniYour table will use quadratic probing to resolve collisions, with the quadratic function (n2+n)2to compute the step size. The hash table must use a contiguous physical structure (array).The initial size of the table will be 1024, and the table will resize itself automatically, bydoubling its size whenever the table becomes 70% full. Since the specified table sizes givenabove are powers of 2, an empty slot will always be found unless the table is full.You can use your desired hash function (e.g. elfhash), and apply it to the concatenation ofthe feature name and state abbreviation field of the data records.You must be able to display the contents of the hash table in a readable manner.Coordinate Index InternalsThe coordinate index will use a bucket PR quadtree3for the physical organization. In a bucketPR quadtree, each leaf stores up to K data objects (for some fixed value of K). Upon insertion,if the added value would fall into a leaf that is already full, then the region correspondingto the leaf will be partitioned into quadrants and the K+1 data objects will be inserted intothose quadrants as appropriate. As is the case with the regular PR quadtree, this may leadto a sequence of partitioning steps, extending the relevant branch of the quadtree by multiplelevels. In this project, K will probably equal 4, but I reserve the right to specify a differentbucket size with little notice, so this should be easy to modify.The index entries held in the quadtree will store a geographic coordinate and a collection ofthe file offsets of the matching GIS records in the database file.Note: do not confuse the bucket size with any limit on the number of GIS records thatmay be associated With a single geographic coordinate. A quadtree node can contain indexobjects for up to K different geographic coordinates. Each such index object can containreferences to an unlimited number of different GIS records.The PR quadtree implementation should follow good design practices, and its interface shouldbe somewhat similar to that of the BST.You must be able to display the PR quadtree in a readable manner. The display must clearlyindicate the structure of the tree, the relationships between its nodes, and the data objectsin the leaf nodes (think of this problem as an in-order traversal of tree with four-children).Buffer Pool DetailsThe buffer pool for the database file should be capable of buffering up to 15 records, andwill use LRU replacement. You may use any structure you like to organize the pool slots;however, since the pool will have to deal with record replacements, some structures will bemore efficient (and simpler) to use. You may use any classes from STL library you think areappropriate.3A quadtree is a tree each node of which can have up to four children. A PR Quadtree limits quadtreenodes to either 4 children or none!5Put your Name Idon the reportFinal ProjectDue April 12th, 2021 11:45pmCOMP 8042Hassan S. ShavaraniIt is up to you to decide whether your buffer pool stores interpreted or raw data; i.e., whetherthe buffer pool stores GIS record objects or just strings.You must be able to display the contents of the buffer pool, listed from MRU to LRU entry,in a readable manner. The order in which you retrieve records when servicing a multi-matchsearch is not specified, so such searches may result in different orderings of the records withinthe buffer pool. That is OK.A Note on Coordinates and Spatial RegionsIt is important to remember that there are fundamental differences between the notion thata geographic feature has specific coordinates (which may be thought of as a point) and thenotion that each node of the PR quadtree corresponds to a particular sub-region of thecoordinate space (which may contain many geographic features).In this project, coordinates of geographic features are specified as latitude/longitude pairs,and the minimum resolution is one second of arc. Thus, you may think of the geographiccoordinates as being specified by a pair of integer values.On the other hand, the boundaries of the sub-regions are determined by performing arithmeticoperations, including division, starting with the values that define the boundaries of theworld. Unless the dimensions Of the world happen to be powers of 2, this can quickly leadto regions whose boundaries cannot be expressed exactly as integer values. You may usefloating-point values or integer values to represent region boundaries when computing regionboundaries during splitting and quadtree traversals. If you use integers, be careful not tounintentionally create gaps between regions.Your implementation should view the boundary between regions as belonging to one of thoseregions. The choice of a particular rule for handling this situation is left to you.When carrying out a region search, you must determine whether the search region overlapswith the region corresponding to a subtree node before descending into that subtree. Thinkabout a proper divide and conquer approach to solve the region search problem.Other System ElementsThere should be an overall controller that validates the command line arguments and managesthe initialization of the various system components. The controller should hand off executionto a command processor that manages retrieving commands from the script file, and makingthe necessary calls to other components in order to carry out those commands.Naturally, there should be a data type that models a GIS record.There may well be additional system elements, whether data types or data structures, orsystem components that are not mentioned here. The fact no additional elements are explicitlyidentified here does not imply that you will not be expected to analyze the design issuescarefully, and to perhaps include such elements.6Put your Name Idon the reportFinal ProjectDue April 12th, 2021 11:45pmCOMP 8042Hassan S. ShavaraniAside from the command-line interface, there are no specific requirements for interfaces ofany of the classes that will make up your software; it is up to you to analyze the specificationand come up with an appropriate set of classes, and to design their interfaces to facilitate thenecessary interactions. It is probably worth pointing out that an index (e.g., a geographiccoordinate index) should not simply be a naked container object (e.g, quadtree); if thats notclear to you, think more carefully about what sort of interface would be appropriate for anindex, as opposed to a container.Command FileThe execution of the program will be driven by a script file. Lines beginning with a semicoloncharacter (;) are comments and should be ignored. Blank lines are possible. Each line inthe command file consists of a sequence of tokens, which will be separated by single tabcharacters. A line terminator will immediately follow the final token on each line. Thecommand file is guaranteed to conform to this specification, so you do not need to worryabout error-checking when reading it.The first non-comment line will specify the world boundaries to be used:worldtabwestLongtabeastLongtabsouthLattabnorthLatThis will be the first command in the file, and will occur once. It specifies theboundaries of the coordinate Space to be modeled. The four parameters will belongitude and latitudes expressed in DMS format, representing the vertical andhorizontal boundaries of the coordinate space.It is certainly possible that the GIS record file will contain records for featuresthat lie outside the specified coordinate space. Such records should be ignored;i.e., they will not be indexed.Each subsequent non-comment line of the command file will specify one of the commandsdescribed below.One command is used to load records into your database from external files:importtabGIS record fileAdd all the valid GIS records in the specified file to the database file. This meansthat the records will be appended to the existing database file, and that thoserecords will be indexed in the manner described earlier. When the import iscompleted, log the number of entries added to each index, and the longest probesequence that was needed when inserting to the hash table. (A valid record is onethat lies within the specified world boundaries.)Note: GIS record file will be a relative address (e.g. ./VA Monterey.txtwill point to the file named VA Monterey.txt which is placed besides the GISexecutable.7Put your Name Idon the reportFinal ProjectDue April 12th, 2021 11:45pmCOMP 8042Hassan S. ShavaraniAnother command requires producing a human-friendly display of the contents of an indexstructure:debugtab[ quad | hash | pool | world]Log the contents of the specified index structure in a fashion that makes theinternal structure and contents of the index clear. It is not necessary to be overlyverbose here, but you should include information like key values and file offsetswhere appropriate (implementing debugtabworld command is optional, if youdont like to implement it, you Can just output that this is an optional feature. Itwill help you debug the QuadTree much easier, tho, if you implement it).Another simply terminates execution, which is handy if you want to process only part of acommand file:quittabTerminate program execution.The other commands involve searches of the indexed records. For the following commands,if a geographic coordinate is specified for the command, it will be expressed as a pairof latitude/longitude values, expressed in the same DMS format that is used in the GISrecord files. In the script files, geographic coordinate will show up as geographiccoordinate latitudetabgeographic coordinate longitude.what is attabgeographic coordinateFor every GIS record in the database file that matches the given geographiccoordinate, log the offset at which the record was found, and the feature name,county name, and state abbreviation. Do not log any other data from the matchingrecords.what istabfeature nametabstate abbreviationFor every GIS record in the database file that matches the given feature nameand state abbreviation, log the offset at which the record was found, andthe county name, the primary latitude, and the primary longitude. Do not logany other data from the matching records.what is intabgeographic coordinatetabhalf-heighttabhalf-widthFor every GIS record in the database file whose coordinates fall within the closedrectangle with the specified height and width, centered at the geographic coordinate, log the offset at which the record was found, and the feature name, the8Put your Name Idon the reportFinal ProjectDue April 12th, 2021 11:45pmCOMP 8042Hassan S. Shavaranistate name, and the primary latitude and primary longitude. Do not log any otherdata from the matching records. The half-height and half-width are specified astotal seconds.The what is in command takes an optional modifier, -long, which causes thedisplay of a long listing of the relevant records. The switch will be the first tokenfollowing the name of the command. If this switch is present, then for every GISrecord in the database file whose coordinates fall within the closed rectangle withthe specified height and width, centered at the geographic coordinate, logevery important non-empty field, nicely formatted and labeled. See the posted logfile(s) for an example. Do not log any empty fields. The half-height and half-widthare specified as seconds.The what is in command also takes an optional modifier, causing the searchresults to be filtered: -filter [ pop | water | structure ]The switch and its modifier will be the first and second tokens following the nameof the command (for simplicity we assume that either -filter will be provided or-long optional modifier, but not both). If present, this causes the set of matchingrecords to be filtered to only show Those whose feature type field corresponds tothe given filter specifier. See Table 2 in the Appendix for instructions on how tointerpret the feature types shown above.Sample command script(s), and corresponding log file(s), are provided alongside this descriptionfile. As a general rule, every command should result in some output. In particular, adescriptive message should be logged if a search yields no matching records. Also, to makesure you are logging everything properly, please avoid using std::cout in your code unlessyou are debugging.Log File DescriptionYour output should be clear, concise, well labeled, and correct. You should begin the logwith a few lines identifying yourself, and listing the names of the input files that are beingused.The remainder of the log file output should come directly from your processing of the commandfile. You are required to echo each comment line, and each command that you processto the log file so that its easy to determine which command each section of your outputcorresponds to. Each command (except for world) should be numbered, starting with 1,and the output from each command should be well formatted, and delimited from the outputresulting from processing other commands.9Put your Name Idon the reportFinal ProjectDue April 12th, 2021 11:45pmCOMP 8042Hassan S. ShavaraniQuick StartReading through this whole document might be quite overwhelming and could make it hardto get started. This section is intended to reduce that complexity and give you a road-mapon the tasks that need to be done in order. Following this road-map will help you save timewhile enabling you to finish up each part as soon as you learn about it in the class. Lets getstarted:1. This project has a certain structure described throughout the document. Get startedby creating a GIS.cpp file and populating the project structure in it. You will needa main function, as well as the classes: GISRecord, NameIndex, CoordinateIndex,BufferPool, Logger, SystemManager, and CommandProcessor. You will also need aenum Command structure for the different commands described in the project descriptionand a struct DMS to keep the parsed coordinates.2. Once done with the project structure, get started on filling up the GISRecord andCommandProcessor classes. By the end of this step your project should be able to readthe script file and parse its content reporting different commands and the argumentspassed to each. Your project should also be able to create the database file and log fileand fill out the initial and final lines of the execution logs as well as copying the commentsand commands using Logger class. Note that the results of running commandsare not expected in this step.3. Next tackle implementing the first command, world. In this step, you dont need tocreate indices with it but later you will modify the code to initiate the indices alongwith world creation.4. Fill up the BufferPool to write to a file, read from a file, and fill up/use its cache.Make sure it has a str() command implemented to be used for debug pool.5. Work on import command. In this step, you will need to create your HashTable andPRQuadtree classes to support NameIndex and CoordinateIndex classes. Fill out yoursupport classes with the help of what you have learnt about Trees and Hashing. Youcan use the starter code provided in the labs as a starting point for this step as well.6. To complete what is command, finish up your NameIndex. Make sure it has a str()command implemented to be used for debug hash.7. To complete what is at and what is in commands, finish up your CoordinateIndex.Make sure it has str() and (optionally) visualize() functions implemented to beused for debug quad and debug world.8. Wrap up the project by re-reading through the project description and taking care ofthe details that have been left out.9. You are done!10Put your Name Idon the reportFinal ProjectDue April 12th, 2021 11:45pmCOMP 8042Hassan S. ShavaraniSubmissionFor this project, you must submit an archive (zip or tar) file containing all the source codefiles for your implementation (i.e., .cpp files). Submit only the source files. Do not submitthe compiled files or any of object files. If you use packages in your implementation (andthats good practice), your archive file Must include the correct directory structure for thosepackages, and your GIS.cpp file must be in the top directory when the archive file is unpacked.Your code must be ready to compile using g++ -std=c++11 or a simple Makefile ifyou have a more complicated structure. Make sure no visual studio related dependenciesor solution files are there when submitting the result, since I certainly will not use visualstudio to test and grade your project.Alongside your source files, I need a pdf file describing your solution, general architectureof your code, and the list of data structures you have implemented or used from STL. Runscript01.txt and put a screen shot of its created log file, as well.The correctness of your solution will be evaluated by executing your solution on a collectionof test data files. Be sure to test your solution with all of the data sets that are posted, sinceI will use a variety of data sets, including at least one very large data one (perhaps hundredsof thousands of records) in my evaluation.As it is stated in the beginning of the file description this project must be done individually.You are not allowed to copy a single function from another person nor from theinternet without citing them. You may use any of the previously provided lab sourcecodes completed by yourself to reduce the implementation time of this project(dont forget to mention which lab codes you have used in your final report).11Put your Name Idon the reportFinal ProjectDue April 12th, 2021 11:45pmCOMP 8042Hassan S. ShavaraniAppendixTable 1: Geographic Data Record FormatName Type Length/Decimals Short DescriptionFeature ID Integer 10 Permanent, unique feature record identifierand official feature nameFeature Name String 120Feature Class String 50 See Table 2 later in this specificationStateAlpha String 2 The unique two letter alphabetic codeand the unique two number code for a US StateStateNumeric String 2CountyName String 100 The name and unique three number codefor a county or county equivalent CountyNumeric String 3PrimaryLatitudeDMS String 7 The official feature locationDMS-degrees/minutes/secondsDEC-decimal degreesNote: Records showing Unknown and zeros forthe latitude and longitude DMS and decimal fields,respectively, indicate that the coordinates of thefeature are unknown. They are recorded in thedatabase as zeros to satisfy the format requirementsof a numerical data type. They are not errors anddo not reference the actual geographic coordinatesat 0 latitude, 0 longitude.PrimaryLongitudeDMS String 8PrimaryLatitudeDECRealNumber 11/7PrimaryLongitudeDECRealNumber 12/7SourceLatitudeDMS String 7 Source coordinates of linear feature only(Class = Stream, Valley, Arroyo)DMS-degrees/minutes/secondsDEC-decimal degreesNote: Records showing Unknown and zeros forthe latitude and longitude DMS and decimal fields,respectively, indicate that the coordinates ofthe feature are unknown. They are recorded in thedatabase as zeros to satisfy the format requirementsof a numerical data type. They are not errors anddo not reference the actual geographic coordinatesat 0 latitude, 0 longitude.\r”

添加老师微信回复‘’官网 辅导‘’获取专业老师帮助,或点击联系老师1对1在线指导