Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Calculate overall drive time from a set of points

DataDaemon
7 - Meteor

Hello All!

 

I have an odd conundrum. I am using the spatial package and am trying to come up with a way to give an overall drive time (or an index of drivetime of some sort) from a series of points. The problem I have is that I don't have a start or end point (you could hypothetically start or end at any of them), but what I'm hoping to do is find maybe the drive time of doing a "lap". Essentially, driving from one of the points, then driving to the next nearest point, hitting them all and returning to the point I started without repeating any of them. Does anyone know if this is possible to set up?

 

Thank you!

6 REPLIES 6
estherb47
15 - Aurora
15 - Aurora

Hi @DataDaemon 

 

I'm wondering if the US & Canada Drivetime tool (https://help.alteryx.com/2018.1/index.htm#US_and_Canada_Drivetime_Macro.htm)

 

Or the Non-Overlapping Drivetime tool (https://help.alteryx.com/2018.1/index.htm#Macro-NonOverlap_DT.htm) might help.

 

If I have my spatial data with me, I'll noodle on this and let you know what else might work.

 

Cheers!

Esther

TravisR
Alteryx Alumni (Retired)

Hi @DataDaemon 

 

It sounds like you're trying to do a traveling salesman problem. This community post outlines how I would approach this problem - https://community.alteryx.com/t5/Alteryx-Designer-Discussions/Traveling-Salesman-with-iterative-macr...

andyuttley
11 - Bolide
11 - Bolide

Hi @DataDaemon 

 

I’ve built out a quick iterative macro (attached) that just starts at the first point, then searches for the next nearest from the remaining points (and so on, and so on…), returning the distance between each point. If you go into the macro you can switch it to drivetimes and your geography, this is just as the crow flies distance for demo, but feel free to change in the drop down of that tool. 

 

IteratePlaces.PNG

 

 

iterate2.PNG

 

 

 

Hopefully it’s a macro that you can just plug your data in to. PS- Very keen to stress that this doesn't aim to solve the Traveling Salesman Problem by the way!

Hope it’s of some help though

Andy

DataDaemon
7 - Meteor

Hi @andyuttley ,

 

Is it possible to iterate this among multiple sets of points?

andyuttley
11 - Bolide
11 - Bolide

hi @DataDaemon 

 

Yes, with a dummy data set of stores (which are almost in order anyway) you can iterate through a list, and even batch it if you have multiple 'groups' of lists you want to run at the same time. I've switched it to drive times as well in the UK, so you may need to go into the macros to change that depending on your geography!

 

Here, a Batch macro contains an iterative macro:

Batch macro = all this is doing is feeding the iterative macro (which has our nearest logic in) a set of lists over and over (e.g. set 1 only, then set 2 only etc.)

Iterative macro = this is where the proper logic happens, we just batch first to make sure there's no records being compared from a different list

 

See below and attached:

Iterate.PNG

 

(note that you only need the top macro; the bottom one is just to show you the iterative process that's happening inside the top one) 

 

Hope that helps!

Andy 

DataDaemon
7 - Meteor

Wow! Thank you @andyuttley !

 

I'm learning a ton from how you built these out. Thank you for all of your hard work and help guiding me through this!

Labels