概括的算法多米诺贴砖? [英] Generalizing the algorithm for domino tiling?

查看:449
本文介绍了概括的算法多米诺贴砖?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<一个href="http://stackoverflow.com/questions/4780201/maximum-number-of-dominoes-can-be-placed-inside-a-figure">this前面的问题 的OP提出以下问题:

  

给定的矩形栅格,其中一些方块是空的,一些被填充,什么是2×1骨牌的最大数目,能够被放置到世界,使得没有两个骨牌重叠,没有骨牌是顶上填充方?

本(相当漂亮!)的回答这个问题,认为这相当于找到一个最大二分匹配的特殊构造图。在该图中,每个空正方形具有由边缘链接到每个它的邻居的节点。每个Domino则对应于这样的,它的端点不属于任何其他边缘图的边缘。因此,任何一组的边不共享一个顶点(匹配)对应于多米诺骨牌的布置,反之亦然。

我的问题是较早的​​一个的概括:

  

给定的矩形栅格,其中一些方块是空的,一些被填充,什么是最大数目的M×N个骨牌(对于给定的M和N),其可以被放置到世界,使得没有两个骨牌重叠并且无多米诺骨牌是顶上实心方块?

我看不到如何转换成一个匹配的问题,这正如在previous情况下完成的。不过,我也看不出有什么特别的原因,为什么这个问题会立即NP难,所以有可能是一个多项式时间内解决问题的办法。

有一个高效的算法来解决这个问题?或者有没有人有减少,将显示这个问题是一个NP难?

太感谢了!

解决方案

这个问题肯定是NP难的,我可以证明这一点。有从3-SAT减少这个问题。具体地讲,它是由3-SAT减少这个问题,其中的多米诺骨牌是1×3的子问题。也可能有其它减量而其他具体尺寸,但是这一个肯定的工作原理。

从本质上讲,在本次减持中,我们将使用多米诺持仓EN code无论是真的还是假的。具体而言,我将采取同样的符号与其他的解决方案,这是说,我将用星号来表示对电网开放空间。我还用套三个大写字母重新present多米诺骨牌和小写字母重新present信号,这是空间可能会或可能不会取决于系统的状态填补。

要嵌入一个3-SAT问题进入这个领域,我们将需要一套我称之为小工具仅允许某些状态是可能的。大部分这些小工具将具有在它们的多米诺骨牌的固定数目。唯一的例外将其重新present这将有一个额外的多米诺骨牌,如果该条款为真(满意)的条文,但不是当它是假的(不满意)小工具。我们可以使用路径互连这些小工具。总之这将使我们能够建立一个3-SAT电路。我们将有多米诺骨牌的基数,因为每个路径和小工具将多米诺骨牌的标准量,我们可以添加这些后拿到基地数k,然后在每个子句的小工具可以有一个额外的多米诺骨牌,如果这是真的,那么如果所有条款可制成真(因此前pression满足)和有n个条款,然后骨牌的最大数量将为n + K。如果不是,则最大数目将是小于n + K。这是减少的基本形式。接下来,我将介绍小工具和举例说明。

类似于其他的答案,我们将有两个位置上连接code真假对于给定的变量。所以,我将开始与一个单一的瓷砖,可以在两种可能的地方。

  ****
 

这既可以覆盖一个多米诺骨牌一样

  AAA *或* AAA
 

显然,这不能被覆盖有2多米诺骨牌,并与0骨牌覆盖它绝不会最大的。对于我而言,我们要考虑的突起重新present值假和缺乏突起重新present真的。因此,我们可以认为这部分具有携带两个信号:

  X **ÿ
 

和在这种情况下,只有一个X或Y的将被覆盖,因此,我们可以考虑的信号是x和逻辑的不是X。对于我们而言,无论是投保的是假的,哪个不是盖的是真的。接下来,我们可以简单地通过直请问弧形的路径传输信号。如果我们有

  X *****ÿ
 

我们将再次有整整两个多米诺骨牌,导致X或Y被覆盖,但不能同时使用。

 性感
*
*
x
 

将有完全一样的行为。因此,我们可以用这个来的长度,它们是3增量创造长期和弯曲的路径然而,并不是我们可能要使用所有的长度是3的增量,因此我们需要一个额外的小工具来移动不同的距离。我把这个小提琴手小工具,它的唯一目的就是稍微移动信号不均匀的距离,使事情成功连接。它的输入来自x和输出到y和它只是沿着传送相同的信号。它看起来是这样的:

 性感
 *
** x
 

