Algorithm for least required matches to rank players in tournament
$begingroup$
Assuming the following conditions:
- A higher skill level always beats a lower skill level.
- Given n players, each have a distinct skill level compared to the other (n-1).
- If player A has beat player B, and player B has beat player C, then player A is better than player C and no match need to occur.
- The skill level of each player can only be used to determine if it is complete (It cannot use the skill level to help the algorithm, it must only use the match history)
- The algorithm is only considered complete when each player is correctly ranked according to their skill level
What matching algorithm would rank the n players in the least number of matches?
Notice I state matches, and not rounds. So concurrent matches occurring does not help. Although I am curious of the algorithm that would do it in the least number of rounds as well.
If there is no clear obvious answer, what methods/techniques are worth considering?
The answer may (probably?) be a well known tournament style.
If not I have a feeling the answer is very simple and is related to some graph traversal problem, or even related to sorting algorithms on random integers.
As an example, I will use a basic algorithm for 4 players:
Player A (skill 4)
Player B (skill 3)
Player C (skill 2)
Player D (skill 1)
Matches
Round 1 (Match-making is random in round 1 as per condition 4)
A vs C: A wins
B vs D: B wins
Known: (A > C), (B > D)
Round 2
A vs B: A wins
C vs D: C wins
Known: (A > BCD), (B > D), (C > D)
Round 3
B vs C: B wins
Known: (A > BCD), (B > CD), (C > D)
So given 4 players, I was able to find the rank for all players in 5 matches.
combinatorics discrete-mathematics graph-theory optimization algorithms
$endgroup$
add a comment |
$begingroup$
Assuming the following conditions:
- A higher skill level always beats a lower skill level.
- Given n players, each have a distinct skill level compared to the other (n-1).
- If player A has beat player B, and player B has beat player C, then player A is better than player C and no match need to occur.
- The skill level of each player can only be used to determine if it is complete (It cannot use the skill level to help the algorithm, it must only use the match history)
- The algorithm is only considered complete when each player is correctly ranked according to their skill level
What matching algorithm would rank the n players in the least number of matches?
Notice I state matches, and not rounds. So concurrent matches occurring does not help. Although I am curious of the algorithm that would do it in the least number of rounds as well.
If there is no clear obvious answer, what methods/techniques are worth considering?
The answer may (probably?) be a well known tournament style.
If not I have a feeling the answer is very simple and is related to some graph traversal problem, or even related to sorting algorithms on random integers.
As an example, I will use a basic algorithm for 4 players:
Player A (skill 4)
Player B (skill 3)
Player C (skill 2)
Player D (skill 1)
Matches
Round 1 (Match-making is random in round 1 as per condition 4)
A vs C: A wins
B vs D: B wins
Known: (A > C), (B > D)
Round 2
A vs B: A wins
C vs D: C wins
Known: (A > BCD), (B > D), (C > D)
Round 3
B vs C: B wins
Known: (A > BCD), (B > CD), (C > D)
So given 4 players, I was able to find the rank for all players in 5 matches.
combinatorics discrete-mathematics graph-theory optimization algorithms
$endgroup$
$begingroup$
I don't understand rule $4.$ Are you saying that the matches must be determined in advance, before the tournament? That is, the outcome of a match doesn't influence who plays whom in later matches?
$endgroup$
– saulspatz
Mar 3 at 5:53
$begingroup$
You are trying to do a minimum-comparison sort. This is a difficult question in general. See section 5.3.1, "Minimum-Comparison Sorting", in Volume 3, "Sorting and Searching" of "The Art of Computer Programming" by Donald Knuth.
$endgroup$
– awkward
Mar 3 at 13:44
add a comment |
$begingroup$
Assuming the following conditions:
- A higher skill level always beats a lower skill level.
- Given n players, each have a distinct skill level compared to the other (n-1).
- If player A has beat player B, and player B has beat player C, then player A is better than player C and no match need to occur.
- The skill level of each player can only be used to determine if it is complete (It cannot use the skill level to help the algorithm, it must only use the match history)
- The algorithm is only considered complete when each player is correctly ranked according to their skill level
What matching algorithm would rank the n players in the least number of matches?
Notice I state matches, and not rounds. So concurrent matches occurring does not help. Although I am curious of the algorithm that would do it in the least number of rounds as well.
If there is no clear obvious answer, what methods/techniques are worth considering?
The answer may (probably?) be a well known tournament style.
If not I have a feeling the answer is very simple and is related to some graph traversal problem, or even related to sorting algorithms on random integers.
As an example, I will use a basic algorithm for 4 players:
Player A (skill 4)
Player B (skill 3)
Player C (skill 2)
Player D (skill 1)
Matches
Round 1 (Match-making is random in round 1 as per condition 4)
A vs C: A wins
B vs D: B wins
Known: (A > C), (B > D)
Round 2
A vs B: A wins
C vs D: C wins
Known: (A > BCD), (B > D), (C > D)
Round 3
B vs C: B wins
Known: (A > BCD), (B > CD), (C > D)
So given 4 players, I was able to find the rank for all players in 5 matches.
combinatorics discrete-mathematics graph-theory optimization algorithms
$endgroup$
Assuming the following conditions:
- A higher skill level always beats a lower skill level.
- Given n players, each have a distinct skill level compared to the other (n-1).
- If player A has beat player B, and player B has beat player C, then player A is better than player C and no match need to occur.
- The skill level of each player can only be used to determine if it is complete (It cannot use the skill level to help the algorithm, it must only use the match history)
- The algorithm is only considered complete when each player is correctly ranked according to their skill level
What matching algorithm would rank the n players in the least number of matches?
Notice I state matches, and not rounds. So concurrent matches occurring does not help. Although I am curious of the algorithm that would do it in the least number of rounds as well.
If there is no clear obvious answer, what methods/techniques are worth considering?
The answer may (probably?) be a well known tournament style.
If not I have a feeling the answer is very simple and is related to some graph traversal problem, or even related to sorting algorithms on random integers.
As an example, I will use a basic algorithm for 4 players:
Player A (skill 4)
Player B (skill 3)
Player C (skill 2)
Player D (skill 1)
Matches
Round 1 (Match-making is random in round 1 as per condition 4)
A vs C: A wins
B vs D: B wins
Known: (A > C), (B > D)
Round 2
A vs B: A wins
C vs D: C wins
Known: (A > BCD), (B > D), (C > D)
Round 3
B vs C: B wins
Known: (A > BCD), (B > CD), (C > D)
So given 4 players, I was able to find the rank for all players in 5 matches.
combinatorics discrete-mathematics graph-theory optimization algorithms
combinatorics discrete-mathematics graph-theory optimization algorithms
edited Mar 3 at 5:10
CuriousDeveloper
asked Mar 3 at 4:35
CuriousDeveloperCuriousDeveloper
383
383
$begingroup$
I don't understand rule $4.$ Are you saying that the matches must be determined in advance, before the tournament? That is, the outcome of a match doesn't influence who plays whom in later matches?
$endgroup$
– saulspatz
Mar 3 at 5:53
$begingroup$
You are trying to do a minimum-comparison sort. This is a difficult question in general. See section 5.3.1, "Minimum-Comparison Sorting", in Volume 3, "Sorting and Searching" of "The Art of Computer Programming" by Donald Knuth.
$endgroup$
– awkward
Mar 3 at 13:44
add a comment |
$begingroup$
I don't understand rule $4.$ Are you saying that the matches must be determined in advance, before the tournament? That is, the outcome of a match doesn't influence who plays whom in later matches?
$endgroup$
– saulspatz
Mar 3 at 5:53
$begingroup$
You are trying to do a minimum-comparison sort. This is a difficult question in general. See section 5.3.1, "Minimum-Comparison Sorting", in Volume 3, "Sorting and Searching" of "The Art of Computer Programming" by Donald Knuth.
$endgroup$
– awkward
Mar 3 at 13:44
$begingroup$
I don't understand rule $4.$ Are you saying that the matches must be determined in advance, before the tournament? That is, the outcome of a match doesn't influence who plays whom in later matches?
$endgroup$
– saulspatz
Mar 3 at 5:53
$begingroup$
I don't understand rule $4.$ Are you saying that the matches must be determined in advance, before the tournament? That is, the outcome of a match doesn't influence who plays whom in later matches?
$endgroup$
– saulspatz
Mar 3 at 5:53
$begingroup$
You are trying to do a minimum-comparison sort. This is a difficult question in general. See section 5.3.1, "Minimum-Comparison Sorting", in Volume 3, "Sorting and Searching" of "The Art of Computer Programming" by Donald Knuth.
$endgroup$
– awkward
Mar 3 at 13:44
$begingroup$
You are trying to do a minimum-comparison sort. This is a difficult question in general. See section 5.3.1, "Minimum-Comparison Sorting", in Volume 3, "Sorting and Searching" of "The Art of Computer Programming" by Donald Knuth.
$endgroup$
– awkward
Mar 3 at 13:44
add a comment |
2 Answers
2
active
oldest
votes
$begingroup$
If we are optimizing the number of matches, then this problem is exactly equivalent to the problem of finding a good sorting algorithm. Since $m$ matches have $2^m$ different possible outcomes, and we want to distinguish $n!$ possible orders between the players, we must have $2^m ge n!$ or $m ge log_2 (n!) = O(n log n)$ matches. Algorithms like quicksort or mergesort achieve this many matches, at least asymptotically.
(So just run quicksort, for example, and every time it asks you to compare two elements, have the corresponding players play a match to decide the outcome of the comparison.)
It's more interesting to optimize the number of rounds. Since each round can include up to $frac n2$ matches, the lower bound on the number of rounds is only $frac{log_2 (n!)}{n/2} = O(log n)$.
We can borrow some constructions from sorting networks to achieve this bound, at least asymptotically. A sorting network can be thought of as a tournament of this type with some restrictions:
- Initially, the players are given an arbitrary ranking from $1$ to $n$.
- When a game is played between players ranked $i$ and $j$, if $i<j$ but the $i^{text{th}}$ player loses, the two players exchange ranks.
- The games have to be prearranged in advance - but in terms of ranks. (So the instructions for one round with 6 players might be "players ranked 1 and 4 play, players ranked 2 and 5 play, players ranked 3 and 6 play".)
The depth of a sorting network is precisely the number of rounds required in the resulting tournament.
There are many sorting networks, such as the bitonic sorter, that have depth $O(log^2 n)$. This is good, but not optimal. The AKS network is a sorting network with depth $O(log n)$, which is optimal up to a (huge) constant; it's not useful in practice.
$endgroup$
add a comment |
$begingroup$
The merge insertion sort is optimal if the number of players is less than 15 or between 20 and 22. For larger numbers of players there exists a sorting algorithm with fewer comparisons than the merge insertion sort.
In general, this is an open problem.
$endgroup$
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "69"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3133155%2falgorithm-for-least-required-matches-to-rank-players-in-tournament%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
If we are optimizing the number of matches, then this problem is exactly equivalent to the problem of finding a good sorting algorithm. Since $m$ matches have $2^m$ different possible outcomes, and we want to distinguish $n!$ possible orders between the players, we must have $2^m ge n!$ or $m ge log_2 (n!) = O(n log n)$ matches. Algorithms like quicksort or mergesort achieve this many matches, at least asymptotically.
(So just run quicksort, for example, and every time it asks you to compare two elements, have the corresponding players play a match to decide the outcome of the comparison.)
It's more interesting to optimize the number of rounds. Since each round can include up to $frac n2$ matches, the lower bound on the number of rounds is only $frac{log_2 (n!)}{n/2} = O(log n)$.
We can borrow some constructions from sorting networks to achieve this bound, at least asymptotically. A sorting network can be thought of as a tournament of this type with some restrictions:
- Initially, the players are given an arbitrary ranking from $1$ to $n$.
- When a game is played between players ranked $i$ and $j$, if $i<j$ but the $i^{text{th}}$ player loses, the two players exchange ranks.
- The games have to be prearranged in advance - but in terms of ranks. (So the instructions for one round with 6 players might be "players ranked 1 and 4 play, players ranked 2 and 5 play, players ranked 3 and 6 play".)
The depth of a sorting network is precisely the number of rounds required in the resulting tournament.
There are many sorting networks, such as the bitonic sorter, that have depth $O(log^2 n)$. This is good, but not optimal. The AKS network is a sorting network with depth $O(log n)$, which is optimal up to a (huge) constant; it's not useful in practice.
$endgroup$
add a comment |
$begingroup$
If we are optimizing the number of matches, then this problem is exactly equivalent to the problem of finding a good sorting algorithm. Since $m$ matches have $2^m$ different possible outcomes, and we want to distinguish $n!$ possible orders between the players, we must have $2^m ge n!$ or $m ge log_2 (n!) = O(n log n)$ matches. Algorithms like quicksort or mergesort achieve this many matches, at least asymptotically.
(So just run quicksort, for example, and every time it asks you to compare two elements, have the corresponding players play a match to decide the outcome of the comparison.)
It's more interesting to optimize the number of rounds. Since each round can include up to $frac n2$ matches, the lower bound on the number of rounds is only $frac{log_2 (n!)}{n/2} = O(log n)$.
We can borrow some constructions from sorting networks to achieve this bound, at least asymptotically. A sorting network can be thought of as a tournament of this type with some restrictions:
- Initially, the players are given an arbitrary ranking from $1$ to $n$.
- When a game is played between players ranked $i$ and $j$, if $i<j$ but the $i^{text{th}}$ player loses, the two players exchange ranks.
- The games have to be prearranged in advance - but in terms of ranks. (So the instructions for one round with 6 players might be "players ranked 1 and 4 play, players ranked 2 and 5 play, players ranked 3 and 6 play".)
The depth of a sorting network is precisely the number of rounds required in the resulting tournament.
There are many sorting networks, such as the bitonic sorter, that have depth $O(log^2 n)$. This is good, but not optimal. The AKS network is a sorting network with depth $O(log n)$, which is optimal up to a (huge) constant; it's not useful in practice.
$endgroup$
add a comment |
$begingroup$
If we are optimizing the number of matches, then this problem is exactly equivalent to the problem of finding a good sorting algorithm. Since $m$ matches have $2^m$ different possible outcomes, and we want to distinguish $n!$ possible orders between the players, we must have $2^m ge n!$ or $m ge log_2 (n!) = O(n log n)$ matches. Algorithms like quicksort or mergesort achieve this many matches, at least asymptotically.
(So just run quicksort, for example, and every time it asks you to compare two elements, have the corresponding players play a match to decide the outcome of the comparison.)
It's more interesting to optimize the number of rounds. Since each round can include up to $frac n2$ matches, the lower bound on the number of rounds is only $frac{log_2 (n!)}{n/2} = O(log n)$.
We can borrow some constructions from sorting networks to achieve this bound, at least asymptotically. A sorting network can be thought of as a tournament of this type with some restrictions:
- Initially, the players are given an arbitrary ranking from $1$ to $n$.
- When a game is played between players ranked $i$ and $j$, if $i<j$ but the $i^{text{th}}$ player loses, the two players exchange ranks.
- The games have to be prearranged in advance - but in terms of ranks. (So the instructions for one round with 6 players might be "players ranked 1 and 4 play, players ranked 2 and 5 play, players ranked 3 and 6 play".)
The depth of a sorting network is precisely the number of rounds required in the resulting tournament.
There are many sorting networks, such as the bitonic sorter, that have depth $O(log^2 n)$. This is good, but not optimal. The AKS network is a sorting network with depth $O(log n)$, which is optimal up to a (huge) constant; it's not useful in practice.
$endgroup$
If we are optimizing the number of matches, then this problem is exactly equivalent to the problem of finding a good sorting algorithm. Since $m$ matches have $2^m$ different possible outcomes, and we want to distinguish $n!$ possible orders between the players, we must have $2^m ge n!$ or $m ge log_2 (n!) = O(n log n)$ matches. Algorithms like quicksort or mergesort achieve this many matches, at least asymptotically.
(So just run quicksort, for example, and every time it asks you to compare two elements, have the corresponding players play a match to decide the outcome of the comparison.)
It's more interesting to optimize the number of rounds. Since each round can include up to $frac n2$ matches, the lower bound on the number of rounds is only $frac{log_2 (n!)}{n/2} = O(log n)$.
We can borrow some constructions from sorting networks to achieve this bound, at least asymptotically. A sorting network can be thought of as a tournament of this type with some restrictions:
- Initially, the players are given an arbitrary ranking from $1$ to $n$.
- When a game is played between players ranked $i$ and $j$, if $i<j$ but the $i^{text{th}}$ player loses, the two players exchange ranks.
- The games have to be prearranged in advance - but in terms of ranks. (So the instructions for one round with 6 players might be "players ranked 1 and 4 play, players ranked 2 and 5 play, players ranked 3 and 6 play".)
The depth of a sorting network is precisely the number of rounds required in the resulting tournament.
There are many sorting networks, such as the bitonic sorter, that have depth $O(log^2 n)$. This is good, but not optimal. The AKS network is a sorting network with depth $O(log n)$, which is optimal up to a (huge) constant; it's not useful in practice.
answered Mar 3 at 5:45
Misha LavrovMisha Lavrov
48.4k757107
48.4k757107
add a comment |
add a comment |
$begingroup$
The merge insertion sort is optimal if the number of players is less than 15 or between 20 and 22. For larger numbers of players there exists a sorting algorithm with fewer comparisons than the merge insertion sort.
In general, this is an open problem.
$endgroup$
add a comment |
$begingroup$
The merge insertion sort is optimal if the number of players is less than 15 or between 20 and 22. For larger numbers of players there exists a sorting algorithm with fewer comparisons than the merge insertion sort.
In general, this is an open problem.
$endgroup$
add a comment |
$begingroup$
The merge insertion sort is optimal if the number of players is less than 15 or between 20 and 22. For larger numbers of players there exists a sorting algorithm with fewer comparisons than the merge insertion sort.
In general, this is an open problem.
$endgroup$
The merge insertion sort is optimal if the number of players is less than 15 or between 20 and 22. For larger numbers of players there exists a sorting algorithm with fewer comparisons than the merge insertion sort.
In general, this is an open problem.
answered Mar 3 at 5:55
Angela RichardsonAngela Richardson
5,46011735
5,46011735
add a comment |
add a comment |
Thanks for contributing an answer to Mathematics Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3133155%2falgorithm-for-least-required-matches-to-rank-players-in-tournament%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
$begingroup$
I don't understand rule $4.$ Are you saying that the matches must be determined in advance, before the tournament? That is, the outcome of a match doesn't influence who plays whom in later matches?
$endgroup$
– saulspatz
Mar 3 at 5:53
$begingroup$
You are trying to do a minimum-comparison sort. This is a difficult question in general. See section 5.3.1, "Minimum-Comparison Sorting", in Volume 3, "Sorting and Searching" of "The Art of Computer Programming" by Donald Knuth.
$endgroup$
– awkward
Mar 3 at 13:44