Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Algorithm for optimal "intersection" of two results?

Tags:

algorithm

I have two results and like to get the best "order" of both these. Example:

We have a race with 5 people in one race, and 7 in another. The outcome is: Race 1.

1. Karl
2. Fred
3. John
4. Peter
5. Sid

Race 2.

1. Steven
2. John
3. Karl
4. Peter
5. Aron
6. Fred
7. Kevin

The questin is: whats the top 7 of both these races?

Its quite obvious that that nr 1 is Karl in this case, since he hold one 1st place and one 3rd, which is better than Johns second and third place. However, Steven could be equally good but he did only participate in one race and should suffer some kind of penalty for that.

What are the known algorithms for this problem? Are there any trivial solutions? I just can't figure it out

like image 416
freakshow Avatar asked Mar 08 '26 21:03

freakshow


2 Answers

You can relate the positions to weights (think of it as points) For instance 1st position has a weight of 20. 2nd has 18. 3rd 16, etc.
Participation miss could relate to a weight of -5. You can adjust the numbers as required.

To find the final result you add everyone's weights and compare the numbers.

I think it should work..

like image 193
Stefanos Kalantzis Avatar answered Mar 11 '26 20:03

Stefanos Kalantzis


Another approach would be to create an ordering of the top nodes which are consistent with the ordering of the previous races. This could be done by using a max-flow algorithm.

like image 21
David Weiser Avatar answered Mar 11 '26 20:03

David Weiser



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!