找到最佳加成链很难吗?


20

一个加法链是正整数的序列(x1,x2,,xn),其中x1=1,并且每个索引i2,我们有xi=xj+xk一些指数1j,k<i。加成链的长度n;加法链的目标xn

对于以下问题的复杂性了解多少:给定整数,目标为N的最短加法链的长度是多少?是NP难吗?NN

维基百科指出Downey,Leong和Sethi于1981年发表的一篇论文证明了以下相关问题是NP-难的:给定整数集,包括整个集合的加法链的最小长度是多少?几位作者显然声称,本文证明了单目标问题是NP难题,但事实并非如此。


2
两个问题:以我认为的二进制形式给出,并且jk是否可以相同(如果是,则总是通过二进制扩展生成长度为log n的序列)Njk
Suresh Venkat

假设以二进制形式给出,尽管即使N是一元也不知道多重时间算法。是的,允许自己添加内容-实际上,这是起步阶段所必需的。128的最短链为(1、2、4、8、16、32、64、128)。NN
Jeffε

Answers:


11

早在2002年Eric Lehman的博士学位论文“基于语法的数据压缩的近似算法”中就提到了这个问题。

“尽管如此,加法链问题的精确解决方案仍然难以捉摸。M元方法在时间polylog(n)上运行并给出1 + o(1)近似值。但是,即使允许以指数方式增加时间,poly( n),尚无确切的算法。”


2

在雷曼论文的主要论文上,对该问题进行了很好的概述(第VB节),并带有参考文献。


1

我想记录一下多项式时间算法的部分进展-到目前为止看来似乎很有希望。更新:添加了一些详细信息,以解决@David指出的故障(谢谢!)。

该方法是将其简化为MINONE-EVEN-3 CSP(MOEC)的实例,这恰好是多项式时间可解决的问题。减少的证明有点模糊,但我希望它存在!

MOEC的一个实例是变量宇宙和整数k个子集的族。现在的问题是,是否有至多重量的满足分配ķ,其中分配是从宇宙的函数{ 0 1 },分配的权重为的变量,它分配一个数,以及分配是对于变量{ x y z }的每个子集,满足(即f)的属性是否满足以下条件:3kk{0,1}{x,y,z}f

f(x)+f(y)+f(z)=0(mod  2)

您可以将其可视化为3-SAT,具有不同的可满足性概念-不选或选两个。对于MOEC 的实例,我会有些松懈,因为除了通常的个子集之外,我还将考虑长度2的含义,析取和约束x = 1 。我相信这些简单的加法将保留问题多项式的时间。3(x=1)

假设我们要减少数字n的加法链问题n。为此减少量设置的变量如下:

对于每一个,变量Ñ 。我将重新写变量Ñ ÑÑ。对于每对Ĵ使得1 Ĵ ķ,引入变量P ĴQ Ĵ1inNiNnNi,j1i,jkPijQij

为每个引入以下子集,使得k = i + ji,j,kk=i+j

{Pij,Qij,Nk}

以及以下含义:

P ĴÑ ĴPijNiPijNj

以及以下约束:

(N1=1),(N=1)

最后,我们需要添加约束条件,以确保在为“对应的” N变量(避免使用符号)分配一个时,至少选择了变量之一。这可以通过在所有P i j上加上通常的OR约束,以使i + j sum到NPNPiji+jN变量来完成。但是,我们必须找到一种在MOEC框架中对此进行重新编码的方法。

因此,让我概述给出一组变量的一般表达方式:

(X,l1,l2,,lt)

如何用MOEC语法编码约束“如果满足一个满足并将设置为1,则必须通过该赋将l i的确切之一设置为1”。请注意,这足以满足我们的要求,我们只需介绍一下约束即可:Xli

(Nk,{Pij | i+j=k})

编码如下。令t叶子上的根完整的二叉树。引入新的变量Ť d 对所有1 d 日志1 大号d ,其中,大号d 表示的节点的数目Ť X在深度dTXtTdi1dlogt1iL(d)L(d)TXd