它总是包含恰好两个多米诺骨牌,并填写以下两种方法之一:

  BBB * AB | BB
 *        一个
AAA * AX
 

如果我们要模拟3-SAT,但是,我们需要的不仅仅是这一点。具体而言,我们需要一些方法来模拟条款。要做到这一点,我们有一个小工具,其中,如果该条款是真正的一个额外的多米诺骨牌可以压缩研究。该条款将是真实的,当它的一个或多个输入是真实的。在这种情况下,这意味着我们可以打包时的输入的至少一个不突出在一个额外的多米诺骨牌。它看起来是这样的:

  * X * Y *
  *
  ž
 

如果我们添加一个额外的路径各为清楚起见,那么它看起来是这样的:

  * *
 * *
 * *
*****
  *
  ****
 

如果X,Y和Z全是假的,那么他们就都有突起,这将填补像 这样的:

  A B
 光盘
 光盘
*光盘*
  *
  EEEF
 

如果多米诺骨牌的A,B和F剩下的继续下跌某处的路径。如果投入至少有一个为真,那么我们就可以在一个额外的多米诺骨牌(G)包,像这样:

  C B A D A B
 C D C D C D
 C D或C D或C D
GGGD * * * CGGG CGD *
  *           *           G
  EEEF EEEF GEEE
 

不过,即使所有的投入都是真的,那么我们就可以不包在一个以上的多米诺骨牌。那情景是这样的:

  C D
 光盘
 光盘
*****
  *
  * EEE
 

正如你所看到的,我们只能准确地插入一个额外的多米诺骨牌入空的空间,而不是两个。

现在,如果条款从来没有重复的,那么我们就来完成(或非常接近完成)。然而,它们可以重复,所以接下来,我们需要一个信号分离器,使得一个变量可以出现在 多个条款。要做到这一点,我们利用以下的小工具:

  Y *** ***ž
   * *
   ***
   ***
    x
 

在此小工具x是输入和y和z的输出。在这个小工具,我们总能包5多米诺骨牌。如果x比突出包装5多米诺骨牌将始终需要覆盖y和z为好。如果x不突出,然后覆盖y和不需要ž。其中x不突出的外观包装是这样的:

  yAAA BBBz
   光盘
   CED
   CED
    Ë
 

当x不突出(我们用X来表示多米诺伸进空间X的结束),最大包装不一定涵盖y和z:

  AAAC DBBB
   光盘
   光盘
   EEE
    X
 

我将采取时刻要注意,这将是可能以当x不是以这样的方式,要么Y或Z凸出突起5骨牌包此。但是,这样做会导致而言这可能是真实的(不突出)成为假(突出)。允许一些术语(未变量,但在各条文实际计)仅通过成为假不必要地将永远不会导致能够满足一个否则不可满足前pression到不同的值。如果我们的3-SAT EX pression为(X | Y | Z)及(X |!Y |!Z)!然后同时允许x和x是假的,只会使事情变得更难。如果我们允许一些东西两端是真实的,这将导致不正确的解决方案,但我们并没有在该方案中做到这一点。要在我们的具体问题方面镜框​​,突出不必要绝不会导致更多的多米诺骨牌能够在以后装在了线。

使用路径和这三个小工具,我们现在可以解决平面3-SAT,这将是3-SAT的子问题,即如果我们画一个图,其中的条款及细则的顶点并有每一个之间的边缘项和其中包含术语,该图是平面的每一个条款。我相信,平面3-SAT可能是NP难的,因为平面1中,3-SAT是,但如果它不是,我们可以用小工具做一个信号交叉。但它确实相当复杂(如果有人看到一个更简单的方法,请让我知道),所以首先我要做的解决平面3-SAT与本系统的一个例子。

所以,一个简​​单的平面3-SAT问题是(X | Y | Z)及(X |!Y |!Z)。显然,这是满足的,使用任何转让其中y是真还是一些其他任务。我们将因此建立我们的多米诺骨牌的问题:

  *******
    * *
    * *
 **** ***
 * *
*** ****
  * *
  * *
  * ******* *
  * * * *
  * * * *
 * Z * X * *****
   * *
   ****
      * *
      ***
      ***
       *
       *
       *
       ÿ
 

请注意,我们必须使用小提琴手在上面得到的东西,以正确的空间,否则这会已经大大减少复杂的。

