View Full Version : Lonely and not so lonely caches



brdad
09-08-2009, 08:34 PM
I was prodded by someone in chat for some numbers regarding what caches were the most remote, so I made a macro in 5 minutes that took 1.5 hours to run to come up with these (useless?) stats. It's too bad it takes so long to run or I might incorporate some of this into the regular stats. I have a few ideas on how to speed it up, but I am not sure it will speed it up enough to satisfy me.

The loneliest active cache in Maine is Little Falls Cache (http://www.geocaching.com/seek/cache_details.aspx?guid=a8b2325e-d4ab-408d-a141-871930e11a91) (GCWMFE) by Sudonim (http://www.geocaching.com/profile/?id=198654) (2/2). It is just under 17.5 miles from any other cache in the state. Second loneliest is a distant second at 14.5 miles, Harrow Mountain Fault (http://www.geocaching.com/seek/cache_details.aspx?guid=24f35449-ad42-456e-9421-2e241e02ecb1) (GC1GDJZ) by Northwoods Explorer (http://www.geocaching.com/profile/?id=381878) (5/5), and third drops into the 11's.

Number active of caches between 11 and 12 miles from another cache: 2
Number active of caches between 10 and 11 miles from another cache: 1
Number active of caches between 9 and 10 miles from another cache: 1
Number active of caches between 8 and 9 miles from another cache: 2
Number active of caches between 7 and 8 miles from another cache: 2
Number active of caches between 6 and 7 miles from another cache: 7
Number active of caches between 5 and 6 miles from another cache: 24
Number active of caches between 4 and 5 miles from another cache: 56
Number active of caches between 3 and 4 miles from another cache: 73
Number active of caches between 2 and 3 miles from another cache: 202
Number active of caches between 1 and 2 miles from another cache: 651
Number active of caches between .5 and 1 mile from another cache: 931
Number active of caches between 0 and .5 mile from another cache: 2581
Number active of caches between 0 and .4 mile from another cache: 2306
Number active of caches between 0 and .3 mile from another cache: 1899
Number active of caches between 0 and .2 mile from another cache: 1298
Number active of caches between 0 and .1 mile from another cache: 328*

Bear in mind, this includes events, eathcaches, virtuals, and mystery caches which are often allowed within .1 miles of another cache.

The average distance between Maine caches is .38 miles.

The median distance of all Maine caches is .39 miles. This means 1/2 of the total Maine caches are further then .39 miles from another cache, and the other half is less than that.

Hiram357
09-08-2009, 09:01 PM
I like the lonely caches, last month I had 2 co-ftfs on caches that were placed almost a year ago. (GC1HF5B, GC1HF4N) They may be lonely, but they're worth the drive, I'll use any excuse to get out... :D:D:D

benandtina
09-09-2009, 09:06 AM
Speeding up algorithms is fun :) Any way I could help?

Is the script's runtime n^2 (so comparing each cache to each other cache)? If so, maybe you can try out SQL to speed it up? I don't know how familiar you are with SQL or if that was what you already had in mind, but I have some ideas that I THINK would let you get that data with a single SQL query rather than nesting loops. The query will use a cross product, so all records will still be compared to each other, but my guess would be that it will likely be a little bit quicker than the nested loops. Let me know if you'd like to hear out those ideas :)

Sudonim
09-09-2009, 09:18 AM
Cool slant on cache density. I think that overall, Northwoods Explorer wins the lonliest cache as Little Falls cache is about 1.5 miles away from a Canadian cache. Lonliest in Maine, yes, lonliest overall, no.
Harrow Mountain looks very isolated, but if you park in the right spot, looks like a 2/3 mile over fairly level ground to get to the cache spot. May have to try that before snow flies...
Thanks again Dave for the cool views you can generate. For a "not about the numbers" guy, you sure give us all lots of them to see :)

Haffy
09-09-2009, 10:00 AM
Speeding up algorithms is fun :) Any way I could help?

Is the script's runtime n^2 (so comparing each cache to each other cache)? If so, maybe you can try out SQL to speed it up? I don't know how familiar you are with SQL or if that was what you already had in mind, but I have some ideas that I THINK would let you get that data with a single SQL query rather than nesting loops. The query will use a cross product, so all records will still be compared to each other, but my guess would be that it will likely be a little bit quicker than the nested loops. Let me know if you'd like to hear out those ideas :)

HUH?????:eek::confused:

