Select to view content in your preferred language

Can I run a Closest Facility analysis with anisotropic round trips?

1263
5
07-21-2020 07:28 PM
MatthewNotarian
Emerging Contributor

In ArcMap 10.7, I'm working on a network analysis of an urban archaeological site where I'm running a closest facility analysis on some 2000 structures to specific features within the city. I've segmented the road layer and calculated travel times for each segment based on Tobler's Hiking Function, which I then enter as the time cost to calculate the quickest routes from each house to the closest feature (in terms of time). The problem I've run into is how to calculate these as round trips. I can't simply double the total time of each route because the time values are anisotropic based on slope and Tobler (i.e. the From-To times for each segment are different from the To-From times). I've tried running the analysis backwards (from Facility to Incident, instead of Incident to Facility), but this often results in different matches and routes, again because of anisotropy. I've also tried summing the From-To and To-From time values for the segments and using those as a kind of "round trip" cost, but this again results in different Incident-Facility matches from the original Incident-Facility analysis using the anisotropic times. 

I've found the "Copy Traversed Source Features" tool that will export a table with all of the segment time values. In theory this could be used to identify all the segments in each route, whether each segment used TF or FT times, and then sum the inverse of these time fields, but the process of recalculating the accumulated inverse time values is daunting, to say the least. I have to join the segment IDs from each route to the original network layer, then somehow note if each segment's time value was TF or FT (via separate fields with 0 or 1 values) and replace it with its inverse. Even worse, sometimes segments are joined in the middle (not at a junction) and the time values have to be proportionally shortened.

I feel like there must be a way to write a script or something to automate this, rather than attempt to do it manually, but I have no idea how to do that.

0 Kudos
5 Replies
JaySandhu
Esri Regular Contributor

I am trying to understand your end goal. Simplifying your message, you have 2000 structures and N specific features within the city. You want to get the total travel time cost of starting from a structure, visiting a feature and returning back to the structure.

You run Closest Facility, structures to city features. And now you also want the travel times from those structures to the N features. So if you ran a complete CF with Incident to Facility and then with Facility to Incident, you will get the same set of routes with two sets of travel times. The closest facility ranking may change. But you should be able to match up the two outputs based on the FacilityID and IncidentID fields and get a sum.

This will work as long as you solved the CF with all N features and no cutoffs.

Jay Sandhu

0 Kudos
MatthewNotarian
Emerging Contributor

Thanks for responding. To simplify, if I run Incident to Facility and then Facility to Incident, I do not get an identical set of routes. In fact, I get different Facility and Incident pairs. This is because I am solving for the quickest route, and the times of each direction vary according to slope. This is because it takes longer to travel uphill then downhill. 

What I am trying to accomplish is how to get a set a identical routes, one a Facility to Incident, and another an Incident to Facility, so that I can sum together the two time totals for a round-trip. 

0 Kudos
JaySandhu
Esri Regular Contributor

As I mentioned earlier, if you are solving CF for ALL closest facilities and there are no cutoffs, you will get the same set of routes back unless some are not possible.

If you have 3 incidents and 4 facilities and solve for 4, you will get 12 routes back. And when you switch the travel direction you will still get 12 back. The FacilityRank ordering may be different. So do you have some limits on the CF that you are solving? 

Jay Sandhu

0 Kudos
MatthewNotarian
Emerging Contributor

Sorry I misunderstood your first message, but you are absolutely right. It's so simple I'm kind of embarrassed that I didn't think of that sooner. All I have to do is find a way to join the corresponding Incident-Facility and Facility-Incident pairs and sum their times. Since the Incident and Facility ids are in different fields I'll have to think of an easy way to do this, but that's a much more manageable problem than my first solution. Thanks so much!

0 Kudos
JaySandhu
Esri Regular Contributor

Glad you can proceed with it! You could add a new text field to the Routes attribute table and set it some combination of the FacilityID and IncidentID that remains unique and then you will have a single field to join the two route attribute tables and sum up the travel times.

Jay Sandhu 

0 Kudos