添加了来自小工具和路径的总多米诺骨牌,我们有1分路器(5多米诺骨牌),两个弄虚作假(各2骨牌),共13个常规路径,对于总计5 + 2 * 2 + 13 = 22骨牌保证,即使各条文不能满足。如果能,那么我们将有2个多米诺骨牌,可填写一共有24一个最佳的包装与24多米诺骨牌如下:

  QRRRSSS
    Q T中
    Q T中
 OPPP * UT
 O u那样
* ON UVVV
  ñW¯¯
  ñW¯¯
  中号IIIJJJKW¯¯
  中号^ h; K X
  中号^ h; K X
 * ZGH * LLLX *
   G       *
   GEEE FFF *
      B D
      BCD
      BCD
       C
       一个
       一个
       一个
 

本平铺包含24多米诺骨牌,所以我们可以知道,原来前pression是满足的。在这种情况下,切片对应于使y和x真和z假。注意,这不是唯一的切片(而不是布尔值的仅满足分配),但没有其它平铺这将增加24超出块的数目,所以这是一个最大的平铺。 (如果你不想指望所有的多米诺骨牌,你可以注意到,我使用除Y和Z的每一个字母。)

如果最大平铺了包含任一22或23骨牌,那么我们将知道的子句之一未被满足(GGG和/或微光骨牌将不能够被放置),因此,我们将知道,原来EX pression是无法满足。

为了可以肯定,我们能够做到这一点,即使平面3-SAT是不是NP难的,我们可以建立一个小工具,它允许路径跨越。这个小工具是不幸的是那种大而复杂,但它是最小的一个,我能够弄清楚。我将首先介绍片,然后整个小工具。

件1:交叉点。 x和y是输入。的a,b,和c是输出。他们将需要使用其它的小工具来实际中继x和y彼此的相对侧被组合

  *** C
   *
  ***
  * *
  * *
  * *
  ***
  ***
 斧* YB
 

这个小工具将始终完全适合7多米诺骨牌。有四个可能的输入组合。如果没有输入突出(两者都为真),比没有输出将凸出,它会被填充如(TT1)或(TT2)以下。如果只输入x,然后伸出只有c将突出在(英尺)以下。如果只输入Ÿ突出然后可以输出或c将突出在(TF)所示。如果输入的X和Y两个突出然后输出C伸出如(FF)所示。

 (TT)AAAC(英尺)AAAC(TF)AAAC(FF)BAAA
      * * *乙
     BBB BBB BBB CBD
     CDCDCDCD
     CDCDCDCD
     CDCDCDEG
     EEE EEE EEE EFG
     FFF FFF FFF EFG
    aGGGb aXGGG GGGYb aXFYb
 

我没有包含,在(英尺)或(TF)的情景将c可以被覆盖,而不是一个或b的可能性。这是可能的这个小工具的范围内,但一旦结合其他的小工具,以形成完整的交叉,如果它是这样做的,它就不会导致条款被满足,所以我们可以排除它更大的数字。考虑到这一点,就可以再观察,在这种情况下,输入x的值等于至b&安培的值; c和输入y等于一个&安培的值; C(注意,这将是合乎逻辑或,而不是逻辑,如果突出部被认为是真实的,而不是假的)。所以,我们只需要分割℃,然后用逻辑和小工具来连接A和B分别连接C的值,我们会再成功了完成了我们的十字架。

的逻辑,也是我们最简单的小工具,到目前为止,它看起来是这样的:

  ****
  *
 X * Y
 

您实际上可能注意到,有一个嵌入式朝着交叉点的小工具的顶部。这个小工具将始终包含precisely 2多米诺骨牌。之一将是在顶部以用作输出。另一种用作将被水平定向仅当x和y都为真(非突起)和垂直取向的,否则,因为我们所用的下列图解中看到一个开关

  BBB * AB | BB AB | BB AB | BB
 * A A A
AAA XAY XAY XAY
 

因此​​,我们可以完成交叉通过分割c和然后加入其中的两个门,一个用于&安培; c和一个用于B和C。把他们放在一起也需要加入一些小提琴手小工具和看起来像这样:

  ******* ****
             * * * *
             * *** *
            *** *** ***
              * * *
           **** * ****
           * * *
           * **** *
          *** * ***
            * *** *
         **** * ****
    Y * * * * X
    * * * * * *
    * **** *** **** *
    *** *** ***
      ********** X * Y *************
 

我不打算填补例如面砖为。你必须做你自己,如果你想看到它在行动。因此,万岁!现在我们可以做任意的3到周六我应该花一点时间来注意,这样做将是一个多项式时间变换,因为即使在最坏的情况下,我们只要做一个大网格,所有的变量和它们的对立面沿着顶部和所有的条款就在身边,做为O(n ^ 2)交叉。因此,有一个简单的,多项式时间算法用于铺设这一切出并变换问题的最大尺寸是多项式中输入的问题的大小。 QED。


