Tag: permutation

用于多维解决方案优化/预测的AI算法

我有6个int参数,范围从0到100 数字的总组合为100 ^ 6,每个组合给出的结果大约为100。 从-10000到100000甚至更多。 Input data example: MySimulation (57, 78, 20, 10, 90, 50) = 300 <- Best Result MySimulation (50, 80, 10, 90, 35, 8) = 200 MySimulation (4, 55, 40, 99, 40, 50) = -50 <- Worst Result 结果越高,数字组合越好,我已经有了计算结果,我只需要AI来找到更好的数字组合,从而得到更高的结果。 Output data example: 55, 70, 25, 15, 95, 52 <- Let's say these […]

如何为工人座位安排生成“社交高尔夫球手”矩阵?

这一挑战是社交高尔夫球手问题场景。 我有一个有320人的公司。 我最近实施了一个按目标管理(MBO)计划,其中每个工作人员都被分配了每月完成的目标。 其中一个经常性的目标是按时到达工作,每天早上参加30分钟的咖啡和dounut会议。 会议在我们的餐厅举行,共有50张桌子。 每张桌子最多可容纳8人。 每个工作日正负80个座位是空的,因为目前最大容量为400个。我想生成一个循环座位安排,以便每个人可以轮流与其他人会面和协作。 (编辑)规则:每个工作日需要8人独特。 一个人不能再与他们过去坐过的其他人坐在一起,直到所有可能的排列都已用完为止。 编辑:所需结果的一个例子是: Day 1: Table 1 will seat worker numbers 1,2,3,4,5,6,7,8. Table 2 will seat worker numbers 9.10,11,12,13,14,15,16 … Table 50 will seat worker numbers 313,314,315,316,317,318,319,320 **NOTE:** (So, the next workday and thereafter, workers 1 through 8 cannot ever be seated with any other workers from that […]

从C#中的正则表达式模式生成文本的所有排列

所以我有一个正则表达式模式,我想生成该模式允许的所有文本排列。 例: var pattern = “^My (?:biological|real)? Name is Steve$”; var permutations = getStringPermutations(pattern); 这将返回以下字符串列表: 我的名字是史蒂夫 我的真名是史蒂夫 我的生物学名字是史蒂夫 更新:显然正则表达式有无限数量的匹配,所以我只想生成可选的字符串文字,如(?:biological | real)? 从我上面的例子。 像(。)*这样的东西有太多的匹配,所以我不会生成它们。

C#中的置换算法

我正在努力学习这个我需要编写的算法。 我正在使用C#。 说我有一个List ,我有一个List 。 我需要编写一个算法,列举所有行李中所有午餐的排列。 例如,假设有3个午餐和2个袋子: // Permutation 1 Bag 1, Lunch 1 Bag 2, Lunch 1 // Permutation 2 Bag 1, Lunch 1 Bag 2, Lunch 2 // Permutation 3 Bag 1, Lunch 1 Bag 2, Lunch 3 // Permutation 4 Bag 1, Lunch 2 Bag 2, Lunch 1 // Permutation 5 Bag […]

找到可能的组合linq

我需要在{“a”, “b”,”c”}之间生成所有可能的组合。 例如,输入集如{“a”, “b”,”c”} ,预期输出为{“a”, “b”, “c” “ab”, “ac”, “bc”, “abc”} 。

使用LINQ生成排列

我有一套必须安排的产品。 有P个产品,每个产品从1到P索引。每个产品可以安排到0到T的时间段。我需要构建满足以下约束的产品计划的所有排列: If p1.Index > p2.Index then p1.Schedule >= p2.Schedule. 我正在努力构建迭代器。 当产品数量是已知常量时,我​​知道如何通过LINQ执行此操作,但是当产品数量是输入参数时,我不确定如何生成此查询。 理想情况下,我想使用yield语法来构造此迭代器。 public class PotentialSchedule() { public PotentialSchedule(int[] schedulePermutation) { _schedulePermutation = schedulePermutation; } private readonly int[] _schedulePermutation; } private int _numberProducts = …; public IEnumerator GetEnumerator() { int[] permutation = new int[_numberProducts]; //Generate all permutation combinations here — how? yield return new PotentialSchedule(permutation); […]