WhereRWe?
09-09-2009, 12:07 PM
HUH?????:eek::confused:

Sheesh! I'm still on Google, trying to figure out what language what was. :confused::confused:

brdad
09-09-2009, 03:55 PM
Speeding up algorithms is fun :) Any way I could help?

Is the script's runtime n^2 (so comparing each cache to each other cache)? If so, maybe you can try out SQL to speed it up? I don't know how familiar you are with SQL or if that was what you already had in mind, but I have some ideas that I THINK would let you get that data with a single SQL query rather than nesting loops. The query will use a cross product, so all records will still be compared to each other, but my guess would be that it will likely be a little bit quicker than the nested loops. Let me know if you'd like to hear out those ideas :)

The macro I use for the stats created an SQL database, and a good portion of the stats is calculated from the resulting SQL.

However, for this I just made a macro using GSAK's GetNear function. It cycles through each cache and enters the coordinates into the GetNear function and the result is a delimited string which includes the distance to the 2 nearest caches (the first nearest is the cache I am checking the distance to). This is the simple macro:


GOTO position=top
WHILE NOT($_EOL)
$Data = getnear($d_latitude + " " + $d_Longitude, "M", 2)
$Distance = Extract($Data, ";", 7)
$d_User2 = $Distance
GOTO position=next
ENDWHILE
MsgOK msg="Finished!"
ENDSUB

I might try using my stats SQL database at a later time, I knew this would work and it was quick to write. GSAK is migrating to a full SQL database in the near future which will make a lot of this much easier.

The hardest part I have about using SQL is efficiently getting the distances to the nearest caches using only the coordinates. In order to do this you currently have to calculate the distances from each cache 4534 times (the number of available caches in the state in my DB). That is over 2 million distance calculations! But I am open to any ideas!

While we're talking math, if you or anyone else can come up with a better formula for me to predict the "Future Milestone Date Predictions" section of my stats I'd be all ears. I know little about how to calculate predictions, my 10 second lame formula is


$PredictedCachesPerDay = (($TotalCaches/(DateDiff($DateFirst,$DateToday))) + ($LastYearTotal/(DateDiff($OneYearAgo,$DateToday))*2))/3

I'm not even sure I remember what that code does! But IIRC it puts more emphasis on the average number of caches placed per day in the last year than it does the average for all time.

I then take and calculate at what date at the calculated rate per day will occur.

brdad
09-09-2009, 04:18 PM
I actually let this script run again today, but I calculated the 100 cache radius.

For this lonely cache story:

