Saturday, 1 October 2016

arcgis desktop - Force closest facilities take the same route


I have a routing problem that I intend to solve with ArcGIS network analyst. First, Closest facility works perfect for me to find the shortest paths to a number of demands. The results look like the left part of the figure:


enter image description here


For my analysis I would like to compare the left situation with the right one, when it is more cost-efficient to share the route. This far I have just painted the routes in the right part for clarity. In a normal Dijkstra I would just recursively adapt the weights of the links, setting the already chosen to a lower cost. However, I do not know how could I do this in ArcGIS closest facility.


Is there a way to modify the shortest path algorithm in Network analyst?



Answer



You cannot make modifications to the Closest Facility solver directly from ArcMap without writing your own solver with ArcObjects and say Visual C++ or C#. Look for more details here Custom solver.



However, there is a simpler approach. If you are OK with some Python scripting, this is what you could do with arcpy (Python programming) to tackle this problem:



  1. Take any of the incident points and solve Route problem finding the shortest/fastest path from the incident to each facility. Find the best route (compare the total travel time / km).

  2. Find out what road links have been traversed by this particular route. There is even a GP tool for that.

  3. Load those line features as scaled-cost barriers in the same Route network layer. You can specify factor of 0-0.9 to make the cost of traversing the same road links smaller. So if traversing a road link costed 10min, with factor 0.6 it will be just 6 min. This means that the road links which have been traversed by the first incident-facility route will be more attractive to subsequent routes.

  4. Repeat the step 1 taking next incident point and the facilities present. Having scaled-cost barriers loaded, the traversed road links will be more attractive to the routes generated.


The steps above can be easily automated with arcpy. Please take a look at this sample.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...