Here's an off the wall idea, though I'm a long ways from trying to code it. Anyway, I'll start babbling and let someone else refine this, if it is worth it.

Think of it visually, like a dark room, and each complaint is a a candle. The radience from each candle dwindles as per inverse square law. If two candles are near each other, then they would have a bright area between them. All you need to do is find the brightest place and go there.

How does this work in code? I'm not sure, but a matrix might be usefull. For every complaint, increment the value of nearby geographical points inversely proportional to the distance from the complaint.

When all complaints are plotted, look for the highest value in the matrix, send a tech there.

Remove up to X complaints within a radius of Y, and recompute. repeat as necessary.

The granularity of the matrix could be adjusted as needed. The "luminosity" of complaints will also need tweaking.

Update:
here's some code, but it doesn't quite do what I want. points on the grid next to a complaint are too "hot". Maybe it should be a more linear dropoff?

my @complaints = ( { 'complaint_id' => 'a123', 'x' => '45.2', 'y' => '39.7' }, { 'complaint_id' => 'b456', 'x' => '46.5', 'y' => '41.2' }, { 'complaint_id' => 'c789', 'x' => '11.9', 'y' => '29.8' }, { 'complaint_id' => 'd863', 'x' => '95.3', 'y' => '17.2' }, { 'complaint_id' => 'e635', 'x' => '65.5', 'y' => '33.3' }, ) ; my @highlight = (0.0,0.0); my $highvalue = 0.0; foreach $testpoint (@complaints) { for ($i = 0.0; $i < 100.0; $i += 1.0) { for ($j = 0.0; $j < 100.0; $j+= 1.0) { $dsqrd = ((($testpoint->{'x'} - $i)**2 + ($testpoint->{'y' +} - $j)**2)); $points[$i][$j] += $dsqrd ? (1000 / ($dsqrd * 4 * 3.14)) : + 0 ; if ($points[$i][$j] > $highvalue) { @highlight = ($i,$j); $highvalue = $points[$i][$j]; } } } } print "\n\n $highlight[0], $highlight[1] has value $highvalue\n";

In reply to Use Inverse Square Law by Notromda
in thread Sorting by geographical proximity / clumping groups of items based on X and Y by vroom

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.