Changes

240 bytes added ,  03:24, 4 May 2007
Line 19: Line 19:     
== Ryan's Nearest City Matlab Script Generator ==
 
== Ryan's Nearest City Matlab Script Generator ==
*This script runs with Matlab, just input the number of cities you want to create and a filename to save the generated input file - nearestCity(numPoints, fileName). Basically, the script randomly picks two points in a 1024x1024 window, point A and B. Point A is used for reference, while point B is actually mapped. The distance between A and B represents the minimum distance all other points must have from the reference point A. As each new point is generated, a road is mapped from the new point to point B, this way roads shouldn't intersect. (Intersections will occur on a VERY, VERY rare basis.) Run the input file and check that the output finds the nearestCity "near". I didn't feel like creating the xml output, so I just look at the last line of the output for the nearest city. (As a note - I was passing all the tests on Part 1 for nearest city and failing them on Part 2 - now I pass them.)
+
*This script runs with Matlab, just input the number of cities you want to create and a filename to save the generated input file - nearestCity(numPoints, fileName). Basically, the script randomly picks two points in a 1024x1024 window, point A and B. Point A is used for reference, while point B is actually mapped. The distance between A and B represents the minimum distance all other points must have from the reference point A. As each new point is generated, a road is mapped from the new point to point B, this way roads shouldn't intersect. (Intersections will occur on a VERY, VERY rare basis.) Run the input file and check that the output finds the nearestCity "near". I didn't feel like creating the xml output, so I just look at the last line of the output for the nearest city.
 +
*I created 20 cities and that was sufficient for finding my errors. I have it so that Matlab plots the roads.
 +
*As a note - I was passing all the tests on Part 1 for nearest city and failing them on Part 2 - now I pass them.
 +
*Also, this script can be modified (with relative ease) to check rangeCities. If I have the time I might make create that as well.
 
**[http://www.wam.umd.edu/~rjmurphy/cmsc420/nearestCity.m nearestCity.m]
 
**[http://www.wam.umd.edu/~rjmurphy/cmsc420/nearestCity.m nearestCity.m]
12

edits