On Two-Handed Planar Assembly Partitioning
OOn Two-Handed Planar Assembly Partitioning
Pankaj K. Agarwal ∗ Boris Aronov † Tzvika Geft ‡ Dan Halperin § Abstract
Assembly planning, which is a fundamental problem in robotics and automation, aims to design asequence of motions that will bring the separate constituent parts of a product into their final placementin the product. It is convenient to study assembly planning in reverse order, where the following keyproblem, assembly partitioning , arises: Given a set of parts in their final placement in a product, partitionthem into two sets, each regarded as a rigid body, which we call a subassembly, such that these twosubassemblies can be moved sufficiently far away from each other, without colliding with one another(sliding of one subassembly over the other, namely motion in contact, is allowed). The basic assemblyplanning problem is further complicated by practical consideration such as how to hold the parts in asubassembly together. Therefore, a desired property of a valid assembly partition is that each of the twosubassemblies will be connected.In this paper we show that even an utterly simple case of the connected-assembly-partitioning problemis hard: Given a connected set A of unit squares in the plane, each forming a distinct cell of the uniforminteger grid, find a subset S ⊂ A such that S can be rigidly translated to infinity along a prescribeddirection without colliding with A \ S , and both subassemblies S and A \ S are each connected. We showthat this problem is NP-Complete, and by that settle an open problem posed by Wilson et al. a quarter ofa century ago [16].We complement the hardness result with two positive results for the aforementioned problem variantof grid square assemblies. First, we show that it is fixed parameter tractable and give an O (2 k n ) -timealgorithm, where n = | A | and k = | S | . Second, we describe a special case of this variant where aconnected partition can always be found in linear time. Each of the positive results sheds further light onthe special geometric structure of the problem at hand. ∗ Department of Computer Science, Duke University, USA. P. K. Agarwal has been partially supported by NSF grants IIS-18-14493and CCF-20-07556. † Department of Computer Science and Engineering, Tandon School of Engineering, New York University, Brooklyn, NY 11201,USA. B. Aronov was supported by NSF grant CCF-15-40656, and by grant 2014/170 from the US-Israel Binational ScienceFoundation. ‡ Blavatnik School of Computer Science, Tel-Aviv University, Israel. § Blavatnik School of Computer Science, Tel-Aviv University, Israel. Work on this paper by T. Geft and D. Halperin has beensupported in part by the Israel Science Foundation (grant no. 1736/19), by the US National Science Foundation/US-Israel BinationalScience Foundation grant no. 2019754 (Agarwal-Halperin), by the Blavatnik Computer Science Research Fund, and by a grant fromYandex. a r X i v : . [ c s . C G ] S e p Introduction
Automating assembly has been a fundamental research area in robotics from its early days. A key problemin this area is assembly planning , where the goal is to find a sequence of motions that merges initiallyseparated parts into their relative final positions in an assembly. While there has been algorithmic success inefficiently finding assembly sequences [9, 17], manual involvement is still typically required when generatingplans [19]. Achieving a high level of automation in assembly planning is hindered by the multitude of practicalconsiderations [10] and the combinatorial explosion inherent to the underlying algorithmic problem: In itsmost general form assembly planning is PSPACE-hard [14], but even the solvable case of one-step translations(for the assembly mating motion) already allows an exponential number of sequences to arise [7]. Therefore,efficiently finding assembly sequences meeting practical constraints remains an important challenge, even inbasic settings.In this paper we tackle a practical constraint for assembly sequences, namely connectedness , whichrequires that each subassembly constructed during the sequence is connected (such assembly sequenceshave also been called contact-coherent [18]). A subassembly is connected if the graph representing contactbetween parts (i.e., each part is a node and an edge between two nodes exists if the corresponding parts are incontact) is connected. Unconnected subassemblies are in general more difficult to manipulate and mate withother subassemblies. They can also require additional fixturing, so real assembly plans rarely include them.Requiring subassemblies to be connected is therefore a common provision in assembly planning [9, 16].Assembly planners that generate sequences under the connectedness constraint typically use a generate-and-test approach: They enumerate partitions that result in connected subassemblies and then test the geometricfeasibility of separating the subassemblies [5, 15]. As the number of ways to partition an assembly into twoconnected subassemblies may be exponential, the generate-and-test approach does not have a polynomial runtime guarantee, motivating the search for efficient algorithms.We study the connectedness constraint for the assembly partitioning problem in the plane: Given a setof non-overlapping polygons and a direction, decide if a proper subset of the polygons exists such that itcan be translated away from its complement in the given direction, and additionally, both the subset and itscomplement form connected sets. See Figure 1. The partitioning problem arises in the popular assembly-by-disassembly approach to assembly planning. In this approach, a dis assembly sequence is obtained and thenreversed by partitioning the final assembly into subassemblies, which are partitioned recursively in turn.Figure 1: A negative (left) and positive(right) instance of assembly partition-ing with the connectedness require-ment. Both instances are assembliescomposed of unit squares. There are polynomial-time algorithms for partitioning a planarassembly into two subassemblies using a single translation [9, 17].Additionally requiring each of the two subassemblies to be connectedwas posed as an open problem in [16], which we settle by showingthat the problem is NP-complete. The more general case of two-handed assembly partitioning using multiple translations with theconnectedness requirement has been shown to be NP-complete byKavraki and Kolountzakis [11].
Contribution.
We show that two-handed assembly partitioningwith the connectedness requirement is NP-complete even when re-stricted to a single translation and each part in the assembly is a unitsquare. This setting is considerably more constrained than the previously most restricted NP-complete variantof the problem by Kavraki and Kolountzakis. In their construction, the assembly has non-convex polygons,and the number of translations required to partition it (i.e., to have the two subassemblies arbitrarily far away)1s linear in the number of parts. We reduce
Monotone Planar 3-SAT [4], which is known to be NP-complete,to our problem. Our proof works in three stages. First, we show in Section 2 that a restricted version ofMonotone Planar 3-SAT, in which there is a total ordering of variables and each clause with three literals hastwo adjacent variables, is also NP-complete; we believe that this result is of independent interest. We refer tothe latter problem as
Monotone Planar 3-SAT with Neighboring Variable Pairs ( MP-3SAT-NVP ). The secondstage, presented in Section 3, reduces the latter problem to the assembly partitioning problem. In Section 3.1we present the reduction for the case in which each part of the assembly is a rectilinear polygon. Then, inSection 3.2 we adapt this construction to the case in which each part is a grid-aligned unit square.We then turn to algorithms for efficiently solving the grid-aligned squares variant of the connected-subassembly partitioning problem. In Section 4 we show that the problem is fixed parameter tractable [3]. Weremark that there has been considerable interest in fine-grained algorithm design for geometric problems; see,e.g., [1, 2, 6, 8] and the references therein. In the partitioning problem we need to satisfy two requirements: (i)that the motion of one subassembly will be free from collision with the other subassembly, and (ii) that eachsubassembly will be connected. Satisfying each of these requirements separately is simple (for collision-freeseparation we use directional blocking graphs [17]). The difficulty of the connected-partitioning problem isthe need to simultaneously satisfy both requirements. Our algorithm builds a partition incrementally, whilealternating between the satisfaction of either requirement. We use the bounded search tree technique, inwhich given a partial solution S , we identify candidates subsets S , . . . , S t , each containing S , such thatany valid partition containing S has to contain at least one of S , . . . , S t . This gives t options of how toextend the current partial solution, which we try until we find a solution or get stuck. This approach leads to a O (2 k n ) -time algorithm, where n is the number of squares in the assembly, to determine if a partition with k squares in one subassembly exists; if it exists, the algorithm reports the subassembly. From the roboticapplication perspective, targeting small k can be advantageous as the subassembly needs to be grasped andmoved, and such manipulations become harder as the number of parts in the subassembly grows.Finally we describe an efficient algorithm for a special class of unit-square assemblies, which runs in O ( n ) time. The positive results shed further light on the special geometric structure of the problem andmotivate future research by providing insight into variants that may be solvable. In this section we introduce our restricted version of
Monotone Planar 3-SAT [4]. A 3-SAT formula consistsof clauses . Each clause consists of at most three literals . A literal is either a variable or the negation of avariable. A k -clause is a clause with k literals. Planar 3-SAT.
Let φ = (cid:86) C i be a Boolean formula in CNF form in which each clause has at most threeliterals. We consider the bipartite graph G φ that contains a vertex for each variable and for each clause, andhas an edge between a variable-vertex and a clause-vertex if and only if the variable appears in the clause.Lichtenstein [13] introduced the Planar 3-SAT problem, which requires G φ to be planar, and showed that it isNP-complete. Furthermore, Knuth and Raghunatan [12] have shown that the graph G φ of a Planar 3-SATinstance can be drawn in the so-called rectilinear embedding. In this embedding, all vertices can be drawnas unit-height rectangles, with all the variable-vertex rectangles centered on a fixed horizontal strip calledthe variable row and every edge is a vertical line segment, which does not cross any rectangles, as shown inFigure 3. We denote the variables by x , . . . , x n , according to their left to right order on the variable row.Planar 3-SAT remains NP-complete when G φ is given in a rectilinear embedding. Monotone Planar 3-SAT.
A clause is positive (negative) if it contains only positive (negative) literals. Aninstance of 3-SAT is monotone if it only has positive or negative clauses.
Monotone Planar 3-SAT [4] is a2estriction of Planar 3-SAT to monotone instances in which the rectilinear embedding of G φ has all positiveclause-vertices above the variable row and all negative clause-vertices below it, as shown in Figure 3. Monotone Planar 3-SAT with Neighboring Variable Pairs (
MP-3SAT-NVP ) . Our new 3-SAT version isa further restriction of Monotone Planar 3-SAT that requires each 3-clause C to have two variables thatare consecutive on the variable row. We call them the neighboring variables of C and denote the pair by neigV ars ( C ) . For example, in Figure 3 we have neigV ars (( x ∨ x ∨ x )) = { x , x } . Note that wedo not require 2-clauses to have neighboring variables. However, if there is a 2-clause C with neighboringvariables x i , x i +1 , then due to monotonicity a 3-clause containing x i , x i +1 that is on the same side of thevariable row as C would be redundant. This fact strengthens the restriction in that for each 3-clause C with neigV ars ( C ) = { x i , x i +1 } , there are no clauses horizontally between the edges ( C, x i ) , ( C, x i +1 ) in therectilinear embedding. Theorem 5 in the appendix shows that MP-3SAT-NVP is NP-complete.
We first state the connected-assembly-partitioning problem formally. An assembly is a set of interior-disjointpolygons, also called parts , in some given relative placements. A subassembly is a subset of the polygonscomposing an assembly A , in their relative placements in A . Two interior-disjoint polygons are edge-connected if their intersection contains a line segment. The adjacency graph of an assembly A , denoted by G ( A ) , is an undirected graph that contains a node for each part in A , and has an edge between two nodes ifand only if the corresponding parts in A are edge-connected. Occasionally, we will not distinguish between A and G ( A ) . A subassembly S is called connected if the nodes of S induce a connected subgraph of G ( A ) .Let A denote an assembly and (cid:126)d denote a direction in the plane. A subassembly S ⊂ A is called a partition of A in direction (cid:126)d if S can be rigidly translated arbitrarily far away along (cid:126)d without colliding with A \ S . A partition S ⊂ A is called connected if each of the subassemblies S and A \ S are connected (whenviewed in isolation from each other). We define our main problem as follows. Planar Partitioning into Connected Subassemblies using a Single Translation (PPCST):
Given an as-sembly A and a direction (cid:126)d , decide if there is a connected partition S ⊂ A in direction (cid:126)d .We also consider a restriction of PPCST to a special class of square assemblies. Let X be the infinitegrid of unit squares, that is X := { ( i, j ) + [ − . , . | i, j ∈ Z } . PPCST-SQ is restriction of PPCST toinstances where the input assembly A consists of grid-aligned unit squares, i.e., A ⊂ X . Figure 1 shows suchan assembly. Given φ ∈ MP-3SAT-NVP , we construct a planar assembly A that has a connected partition in the the (+ y ) -direction if and only if φ is satisfiable. Denote a partition of A by the subassembly UP ⊂ A , whichcontains the parts that are translated up. We denote the complement subassembly A \ UP by DOWN .We construct the assembly A based on the rectilinear embedding of G φ . The variables are represented byfixed-height rectangles whose bottom edges lie on a common horizontal line. The left-to-right order of thevariable-rectangles corresponds to the order of variables on the variable row in G φ . With a slight abuse ofnotation we denote both the variables and the corresponding variable-rectangles by x i . The main idea is thefollowing correspondence between a partition UP ⊂ A and an assignment to φ : x i is assigned TRUE if andonly if x i ∈ UP for the corresponding variable-rectangle. We denote such an assignment by A ( UP ) .3 i b i d i c i x k x k +1 x j x j x k a i b i ... ... Figure 2: (Left) A gadget for the clause ( x j ∨ x k ∨ x k +1 ) together with the threevariable-rectangles it touches. (Right) Agadget for the negative clause ( x j ∨ x k ) .In the full construction all the variable-rectangles appear at the same height inthe variable row. The clause gadget.
We describe the clause gadget, focusing firston positive 3-clauses. Figure 2 (left) shows the gadget for a clause C i = ( x j ∨ x k ∨ x k +1 ) . The gadget is located above the variablerow in A . It is composed four parts a i , b i , c i , d i , which are recti-linear polygons, each drawn in a unique color. Accordingly, eachcolored line segment in Figure 2 should be interpreted as a verythin rectangular region of a polygon. The variables x k , x k +1 arethe neighboring variables of C i , which exist for all 3-clauses bythe definition of MP-3SAT-NVP . As shown in the figure, we alwayshave both of the parts c i and d i touch neigV ars ( C i ) .Let us examine the functionality of the gadget. Parts p, p (cid:48) ∈ A are said to interlock if they are not separable by a vertical trans-lation, i.e., p ∈ UP ⇔ p (cid:48) ∈ UP . For example, parts a i and b i of the gadget interlock, as do parts c i and d i . Let us assume that a i ∈ UP (we later force this to always be the case). Due to theinterlock, we must have b i ∈ UP , and since a i and b i are both in UP , there needs to be a connection betweenthem in order for UP to be connected (i.e., there must exist a path between a i and b i in the adjacency graph G ( UP ) ). The only way to connect them is to have either one of x j , c i be in UP . In this sense, a i and b i act analogously to a logical OR gate with the inputs x j ∈ UP , c i ∈ UP . Therefore, if x j ∈ DOWN , wemust have c i ∈ UP . In that case, c i and d i act in an analogous manner to a i and b i . Namely, we must have d i ∈ UP , and in order to have a connection between c i and d i , we must have either x k ∈ UP or x k +1 ∈ UP .To summarize, if a i ∈ UP then the gadget guarantees that at least one of variable-rectangles of C i (i.e., x j , x k , x k +1 ) is also in UP . We therefore get that any partition with a i ∈ UP corresponds to a satisfyingassignment to C i : Lemma 1.
For a positive clause C i , if a i ∈ UP then A ( UP ) satisfies C i . We now discuss the other types of clauses. If C i is a positive 2-clause ( x j ∨ x k ) , the correspondinggadget contains only the parts a i and b i modified so that their right side touches x k instead of c i (their shape x ∨ x x ∨ x ∨ x x x x x x x x ∨ x ∨ x x ∨ x x ∨ x ∨ x x ∨ x C = x ∨ x ∨ x x ∨ x C = x ∨ x ∨ x C = x ∨ x x x x x touching hooks x x C = ¬ x ∨ ¬ x ∨ ¬ x C = ¬ x ∨ ¬ x Figure 3: Monotone Planar 3-SAT instance in a rectilinear embedding (left) and the corresponding assemblyconstruction A (right). Blue and green parts are type- a and - b parts of the clause gadgets, respectively, andred and yellow parts are type- c and - d parts. 4s the same as c i and d i in Figure 2 (left) respectively). Lemma 1 holds for 2-clauses as well using similararguments. As for negative clause gadgets, they are drawn the same way, except that they are mirroredvertically (as they are placed below the variable row); see Figure 2 (right). In general, all claims for positiveclauses hold symmetrically for negative clauses, which we do not always reiterate. The full construction.
We now incorporate all the clause gadgets into the full construction of A . All theclause gadgets are placed according to each clause’s position in the rectilinear embedding of G φ , whichallows each clause gadget to touch the appropriate variable-rectangles; see Figure 3. It is helpful to viewclauses in a hierarchical manner: A clause C i is called the parent of another clause C j , if C i directly encloses C j , i.e., the part b i can vertically see a j . In this case, we call C j a child of C i . For example, in Figure 3, C is the parent of C , but not of any other clause. We call a clause with no parent a root clause. Without loss ofgenerality, we have a single root clause on each side of the variable row and it is a 2-clause; see Lemma 17 inAppendix B. The example in Figure 3 has this property — C and C are the unique root clauses.We now introduce a slight change to the clause gadgets, which is the addition of touching hooks to eachparent-child pair of clauses. These hooks are the same as the ones used within a single clause gadget (tointerlock a i and b i ), except that they are touching. More precisely, for each parent-child pair of positiveclauses ( C i , C j ) , we add a hook emanating downwards from a i and another one emanating upwards from b j such that the parts a i and b j interlock and touch (negative clauses are handled symmetrically); see Figure 3.Denote by C + ⊂ A (resp. C − ) the set of parts that belong to positive (resp. negative) clause gadgets and let C root denote the positive root clause. Lemma 2.
For all a i ∈ C + , i (cid:54) = root, a i interlocks with a root (the top part of the positive root clause).Proof. Any a i ∈ C + ( a i (cid:54) = a root ) interlocks via the touching hooks with part b j of its parent clause (i.e. C j is the parent of C i ) and part b j interlocks with part a j . Hence, by induction, a i transitively interlocks with a root .In other words, if we translate a root upwards, it will ultimately drag every a i ∈ C + with it. Hence, all thepositive { a i } (and { b i } ) parts must belong to the same set of the partition. Note that this is not the case for { c i } and { d i } parts, which do not interlock with a root , resulting in some flexibility that we will exploit.We now show that φ has a satisfying assignment if and only if the assembly A has a connected partitionin the (+ y ) -direction. Lemma 3.
Let UP be a connected partition of A in the (+ y ) -direction. Then A ( UP ) satisfies φ .Proof. Assume that UP specifies a connected partition of A , namely that all parts in UP can be translatedupwards without colliding with DOWN and that each of UP and DOWN are connected. We need to showthat the corresponding assignment A ( UP ) , in which x i is TRUE if and only if x i ∈ UP , satisfies φ . Weshow that each positive clause in φ is satisfied, which will symmetrically give the same results for eachnegative clause. First, a root blocks all other parts from above, so it must be in UP . By Lemma 2, each a i ∈ C + interlocks with a root , so we must have a i ∈ UP . By Lemma 1, each C i must then be satisfied,which concludes the proof.For the other direction, we assume that φ has a satisfying assignment A and specify a correspondingpartition UP . Of the variable-rectangles, UP includes exactly those that correspond to variables assigned TRUE . For each positive clause C i , we must include a i and b i in UP . If C i is a 3-clause, we must determinewhere c i and d i go based on the assignment A , as follows: Assign c i and d i to UP if and only if A assigns atleast one of neigV ars ( C i ) to be TRUE . Recall that c i and d i both touch neigV ars ( C i ) in A . Therefore, ifone of the variables in neigV ars ( C i ) is assigned TRUE , one of the corresponding variable-rectangles is in5 ∨ x ∨ x x ∨ x x ∨ x ∨ x x ∨ x x x x x x x x ∨ x ∨ x x ∨ x x ∨ x ∨ x x ∨ x x ∨ x ∨ x x ∨ x x x x x x x x ∨ x ∨ x x ∨ x Figure 4: (left) Partition for the assignment x = T, x = F, x = T, x = F, x = T, x = T .(right) Partition for the assignment x = T, x = F, x = T, x = T, x = F, x = F . UP , which allows c i and d i to remain connected in UP . (Conversely, if neigV ars ( C i ) are both FALSE , thereis no way for c i and d i to remain connected if they translate up). See Figure 4 for examples of partitions ofthe construction in Figure 3. We now prove the connectivity and separability properties of the partition UP . Lemma 4. UP and DOWN , as defined based on a satisfying assignment A , are separable by a verticaltranslation.Proof. If C + ⊂ UP and C − ⊂ DOWN , then no collision would occur since all parts in C + are above allparts in C − and the variable-rectangles cannot collide by vertical translation. Hence, we examine the set S := C + ∩ DOWN . The only parts that S may contain are c i , d i for some i . Indeed, if there exist c i , d i ∈ S ,then neigV ars ( C i ) ⊂ DOWN , by definition. By the neighboring variable pairs property of
MP-3SAT-NVP ,parts c i and d i touch neighboring variable-rectangles, and so there are no other parts of C + below c i and d i .Therefore, c i and d i may only collide with parts in T := C − ∩ UP . Let us assume, for contradiction, that c i ∈ S collides with some c j ∈ T (if a collision occurs with some d j ∈ T , then a collision with c j must alsooccur). Since c i and c j both touch neighboring variable-rectangles in A , there must be a variable-rectangle x k that they both touch, in order to collide. This is a contradiction, since x k would also collide with one ofthem, which cannot occur by the definition of the partition for type- c and type- d parts. Lemma 5. UP and DOWN , as defined based on a satisfying assignment A , are both connected subassem-blies.Proof. We verify that UP is connected (the symmetric logic applies to DOWN ). By the definition, we have a i , b i ∈ UP for each positive clause C i . It is easy to verify that each a i , b i pair is connected, either through c i or through the variable-rectangle that they both touch. This fact, together with the touching hooks weintroduced (see Figure 3), implies that all the parts a i , b i ∈ C + form one connected subassembly, whichwe call S . We show that other parts in UP are also connected to S . If c i and d i are in UP , for a positiveclause C i = ( x j ∨ x k ∨ x k +1 ) , then we have c i touching a i , which is connected to S . As for d i , it must6e connected to c i , through either x k or x k +1 (or both), one of which translates up by the definition of thepartition. Therefore, we have established that the connected subassembly S includes C + ∩ UP . At this pointwe examine variable-rectangles. Without loss of generality, each variable in φ appears in at least one positiveand one negative clause. Therefore, each variable-rectangle x l ∈ UP must be touching some part p ∈ C + . If p ∈ DOWN , then it would collide with x l , which cannot happen by Lemma 4. Therefore p ∈ C + ∩ UP ⊆ S ,and so x l is connected to S through p . It remains to examine some c i ∈ C − ∩ UP (the case of d i ∈ C − ∩ UP is the same). If c i ∈ UP , then by definition we have neigV ars ( C i ) ⊂ UP . In other words, c i is connectedto S via the neighboring variables it touches. Therefore, we have shown that the connected subassembly S contains all parts in UP .In summary, given a satisfying assignment to φ , we have defined a connected partition UP ⊂ A , thusconcluding the remaining direction. Overall, we get the following: Theorem 1.
PPCST is NP-Complete.
We now modify the construction so that A consists of grid-aligned unit squares, i.e., A ⊂ X , in order toshow that PPCST-SQ remains NP-complete. We show how to convert each part in the original polygonalconstruction to a quasi-polygon — an equivalent collection of squares. The main intricacy that arises inquasi-polygons is that they may get split up by the partition instead of remaining a single rigid piece. Eventhough we cannot avoid such splits, we will show that they cannot occur in critical places.Figure 5 shows the converted version of the polygonal construction in Figure 3, limited to positive clauses.In this figure each line segment signifies a contiguous part of single grid row or column that is occupiedby squares. The figure also shows the converted variable gadgets, but for now we treat them as if they arerigid parts, like the variable-rectangles in the polygonal construction. This means that the definition of theassignment A ( UP ) , which a assigns TRUE to x i ∈ φ if and only if the variable-rectangle x i ∈ UP , is stillvalid. The conversion of each variable-rectangle to an equivalent quasi-polygon is addressed separately inAppendix B.2.1. Figure 6 shows an approximate “zoomed in” view of a converted positive 3-clause, whereindividual squares are shown. It shows the four quasi-polygons a i , b i , c i , d i that are respectively equivalent tothe polygonal parts of the same name.We now describe the conversion of the polygonal construction in detail. At the top of the assembly A , weadd a blocking quasi-polygon B (drawn in black in Figure 5). The top row of B is wide enough so that itblocks all the other squares in the construction from above. This fact, together with the overall shape of B ,results in having B ⊂ UP ; see Lemma 18 in Appendix B. A symmetric blocking quasi-polygon is addedat the bottom of the construction (not shown). We turn our attention to clause gadgets, for which the mainchange is a modification of the so-called touching hooks: For each parent-child pair of clauses ( C i , C j ) , weadd a gap between their two touching hooks, so that they no longer touch. Instead, a connection is introducedbetween b i and a j using a new set of squares, marked in dark green in Figure 5, which are considered to be apart of b i . Furthermore, all the hooks emanating below b i now form a connected subassembly that connects tothe rest of b i only via the square s b in Figure 6 ( b i has two such hooks in the figure). We call this subassemblythe lower hooks of b i (more precisely, it is the connected component of G ( b i \ { s b } ) that neighbors the loweredge of s b ), or L ( b i ) for short. We define the U ( b i ) ( upper hook of b i ) to be the upper connected componentof G ( b i \ { s b } ) , i.e. the component that neighbors the upper edge of s b . (Recall that squares are consideredtouching only if they share an edge, so G ( b i \ { s b } ) has four connected components.) We similarly define U ( a i ) and L ( a i ) , as the upper and lower component, respectively, of G ( a i \ { s a } ) .7 = x ∨ x ∨ x x ∨ x C = x ∨ x ∨ x C = x ∨ x x x x x x x B upperhooklowerhook Figure 5: Square construction showing only positiveclauses. d i s c s b s a c i b i a i Figure 6: Converting a clause gadget to4 quasi-polygons marked by different col-ors. We highlight key squares using thickerborders and lighter fill.
Clause Gadget Functionality.
We would now like to have the converted clause gadget replicate thefunctionality we proved in Lemma 1.
Lemma 6.
Let S ⊂ A be a connected subassembly and s ∈ A \ S be a square such that (1) S is a connectedcomponent of G ( A \ { s } ) and (2) for each square s (cid:48) ∈ S there is a square s (cid:48)(cid:48) ∈ A \ S that is located below s (cid:48) in the same grid column. Then, s ∈ UP ⇒ S ⊂ UP .Proof. Assume that s ∈ UP and also assume for contradiction that there exists some square s (cid:48) ∈ S ∩ DOWN .Then, by (2) there exists another square s (cid:48)(cid:48) ∈ A \ S that would block s (cid:48) from below, and so s (cid:48)(cid:48) ∈ DOWN .Since
DOWN is connected, it must contain a path between s (cid:48) and s (cid:48)(cid:48) that s cannot be a part of, since s ∈ UP .This path exists in A \ { s } , which implies that s (cid:48) and s (cid:48)(cid:48) must be in the same connected component of A \ { s } .Therefore, we must have s (cid:48)(cid:48) ∈ S , which is a contradiction.The hypothesis in Lemma 1 is that the polygon a i translates up, but because the corresponding quasi-polygon a i is made of squares, we assume instead that U ( a i ) ⊂ UP : Lemma 7.
For a positive clause C i , if U ( a i ) ⊂ UP then (i) L ( b i ) ⊂ UP and (ii) A ( UP ) satisfies C i .Proof. If U ( a i ) ⊂ UP then UP must contain a path connecting U ( a i ) to B , since B ⊂ UP (by Lemma 18).Observe that any such path must include the square s a , so we have s a ∈ UP . By applying Lemma 6 on L ( a i ) (as S in the lemma) and s a , we get that L ( a i ) ⊂ UP . Consequently, L ( a i ) forces the subassembly of U ( b i ) that is in its way, to translate up. As before, we must now have L ( a i ) and the subassembly of U ( b i ) be connected by some path P ⊂ UP . Observe that in any case P must contain the square s b . This fact,together with Lemma 6, results in L ( b i ) ⊂ UP , which concludes the proof for (i). P can either go throughthe variable gadget x j or go through the leftmost column of squares of c i (similarly to the two choices wehad in order to have the polygonal counterparts of a i and b i be connected). Therefore, if P does not containthe variable gadget x j , it must contain a part of the leftmost column of c i , in which case the square s c wouldalso translate up, as it is in the way. By applying Lemma 6 on s c , the connected subassembly neighboring theright edge of s c (as S in the lemma) must translate up. This forces a subassembly of d i to translate up, whichmeans that we must have a path in UP connecting it and the subassembly of c i translating up. Such a pathmust contain either one the variable gadgets x k or x k +1 . In summary, one of variable gadgets of C i musttranslate up, which proves (ii) by the definition of A ( UP ) .8e can now use this lemma similarly to how Lemma 1 is used in the hardness proof of PPCST. We providefull details of the correctness of the conversion to squares in Appendix B.2, which obtain the following result: Theorem 2.
PPCST-SQ is NP-complete.
We now show that for motion in the (+ y ) -direction, PPCST-SQ is fixed-parameter tractable, with thesize of the partition as the parameter. Recall that X is the infinite grid of unit squares, that is X := { ( i, j ) + [ − . , . | i, j ∈ Z } . In this section, we represent a square in X by its center, and we will notdistinguish between a square and its center. For a grid square assembly A ⊂ X , the adjacency graph G ( A ) has an edge between two squares ( i, j ) and ( i (cid:48) , j (cid:48) ) , if the squares share an edge, i.e., if i = i (cid:48) and | j − j (cid:48) | = 1 ,or j = j (cid:48) and | i − i (cid:48) | = 1 . G ( A ) is a geometric planar graph with a rectilinear embedding.Given a connected assembly A ⊂ X of n unit squares and a parameter k ≤ n/ , the goal is determineif there exists a connected partition S ∗ ⊂ A in the (+ y ) -direction, namely S ∗ can be moved arbitrarily faraway in the the (+ y ) -direction without colliding with A \ S ∗ and each of the subassemblies S ∗ and A \ S ∗ isconnected, such that | S ∗ | ≤ k . If the answer is yes, the algorithm also returns S ∗ . We refer to S ∗ as a validpartition . We present an O (2 k n ) -time algorithm for the problem. Our overall approach is as follows. We fixa “seed” square s ∈ A and describe a bounded search tree algorithm for computing a valid partition S ∗ ofsize at most k , with the additional property that s ∈ S ∗ , if there exists one. By repeating this algorithm for allpossible choices of s , we can compute a valid partition, at the cost of an additional O ( n ) factor in the runningtime. Note that it suffices to consider only the top squares of A on each grid column as s . If k is not given aspart of the input and the goal is to find a connected partition of A , we can run our algorithm and its “mirror”version, where we compute a connected partition in the ( − y ) -direction, for all possible values of k from to n/ until we find a connected partition or the algorithm does not find a connected partition even for k = n/ .We now describe a recursive algorithm, called A UGMENT , for computing S ∗ , if there exists one, for afixed pair s, k . Each recursive call maintains a “partial solution”—a subassembly S ⊆ A . The algorithmgrows S until it either finds a valid partition S ∗ ⊇ S or determines there is no valid partition containing S . Itmaintains the following invariant for each partial solution S it computes:(*) S spans a contiguous sequence of columns, that is, if ( i, j ) , ( i (cid:48) , j (cid:48) ) ∈ S with i < i (cid:48) , then for all integers i (cid:48)(cid:48) ∈ [ i, i (cid:48) ] , there is an integer j (cid:48)(cid:48) with ( i (cid:48)(cid:48) , j (cid:48)(cid:48) ) ∈ S .Initially, A UGMENT is called with the partial solution S := { s } , which satisfies (*).Given a subassembly S ⊂ A that satisfies (*), each recursive call of A UGMENT performs one of thefollowing three actions:(i) It returns a valid partition S ∗ containing S , in which case the overall algorithm stops and returns S ∗ .(ii) It concludes that there is no valid partition of size at most k containing S , in which case the algorithmaborts the current branch and moves to another one.(iii) It finds a set of subassemblies S , . . . , S t , each properly containing S , such that any valid partition thatcontains S also contains at least one of S , . . . , S t . In this case, the algorithm is called recursively witheach one of S , . . . , S t .We now describe the A UGMENT procedure. First, the procedure applies a reduction rule that adds to S any square that S would collide with during a translation upwards to infinity, resulting in an augmentedsubassembly B ⊇ S . The resulting subassembly B or its complement A \ B may be disconnected. For9ach of these two cases, the procedure then applies an appropriate branching rule that finds candidate sets ofsquares to add to B , such that the connectivity of the disconnected subassembly is increased. Algorithm 1gives a pseudo-code of the A UGMENT procedure. Before describing it in detail, we introduce a few concepts.
Shadows.
For a finite subset X ⊂ X , we define the shadow of X , denoted by Sh( X ) ⊆ X , to be X plusthe set of squares that lie above a square in X , i.e., Sh( X ) := { ( i, j ) ∈ X | ∃ j (cid:48) ≤ j such that ( i, j (cid:48) ) ∈ X } . If the squares in X span a contiguous sequence of columns, then Sh( X ) is connected. We define the boundary of Sh( X ) , denoted by L ( X ) , to be the boundary of the unbounded face of G (Sh( X )) (blue curve in Figure 7).Let the frontier fr( X ) of Sh( X ) ⊆ X be the set of nodes that lie on L ( X ) (circled grid points in the figure).In general, L ( X ) consists of an x -monotone path with two rays in the (+ y ) -direction along with somevertical chains emanating from the path in the ( − y ) -direction. If X lies on a single column, then the two rayscoincide and L ( X ) consists of a single ray and Sh( X ) = fr( X ) in this case. We call Sh( X ) non-degenerate if X spans more than one column and L ( X ) consists of only the x -monotone path without vertical chainsemanating downwards from this path. L ( X ) ······ ··· Figure 7: A set X of three grid points (marked with crosses) and its shadow Sh( X ) (marked with dots;includes X ); the shadow extends upwards to infinity. Part of the adjacency graph G (Sh( X )) is pictured. Thefrontier fr( X ) of Sh( X ) consist of the circled grid points. L ( X ) is drawn in blue; it comprises a two-linkvertical chain attached to a bi-infinite path.The following lemma follows immediately from the definition of the shadow. Lemma 8. (i)
Sh( S ) ∩ A can be moved upwards without colliding with A \ Sh( S ) .(ii) If S ∗ is a valid partition that contains S , then Sh( S ) ∩ A ⊆ S ∗ . Let B := Sh( S ) ∩ A . By Lemma 8, we can replace S with B . If | B | > k , we can conclude that there isno valid partition of size at most k that contains S , and we return. So, assume | B | ≤ k . If both B and A \ B are connected, then B is a valid partition (see Lemma 8(i)), and we return B . If A \ B is not connected, thenlet T , . . . , T r be the connected components of G ( A \ B ) . In this case, we use a branching rule that is basedon the following: Lemma 9. If S ∗ is a valid partition that contains B and G ( A \ B ) is a disconnected graph with r connectedcomponents, then S ∗ must contain r − connected components of G ( A \ B ) . lgorithm 1: A UGMENT ( A, S, k ) Input:
Grid square assembly A , subassembly S ⊆ A that satisfies invariant (*), integer k ≤ n/ Output:
A connected partition S ∗ such that S ⊂ S ∗ , | S ∗ | ≤ k , if it exists if S = ∅ or | S | > k then return false B ← Sh( S ) ∩ A if | B | > k then return false if A \ B is not connected then T , . . . , T r ← connected components of G ( A \ B ) for i ← to r do B = A UGMENT ( A, A \ T i , k ) if B (cid:54) = false or i = r then return B if B is connected then return B S , S ← C ONNECT ( A, B ) B = A UGMENT ( A, S , k ) if B (cid:54) = false then return B return A UGMENT ( A, S , k ) Proof.
Assume for a contradiction that S ∗ contains less than r − components of G ( A \ B ) . In such acase, there are at least two components T i , T j of G ( A \ B ) that S ∗ does not contain. This means that A \ S ∗ must contain at least one square s i ∈ T i and another square s j ∈ T j . Since S ∗ is a valid partition, A \ S ∗ isconnected. Therefore, there is a path between s i and s j in G ( A \ S ∗ ) . This path must also exist in G ( A \ B ) ,since B ⊂ S ∗ . This is a contradiction to T i and T j being two different components of G ( A \ B ) .So, if A \ B is not connected, we branch on the r options for augmenting B with r − components of G ( A \ B ) . That is, for each ≤ i ≤ r , we recursively call A UGMENT with S i := A \ T i , which concludesthis case.We can now assume that A \ B is connected but B is not connected. In this case we call a subroutineC ONNECT ( A, B ) that identifies at most two candidate subassemblies to branch on, B ⊂ S , S ⊆ A , suchthat each of G ( S ) , G ( S ) has less connected components than G ( B ) , and S ∗ contains one of them. This caseconcludes the description of the A UGMENT procedure. Algorithm 2 gives a pseudo-code of the C
ONNECT procedure, which we describe next. We start by proving a few properties of the frontier
Sh( B ) . Structural properties of fr(Sh( B )) . For simplicity of presentation, we assume that
Sh( B ) is non-degenerate. Since B is not connected, let B , . . . , B u be the connected components of G ( B ) . Let Z = B ∩ fr( B ) , and let Z i = B i ∩ fr( B ) . Since A is connected, it is easily seen that Z i (cid:54) = ∅ for every i = 1 , . . . u . Set L := L ( B ) .Let s , s , . . . , s m be the sequence of squares in Z sorted in clockwise order along L . We orient L from s to s m , so that Sh( B ) lies to the right of L and A \ B lies to the left of L . For each i ≤ u , let (cid:96) i (resp. r i )be the index of the first (resp. last) square in Z i . We say that Z i appears before Z j if (cid:96) i < (cid:96) j . The following If Sh( B ) is degenerate, then we convert it into a simple path containing two rays in the (+ y ) -direction by taking its tour. Someof the vertices of L ( B ) appear twice on the tour. We can view these vertices as having two copies in G ( A ) as well, one lyingimmediately above the other, and we connect the edges of G ( A ) incident on these vertices to their appropriate copies. We omitdetails. lgorithm 2: C ONNECT ( A, B ) Input:
Grid square assembly A , subassembly B ⊆ A that satisfies invariant (*), B is not connectedbut A \ B is connected Output:
Either one or two subassemblies B ⊂ S , S ⊆ A , such that any connected partition of A containing B also contains at least one of S or S B , . . . , B u ← connected components of G ( B ) Z ← B ∩ fr( B ) Z j ← B j ∩ fr( B ) , for all ≤ j ≤ u L ← L ( B ) s , . . . , s m ← sequence of squares in Z sorted in clockwise order along L (cid:96) j ← index of first square of Z j along L , for all ≤ j ≤ u r j ← index of last square of Z j along L , for all ≤ j ≤ u R ← A \ B G ← G ( R ∪ Z ) ∪ L [1 , m ] (cid:96) i ← max j (cid:96) j e < ← ( s (cid:48) , s (cid:96) i ) , s (cid:48) predecessor of s (cid:96) i along L F < ← face of G adjacent to e < on its left S ← ∅ if F < is bounded then γ < ← the outer subtour of ∂F < \ L if an endpoint of γ < lies in Z i then Π < ← vertices of γ < except the first and last vertices S ← B ∪ Π < if r i (cid:54) = max j r j then e > ← ( s r i , s (cid:48)(cid:48) ) , s (cid:48)(cid:48) successor of s r i along L F > ← face of G adjacent to e > on its left Repeat lines 13-18 to define S return S , S // At least one of S , S is not empty two properties of Z i ’s will be crucial for our algorithm. For a pair of integers ≤ a < b ≤ m , let L [ a, b ] denote the nodes and edges that lie on the portion of L between s a and s b , including the endpoints. Lemma 10.
The squares in Z , . . . , Z u form a nested structure, i.e., there are no six indices i < j ≤ u and a < b < c < d such that s a , s c ∈ Z i and s b , s d ∈ Z j .Proof. For a contradiction, suppose such a set of indices exists. Since s a and s c lie in the same connectedcomponent B i of G ( B ) , there is a path P i from s a to s c in G ( B ) . Similarly there is a path P j from s b to s d in G ( B ) . Since B ⊂ Sh( B ) , G ( B ) lies on one side of L . G ( B ) is planar, so P i and P j must intersect. However,this contradicts the fact that Z i and Z j lie in two different connected components of G ( B ) . Lemma 11.
There exists an i ≤ u such that Z i = { s j | (cid:96) i ≤ j ≤ r i } .Proof. Let Z i to be the set that appears last, i.e., (cid:96) i > (cid:96) i (cid:48) for all i (cid:48) (cid:54) = i . Suppose to the contrary there is anindex j such that (cid:96) i < j < r i and s j ∈ Z i (cid:48) for some i (cid:48) (cid:54) = i . Note that (cid:96) i (cid:48) < (cid:96) i , by the choice of Z i . We nowhave four indices (cid:96) i (cid:48) < (cid:96) i < j < r i such that s (cid:96) i (cid:48) , s j ∈ Z i (cid:48) and s (cid:96) i , s r i ∈ Z i , contradicting Lemma 10.12 mproving the connectivity of G ( B ) . We now describe how we choose additional squares to be addedto B , so that G ( B ) has fewer connected components. Let R := A \ B , and let G := G ( R ∪ Z ) ∪ L [1 , m ] , i.e.,we take G ( R ∪ Z ) and add the nodes and edges of L [1 , m ] to it, but we do not connect two adjacent squares s, s (cid:48) with s ∈ L [1 , m ] \ Z and s (cid:48) ∈ R by an edge. Since G ( A ) is connected, the boundary of each face in G is connected. Furthermore G lies to the left of L . The following simple observation will be useful for ourconstruction: Lemma 12.
Let π be a simple path in G whose endpoints s a , s b , lie in Z and the rest of the nodes lie in R .Let ∆ ⊂ R ∪ Z be the set of nodes of G that lie in the region bounded by the cycle in G composed of π and L [ a, b ] . Then ∆ ⊂ Sh( π ) . We identify the following two edges in G . Let Z i be the set that appears last along L . By Lemma 11,the squares in Z i form a contiguous subsequence in Z . Since Z i is not the first set along L , there is an edge e < = ( s (cid:48) , s (cid:96) i ) of G lying on L , where s (cid:48) is the predecessor of s (cid:96) i along L . By construction, s (cid:48) / ∈ A (becauseotherwise s (cid:48) ∈ Z i ). If Z i is the not the last set along L (i.e., there is a j (cid:54) = i such that r j > r i ), then there isan edge e > = ( s r i , s (cid:48)(cid:48) ) of G lying on L and s (cid:48)(cid:48) / ∈ A ; see Figure 8.We assume that both e < , e > exist, otherwise the situation is simpler. We orient both of the edges inclockwise direction along L . Let F < (resp. F > ) be the face of G lying to the left of the edge e < (resp. e > )and adjacent to it. Lemma 13. (i) F < (cid:54) = F > . (ii) At least one of F < and F > is bounded.Proof. Since A is connected, there is a path π in G from a square s a ∈ Z i to a square s b ∈ Z j for some i (cid:54) = j . It is easily seen that π separates e < and e > , which implies that F < (cid:54) = F > , proving (i); see Figure 8.Let ∆ be the region bounded by π and the portion of L between s a and s b . If b < a (resp. a > b ) then e < (resp. e > ) lies on the boundary ∂ ∆ and thus F < (resp. F > ) is bounded, thereby proving (ii).Suppose F < is bounded. Consider the boundary ∂F < of this face; it is a non-self-crossing tour in G ; itneed not be simple, and edge e < is part of ∂F < . Remove all edges the lie on L from ∂F < . This breaks ∂F < into (connected non-self-crossing) subtours, each starting and ending at a node (square) of Z and composedof the edges of G ( R ∪ Z ) . We associate each subtour γ with the pair of indices i − , i + , with i − < i + , of thesquares of Z that are the endpoints of γ . We also associate the interval I γ = [ i − , i + ] with γ . Since F < liescompletely to the left of L , the intervals associated with the subtours can be classified as follows: zero ormore inner intervals that are pairwise disjoint and one outer interval that contains them all (e.g. I is an innerinterval and I is an outer interval in Figure 8 (left)). Let γ < be the subtour that corresponds to the outerinterval along L , as above. If an endpoint of γ < lies in Z i , then we define Π < ⊆ R to be the set of squarescorresponding to the nodes of γ < except its endpoints. Otherwise Π < is undefined.Similarly if F > is bounded, we define the outer subtour γ > and the set Π > of squares in an analogousway. Lemma 14.
At least one of Π < and Π > is defined.Proof. By Lemma 13, at least one of F < , F > , say, F < , is bounded, in which case γ < exists. If an endpointof γ < lies in Z i , then the lemma is true. Suppose to the contrary that the indices of the endpoints of γ < are a, b with a < (cid:96) i < r i < b . In this case, the region φ bounded by γ < and L [ a, b ] contains both e < and e > onits boundary, so the face F > cannot be unbounded. If one of the endpoints of γ > lies in Z i , then again thelemma is true. Therefore assume that neither of the endpoints of γ > lies in Z i . Let a (cid:48) < (cid:96) i < r i < b (cid:48) be the13ndices of the endpoints of γ > . Since γ > is a portion of ∂F > and both F < , F > lie on the same side of L , thesubtours γ < , γ > cannot cross each other, i.e., either [ a, b ] ⊆ [ a (cid:48) , b (cid:48) ] or [ a (cid:48) , b (cid:48) ] ⊆ [ a, b ] . In the former case, e > does not lie on ∂F > , and e < does not lie on ∂F < in the latter case, neither of which is possible. Hence, either s a ∈ Z i or s a (cid:48) ∈ Z i , which completes the proof of the lemma.Refer to Figure 8 (left), where both Π < and Π > are defined, while in Figure 8 (right), only Π < is defined. LF > e > e < F < I I LF > e > e > e < F < Figure 8: An embedding of G where L is stretched out on a line, showing faces F < and F > , arcs γ < and γ > ,and paths Π < and Π > . Thick blue lines denote Z i and thick arcs are γ < and γ > . (left) Both Π < and Π > aredefined. (right) Only Π < is defined. Lemma 15.
Let S ∗ be any valid partition that contains S , then B ∪ Π < ⊆ S ∗ or B ∪ Π > ⊆ S ∗ .Proof. Since S ∗ is a valid partition containing S , by Lemma 8, B ⊂ S ∗ . Furthermore S ∗ is connected, so G ( S ∗ ) must contain a path from B i to B \ B i . Among all such paths, let π be a minimal path, i.e., no subpathof π connects B i to B \ B i . Then one endpoint of π , say, s a , lies in Z i , the other endpoint, say, s b , lies in Z j for j (cid:54) = i . The rest of the nodes of π lie in R , since B i and B j are different components of B , i.e., π is a pathfrom s a to s b in G ( R ∪ Z ) . Assume that b > r i , i.e., (cid:96) i < a < r i < b . Let ∆ be the region bounded by π and L [ a, b ] . ∂ ∆ is a cycle in G lying to the left of L and e > ∈ ∂ ∆ . Therefore the face of G lying to the left of e > ,namely, F > , is bounded. Furthermore, since F > is a face of G , ∂F > lies in ∆ , possibly overlapping ∂ ∆ ; seeFigure 9. Since a > (cid:96) i , the index of the first square in γ > lies between a and r i , implying that Π > is defined.Finally, since γ > lies inside ∆ , by Lemma 12, Π > ⊆ Sh( π ) . By Lemma 8(ii), Sh( π ) ⊆ S ∗ , therefore Π > ⊆ S ∗ . If b < r i , we similarly conclude that Π < ⊆ S ∗ .If Π > is defined, we set S = B ∪ Π > . Similarly, if Π < is defined, we set S = B ∪ Π < . By Lemma 15,any valid partition containing S contains either S or S . It can be verified that S and S satisfy theinvariant (*). L F > e > e < a bγ > π Z i Figure 9: Path π ∈ G and the face F > surrounded by it.14 unning Time Analysis. First, it is easily seen that each call to the A
UGMENT procedure takes O ( n ) time.To bound the number of calls we examine the procedure as a search tree , in which each node corresponds toa call. The root of a search tree is the first call to A UGMENT and each recursive call is a child of the callingnode. We define the size of an input to a call A
UGMENT ( A, S, k ) to be k − | S | , which corresponds to themaximum number of squares that can still be added to S in order for it to be a valid partition. Let T ( k ) denote the upper bound on the number of nodes in a search tree of an input of size k .We examine the two branching rules of A UGMENT . The first branching rule is applied when G ( A \ B ) is adisconnected graph with r > components (i.e., when the condition in line 4 is true). In this case there are atmost r recursive calls, in each of which the partial solution S is augmented with r − components of G ( A \ B ) .Since each component has at least one square, the size of each of the subproblems is decreased by at least r − . Therefore, the first branching rule corresponds to the following recurrence: T ( k ) ≤ r · T ( k − r + 1) ,where ≤ r ≤ k . We assume that r ≤ k , because otherwise the overall work by all the recursive calls is O ( n ) (since in each recursive call we will have | S | > k , and we immediately return false in such case). Lemma 16.
For ≤ r ≤ k , T ( k ) ≤ k .Proof. The proof is by induction on k . We verify the statement for the base case k = 2 : T (2) ≤ · T (1) ≤ Assume now that the statement holds for , . . . , k . T ( k + 1) ≤ r · T ( k − r + 2) ≤ r · k − r +2 = r r − · k +1 ≤ k +1 In the second branching rule, which is applied when A \ B is connected but B is not, there at most tworecursive calls. Therefore, after taking both branching rules into account we have T ( k ) ≤ k . Hence, therunning time of procedure A UGMENT is O ( T ( k ) · n ) = O (2 k n ) . Finally, summing over all choices of the“seed” square s and k , the total time required to find a valid partition is O ( n (cid:80) i ≤ k i ) = O (2 k n ) . Puttingeverything together we conclude the following: Theorem 3.
Let A ⊂ X be a connected assembly of n unit squares, and let k (cid:54) n/ be an integer. If there isa connected subassembly S ⊂ A of size at most k such that A \ S is also connected and S can be movedupwards without colliding with A \ S , then such a subassembly S can be computed in O (2 k n ) time. In this section, we present a restricted case of PPCST-SQ, for which a connected partition always exists andshow how it can be obtained in O ( n ) time. Let A ⊂ X be a connected grid square assembly. A directedpath of squares s , . . . , s t in G ( A ) is called rightward (resp. leftward) monotone if for all i < t , s i +1 is notlocated to the left (resp. right) of s i . A is called horizontally monotone if either one of the following holds:(1) from every square of A there is a rightward-monotone path to some rightmost square of A or (2) fromevery square of A there is a leftward-monotone path to some leftmost square of A . For convenience, weassume in this section that a horizontally monotone assembly satisfies condition (1).15 heorem 4. A connected horizontally monotone assembly of n > grid-aligned unit squares can always bepartitioned into two connected subassemblies by a single vertical translation. Such a partition can be foundin O ( n ) time.Proof. We show how to obtain a connected subassembly S ⊂ A that can be rigidly translated upwardswithout colliding with A \ S , such that A \ S is also connected. Let s denote the top square on the leftmostcolumn of A (namely the leftmost column of the grid that contains a square of A ). If the complement of { s } is connected, then { s } is a valid choice for S , since both components are connected and there is nothingblocking a translation of s upwards to infinity, and we are done. Thus we can assume that A \ { s } has morethan one component. It must have exactly two components, as s has two neighboring squares in A in thiscase. Let s (cid:48) denote the square directly below s , and let C (cid:48) be the component of A \ { s } containing s (cid:48) , andlet C = A \ C (cid:48) . Obviously C and C (cid:48) are each connected. We claim that C is a subassembly that can betranslated upwards without a collision. We therefore assume to the contrary that there is a square t ∈ C thatis located below square t (cid:48) ∈ C (cid:48) on the same column. Because s and t are both in C , there is some path P in C from s to t . Since P is in C and t (cid:48) (cid:54)∈ C , P may not pass through t (cid:48) . By assumption, there must exist arightward-monotone path Q from t to a rightmost square r of A (which may consist of just t ); see Figure 10.Notice that the concatenation of P and Q , which we denote by P (cid:48) (which need not be a simple path, but thisdoes not affect our argument), is contained in C . (If Q were not fully contained in C then s would not havedisconnected A .) We further extend P (cid:48) into an infinite set P (cid:48)(cid:48) of cells (now some of which no longer containsquares of A ) by adding all the grid cells to the right of r in its own row, and all the grid cells to the left of s in its own row. The extended set P (cid:48)(cid:48) does not contain squares of C (cid:48) and it splits the grid into two parts, aboveand below P (cid:48)(cid:48) . To conclude the proof, we observe that s (cid:48) is above P (cid:48)(cid:48) and t (cid:48) is below P (cid:48)(cid:48) . Since P (cid:48)(cid:48) does notcontain squares of C (cid:48) , there is no way to connect s (cid:48) to t (cid:48) in C (cid:48) , which is a contradiction. Therefore, C is avalid partition in the (+ y ) -direction.Computing such a valid partition takes time O ( n ) , if G ( A ) is given in the input, as it is only a matter ofidentifying s , counting the number of components of the graph produced by its removal, and extracting oneof these components if the number is two. If G ( A ) is not given, we can construct it in O ( n ) time (we omitthe details). s (cid:48) t (cid:48) s . . .. . . t rP Q Figure 10: The path P (cid:48)(cid:48) in the proof of Theorem 4. The unshaded squares are not in A . We have shown that given a planar assembly, finding a connected partition for a given direction is hard. Inassembly planning one may not require the separating motion to occur along a specific direction, but ratherask whether a connected partition exists for any direction. This problem remains NP-complete since ourconstruction for PPCST can be easily modified so that a partition can only occur along the vertical direction(e.g., by having the positive root clause be constrained to move up due to a sliding contact with the negativeroot clause). The construction for PPCST-SQ can be similarly made to only have a partition in the verticaldirection by modifying the quasi-polygon B . PPCST-SQ remains NP-complete for the spatial case, in which16he parts are unit cubes each occupying a cell of the spatial unit grid, since we can give the squares in ourconstruction volume along the z -axis. Deciding whether a connected partition exists for any direction forunit cubes is an open problem, though it is likely that the construction for PPCST-SQ can be adapted for itas well. The same question for general polyhedral parts is NP-complete, because we can again modify theconstruction for PPCST to restrict the only possible partition direction to be the the (+ y ) -direction.Our results indicate that the overall shape of the assembly, i.e., the shape of the union of its constituentparts (as opposed to the shape of individual parts), plays an important role in the difficulty of the connectedpartitioning problem. For example, “hooks” are a crucial part of our gadgets in both the polygonal and squareconstruction. We saw that the gadgets’ functionality can be kept the same regardless of whether the hooks arerigid or made of squares that resemble a hook. This suggests that more results can be obtained by focusingon the implications of the overall shape of the assembly, such as the property we explored in Section 5.We are currently investigating several immediate extensions of the results presented in this paper. Primar-ily, we are working to prove our conjecture that the FPT algorithm in Section 4 can be extended to the case ofconvex polygons in arbitrary placements (as opposed to a grid). Acknowledgements.
We thank Nancy M. Amato, Stav Ashur, Gali Bar-On, Gil Ben-Shachar, KostasBekris, J. Frederico Carvalho, Erik Demaine, Jayson Lynch, and Jay Tenenbaum, for useful discussions.
References [1] Akanksha Agrawal, Kristine V. K. Knudsen, Daniel Lokshtanov, Saket Saurabh, and Meirav Zehavi.The parameterized complexity of guarding almost convex polygons. In , volume 164 of
LIPIcs , pages 3:1–3:16, 2020.[2] Sergio Cabello, Panos Giannopoulos, Christian Knauer, D´aniel Marx, and G¨unter Rote. Geometricclustering: Fixed-parameter tractability and lower bounds with respect to the dimension.
ACM Trans.Algorithms , 7(4):43:1–43:27, 2011.[3] Marek Cygan, Fedor V. Fomin, Lukasz Kowalik, Daniel Lokshtanov, D´aniel Marx, Marcin Pilipczuk,Michal Pilipczuk, and Saket Saurabh.
Parameterized Algorithms . Springer, 2015.[4] Mark de Berg and Amirali Khosravi. Optimal binary space partitions in the plane. In
Computing andCombinatorics, 16th Annual International Conference, COCOON 2010, Nha Trang, Vietnam, July19-21, 2010. Proceedings , pages 216–225, 2010.[5] L.S. Homem De Mello and Arthur C. Sanderson. A correct and complete algorithm for the generationof mechanical assembly sequences.
IEEE Transactions on Robotics and Automation , 7(2):228–240,1991.[6] Eduard Eiben and Daniel Lokshtanov. Removing connected obstacles in the plane is FPT. In SergioCabello and Danny Z. Chen, editors, , volume 164 of
LIPIcs , pages 39:1–39:14, 2020.[7] Tzvika Geft, Aviv Tamar, Ken Goldberg, and Dan Halperin. Robust 2D assembly sequencing viageometric planning with learned scores. In , pages 1603–1610, 2019.178] Panos Giannopoulos, Christian Knauer, G¨unter Rote, and Daniel Werner. Fixed-parameter tractabilityand lower bounds for stabbing problems.
Comput. Geom. , 46(7):839–860, 2013.[9] Dan Halperin, Jean-Claude Latombe, and Randall H Wilson. A general framework for assemblyplanning: The motion space approach.
Algorithmica , 26(3-4):577–601, 2000.[10] Rondall E Jones and Randall H Wilson. A survey of constraints in automated assembly planning. In , volume 2, pages 1525–1532,1996.[11] Lydia E Kavraki and Mihail N Kolountzakis. Partitioning a planar assembly into two connected parts isNP-complete.
Information Processing Letters , 55(3):159–165, 1995.[12] Donald E. Knuth and Arvind Raghunathan. The problem of compatible representatives.
SIAM J.Discrete Math. , 5(3):422–427, 1992.[13] David Lichtenstein. Planar formulae and their uses.
SIAM J. Comput. , 11(2):329–343, 1982.[14] Balas K Natarajan. On planning assemblies. In
Proceedings of the Fourth Annual Symposium onComputational Geometry , pages 299–308. ACM, 1988.[15] Ulrike Thomas, Mark Barrenscheen, and Friedrich M Wahl. Efficient assembly sequence planning usingstereographical projections of c-space obstacles. In
Proceedings of the IEEE International Symposiumon Assembly and Task Planning, 2003. , pages 96–102. IEEE, 2003.[16] Randall H. Wilson, Lydia E. Kavraki, Tom´as Lozano-P´erez, and Jean-Claude Latombe. Two-handedassembly sequencing.
I. J. Robotics Res. , 14(4):335–350, 1995.[17] Randall H Wilson and Jean-Claude Latombe. Geometric reasoning about mechanical assembly.
ArtificialIntelligence , 71(2):371–396, 1994.[18] Jan D. Wolter. A combinatorial analysis of enumerative data structures for assembly planning. In
Proceedings of the 1991 IEEE International Conference on Robotics and Automation, Sacramento, CA,USA, 9-11 April 1991 , pages 611–618, 1991.[19] Li Da Xu, Chengen Wang, Zhuming Bi, and Jiapeng Yu. Autoassem: An automated assembly planningsystem for complex products.
IEEE Trans. Industrial Informatics , 8(3):669–678, 2012.
A Monotone Planar 3-SAT with Neighboring Variable Pairs
Theorem 5.
Monotone Planar 3-SAT with Neighboring Variable Pairs is NP-complete.Proof.
The problem is clearly in NP. We prove NP-hardness by a reduction from Monotone Planar 3-SAT.Let φ be a Monotone Planar 3-SAT instance given in a rectilinear embedding. We say that a 3-clauseis valid if it has a neighboring variable pair. We first modify each 3-clause in φ so that it is valid. Themodification introduces clauses that are not monotone, which we later fix in a separate transformation. Let C = ( x i ∨ x j ∨ x k ) , i < j < k , be a positive 3-clause, which must lie above the variable row. We modifyit as follows. (Negative clauses, which lie below the variable row, are modified symmetrically.) Introduce18igure 11: Modifying a 3-clause so that it hasa neighboring variable pair. The variables x i +1 through x j − (not shown) lie horizontally in the biggap between the drawn variables. Figure 12: Fixing a non-monotone 2-clause.two variables a and b immediately to the right of x i and add the following equivalence clauses , that enforce a = x j and b = x i and are drawn as shown in Figure 11: ( x j ∨ a ) ∧ ( x j ∨ a ) ∧ ( x i ∨ b ) ∧ ( x i ∨ b ) . We then apply the transformation
Replace ( C, x i , b ) , which replaces x i by b in each clause C (cid:48) that is either(1) above the variable row and has an edge ( C (cid:48) , x i ) that is to the right of the edge ( C, x i ) or (2) belowthe variable row and has neigV ars ( C (cid:48) ) = { x i , x i +1 } . Finally, we replace x j by a in clause C , so that now C = ( x i ∨ a ∨ x k ) , which makes C valid since x i and a are neighboring variables.As per Figure 11, the modification preserves the rectilinear embedding. We can shrink the new variablesso that they fit between the existing variables. The fat blue edges are shifted right from x i to b due to Replace ( C, x i , b ) . This allows any clause that had an edge connecting it to x i , to be now connected to b . The modified formula is equisatisfiable to φ because the equivalence clauses are satisfied if and onlyif a = x j and b = x i and the variables are replaced accordingly. We verify that the modification doesnot accidentally invalidate a 3-clause already having neighboring variables: Observe that only a 3-clause C (cid:48) with the neighboring variables { x i , x i +1 } in φ may potentially be invalidated. However, by applying Replace ( C, x i , b ) we would have neigV ars ( C (cid:48) ) = { b, x i +1 } . Finally, all the clauses except the four newequivalence clauses remain monotone and on the correct side of the variable row.By applying the modification above to each 3-clause in φ , we transform it to an equisatisfiable formula inwhich each 3-clause has a neighboring variable pair. However, we now have to address the new non-monotone2-clauses. We therefore apply a transformation nearly identical to the one used in the NP-completenessproof of Monotone Planar 3-SAT [4], which fixes one non-monotone 2-clause at a time. Assume that thevariables have been relabeled according to their order on the variable row, and let C = ( x i ∨ x j ) , i < j be anon-monotone clause. We make C positive if it is above the variable row, or make C negative if it is below it,as per the requirements of Monotone Planar 3-SAT. We assume the former case and modify C as follows(the latter case, as well as the case of j < i , is similar). Introduce two variables a and b immediately to theright of x i and add the following equivalence clauses, which are now monotone, that enforce a = x i and b = a = x i (see Figure 12): ( x i ∨ a ) ∧ ( x i ∨ a ) ∧ ( a ∨ b ) ∧ ( a ∨ b ) . As in the first transformation, we then apply
Replace ( C, x i , b ) , which replaces x i by b as defined above. Then,we replace x i by a in clause C , which turns C into a positive clause, as required.19y the same arguments as in the first transformation, the modified formula is equisatisfiable to φ and themodified rectilinear embedding is valid. Also as before, performing Replace ( C, x i , b ) guarantees that themodification preserves the neighboring variable pair of each 3-clause. Lastly, the new clauses, as well as C ,are monotone and on the correct side of the variable row.By applying the modification to each non-monotone 2-clause, we transform φ to an equisatisfiableformula that meets the requirements: it is monotone, all the positive (resp., negative) clauses are above (resp.,below) the variable row, and each 3-clause has two neighboring variables. Finally, it is easy to verify that thereduction can be done in polynomial time. B Hardness of Connected Assembly Partitioning
B.1 Omitted Proofs
Lemma 17.
Let φ ∈ MP-3SAT-NVP. Then φ can be converted to an equisatisfiable Boolean formula φ (cid:48) ∈ MP-3SAT-NVP that has a rectilinear embedding with a single root clause that is a 2-clause, on each side of thevariable row.Proof.
Given φ ∈ MP-3SAT-NVP , we modify it as follows: Introduce a variable at each end of the variablerow, and add a 2-clause C root containing the new variables such that it encloses the rest of the positive clauses.The clause C root can always be satisfied, so the satisfiability of φ is not affected. Any root clause that existedbefore the addition of C root must now be the child of C root . A unique negative root 2-clause can be obtainedin a symmetric manner. Lemma 18.
For any connected partition UP ⊂ A we have B ⊂ UP .Proof. In any partition, at least one square s in the top row of B must move up, otherwise no square canmove up. Let S denote the connected subassembly of B \ { s } containing the lower hook on the left side of B (the hook has a thicker width in Figure 5). We apply Lemma 6 to S , since it is connected to A \ S only viathe square s . Therefore S ⊂ UP , which forces the subassembly S (cid:48) of the upper hook that is above the lowerhook to also translate up. For UP to be connected, it must contain a path P between S and S (cid:48) , which canonly be B \ ( S ∪ S (cid:48) ) . So overall, we have B ⊂ UP . B.2 Correctness of the Conversion to Squares
Lemma 19. φ has a satisfying assignment if and only if the converted square assembly A has a connectedpartition in the (+ y ) -direction.Proof. Specifying a valid partition given a satisfying assignment is straightforward because we can proceedas in Theorem 1 by treating each quasi-polygon as a regular polygon that must move together. All thesquares comprising a quasi-polygon are assigned together to either UP or DOWN based on the direction thequasi-polygon is supposed to move in (and the new quasi-polygon B would be sent up). The partition is validbecause the connectivity and blocking relations between the quasi-polygons are the same as for the respectivepolygons.In the other direction, when given a valid partition UP ⊂ A , we also proceed as before and take theassignment A ( UP ) , which assigns a variable to be positive if and only if the corresponding variable-rectanglemoves up. By Lemma 7(ii), it suffices to show that U ( a i ) ⊂ UP for each quasi-polygon a i , because then C i
20s satisfied. To this end, we show the equivalent of having all type- a parts in the polygonal construction beinterlocked: For any clause C i with a parent C j , if U ( a j ) ⊂ UP then by Lemma 7(i) we have L ( b j ) ⊂ UP ,which in turn forces U ( a i ) ⊂ UP (i.e., the leftmost square of U ( a i ) is forced to translate up due to blockingrelations, which consequently forces the rest of U ( a i ) up due to the connectivity of UP ). Finally, since B ⊂ UP we have U ( a root ) ⊂ UP , and so by induction we get U ( a i ) ⊂ UP for all i . In conclusion, theassignment A ( UP ) satisfies φ . B.2.1 Converting Variable-Rectangles
We now describe how to convert variable-rectangles to equivalent quasi-polygons. Figure 13 shows thequasi-polygon equivalent of a single variable-rectangle. The gadget is made up only of the gray-filled squares.Let V denote this set of squares. The unfilled squares are connections coming from clause gadgets, whichnow touch the gadget from the right instead of from above and below (in the figure there are two connectionsfrom positive clauses and one from a negative clause). We claim that replacing variable-rectangles by thisgadget preserves the correctness of the construction. In particular, in the definition of A ( UP ) now refers tothe new gadget, i.e., a variable is assigned true if and only if V ⊂ UP (where V is the corresponding gadget).To show that the assignment remains well defined, we need to show that all the squares in V always move inthe same direction, emulating a single rigid piece: Lemma 20.
For any connected partition UP ⊂ A we have either V ⊂ UP or V ⊂ DOWN .Proof.
We show that V moves in the same direction as squares s in Figure 13: If s ∈ UP , then by Lemma 6the connected subassembly of V \ { s } resembling a C-shape must also move up. This subassembly includesthe square labeled s (cid:48) , which forces all others squares of V to move up too. Otherwise s ∈ DOWN , in whichcase the whole rightmost column of V must also move down. Since DOWN is connected, all other squaresin V must then also move down to have a connection between s and s (cid:48) . ss
We show that V moves in the same direction as squares s in Figure 13: If s ∈ UP , then by Lemma 6the connected subassembly of V \ { s } resembling a C-shape must also move up. This subassembly includesthe square labeled s (cid:48) , which forces all others squares of V to move up too. Otherwise s ∈ DOWN , in whichcase the whole rightmost column of V must also move down. Since DOWN is connected, all other squaresin V must then also move down to have a connection between s and s (cid:48) . ss (cid:48) ss