[英]Most suitable combinatorics algorithm
There are 6 seats and 4 persons, for which seats must be allocated according to some optimality criterion. 有6个席位和4个席位,必须根据一些最佳标准为其分配席位。 For example: 例如:
Allocation 1:
_ _ _ _ _ _
1 2 3 4
Allocation 2:
_ _ _ _ _ _
1 3 2 4
...
Question 1: Which combinatorics problem is it? 问题1:哪个组合问题?
Question 2: What is the name of most suitable algorithm for searching through all possible combinations? 问题2:搜索所有可能组合的最合适算法的名称是什么?
1.) k-permutation of n without repetion: http://www.statlect.com/comdis1.htm 1.)不作重复的n的k-置换: http : //www.statlect.com/comdis1.htm
2.) It depends on which you are searching for. 2.)取决于您要搜索的内容。 For example, I offer you genetic algorithms which can find the best candidate based on a special heuristic if you can order a "goodness degree" to the possible solutions. 例如,我为您提供了遗传算法,如果您可以为可能的解决方案定出“优度”,则可以基于特殊的启发式算法找到最佳候选者。
To answer Question 1, note that for the sequence of 4 persons there are 4!
要回答问题1,请注意,对于4个人的序列,有4!
possibilites. possibilites。 Additionally, the 6-4=2
non-occupied seats must be positioned between the people, for which there are 4+1=5
slots (before every person and behind the last person), resulting in 5+2-1 choose 2
possibilities, where choose
denotes the binomial coeffiecient, by interpretation as stars and bars problem. 此外,必须在人与人之间放置6-4=2
个无人座位,为此必须有4+1=5
个位置(在每个人之前和最后一个人之后),导致5+2-1 choose 2
可能性,其中choose
表示二项式coeffiecient,通过解释为明星和酒吧的问题。 In total, there are 总共有
4!(6 choose 2)
possibilities, or parameterized 可能性或参数化
m!(m+1+nm-1 choose nm) = m!(n choose nm)
where m
is the number of people and n
is the number of seats; 其中m
是人数, n
是座位数; using the identity 使用身份
n choose k = n!/(k!(nk)!)
this can be simplified to 这可以简化为
n!/(nm)!
which is indeed the n
-permutation of m
objects as defined here . 的确是此处定义的m
对象的n
置换。
Concerning Question 2, this really depends on the optimality criterion and whether an exact, approximate or heuristic algorithm is desired. 关于问题2,这实际上取决于最佳性标准以及是否需要精确,近似或启发式算法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.