Malte,

How about something like this:

1) Normalize all of your relations to "older than" (reverse of "younger than")

So if you started with:

Malte is older than Bjornke
Mark is older than Malte
Mark is younger than Fred
George is younger than Fred

You now have these ordered pairs:

Malte,Bjornke
Mark, Malte
Fred,Mark
Fred, George

Ignore "equals" relations for now.

2) Combine any places where a name occurs in both the 1st and last items, 
repeat as necessary:

=>
Malte,Bjornke
Fred, Mark, Malte
Fred, George

=>
Fred, Mark, Malte, Bjornke
Fred, George

4) For any "equals" relations, simply treat them as aliases in the final 
analysis. If a name doesn't appear in your list, try all of the aliases because 
the result will be the same.

5) To answer a question, use each resulting line as a test.

Examples: 
If Person A > Person B, then they will appear before them in at least 1 line
If Person A < Person B, then they will appear after them in at least 1 line
If Person A = Person B, then they must not appear on the same line

This probably isn't perfect, but maybe a good direction?


> Thanks for the head ups folks,
> 
> Björnke and Mark: I do not have the exact ages to sort by. All I do have is 
> relations:
> 
> Malte is older than Björnke
> Mark is older than Malte
> 
> And now I need to compute if it is valid to say: 
> - Björnke is older than Mark  (obviously not)
> - Björnke is the same age as Mark (obviously not)
> - Björnke is younger than Mark. (That´s the one)
> 
> What comes easy to the human brain in fact appears to be a lot more difficult 
> when having to be tackled computationaly.
> 
> Chris: Yes, I want such a list in the end. But in order to finally get this I 
> will need to tell the machine which relations are legal first (the user tells 
> which relations there are) and ideally filter out the data for relations that 
> make no sense. Now I wish it was easy to tell the machine to just use logic 
> and make sense itself :D This comparison has to be done for thousands of 
> entities (children in this case). 
> 
> Cheers,
> 
> Malte
_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to