The cache which has the greatest radius to 99 other caches is Moody Bridge Spring (http://www.geocaching.com/seek/cache_details.aspx?guid=16e92924-aa4f-431e-a643-b4691d0daa6a) (GC16E79) by Northwoods Explorer (http://www.geocaching.com/profile/?id=381878) (2/2).The 100 cache radius from this point is 73.5 miles.


The cache which has the smallest radius to 99 other caches is Baxter Sundial (http://www.geocaching.com/seek/cache_details.aspx?guid=10326e73-00f1-4eea-a8cb-00b73011e9c0) (GC150MN) by NorthCumberMouth Cachers (http://www.geocaching.com/profile/?id=66924) (2/2). There are 100 caches within 2.01 miles of this cache!

benandtina
09-09-2009, 04:19 PM
The macro I use for the stats created an SQL database, and a good portion of the stats is calculated from the resulting SQL.

However, for this I just made a macro using GSAK's GetNear function. It cycles through each cache and enters the coordinates into the GetNear function and the result is a delimited string which includes the distance to the 2 nearest caches (the first nearest is the cache I am checking the distance to). This is the simple macro:


GOTO position=top
WHILE NOT($_EOL)
$Data = getnear($d_latitude + " " + $d_Longitude, "M", 2)
$Distance = Extract($Data, ";", 7)
$d_User2 = $Distance
GOTO position=next
ENDWHILE
MsgOK msg="Finished!"
ENDSUB

I might try using my stats SQL database at a later time, I knew this would work and it was quick to write. GSAK is migrating to a full SQL database in the near future which will make a lot of this much easier.

The hardest part I have about using SQL is efficiently getting the distances to the nearest caches using only the coordinates. In order to do this you currently have to calculate the distances from each cache 4534 times (the number of available caches in the state in my DB). That is over 2 million distance calculations! But I am open to any ideas!

I didn't know there was a GetNear() function. My thought was that if you are iterating over all n^2 (n is number of caches, so 4534 I guess) and calculating distance (using the sqrt((x1-x2)^2+(y1-y2)^2) or whatever formula) you would be better off with a query that computes the n^2 distances but likely has less overheard. However, with GetNear() that may not be the case. On the other hand, we have no way of knowing what GetNear() is doing behind the scenes so it could have some crazy overhead of it's own. I'm curious now, so if I have time maybe I'll fool with it a little tonight :)


While we're talking math, if you or anyone else can come up with a better formula for me to predict the "Future Milestone Date Predictions" section of my stats I'd be all ears. I know little about how to calculate predictions, my 10 second lame formula is


$PredictedCachesPerDay = (($TotalCaches/(DateDiff($DateFirst,$DateToday))) + ($LastYearTotal/(DateDiff($OneYearAgo,$DateToday))*2))/3

I'm not even sure I remember what that code does! But IIRC it puts more emphasis on the average number of caches placed per day in the last year than it does the average for all time.

I then take and calculate at what date at the calculated rate per day will occur.

Cano told me about an evolution algorithm he came up with that would predict where new caches are being placed based on current cache density. It sounded pretty impressive, but when he explained the theory to me my eyes glazed over a little bit. Maybe you can get his thoughts? I think he mentioned that he'll be at one of the upcoming events, but I'm not sure which one(s).

benandtina
09-09-2009, 04:31 PM
Thinking a little more, I wonder if there would be a kinda hackish way to optimize? For all I know, GetNear() already does something along these lines, but this is me thinking about it out loud...

I wrote a macro that can go through a database and determine which DeLorme grid every cache is in. Suppose you run this on the set of all Maine caches and store the values.

Now, suppose you also store a mapping of which grids are adjacent to each other.

At the most, you probably only want to compute distances between caches in the same grid or in one of the 8 adjacent grids. The rest of the caches are guaranteed to be way more than 12 miles away. Right?

Just some thoughts. I don't know if the overhead of figuring out what to/not to compare would make it not be worth it.

brdad
09-09-2009, 04:35 PM
I didn't know there was a GetNear() function. My thought was that if you are iterating over all n^2 (n is number of caches, so 4534 I guess) and calculating distance (using the sqrt((x1-x2)^2+(y1-y2)^2) or whatever formula) you would be better off with a query that computes the n^2 distances but likely has less overheard. However, with GetNear() that may not be the case. On the other hand, we have no way of knowing what GetNear() is doing behind the scenes so it could have some crazy overhead of it's own. I'm curious now, so if I have time maybe I'll fool with it a little tonight :)

GSAK has a decent explanation of its macro functions and abilities in it's help section. Another way I can have it take less time is to only update the caches which are affected by new caches or the loss of a cache by archival. That way, the first time it was run it would be slow, but subsequent runs would be faster. That is the way the elevation macro works now.



Cano told me about an evolution algorithm he came up with that would predict where new caches are being placed based on current cache density. It sounded pretty impressive, but when he explained the theory to me my eyes glazed over a little bit. Maybe you can get his thoughts? I think he mentioned that he'll be at one of the upcoming events, but I'm not sure which one(s).

The only thing I know about evolution is I definitely evolved from an ape! :D I'll have to ask him or perhaps he can enlighten me here, or at least help predict the dates, let alone the place!

pm28570
09-09-2009, 04:38 PM
OMG....a Brdad in training.......:D



Speeding up algorithms is fun :) Any way I could help?

Is the script's runtime n^2 (so comparing each cache to each other cache)? If so, maybe you can try out SQL to speed it up? I don't know how familiar you are with SQL or if that was what you already had in mind, but I have some ideas that I THINK would let you get that data with a single SQL query rather than nesting loops. The query will use a cross product, so all records will still be compared to each other, but my guess would be that it will likely be a little bit quicker than the nested loops. Let me know if you'd like to hear out those ideas :)

squirrelcache
09-09-2009, 04:41 PM
I love it when my Science minded friends talk over my head. I just listen intently and hope that it's soaking in.... trusting that the seeds planted will germinate one day. I've had more than one lightbulb come on over the years ;)

brdad
09-09-2009, 04:43 PM
OMG....a Brdad in training.......:D

Oh no, quite the opposite! I just tinker until it works. Tina knows what she's doing! I have about a year jump on GSAK, but I assume she'll buzz by me in a few weeks playing around!


For a "not about the numbers" guy, you sure give us all lots of them to see :)

