shortest route from point to point on discontinuous line



Hi all,

I've been braking my head over this, and i'm just stuck. I'm writing
an algorithm that applies limits to a collection of objects and then
tries to find the largest subset of that collection that fits all
these limits.

Now one of these limits can be simplified to this situation.

Every point in my collection has an X and a Y value. One limit states
that the limit for the average value for Y is dependent on the average
value for X through this function:

LimitY(x) =
if x <= 36 then .5
if x > 36 and <= 39 then .45
if x > 39 and <= 42 then .41
if x > 42 and <= 45 then .38
if x > 45 and <= 48 then .36
if x > 48 then .33

so this limit is a line that looks something like this:

______
_____
_____
______
_______


To find out if the average for a certain collection, a point (x, y),
is above the line is easy, put the average for x into the function and
check if the average y is bigger than LimitY(x).

If the average is above the line, i have to delete some elements in
the collection to bring the average under the line. But i want to
delete as few objects as possible to bring it under the line. So take
these examples:

for points (X,Y)
* (48.1 , .35) in this case i would delete objectswith a large X to
bring down the average X to under 48. That would make the limit .36
and i would be ok.

* (47,9 , .37) in this case i would delete objects with a large Y to
bring down the average Y to .36.

* 48.1 , .37) in this case i woudl delete object with a large X and
a large Y, because the nearest point below the line is just to the
left and below.

Now i would like to find some generic algotithm that, for any point
(x,y), when above the limit, tells me if i should bring the average X
down, bring the average Y down, or maybe both.

So i need to find the shortest 'route' to a point below the line for
a given point (X, Y)

Does anyone have any experience with this type of problem? It's easy
to spot when you draw it out, but i'm finding it difficult to program
it with line segements and all.

Hope that one of you can give me some pointers,

Regards Gert-Jan

.



Relevant Pages

  • Re: Clue bats
    ... I could tell myself more complicated stories. ... I can't keep them in my head, so I have to write them down. ... and I enjoy the process of writing very much ... I've been absolutely utterly thoroughly stuck 20K after a missed ...
    (rec.arts.sf.composition)
  • Re: So Hows Everyone?
    ... >>>Has there been a topic on writing while I was away? ... > Hey Ari. ... Just stuck my head back in myself. ...
    (misc.writing)
  • Re: Effects of Magic
    ... I've got dialogue in my head and I'm writing it down already. ... because I much prefer the scenes where I've ... better class of first draft as long as I know the setting, ...
    (rec.arts.sf.composition)
  • Re: A REAL LIVE Reverse Entropy Machine-Warning
    ... A lot of rural gangs are head and other clinical manufactures are ... stuck, but will Hassan explode that? ...
    (sci.crypt)
  • Re: Intro post (belated): Nick Argall
    ... no productivity. ... To be a writer, one must *sit down and write*. ... It makes me want to beat my head against a wall. ... I know up front that I'm probably not going to get any writing done, and I know that I will as soon as I get home, so I'm not going to beat myself up over it. ...
    (rec.arts.sf.composition)

Loading