编辑备注: 继汤姆Sirgedas在寻找在分流器小工具的错误出色的工作,我已经做了一些改动答案。从本质上讲,我的老分流看起来像这一点,可以用6包装当x不突出(而不是5我本来打算)是这样的:

  Y *** ***žAAAC DBBB
   * *         光盘
   ***         光盘
   *** EEE
   * X * FFF
 

所以,我通过在x的两侧卸下两个空间订正。这消除了6多米诺包装,同时仍然允许5多米诺包装,其中y和z当x不被覆盖未被覆盖。

In this earlier question the OP asked the following problem:

Given a rectangular grid where some squares are empty and some are filled, what is the largest number of 2x1 dominoes that can be placed into the world such that no two dominos overlap and no domino is atop a filled square?

The (quite beautiful!) answer to this problem recognized that this is equivalent to finding a maximum bipartite matching in a specially-constructed graph. In this graph, each empty square has a node that is linked to each of its neighbors by an edge. Each domino then corresponds to an edge in the graph such that its endpoints are not covered by any other edge. Consequently, any set of edges that don't share a vertex (a matching) corresponds to an arrangement of dominoes, and vice-versa.

My question is a generalization of this earlier one:

Given a rectangular grid where some squares are empty and some are filled, what is the largest number of M x N dominoes (for a given M and N) that can be placed into the world such that no two dominos overlap and no domino is atop a filled square?

I cannot see how to convert this into a matching problem as was done in the previous case. However, I also don't see any particular reason why this problem would immediately be NP-hard, so there may be a polynomial time solution to the problem.

Is there an efficient algorithm for solving this problem? Or does anyone have a reduction that would show that this problem is NP-hard?

Thanks so much!

解决方案

This problem is definitely NP-hard and I can prove it. There is a reduction from 3-SAT to this problem. Specifically, it's a reduction from 3-SAT to the subproblem of this problem in which the dominoes are 1x3. There may also be other reductions for other specific sizes, but this one definitely works.

Essentially, in this reduction, we're going to use domino positions to encode either true or false. In specific, I'm going to adopt the same notation as the other solution, which is to say that I'll use asterisks to indicate open spaces on the grid. I'll also use sets of three capital letters to represent dominoes and lower case letters to represent "signals" which are spaces which may or may not be filled depending on the state of the system.

To embed a 3-SAT problem into this space, we're going to need a set of what I'll call gadgets which allow only certain states to be possible. Most of these gadgets will have a fixed number of dominoes in them. The exception will be the gadgets which represent the clauses which will have one extra domino if the clause is true (satisfied) but not when it is false (unsatisfied). We can interconnect these gadgets using paths. Together this will allow us to build a 3-SAT circuit. We will have a base number of dominoes since each path and gadget will take a standard amount of dominoes, we can add those up to get a base number k and then each clause gadget can have one extra domino if it is true, so if all clauses can be made true (and hence the expression satisfied) and there are n clauses, then the maximum number of dominoes will be n+k. If not, then the maximum number will be less than n+k. This is the basic form of the reduction. Next I will describe the gadgets and give examples.

Similar to the other answer, we're going to have two positions which encode true and false for a given variable. So, I'll start with a single tile which can be in two possible places.

****

This can either be covered with one domino like

AAA* or *AAA

Obviously, this cannot be covered with 2 dominoes and covering it with 0 dominoes would never be maximal. For my purposes, we're going to consider a protrusion to represent the value "false" and a lack of protrusion to represent "true". So we can view this part as having carrying two signals:

x**y

And in this case, only one of x or y will be covered, so we can consider the signals to be x and the logical not of x. For our purposes, whichever is covered is false, whichever is not covered is true. Next, we can transmit signals simply through straight can curved paths. If we have

x*****y

We will again have exactly two dominoes and result in either x or y being covered, but not both.

***y
*
*
x

Will have exactly the same behavior. So we can use this to create long and curving paths in lengths which are increments of 3. However, not all lengths we might want to use are increments of 3, so we need an additional gadget to move a different distance. I call this the fiddler gadget and it's only purpose is to move the signal slightly uneven distances to make things connect successfully. Its input comes from x and output goes to y and it merely transmits the same signal along. It looks like this:

 ***y
 *
**x