对于每个节点,如果pq是树中的子节点,则引入EVEN-3约束:Tdipq

{Tdi,p,q}

这意味着,如果将与某个节点相对应的变量设置为true,则其子对象之一也必须正确设置为true。现在添加含义:

d 日志ĴĴ(XT11)(dlogt,j)lj(逗号为了清楚)。

EVEN-3约束和含义的这种组合等效于我们希望编码的约束。

直观地,发生的是最后两个约束恰好触发了建立加成链所需的反应。特别地,让我们看一下由令人满意的分配分配给一个的-声称它们将为N形成一个加法链:由于该分配被迫将N设置为1,因此至少必须存在设置为1的一个P i j,以及影响力N iN jNiNNPijNiNj被分配一个,然后一直向下(我确定可以通过归纳法将其形式化,尽管我还没有得出详细的水平)。请注意,在分配的数量上最佳的令人满意的分配不会为两对r s r 's '设置 true ,因为P变量带有附加变量含义的包而Q变量不行(它们是为了确保EVEN-3可满足性-在N i为真且P为P的子句中Pij(r,s)(r,s)PQNiPij is not true, we still need to pick something to satisfy that clause, and for reasons that are easy to see, this cannot be one universal variable across clauses).

So I believe an addition chain corresponds to a satisfying assignment and vice-versa. Let me describe one part of this somewhat formally: given an addition chain, we construct an assignment f that is satisfying. To begin with, f sets all Ni's that feature in the chain to one, and the other Ni's to zero. Further, if k features in the addition chain, then for each Nk, let ik,jk be the elements in the chain such that ik+jk=j. Then f sets Pikjk to one (and Qikjk to zero), and all (i,j) such that iik and jjk and i+j=k, f sets Qij to one (and Pij to zero). For all k that don't feature in the addition chain, for all i,j such that i+j=k, set all Qij and Pij to zero (notice that consistency follows from the fact that two numbers add up in only one way). Every clause involving a Ni in the chain is satisfied because either a P-variable or Q-variable corresponding to it was set to one (and notice that exactly one of them are set to one for any pair (i,j)). For every other clause, everything is set to zero. That the implications hold is easy to check.

The part that is unclear is the following: because for every element t chosen in the addition chain, the assignment incurs a weight of t (because of all the Q-variables being set to one). So there is a possibility that a longer additional chain would correspond to a cheaper assignment, but I am quite sure this doesn't happen because of a proof along the following lines: consider an optimal addition chain and suppose there is a longer one that has a smaller-weight satisfying assignment corresponding to it. Clearly, the elements of the longer chain exclude at least one from the shorter one - let that element be x. I wish to say that the cost incurred with x is incurred in the longer chain anyway, and the remaining compares favorably. However, I have to write this down carefully, and I might just be seeing things from post-midnight syndrome!


1
If this does work, it seems that it would still be exponential time (when N is expressed in binary) because the number of variables is proportional to N^2 rather than polylog(N).
David Eppstein

Ah yes, I should have emphasized that. I was thinking of N in unary following @JeffE's remark that even that is not clear. I do plan to think about cutting down the instance size further, but at the moment am more keen on ensuring this is alright. If it is, I think there is room aplenty for improvement. Incidentally, would you find the approach promising?
Neeldhara

I don't see how the constraints you describe force a solution to be valid. What stops you from setting P_ij=0 and Q_ij=1 for all i+j=n, and P_ij=Q_ij=0 for all other i,j?
David Eppstein

Thanks for wading through that! And yes, you are quite right; I meant to add a constraint that said any of the Ni's implies one of the relevant Pij's, but realized it blows up the complexity of the instance into the Hitting Set domain, and while I meant to fix it, I think I forgot about it instead. I have updated the answer with a possible fix, it's just a slightly tedious (but simple) construction.
Neeldhara
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.