I have a large university dataset of handicap routes. I am trying to create separate routes and directions for every possible combination of start and end points. I have 298 locations which leads to over 88,000 possible routes. I have an ArcPy script set up to run this and it works but if it continues are its current progress I am looking at a run time of about two months. import arcpy
from arcpy import env
env.workspace = "C:/Users/zx52530/Routing/BestTest.gdb/"
env.scratchWorkspace = "C:/Users/zx52530/Routing/BestTest.gdb/"
env.overwriteOutput = True
i = arcpy.SearchCursor("HC_2013_ND_Junctions")
... for j in i:
... whereClause = ' "OBJECTID" = ' + str(j.OBJECTID)
... for g in i:
... arcpy.na.MakeClosestFacilityLayer("HC_2013_ND", "CF_" + str(j) + "_" + str(g), "Length")
... arcpy.SelectLayerByAttribute_management("HC_2013_ND_Junctions","NEW_SELECTION",whereClause)
... arcpy.na.AddLocations("CF_" + str(j) + "_" + str(g), "Facilities", "HC_2013_ND_Junctions")
... whereClause2 = ' "OBJECTID" = ' + str(g.OBJECTID)
... arcpy.SelectLayerByAttribute_management("HC_2013_ND_Junctions","NEW_SELECTION",whereClause2)
... arcpy.na.AddLocations("CF_" + str(j) + "_" + str(g), "Incidents", "HC_2013_ND_Junctions")
... arcpy.na.Solve("CF_" + str(j) + "_" + str(g),"SKIP","CONTINUE")
... try:
... arcpy.na.Directions("CF_" + str(j) + "_" + str(g),"HTML","C:/Users/zx52530/Routing/" +"CF_" + str(j) + "_" + str(g)+".txt","Feet","NO_REPORT_TIME")
... except:
... print "CF_" + str(j) + "_" + str(g) + "FAILS"
... arcpy.management.SaveToLayerFile("CF_" + str(j) + "_" + str(g),"CF_" + str(j) + "_" + str(g),"RELATIVE")
... print "Finished Facility: ", j, "to Incident: ", g
Does anyone have any ideas about how I might improve the efficiency of this script?