简要地
在给定排列唯一索引的情况下,神经网络可以模拟因子分解(或其他一些方法)来提供列表排列吗?
应用
我列出了10件事,它们是无关紧要的。我关心的是我的10件事可以被放入3628800(或10!)个唯一的订单中,因为我可以使用无符号整数和阶乘分解来表达我的10件事的任何列表顺序:
Order 0: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
Order 1: 0, 1, 2, 3, 4, 5, 6, 7, 9, 8
Order ....
Order 3628799: 9, 8, 7, 6, 5, 4, 3, 2, 1, 0
这允许在我的10件事的不同列表顺序上并行分析分析。
一个常见的例子是旅行商问题:
1. I give 500 different computers each a range of unsigned integers:
0 -> 7257 for computer 0,
7257 -> 14516 for computer 1,
etc.
2. Each computer first calculates the list order from it's unsigned integer
index by using factorial decomposition.
ie. Order 1 -> 0, 1, 2, 3, 4, 5, 6, 7, 9, 8
3. The distance between the cities placed in the order described is calculated.
4. The shortest distances from each computer is collected, and the shortest
of those is taken. Leaving us with a single unsigned integer index that
describes the shortest possible permutation of cities.
实际上,可以使用相同的过程来解决几乎任何可约束的误差表面,这通常远远超过可行的计算能力。
递归算法解决方案
我们可以使用因子分解计算任何固定大小列表的第N个排列(授予我们将需要对更大列表的大整数支持)(这里用php概述),为了清楚起见,在这里用javascript提供:
function ithPermutationOfNElements (n, i)
{
var j, k = 0;
var fact = [];
var perm = [];
// compute factorial numbers
fact[k] = 1;
while (++k < n)
fact[k] = fact[k - 1] * k;
// compute factorial code
for (k = 0; k < n; ++k)
{
perm[k] = Math.floor(i / fact[n - 1 - k]);
i = i % fact[n - 1 - k];
}
// readjust values to obtain the permutation
// start from the end and check if preceding values are lower
for (k = n - 1; k > 0; --k)
for (j = k - 1; j >= 0; --j)
if (perm[j] <= perm[k])
perm[k]++;
return perm;
}
console.log(ithPermutationOfNElements(4, 23)); // [ 3, 2, 1, 0 ]
神经网络方案?
任何神经网络架构和训练组合可以模拟这个函数,因为它只有输入神经元和n个输出神经元代表排列的每个元素?