We study the following combinatorial problem. Given a set of $n$ y-monotone wires, a tangle determines the order of the wires on a number of horizontal layers such that the orders of the wires on any two consecutive layers differ only in swaps of neighboring wires. Given a multiset $L$ of swaps (that is, unordered pairs of numbers between 1 and $n$) and an initial order of the wires, a tangle realizes $L$ if each pair of wires changes its order exactly as many times as specified by $L$. The aim is to find a tangle that realizes $L$ using the smallest number of layers. We show that this problem is NP-hard, and we give an algorithm that computes an optimal tangle for $n$ wires and a given list $L$ of swaps in $O((2|L|/n^2+1)^{n^2/2} \cdot \varphi^n \cdot n)$ time, where $\varphi \approx 1.618$ is the golden ratio. We can treat lists where every swap occurs at most once in $O(n!\varphi^n)$ time. We implemented the algorithm for the general case and compared it to an existing algorithm. Finally, we discuss feasibility for lists with a simple structure.
翻译:我们研究以下组合问题。给定一组 $n$ 个单调递增的导线,一个缠结决定了这些导线在若干水平层上的顺序,使得任意两个连续层上的导线顺序仅通过相邻导线的交换而不同。给定一个交换多重集 $L$(即介于 1 到 $n$ 之间的无序数对)以及导线的初始顺序,若每对导线交换顺序的次数恰好等于 $L$ 中指定的次数,则称该缠结实现了 $L$。目标在于找到实现 $L$ 且使用最少层数的缠结。我们证明了该问题是 NP 难问题,并给出了一种算法,可在 $O((2|L|/n^2+1)^{n^2/2} \cdot \varphi^n \cdot n)$ 时间内为 $n$ 条导线和给定的交换列表 $L$ 计算出最优缠结,其中 $\varphi \approx 1.618$ 为黄金分割比。对于每个交换至多出现一次的列表,我们可在 $O(n!\varphi^n)$ 时间内处理。我们实现了该算法的一般情况,并与现有算法进行了比较。最后,我们讨论了具有简单结构的列表的可行性。