It always contains exactly two dominoes and is filled in one of the following two ways:

 BBB*     ABBB
 *        A   
AAA      *AX  

If we're going to model 3-SAT, however, we need more than this. Specifically, we need some way to model the clauses. To do this, we have a gadget where one extra domino can be packed in if the clause is true. The clause will be true when one or more of its inputs is true. In this case, that means that we can pack one extra domino in when at least one of the inputs does not protrude. It will look like this:

*x*y*
  *
  z

If we add an extra path to each for clarity, then it looks like this:

 * *
 * *
 * *
*****
  *
  ****

If x,y, and z are all false, then they'll all have protrusions and it will be filled like this:

 A B
 C D
 C D
*C*D*
  *
  EEEF

Where the rest of dominoes A,B, and F continue on down a path somewhere. If at least one of inputs is true, then we can pack in one extra domino (G) like so:

 C B         A D         A B
 C D         C D         C D
 C D    or   C D    or   C D
GGGD*       *CGGG       *CGD*
  *           *           G
  EEEF        EEEF        GEEE

However, even if all inputs are true, then we cannot pack in more than one domino. That scenario would look like this:

 C D
 C D
 C D
*****
  *
  *EEE

And as you can see, we can only insert exactly one extra domino into the empty space, not two.

Now, if terms were never repeated, then we'd be done (or very nearly done). However, they can be repeated, so next, we need a signal splitter so that one variable can appear in multiple terms. To do this, we utilize the following gadget:

y*** ***z
   * *
   ***
   ***
    x

In this gadget x is the input and y and z are the outputs. In this gadget, we can always pack 5 dominoes. If x protrudes than packing 5 dominoes will always require covering y and z as well. If x does not protrude, then covering y and z is not required. The packing where x does not protrude looks like this:

yAAA BBBz
   C D  
   CED 
   CED  
    E 

When x does protrude (we use X to indicate the end of the domino protruding into space x), the maximal packing necessarily covers both y and z:

AAAC DBBB
   C D
   C*D
   EEE
    X

I will take a moment to note that it would be possible to pack this with five dominoes when x is not protruding in such a way that either y or z protrude. However, doing so would result in terms which could be true (not protruding) becoming false (protruding). Allowing some of the terms (not variables, but actual terms in the clauses) to differ in value only by becoming false unnecessarily will never result in being able to satisfy an otherwise unsatisfiable expression. If our 3-SAT expression was (x | y | z) & (!x | y | !z) then allowing both x and !x to be false would only make things harder. If we were to allow both ends of something to be true, this would result in incorrect solutions, but we do not do this in this scheme. To frame it in terms of our specific problem, protruding unnecessarily will never result in more dominoes being able to be packed in later down the line.

With paths and these three gadgets, we can now solve planar 3-SAT, which would be the sub-problem of 3-SAT where if we draw a graph where the terms and clauses are vertices and there is an edge between every term and every clause which contains that term, that the graph is planar. I believe that planar 3-SAT is probably NP-hard because planar 1-in-3-SAT is, but in case it's not, we can use gadgets to do a signal crossing. But it's really quite complex (if anyone sees a simpler way, please let me know) so first I'm going to do an example of solving planar 3-SAT with this system.

So, a simple planar 3-SAT problem would be (x | y | z) & (!x | y | !z). Obviously, this is satisfiable, using any assignment where y is true or several other assignments. We will build our dominoes problem thus:

    *******
    *     *
    *     *
 ****   ***
 *       *
***      ****
  *         *
  *         *        
  * ******* *
  * *     * *
  * *     * *
 *z*x*   *****
   *       *
   **** ****
      * *
      ***
      ***
       *
       *
       *           
       y

Notice that we had to use fiddlers at the top to get things to space correctly or else this would've been substantially less complex.

Adding up the total dominoes from gadgets and paths we have 1 splitter (5 dominoes), two fiddlers (2 dominoes each), and a total of 13 regular paths, for a grand total of 5 + 2*2 + 13 = 22 dominoes guaranteed, even if the clauses cannot be satisfied. If they can be, then we will have 2 more dominoes which can be filled in for a total of 24. One optimal packing with 24 dominoes is as follows:

    QRRRSSS
    Q     T
    Q     T
 OPPP   *UT
 O       U
*ON      UVVV
  N         W
  N         W        
  M IIIJJJK W
  M H     K X
  M H     K X
 *zGH*   LLLX*
   G       *
   GEEE FFF*
      B D
      BCD
      BCD
       C
       A
       A
       A

