另一种措辞是:任意分割 同样的物品进入了 k,使一些桶空。
讨论:
- an "integer partition of N", to match the usual definition and counting, can be considered as:
- a tuple of positive integers, in decreasing order, which sums to N
- a vector of unsigned integers is a "partition" of N, if the sum of its elements (without integer overflow) is N.
我想写出一种功能 f(N,k),即随机和统一地选择了N分治可能长效的病媒,并回收选定的病媒。
如果能找到一个适用于所有k>、=1,但我特别关心k >、N。 因此,如果它有助于关注或限制这种条件,即证明。 而且,如果我们必须研究近似/湿度,那么把大部分病媒分录为零(至少是千兆字节;2N)就算得太高。
我的初步想法是:
- If N is small enough that it is reasonable to calculate (or look up in a table?) the number of integer partitions of N, then maybe we could proceed as:
- Create a vector of k unsigned ints initialized to zero
- Make a random integer partition of N. Let m be the length of this tuple.
- Place those values in the initial m positions of the vector.
- Randomly shuffle the vector.
这种做法将尽可能地对待生产媒介将含有N的条目与含有1的N条目一样。 这是正确的。 但是,可能有一种简单的权重,可以适用于“任意分割N”的情况,而这种权衡是正确的?
- Another approach which feels cleaner, but would likely still need "re-weighting" somewhere:
- Create a vector of k unsigned ints initialized to zero
- do the following N times:
- randomly choose an element of the vector and increment it
虽然这感觉更清洁,但我认为,这将大大提高“再加权”的难度。 虽然第1部分的权重像对我来说是一个困难的算法问题,但我至少可以想象需要计算什么。 在这方面,我甚至不敢确定需要重新加权的内容和方式。
The reason I think it likely still needs reweighting is that there is exactly one sequence of random choices that would lead to the vector looking like [N,0,0,...,0], and N! sequences of random choices that would lead to the vector starting with N ones [1,1,...,1,0,0,...,0]. Calculating the ratios of these "incorrect weighting" of the final result sounds doable, but I don t know how I d go about reweighting the individual steps to correct for it.
- Or maybe there is another approach entirely, that I have not thought of?