Ah, but these numbers are not competing against any other numbers. As soon as every other state starts comparing theirs to these, they'll be pulled off quicker than most of the spam we get here.

benandtina
09-09-2009, 04:50 PM
Oh no, quite the opposite! I just tinker until it works. Tina knows what she's doing! I have about a year jump on GSAK, but I assume she'll buzz by me in a few weeks playing around!

Not really! I probably wouldn't have even thought to start tinkering with GSAK if you hadn't shared your waterfalls macro with me :) That's what inspired me to sit down and learn about this stuff! Usually I'm much more content just clicking random buttons and seeing what happens, lol.

Ekidokai
09-10-2009, 02:52 AM
And screaming for some reason.

NativeMainer
09-11-2009, 10:24 PM
I may be going crazy (comes with the territory, father of twin 5 year old girls and all), but I just looked at the Little Falls Cache. There appears to be a cache about two miles away as the crow flies, Along The World's Longest Undefended Border (GC67FE).

brdad
09-12-2009, 10:00 AM
I may be going crazy (comes with the territory, father of twin 5 year old girls and all), but I just looked at the Little Falls Cache. There appears to be a cache about two miles away as the crow flies, Along The World's Longest Undefended Border (GC67FE).

GC67EF is as Andy stated a Canadian cache closer than 17 miles to his cache. My database only included Maine caches.

NativeMainer
09-12-2009, 11:15 PM
GC67EF is as Andy stated a Canadian cache closer than 17 miles to his cache. My database only included Maine caches.


Gotcha. I didn't see that post.

EMSDanel
09-13-2009, 12:11 AM
My word.....reading through this thread......do any of your computers, Blackberries, or GPS'rs ever start say the words "TILT - TILT - TILT" ???????

cano
09-23-2009, 12:02 PM
My first post. This thread made me to register. There is some serious science going on here :)

Looks like your macro is running in O(n^2) or worse time complexity. You however, don't need to check every couple of caches. There is an algorithm that runs in O(n log n) time complexity. You just need to find Delaunay triangulation because is is dual problem to Voronoi and check only edges for maximum distance.

http://en.wikipedia.org/wiki/Delaunay_triangulation
http://en.wikipedia.org/wiki/Voronoi_diagram

or you can just take results from my webpage :)
http://mgs.cano.sk/proximity.php

Haffy
09-23-2009, 12:18 PM
HUH??? What was that all about? I doubt even Brdad could even figure that one out....:D:eek: And besides we use miles here and not kilometers...lol

benandtina
09-23-2009, 02:14 PM
You just need to find Delaunay triangulation because is is dual problem to Voronoi and check only edges for maximum distance.

Haha, "just". Don't click on his wikipedia links... they made me so confused that I spent the morning alternating between crying and banging my head on my desk.

WhereRWe?
09-23-2009, 03:05 PM
And besides we use miles here and not kilometers...lol

Haffy - Cano is from Bangor. Although he's a newcomer on GCM.org, he's been to several of the local events. (Sheesh! Just because he appears smarter than you - and possibly me... :p:p)

brdad
09-23-2009, 03:57 PM
I thought it was funny haffy used the word "here" and he's not "here"! But I know you're here in spirit, John, and miss you at all the events.

Welcome to the registered side of gcmaine, cano.

I think haffy may be right in one thing, I'm not sure I understand those links! And perhaps I should stick to WHEN the next nth cache will be placed instead of WHERE! But I will look again when my mind isn't busy elsewhere.

Haffy
09-23-2009, 04:42 PM
I thought it was funny haffy used the word "here" and he's not "here"! But I know you're here in spirit, John, and miss you at all the events.



"Here" as in the good ole USA not necessarily where "I" am right now and not in Slovakia or where ever Cano is originally from....:D

cano
09-23-2009, 04:46 PM
km vs miles, I just knew radius of Earth in km and was lazy to convert it to miles, so I used km in my calculations.

I thought you are looking for the loneliest cache :)
You cannot predict place, because placing caches is a random process, however you can find an area with the highest probability for given radius easily and precisely using evolution algorithms. If you are OK with just approximate solution you can find and area around an existing cache which has the most caches in it for given radius easily in O(n^2) time

About predicting a precise time of next milestones... I can look at it :)

Haffy
09-23-2009, 04:52 PM
It's not your fault Cano, I think the USA is about the only country in the world that hasn't converted to the metric system yet.:eek: :D

cano
09-23-2009, 05:06 PM
It's not your fault Cano, I think the USA is about the only country in the world that hasn't converted to the metric system yet.:eek: :D

There are actually 3 countries in the world that don't use metric system yet. USA and some two small African countries. But they don't have anything to measure anyway so it doesn't matter for them which system they use for measures.:)

Anyway, for this purpose it doesn't matter what units are used. I could tell you it is miles or feet without changing the numbers and nobody would noticed :)

brdad
09-23-2009, 05:07 PM
It's not your fault Cano, I think the USA is about the only country in the world that hasn't converted to the metric system yet.:eek: :D

I wish people had voted for the metric system back in... when was it, around 1975 maybe? By now, it would have been a good change. I was too young and most of the older fuddy-duddies were against learning anything new.

WhereRWe?
09-23-2009, 06:18 PM
I wish people had voted for the metric system back in... when was it, around 1975 maybe? By now, it would have been a good change. I was too young and most of the older fuddy-duddies were against learning anything new.

Since I've spent almost 12 years outside the US, I'm pretty conversant in liters/kilograms (a 12 ounce beer is 33 centiliters). :D:D

cano
09-23-2009, 06:58 PM
Since I've spent almost 12 years outside the US, I'm pretty conversant in liters/kilograms (a 12 ounce beer is 33 centiliters). :D:D
it's actually 355ml or 35.5 cl (at least my can of coke, maybe bear is different haha :)) we don't use centiliters much, unless it is distillate alcohol :)

brdad
09-23-2009, 07:05 PM
I could be wrong, but I'd gamble Bruce is getting cheated and the can is a 33 cl / 330 ml can, which is just over 11 ounces. It seems likely that a metric using country would use an integer for the metric volume.

I swear I could start a topic of underwear or tuna fish or Barbie dolls and Bruce could turn it into a subject about beer! :p

pm28570
09-23-2009, 07:09 PM
Many of you know that I travel internationally a fair amount and like Bruce have become pretty adept at imperial/metric and metric to imperial. Metric is so much easier to understand and use for length, volume, liquid and pressure. But.....as Nick the Beer Drinking Dog will tell you, a pint is pint!



Since I've spent almost 12 years outside the US, I'm pretty conversant in liters/kilograms (a 12 ounce beer is 33 centiliters). :D:D

pm28570
09-23-2009, 07:10 PM
And that's wrong because.....?:)



I swear I could start a topic of underwear or tuna fish or Barbie dolls and Bruce could turn it into a subject about beer! :p

brdad
09-23-2009, 07:26 PM
And that's wrong because.....?:)

Well, at least his post was math related in this thread. I'm guessing because he can count higher with beers than he can fingers and toes!

pm28570
09-23-2009, 07:29 PM
Ah, now I see. Counting in multiples of 6......:D



Well, at least his post was math related in this thread. I'm guessing because he can count higher with beers than he can fingers and toes!

WhereRWe?
09-24-2009, 07:34 AM
Ah, now I see. Counting in multiples of 6......:D

24 in a case... :D:D

WhereRWe?
09-24-2009, 07:36 AM
it's actually 355ml or 35.5 cl (at least my can of coke, maybe bear is different haha :)) we don't use centiliters much, unless it is distillate alcohol :)

Oops - I had just looked at a Stella Artois bottle - forgetting that it is 11.5 ounces and not the regulation 12. Gotta watch those Belgians... Next they'll be doing it to Budweiser! :eek::eek::eek:

Ekidokai
09-24-2009, 11:57 AM
There are actually 3 countries in the world that don't use metric system yet. USA and some two small African countries. But they don't have anything to measure anyway so it doesn't matter for them which system they use for measures.:)

Anyway, for this purpose it doesn't matter what units are used. I could tell you it is miles or feet without changing the numbers and nobody would noticed :)


I wish people had voted for the metric system back in... when was it, around 1975 maybe? By now, it would have been a good change. I was too young and most of the older fuddy-duddies were against learning anything new.

Yeah, now I remember that too. It really isn't that hard. Just like learning a new language. After a while you get it down, with a slight, sexy accent.

brdad
09-24-2009, 12:02 PM
Yeah, now I remember that too. It really isn't that hard. Just like learning a new language. After a while you get it down, with a slight, sexy accent.

That's exactly what sealed the deal with Lee. She loves my sexy metric counting. 1 kilogram... 2 kilogram... 3kilogram... ;)