This tiling contains 24 dominoes, so we can know that the original expression is satisfiable. In this case, the tiling corresponds to make y and x true and z false. Notice that this is not the only tiling (and not the only satisfying assignment of boolean values), but that there is no other tiling which will increase the number of tiles beyond 24, so it is a maximum tiling. (If you don't want to count all the dominoes you can note that I used every letter except for Y and Z.)

If the maximal tiling had contained either 22 or 23 dominoes, then we would know that one of the clauses was not satisfied (GGG and/or LLL dominoes would not be able to be placed) and hence we would know that the original expression was not satisfiable.

In order to be certain that we can do this even if planar 3-SAT isn't NP-hard, we can build a gadget which allows paths to cross. This gadget is unfortunately kind of big and complex, but it's the smallest one I was able to figure out. I'll first describe the pieces and then the whole gadget.

Piece 1: Crossover point. x and y are the inputs. a,b,and c are the outputs. They will need to be combined using other gadgets to actually relay x and y to the opposite side of each other.

   ***c
   *
  ***
  * *
  * *
  * *
  ***
  ***
 ax*yb

This gadget will always fit exactly 7 dominoes. There are four possible input combinations. If neither input protrudes (both are true) than no output will protrude and it will be filled as in (tt1) or (tt2) below. If only input x protrudes then only c will protrude as in (ft) below. If only input y protrudes then either output a or c will protrude as in (tf) below. And if input x and y both protrude then output c protrudes as in (ff) below.

 (tt) AAAc         (ft) AAAc         (tf) AAAc         (ff) BAAA     
      *                 *                 *                 B        
     BBB               BBB               BBB               CBD       
     C D               C D               C D               C D       
     C D               C D               C D               C D       
     C D               C D               C D               E G       
     EEE               EEE               EEE               EFG       
     FFF               FFF               FFF               EFG       
    aGGGb             aXGGG             GGGYb             aXFYb      

I have not included the possibility that in the (ft) or (tf) scenarios that c could be covered instead of a or b. This is possible within the scope of this gadget but once combined with other gadgets to form the complete crossover, if it were to do so, it would never result in a larger number of clauses being satisfied so we can exclude it. With that in mind, we can then observe that in this case the value of the input x is equal to the value of b & c and the input y is equal to the value of a & c (note that this would be logical or rather than logical and if protrusion were considered true rather than false). So we just need to split c and then use a logical and gadget to connect connect the values of c with a and b respectively and we will then have successfully completed our cross over.

The logical and is our simplest gadget so far and it looks like this:

  ****
  *
 x*y

You might actually note that there's one embedded towards the top of the crossover point gadget. This gadget will always contain precisely 2 dominoes. One will be at the top to serve as the output. The other one serves as a switch which will be horizontally oriented only if both x and y are true (non-protruding) and vertically oriented otherwise as we can see in the following diagrams:

 BBB*     ABBB     ABBB     ABBB
 *        A        A        A   
AAA      XAy      xAY      XAY  

Thus we can complete the crossover by splitting c and then adding two of these gates, one for a & c and one for b & c. Putting it all together requires also adding some fiddler gadgets and looks like this:

             ******* ****
             *     * *  *
             *     ***  *
            ***    *** ***
              *     *  *
           ****     *  ****
           *        *     *
           *     ****     *
          ***    *       ***
            *   ***      *
         ****   * *      ****
    y    *      * *         *    x
    *    *      * *         *    *
    * ****      ***         **** *
    ***         ***            ***
      **********x*y*************

I'm not going to fill in example tilings for that. You'll have to do it yourself if you want to see it in action. So, hooray! We can now do arbitrary 3-SAT. I should take a moment to note that doing this will be a polynomial time transformation because even in the worst case, we can just make a big grid with all of the variables and their opposites along the top and all the terms on the side and do O(n^2) crossovers. So there is a simple, polynomial-time algorithm for laying this all out and the maximum size of the transformed problem is polynomial in the size of the input problem. QED.


Edit note: Following Tom Sirgedas's excellent work in finding a mistake in the splitter gadget, I've made some changes to the answer. Essentially, my old splitter looked like this and could be packed with 6 when x does not protrude (rather than the 5 I had intended) like this:

y*** ***z   AAAC DBBB
   * *         C D
   ***         C*D
   ***         EEE
   *x*         FFF

So I revised it by removing the two spaces on either side of x. This eliminates the six domino packing while still allowing a 5-domino packing in which y and z are uncovered when x is uncovered.

这篇关于概括的算法多米诺贴砖?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