RE: [PHP] Seeking overlap algorithm
| From: | Ford, Mike | Date: | Fri, 07 Dec 2007 15:12:11 +0000 |
| Subject: | RE: [PHP] Seeking overlap algorithm | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-265569@lists.php.net to get a copy of this message | ||
On 07 December 2007 02:14, tedd wrote:
> Now, what I need is a way to analyze the distribution of the current
> service providers to see if a given location is open to being sold as
> a "preferred" position -- do you see what I mean?
>
> Another example, let's say we have four "preferred" service providers
> at the same location. Obviously, we could not sell another
> "preferred" position within 100 miles.
>
> Another example, let's say we have four "preferred" service providers
> 100 miles apart, clearly we can sell more "preferred" positions. But,
> the number of positions available depends upon the distribution of
> the original four. If they were located in a straight line, then we
> could sell two positions between each one. But, if they were
> distributed in a square, we could only sell one. Do you see?
A simplistic but effective way would be:
(1) Locate all "preferred" providers within 50 miles of the potential new one (presumably
a maximum of four!).
(2) For each of these, find how many suppliers are within their 50-mile catchment radius.
If any of the answers at step 2 is four, you lose; if none of them is, you win.
I can't think of any obvious ways to optimize this, but then I never did properly
"get" the travelling salesman or 4-colour problem!
Cheers!
Mike
---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
JG125, The Headingley Library,
James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS, LS6 3QS, United Kingdom
Email: m.ford@leedsmet.ac.uk
Tel: +44 113 812 4730 Fax: +44 113 812 3211
To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm