Free Trial

#SANTALYTICS 2016

Help an elf get Santa around the globe!

#SANTALYTICS Part 2

TaraM
Alteryx Alumni (Retired)

#SANTALYTICS Continues! Are we having fun yet? Be sure to share your thoughts with your social networks and use the #Santalytics hash tag .

 

The Elf thanks you all for participating in Part 1. In fact we are so excited over the level of participation, that we are upping the ante. Stay tuned on that.  For now we are onto part 2 and it's going to get tricky. 

 

With nice kids scattered across the globe, Santa can't be wasting any time this Holiday season! Use the Create Points Tool, of course, to identify where all our presents need to make it this year. We'll have to call on the elves to distribute them to each house, but let's see if we can't keep Santa from making any extra trips.

 

Determine the least number of trade areas we can distribute bunches of presents to while making sure that no two points in a distribution hub are more than 500 miles apart - remember, we only need to worry about including the nice kids who will be getting presents delivered this year. Once your distribution hubs are assigned, what's the minimum weight that we can use for every one of the hubs while making sure each kid gets a present from the classification of present that they earned? Santa will worry about how many reindeer to hook to the sleigh, but we need to let him know the minimum towage to account for!

 

Goal of Part 2:

Find a list of delivery "hubs" that include every nice kid - with no two kids in a hub being more than 500 miles apart or 250 miles from the central recipient (hub) location

Identify the minimum weight that be used to deliver presents (with respect to each present class in that hub) to every hub, excluding presents of 0 or null weight

 

Make sure you are using the data from our Part 1 Solution Blog post!

 

santalytics2.gif

Tara McCoy
21 REPLIES 21
ggruccio
ACE Emeritus
ACE Emeritus

This was a great learning experience for me!  I came up with 346 trade areas - which doesn't match anything posted so far - but I wanted to try it without peeking.

 

My approach was to determine first which location would deliver the most packages in a 250 mile radius.  Remove the records then run thru an iterative macro that determined which location delivered the second-most, and so on until I ran out of locations.

 

As records were removed from the iterative macro - they were summed for each hub with the minimum weights for the present classes applied and summarized. 

ggruccio
ACE Emeritus
ACE Emeritus

Here's the macro....

ggruccio
ACE Emeritus
ACE Emeritus

....and my data files!  

JoeM
Alteryx Alumni (Retired)

Attached is my approach which came out with a total of 303 hubs.

 

Process:

1) Cross Joined all addresses of 'nice' children together (which was quite expensive at taking 2 mins)

2) Calculated distance between the each of the cross joined rows.

3) Removed and rows with a greater than 250 miles away from each child's address

4) Summarized/sorted to find which children had the most surrounding children in their "hub"

5) Used an iterative macro to assign the top children's address to become a hub centroid (and removing all other children in the trade area  in order to not have them become their own centroid)

6) Output of the macro is 303 addresses that will now be centroids for the hubs

7) Finally, I built non-overlapping 250mile radius trade areas

 

In total, my process runs ~3min and needs some optimizing when looking at some other solutions here!

 

hubpic.png

 

 

JonA
Alteryx
Alteryx

Throwing my 341 polygons in the ring and adding a custom poly tableau view...

 

View.jpg

TaraM
Alteryx Alumni (Retired)

@JonA very FESTIVE !

Tara McCoy
mceleavey
17 - Castor
17 - Castor

Right, this hurt my brain. I think my solution is decidedly inelegant, and given that at a glance everybody seems to have used iterative macros I may have missed something, but here goes!

I simply brought in the output from part one, the addresses and the present information. I then created my map points for each nice child, then created grids at a size of 500 miles. It was then a simple task of spacial matching the points against a grid to see in which grid each child belonged. I then did a count of the number of nice children per grid.

From there I determined from the present score the minimum weight, summarised by grid and there you go.

286 "Hubs". 

 



Bulien

JohnJPS
15 - Aurora

Here's the map of the 271 hub solution; the Alteryx solution (using R tool) to generate the hubs is also attached:

Capture.PNG

 

alex
11 - Bolide

Hello Sophia,

 

Why use 353 miles in the Grid Solution?  Being a novice at spatial tools, I found it difficult to follow the help for the tools, but I was trying to go down this same path.  Any suggestions for better ways to learn how each tool works as well as practical applications? 

 

Alex

SophiaF
Alteryx
Alteryx

Hi @alex,

 

Here's where we take a page from our friend Pythagoras to calculate the correct length of the grid. The grid tool makes squares, which are essentially 2 right triangles stuck together. If we set the "length" (grid size) of each grid to 500, you get the following:

 

 

pyth.png

 

If you calculate the length of your hypotenuse, you will see that the diagonal is roughly 707 miles long. Now if we happen to have 2 children living at the green dots, a 500 grid square could actually contain kids up to 707 miles apart.What we actually want is a 500 mile diagonal (hypotenuse). A little more math, and we get that a 353 mile length actually gives us an approximate 500 mile diagonal.

 

 

pyth2.png
 

Many of our Tools contain "One-Tool Examples" within the Designer - right click and you will see "Open Example". We also have a "Tool Mastery" series we just introduced that goes over more of the "why" of using the tool, rather than the "how". You can search "Tool Mastery" in the Community to find any of those. Here's a link to one of the more popular ones: Tool Mastery - Summarize

 

3.png

 

 

 

Sophia Fraticelli
Senior Solutions Architect
Alteryx, Inc.