我正在尝试找到一种算法来识别结果的有序组合,如下所示:
- 有 N 场比赛,每场比赛有 3 个相互排斥的结果(赢、输或平),总共有 3N 个结果和 3^N 种组合
- 3N 个可能的结果中的每一个都被分配了一个唯一的等级,最优选的结果的等级为 1,最不优选的结果的等级为 3N
- 找出每场比赛的前 M 个结果组合,从包含排名最高的结果的组合开始。
例如,假设 N = 3 并且结果排名如下:
Contest 1 Win = 1
Contest 1 Tie = 4
Contest 1 Loss = 7
Contest 2 Win = 2
Contest 2 Tie = 5
Contest 2 Loss = 8
Contest 3 Win = 3
Contest 3 Tie = 6
Contest 3 Loss = 9
鉴于这些排名,组合应按以下顺序排列:
Contest 1 Win (1), Contest 2 Win (2), Contest 3 Win (3)
Contest 1 Win (1), Contest 2 Win (2), Contest 3 Tie (6)
Contest 1 Win (1), Contest 2 Win (2), Contest 3 Loss (9)
Contest 1 Win (1), Contest 2 Tie (5), Contest 3 Win (3)
Contest 1 Win (1), Contest 2 Loss (8), Contest 3 Win (3)
Contest 1 Win (1), Contest 2 Tie (5), Contest 3 Tie (6)
Contest 1 Win (1), Contest 2 Tie (5), Contest 3 Loss (9)
Contest 1 Win (1), Contest 2 Loss (8), Contest 3 Win (6)
Contest 1 Win (1), Contest 2 Loss (8), Contest 3 Loss (9)
Contest 1 Tie (4), Contest 2 Win (2), Contest 3 Win (3)
Contest 1 Loss (7), Contest 2 Win (2), Contest 3 Win (3)
Contest 1 Tie (4), Contest 2 Win (2), Contest 3 Tie (6)
Contest 1 Tie (4), Contest 2 Win (2), Contest 3 Loss (9)
Contest 1 Loss (7), Contest 2 Win (2), Contest 3 Tie (6)
Contest 1 Loss (7), Contest 2 Win (2), Contest 3 Loss (9)
Contest 1 Tie (4), Contest 2 Tie (5), Contest 3 Win (3)
Contest 1 Tie (4), Contest 2 Loss (8), Contest 3 Win (3)
Contest 1 Loss (7), Contest 2 Tie (5), Contest 3 Win (3)
Contest 1 Loss (7), Contest 2 Loss (8), Contest 3 Win (3)
Contest 1 Tie (4), Contest 2 Tie (5), Contest 3 Tie (6)
Contest 1 Tie (4), Contest 2 Tie (5), Contest 3 Loss (9)
Contest 1 Tie (4), Contest 2 Loss (8), Contest 3 Tie (6)
Contest 1 Tie (4), Contest 2 Loss (8), Contest 3 Loss (9)
Contest 1 Loss (7), Contest 2 Tie (5), Contest 3 Tie (6)
Contest 1 Loss (7), Contest 2 Tie (5), Contest 3 Loss (9)
Contest 1 Loss (7), Contest 2 Loss (8), Contest 3 Tie (6)
Contest 1 Loss (7), Contest 2 Loss (8), Contest 3 Loss (9)
我正在寻找一种生成这些组合的方法,以便获得任意大的 N 值,尽管我不希望得到所有组合。例如,在 N=256 和总共 3^256 个组合的情况下,我希望找到前 500 个组合。