Planning over Chain Causal Graphs for Variables with Domains of Size 5 Is NP-Hard

Recently, considerable focus has been given to the problem of determining the boundary between tractable and intractable planning problems. In this paper, we study the complexity of planning in the class C_n of planning problems, characterized by unary operators and directed path causal graphs. Although this is one of the simplest forms of causal graphs a planning problem can have, we show that planning is intractable for C_n (unless P = NP), even if the domains of state variables have bounded size. In particular, we show that plan existence for C_n^k is NP-hard for k>=5 by reduction from CNFSAT. Here, k denotes the upper bound on the size of the state variable domains. Our result reduces the complexity gap for the class C_n^k to cases k=3 and k=4 only, since C_n^2 is known to be tractable.


Introduction
There is an ongoing effort in the planning community to determine the complexity of different classes of planning problems.Known tractable classes are usually characterized by a simple causal graph structure accompanied by additional restrictions on variables and operators.However, the boundary between tractable and intractable planning problems is still not clearly established.The present paper contributes a novel complexity result for a class of planning problems with simple causal graph structure from the literature, in an effort to reduce this complexity gap.
The problem of determining tractable classes of planning problems is not purely of theoretical interest.For instance, complex planning problems can be projected onto tractable fragments of planning problems to generate heuristics to be used during search (Katz & Domshlak, 2008b).Also, the causal graph heuristic (Helmert, 2006) exploits the hierarchical structure of a planning problem by transforming it into a more tractable form: first, it translates propositional variables into multi-valued variables, a process that simplifies the causal graph of the problem; then, it keeps relaxing the problem until the causal graph becomes acyclic.
The present paper aims to study the complexity of planning problems in the class C n , defined by Domshlak and Dinitz (2001) multi-valued variables and chain causal graphs, i.e., the causal graph is just a directed path (implying that operators are unary).The notation n indicates that the number of state variables is unbounded.In particular, we study the complexity of plan existence for C n , i.e., determining whether or not there exists a plan that solves a planning problem in C n .
Even though planning problems in C n exhibit an extremely basic form of causal structure, i.e., linear dependence between state variables, solving planning problems in C n is not necessarily tractable, even if we impose additional restrictions.Let C k n be the subclass of C n for which state variables have domains of size at most k.It is known that class C 2 n is polynomial-time solvable (Brafman & Domshlak, 2003) and that plan existence for class C n is NP-hard (Giménez & Jonsson, 2008a).Our aim is to study the complexity of plan existence for those classes in between, namely C k n for k ≥ 3. Domshlak and Dinitz (2001) showed that there are solvable instances of C 3 n that require exponentially long plans.This means that there is no polynomial-time plan generation algorithm for C k n with k ≥ 3, as was the case for C 2 n .However, this does not rule out the existence of a polynomial-time algorithm that determines plan existence for class C k n , or even an algorithm that generates plans in some succinct form, like those of Jonsson (2007) and Giménez and Jonsson (2008a).This is not incompatible with C n being NP-hard.
In this paper, we prove that plan existence for the class C k n is NP-hard for k ≥ 5.In other words, even if the causal graph is a directed path and the domains of the state variables are restricted to contain no more than 5 values, deciding whether or not a plan exists for solving the corresponding planning problem is NP-hard.Our result implies that it is not sufficient for a planning problem to exhibit linear variable dependence and restricted variable domain sizes; additional restrictions are necessary to make planning tractable.
Table 1 shows an overview of the complexity results for the class C k n to date.By "Macro plan generation" we mean any algorithm for generating a compact representation of the solution, such as in the work of Jonsson (2007) and Giménez and Jonsson (2008a).The "Intractable" result for this column means that the complexity is yet unknown but cannot be in P unless P = NP (else plan existence would be in P).The row for k = 2 is due to Brafman and Domshlak (2003), the column for plan generation is due to Domshlak and Dinitz (2001), and the contributions of the present paper are marked in boldface.Note that the novel result subsumes that of Giménez and Jonsson (2008a), who showed NP-hardness for k = O(n).
This paper is organized as follows.In Section 2 we relate our results to previous work, and in Section 3 we introduce the notation used throughout.In Section 4 we give formal proof of a reduction from Cnf-Sat to planning problems in C 11 n .The main result, a reduction from Cnf-Sat to planning problems in C 5 n , is then proved in Section 5.Although the result for C 5 n subsumes that for C 11 n , we believe that the intuitive idea behind the C 11 n reduction is easier to understand, and may be of interest for anyone trying to prove hardness results under similar circumstances.In Section 6 we discuss the complexity of the remaining classes C 3 n and C 4 n .We also prove the correctness of a third reduction, this time from Cnf-Sat to C 7 n , in Appendix A. The reductions for C 11 n and C 7 n previously appeared in a conference paper (Giménez & Jonsson, 2008b), and the present paper provides formal proof of their correctness.

Related Work
The complexity of planning has been studied extensively over the last twenty years (Bylander, 1994;Chapman, 1987;Erol, Nau, & Subrahmanian, 1995).Many tractable classes of planning problems exploit the notion of a causal graph in one way or another.Knoblock (1994) is usually credited with introducing the causal graph in his work on hierarchical planning.Williams and Nayak (1997) required planning problems to have acyclic causal graphs in an effort to ensure tractability.Jonsson and Bäckström (1998) defined the class 3S of planning problems, also with acyclic causal graphs, and showed that plan existence is tractable for this class.Domshlak and Dinitz (2001) introduced the class C n of planning problems studied in this paper, as well as several related classes, all of which have a particular causal graph structure.Brafman and Domshlak (2003) designed a polynomial-time algorithm for solving planning problems with binary state variables and polytree causal graphs of bounded indegree, proving that planning is tractable for the class C 2 n .Brafman and Domshlak (2006) presented complexity results related to the tree-width of the causal graph.Katz and Domshlak (2008a) used causal graph structure to prove several complexity results for optimal planning.Jonsson (2007) and Giménez and Jonsson (2008a) designed polynomial-time algorithms that solve planning problems with restricted causal graphs by generating a hierarchy of macros.Recently, Chen and Giménez (2008) showed that the complexity of planning is intractable unless the size of the largest connected component of the causal graph is bounded by a constant.Consequently, causal graph structure alone is not enough to guarantee tractability, implying that additional restrictions are needed.

Notation
Throughout the paper, we use [i..n] to denote the set {i, . . ., n}.
Let V be a set of state variables, and let D(v) be the finite domain of state variable v ∈ V .We define a state s as a function on V that maps each state variable v ∈ V to a value s(v) ∈ D(v) in its domain.A partial state p is a function on a subset V p ⊆ V of state variables that maps each state variable v ∈ V p to p(v) ∈ D(v).We frequently use the notation (v 1 = x 1 , . . ., v k = x k ) to denote a partial state p defined by A planning problem is a tuple P = V, init, goal, A , where V is the set of variables, init is an initial state, goal is a partial goal state, and A is a set of operators.An operator a = pre(a); post(a) ∈ A consists of a partial state pre(a) called the pre-condition and a A partial plan Π for planning problem P is a sequence of operators a 1 , . . ., a k ∈ A k , k ≥ 0, such that a 1 is applicable in the initial state init and, for each i ∈ [2..k], a i is applicable following the application of a 1 , . . ., a i−1 starting in init.Note that a partial plan does not necessarily solve P .A plan Π for solving P is a partial plan such that the goal state goal is satisfied following the application of a 1 , . . ., a k .P is solvable if and only if there exists such a plan Π.
The causal graph of a planning problem P is a directed graph (V, E) with the state variables as nodes.There is an edge (u, v) ∈ E if and only if u = v and there exists an operator a ∈ A such that u ∈ V pre(a) ∪ V post(a) and v ∈ V post(a) .Figure 1 shows an example causal graph in the form of a directed path.The structure of the causal graph implies that each operator a ∈ A is unary, i.e., the post-condition of a is specified on a single variable v, and the pre-condition of a is specified on (at most) v and its predecessor v ′ in the causal graph.
In this paper we study the class C k n of planning problems, defined as follows: Definition 3.1.A planning problem P belongs to the class C k n if and only if the causal graph of P is a directed path and, for each v ∈ V , |D(v)| ≤ k.
For planning problems in C k n , the domain transition graph, or DTG, of a state variable v is a labelled, directed graph (D(v), E ′ ) with the values in the domain of v as nodes.
There is an edge (x, y) ∈ E ′ with label l ∈ D(v ′ ) if and only if there exists an operator v ′ = l, v = x; v = y in A, where v ′ is the predecessor of v in the causal graph.An edge without label indicates that the pre-condition of the corresponding operator is defined on v alone.An edge with more than one label indicates the existence of multiple operators with the same pre-and post-condition on v but different pre-conditions on v ′ .

C 11
n Is NP-hard In this section we prove that C 11 n is NP-hard by reduction from Cnf-Sat.In other words, to every CNF formula F we associate a planning instance P 11 (F ) of C 11 n such that P 11 (F ) is solvable if and only if F is satisfiable.We first describe the planning problem P 11 (F ), then explain the intuitive idea behind the reduction, and finally provide formal proof of its correctness.
Let F = C 1 ∧ • • • ∧ C k be a CNF formula on k clauses and n variables x 1 , . . ., x n .We define the planning problem P 11 (F ) = (V, init, goal, A) as follows.The variable set V is .n], and the goal state is a partial state defined by goal(v in ) = g x for each i ∈ [1..k], goal(v e ) = 0, and goal(e i ) = (i mod 2) for each Before providing a formal definition of the operators in A, we give an intuitive overview of the planning problem P 11 (F ).To do this, we present the causal graph of P 11 (F ) as well as the DTGs of each state variable.A reader who is only interested in the formal proof of the correctness of the reduction may skip to Section 4.2, where we introduce the formal definitions of operators in order to prove several theoretical properties of P 11 (F ).

Intuition
The planning problem P 11 (F ) associated to each CNF formula F consists of three parts, each with a clearly defined role.The three parts are illustrated in Figure 2, showing the causal graph of P 11 (F ).The first part of P 11 (F ) corresponds to state variables s 1 , . . ., s 2n−1 , v s , the second part corresponds to state variables v 11 , . . ., v 1n , . . ., v k1 , . . ., v kn , and the third part corresponds to state variables v e , e 1 , . . ., e 2n−1 .The role of the first part is to generate a message corresponding to an assignment to the variables of the CNF formula F .The role of the second part is to verify whether this assignment satisfies each clause C i , and to remember this fact (using a value of state variable v in ).Finally, the role of the third part is to make sure that the message is propagated all the way to the end of the chain.
The DTGs of state variables s 1 , . . ., s 2n−1 , v s appear in Figure 3.These state variables are used to generate an assignment σ to the variables x 1 , . . ., x n of the CNF formula F .To do this, the operators of P 11 (F ) are defined in such a way that the value of v s can change from x to either 0 or 1, while from 0 or 1 it can only change back to x.Thus, by applying the operators of P 11 (F ) it is possible to generate a sequence x, m 1 , x, . . ., x, m n , x of values of v s , where m j ∈ {0, 1} for each j ∈ [1..n].
We define a message m as the sequence m 1 , . . ., m n of n symbols (either 0 or 1) corresponding to a sequence of values of v s .In what follows, we refer to these symbols as the "bits" of the message.The value x is used as a separator to distinguish between consecutive bits of the message.Given a message m, the assignment σ is defined as σ(x j ) = m j for each j ∈ [1..n].Thus, the assignment to x 1 is determined by the first choice of whether to change the value of v s from x to 0 or 1, and so on.The only purpose of the remaining state variables s i of the first part is to restrict the message m to contain no more than n bits.
(a) The DTGs of state variables v ij , i ∈ [1.
.n], appear in Figure 4.The dashed edges in the DTGs indicate that the corresponding operators depend on the CNF formula F .For example, if the assignment σ(x 1 ) = 1 satisfies the clause C 1 , the edge from v 11 = a x with label 1 in Figure 4(a) points to g 1 , else it points to b 1 .Likewise, if σ(x 1 ) = 0 satisfies C 1 , the edge from v 11 = a x with label 0 points to g 0 , else it points to b 0 .
Recall that the role of the second part is to check whether the assignment σ generated by the first part satisfies the CNF formula F .For each clause C i and each variable x j of F , the main function of state variable v ij is to check whether the assignment σ(x j ) = m j satisfies C i .To do this, state variable v ij acts as a finite state automaton that propagates each bit of the message m while keeping track of when the j-th bit of the message arrives.Since the domain size of state variables is restricted, there is no way for v ij to count the number of bits it has received.Instead, the fact that the j-th bit has arrived is indicated to it by v i(j−1) .Moreover, the last state variable v in for each clause C i has to remember whether or not C i has been satisfied by the assignment to some variable x j .
In summary, each state variable v ij in the second part performs the following functions through its values and operators: 1. Propagate the message m generated by v s .
2. Check whether the assignment to x j (the j-th bit of m) satisfies the clause C i .3. Remember whether C i was satisfied by the assignment to some x l , l ≤ j.
4. If j < n and C i has been satisfied, propagate this fact.
5. If j < n, let v i(j+1) know when the (j + 1)-th bit of the message has arrived.
Note that the third function is only strictly necessary for j = n.However, including it for all state variables makes the reduction more compact because of symmetry.
Next, we briefly describe how v ij implements each of these functions.Each value in the domain of v ij has subscript 0, 1, or x.To propagate the message, v ij always moves to a value whose subscript matches that of its predecessor (in the case of v 11 , its subscript should match the value of v s ).Unless C i is satisfied by the assignment to x l , l < j, the value of v ij remains in the subdomain {a 0 , a 1 , a x } prior to the arrival of the j-th bit.
The clause C i is encoded into the dashed edges of the DTGs of variables v ij .These operators are such that when the j-th bit m j arrives, v ij moves from a x to g m j if the assignment σ(x j ) = m j satisfies C i , and to b m j otherwise.The fact that the value of v ij is in the subdomain {g 0 , g 1 , g x } indicates that C i was satisfied by the assignment to some x l , l ≤ j.This fact is propagated all the way to v in since each subsequent state variable for C i is forced to move to a value in the subdomain {g 0 , g 1 , g x } whenever the value of its predecessor is in {g 0 , g 1 , g x }.Whether or not a clause C i has been satisfied is checked by defining a goal state v in = g x .
Finally, if j < n and v ij moves to b m j , then v i(j+1) moves to a m j .From there, v ij has no choice but to move to c x , causing v i(j+1) to return to a x .When the next bit arrives, v ij moves to either c 0 or c 1 , correctly indicating to v i(j+1) that the (j + 1)-th bit has arrived.Consequently, v i(j+1) moves to either g 0 (g 1 ) or b 0 (b 1 ), depending on whether or not the assignment to x j+1 satisfies C i .Hence, the values of type b are used to delay the transition of v i(j+1) from a value of type a to either b or g.This is the mechanism that allows a variable v ij to react to the j-th bit.For each clause C i , the operators for v i1 are defined such that v i1 always reacts to the first bit.
The DTGs of state variables v e , e 1 , . . ., e 2n−1 appear in Figure 5.The function of these state variables is to make sure that all n bits of the message m are propagated to the end of the causal graph.A state variable (strictly speaking, a planner solving the planning problem) is never forced to select an operator, so it can choose not to propagate a bit of the message and instead wait for the next bit to arrive before acting.In turn, this may cause another state variable to incorrectly conclude that a clause has (not) been satisfied.The variables of the third part prevent this from happening, since the goal state is defined in such a way that it cannot be reached unless all bits of the message arrive at the end of the causal graph.

Formal Proof
In this section, we prove that C 11 n is NP-hard by showing that the planning problem P 11 (F ) is solvable if and only if the formula F has a satisfying assignment.To start with, we provide formal definitions of the operators of P 11 (F ).The operators for s 1 , . . ., s 2n−1 , v s appear in Table 2, and the corresponding DTGs appear in Figure 3.The operators for variables v ij , i ∈ [1..k] and j ∈ [1..n], appear in Table 3, and the DTGs appear in Figure 4. Finally, the operators for v e , e 1 , . . ., e 2n−1 appear in Table 4, and the DTGs appear in Figure 5.
To reduce the space requirement we use shorthand in the definitions of operators.In other words, For state variables v ij we also introduce reference numbers that allow us to easily refer to operators.
Furthermore, some operators are conditional on properties of the CNF formula F ; such an operator only exists if the indicated property is satisfied.For example, the operator v 22 = c 0 , v 23 = a x ; v 23 = g 0 only exists if the clause C 2 is satisfied by x 3 , and the operator v 22 = c 0 , v 23 = a x ; v 23 = b 0 only exists if C 2 is not satisfied by x 3 .We use the set notation x j ∈ C i to denote that the literal x j appears in the clause C i .
The proof is organized as follows.We begin with a series of technical definitions and lemmas (4.1-4.6)related to the operators and their implications.Definition 4.7 then introduces the notion of admissible plans, and Lemma 4.8 states that any plan for solving P 11 (F ) has to be admissible.Next, Lemma 4.10 establishes that any admissible plan corresponds to an assignment to the variables of the CNF formula F , and that all operator choices of the plan are forced given this assignment.Finally, Lemma 4.13 determines the exact sequence of values taken on by each state variable during the execution of an admissible plan, making it possible to check whether the goal state is reached at the end of the execution.Theorem 4.14 then concludes that the only admissible plans solving P 11 (F ) are those corresponding to satisfying assignments of F .Definition 4.1.Given a partial plan Π for P 11 (F ) and a variable v ∈ V , Π(v) is the number of times the value of v is changed by operators in Π.
Lemma 4.2.For each partial plan Π for P 11 (F ), it holds that

Variable
Ref.
Proof.By induction on i.For i = 1, variable s 1 can only change once, so Π(s 1 ) ≤ 1.For i ∈ [2..2n − 1], it follows from inspection of the operators that we cannot change the value of s i twice without changing the value of s i−1 once in between (the operator for setting s i to 1 has s i−1 = 0 as a pre-condition, and the operator for resetting s i to 0 has s i−1 = 1 as a pre-condition).Since we can change the value of s i once in the initial state without first changing the value of s i−1 , it follows that Π(s i ) ≤ Π(s i−1 ) + 1 ≤ (i − 1) + 1 = i by induction.The same argument holds for variable v s and its predecessor Lemma 4.3.For each partial plan Π for P 11 (F ) and each , where v ′ is the predecessor of v ij in the causal graph.
Proof.Just as before, it follows by inspection of the operators that we cannot change the value of v ij twice without changing the value of v ′ in between.To see this, note that the subscript of each value in D(v ij ) is either x, 0, or 1.An operator for v ij either changes its value from one with subscript x to one with subscript 0 (1), if v ′ also has a value with subscript 0 (1), or from one with subscript 0 (1) to one with subscript x, if v ′ also has a value with subscript x (the same argument holds for v 11 , although the values of its predecessor v s are x, 0, and 1 without subscripts).
Note that the value of v ij cannot change in the initial state without first changing the value of v ′ , since v ′ has to have a value with subscript 0 or 1 for the value of v ij to change from its initial value a x .Consequently, the value of v ij cannot change more times than the value of v ′ , so Π(v ij ) ≤ Π(v ′ ) as claimed.
Lemma 4.4.For each v ij , i ∈ [1..k] and j ∈ [1..n], and each partial state (v ′ = x, v ij = y), where v ′ is the predecessor of v ij in the causal graph, there is at most one applicable operator for changing the value of v ij .
Proof.By inspecting the operators it is easy to see that each pair of operators for v ij have different pre-conditions.The only exception to this rule are operators that do not exist simultaneously due to properties of the CNF formula F (e.g.operators (1) and ( 2)).
Lemma 4.5.For each partial plan Π for P 11 (F ), it holds that • Π(e 1 ) ≤ Π(v e ), and Proof.Let v be a variable among v e , e 1 , . . ., e 2n−1 , and let v ′ be its predecessor in the causal graph.As before, we cannot change the value of v twice without changing the value of v ′ once in between.If v ∈ {e 1 , . . ., e 2n−1 }, the operator setting v to 1 requires v ′ = 1, and the operator resetting v to 0 requires v ′ = 0.For v = v e , the operator setting v to 1 requires v ′ to have a value with subscript 0 or 1, while the operator resetting v to 0 requires v ′ to have a value with subscript x.Note that, in either case, we cannot change the value of v in the initial state without first changing the value of v ′ .Thus, Π(v) ≤ Π(v ′ ) for each of these variables, as claimed.
We now turn to the problem of finding a plan Π that solves P 11 (F ).
Definition 4.7.An admissible plan Π for planning problem P 11 (F ) is a partial plan such that Π(s Please note that the converse of Lemma 4.8 is not true, that is, not all admissible plans do solve the planning problem P 11 (F ).
As a consequence of Lemma 4.8, to find a plan that solves P 11 (F ) we only need to consider admissible plans.In particular, an admissible plan changes the value of variable v s exactly 2n times, generating a sequence of 2n + 1 values.Note that the value of v s always changes from x to either 0 or 1, and then back to x. Definition 4.9.Let Π be an admissible plan, and let x, m 1 , x, . . ., x, m n , x be the sequence of 2n + 1 values that variable v s takes on during the execution of Π, where m j ∈ {0, 1} for each j ∈ [1..n].We use m Π to denote the message m 1 , . . ., m n induced by Π, and we use σ Π to denote the formula assignment σ Π (x j ) = m j for each j ∈ [1..n].
As it turns out, the operators that are part of an admissible plan Π are completely determined by the message m Π induced by Π.
Lemma 4.10.Let Π be an admissible plan for P 11 (F ) and let m Π be its induced message.The operators in Π for changing the value of variable v ij , i ∈ [1..k] and j ∈ [1..n], as well as the sequence of values that variable v ij takes on during the execution of Π, are completely determined by m Π .
Proof.For each v ∈ {v 11 , . . ., v kn }, let v ′ be its causal graph predecessor.From the proof of Lemma 4.3 we know that we cannot change the value of v twice without changing the value of v ′ in between, and that in the initial state, we have to change the value of v ′ before we can change the value of v. From the definition of admissible we know that Π(v ′ ) = Π(v) = 2n.The only way an admissible plan can change the value of v 2n times without changing the value of v ′ more than 2n times is to first change the value of v ′ , then v, then v ′ , and so on.Now, from Lemma 4.4 we know that, given a partial state (v ′ = x, v = y), there is at most one applicable operator for changing the value of v. Thus, each time the admissible plan changes the value of v for some value of v ′ , there is at most one operator for doing so.The plan has no choice but to select this operator since it is not allowed to change the value of v ′ again before changing the value of v. Consequently, if the sequence of values taken on by v ′ is completely determined, the operators for v, as well as the sequence of values it takes on, are completely determined also.The proof follows by a double induction on i and j, since the sequence of values taken on by v s (the predecessor of v 11 ) is completely determined by the message m Π .
It follows from Lemma 4.10 that the only relevant "degree of freedom" of an admissible plan Π is selecting the elements of the message m Π , by repeatedly deciding whether to move to v s = 0 or v s = 1 from v s = x.Once m Π has been selected, all other operator choices are forced, else the plan is not admissible.In particular, for each message m Π there is a unique state s such that executing any admissible plan starting from init results in s.It remains to determine whether this unique state matches the goal state.
Remark.Note that Lemma 4.10 does not mention the operator order of an admissible plan.Indeed, we can change the order of the operators of an admissible plan without making the plan inadmissible.As an example, let v 1 , v 2 , and v 3 be three consecutive variables in the causal graph, and let a 1 1 , a 1 2 , a 1 3 , a 2 1 , a 2 2 , a 2 3 be a subsequence of operators for changing their values, such that a j i is the j-th operator for changing the value of v i .Then the subsequence a 1 1 , a 1 2 , a 2 1 , a 1 3 , a 2 2 , a 2 3 achieves the same result.As long as the partial order a j i , a j i+1 , a j+1 i is respected for each i and j, we can change the operator order as we please.
We proceed to determine the sequence of values that variable v ij , i ∈ [1.
.k] and j ∈ [1..n], takes on during the execution of an admissible plan Π with induced message m Π .First, we define the satisficing index of clauses, and the sequence of values of a plan.Definition 4.11.Let Π be an admissible plan with induced message m Π = m.For each clause C i , let the satisficing index Definition 4.12.Let Π be an admissible plan.For each clause C i and each t ∈ [1..2n + 1], let the sequence of values Q t i (Π) be the vector of n values representing, for each variable v ij , j ∈ [1..n], the t-th value taken on by v ij during the execution of Π.
The following lemma is key to understanding the idea behind the reduction for C 11 n , since it specifies the sequences of values that an admissible plan induces during its execution.Lemma 4.13.Let σ be an assignment to variables x 1 , . . ., x n of formula F . 1) Existence.There exists an admissible plan Π of planning problem P 11 (F ) with induced assignment σ Π = σ.
2) Claim.Let Q t i be the sequences of values described in Part 3) of this lemma.All admissible plans Π with σ Π = σ have the same sequences of values Before proving the lemma, we must check that the definition of Q t i given in Part 3 is consistent.This is necessary due to the overlapping of the statements, namely, for every odd t other than 1 and 2n + 1, the sequence Q t i is defined twice, once as Q 2j−1 i for j = ⌈ t 2 ⌉, and another time as However, these sequences of values are well-defined because the definitions of Q 2j−1 i and Q 2j ′ +1 i match for any combination of j and j ′ = j − 1, as shown in the following table.
Now, we prove Parts 2 and 3 of the lemma.Assume Π is an admissible plan with induced assignment σ Π = σ.The proof proceeds by a double induction on i and j.In particular, we prove the validity of the three statements of type , assuming that all statements of type Q t i ′ (for any i ′ < i and any t) and that all statements of type i (for any j ′ < j) already hold.We first prove the validity of and (b) corresponds to the initial state of v i1 , . . ., v in (note that Case (c) cannot hold for j = 1).When j > 1 we know that, since the statements are consistent, Next, we prove the statements relative to Q 2j i and Q 2j+1 i .Consider the variable v ′ that precedes v i1 in the causal graph, and values number 2j − 1, 2j, and 2j + 1 it takes on during the execution of Π.If i = 1, then v ′ = v s and the values are x, m j , x.If i > 1, then v ′ = v (i−1)n and, by induction on i, the values are a x , a m j , a x if j < T i−1 and j < n; The proof is divided into 6 parts, depending on the values of j and T i .
I) 1 = j < T i .Consider the following table, where we write m instead of m j = m 1 to simplify the notation.
The three rows of the table correspond to values number 2j − 1, 2j, and 2j + 1 of variables v ′ , v i1 , . . ., v in .The first column corresponds to the possible values that the predecessor v ′ of v i1 can take on.The first row is given by Q 2j−1 i , while the second and third rows, to be filled, correspond to Q 2j i and Q 2j+1 i .
Let A 2j be the operator causing the 2j-th value of v i1 .According to the previous table, the pre-condition of A 2j must be compatible with that is, the values of variables v ′ and v i1 when A 2j is applied.Since T i > 1, σ Π (x 1 ) = m 1 does not satisfy clause C i , so the operator A 2j must be one of those labelled ( 2) and ( 4) in Table 3. (Only one of these operators is applicable, depending on the value of m 1 and whether v ′ is v s or v (i−1)n .)In either case, the application of A 2j causes the value of v i1 to become b m 1 , so we can fill in a blank in the previous table.
In the same way, we can check that A 2j+1 , the operator causing the (2j + 1)-th value of v i1 , must be one of those labelled (7) in Table 3; the new value of v i1 is c x .As for the remaining variables, it is easy to check that variables v i2 , . . ., v in become a m 1 , due to operators of type ( 14), and then become a x , due to operators of type ( 18).The table is now complete: This shows that Case (a) of Lemma 4.13 holds when j = 1 and T i > 1.
II) 1 = j = T i .The proof is similar to that of Case (I).Since As a result, the admissible operators for causing the 2j-th value of v i1 are now those labelled ( 1) and ( 3).In either case, the value of v i1 becomes g m 1 .
Consequently, the admissible operators for v i2 , . . ., v in are different from before.This is the resulting table: In this case, as in the remaining ones, we just show the resulting table.
We always write m = m j .In what follows, we omit the column for v ′ since its possible values are always the same.
It just remains to check that Case (a) of Lemma 4.13 follows from parts (I) and (III), Case (b) from parts (II) and (IV), and Case (c) from parts (V) and (VI).This proves Part 2 and 3 of the lemma.
Finally, note that the existence of an admissible plan Π directly follows from the previous discussion, since we have always specified which operators should be used in every situation, and not just assumed their existence.This proves Part 1 of the lemma.
Theorem 4.14.There exists a plan that solves the planning problem P 11 (F ) if and only if there exists an assignment σ that satisfies the CNF formula F .
Proof.⇐: Given an assignment σ that satisfies F , construct an admissible plan Π whose induced formula assignment σ Π equals σ, by choosing the sequence of values of v s accordingly.It follows that T i ≤ n for each clause C i , since there exists a variable x j such that σ Π (x j ) = m j satisfies C i .Then, Q 2n+1 i has the form indicated in Case (b) or (c) of Lemma 4.13.In either case, the (2n + 1)-th value of variable v in is g x , as required by the goal state.The plan Π thus solves P 11 (F ).
⇒: Let Π be a plan that solves the planning problem P 11 (F ).By Lemma 4.8 the plan Π is admissible.We show by contradiction that σ = σ Π satisfies F .Assume not.Then there exists a clause C i not satisfied by σ, implying T i = n + 1.Since n < T i , the (2n + 1)-th value of variable v in is c x according to Case (a) of Lemma 4.13.This contradicts Π solving P 11 (F ), since the goal value of v in is not c x but g x .
Proposition 4.15.Plan existence for C 11 n is NP-hard.
Proof.The largest variable domains of the planning problem P 11 (F ) are those of variables v 11 , . . ., v kn , which contain 11 values.The proof follows immediately from the well-known NP-hardness of Cnf-Sat, Theorem 4.14, and the fact that we can produce the planning problem P 11 (F ) in polynomial time given the CNF formula F .

Example
We illustrate the reduction using a small example CNF formula F = (x 1 ∨ x 2 ) on one clause and two variables x 1 and x 2 .The variable set of the corresponding planning problem 1 , e 2 , e 3 }.An admissible plan Π can induce any of four different messages (0, 0), (0, 1), (1, 0), and (1, 1).Only the message (0, 0) corresponds to an assignment that does not satisfy F .A plan Π that solves P 11 (F ) with induced message (0, 1) appears in Table 5.Note that, following execution of the plan, the goal state goal = (v 12 = g x , v e = 0, e 1 = 1, e 2 = 0, e 3 = 1) is satisfied as desired; the last value change of each variable appearing in the goal state is marked using boldface.

C 5 n Is NP-hard
In this section, we describe a reduction from Cnf-Sat to C 5 n .To each CNF formula F we associate a planning problem P 5 (F ).For each clause C i and variable x j of F , P 5 (F ) contains two state variables v 1 ij , with domain Table 5: A plan that solves the planning problem P 11 (F ) for the example formula F .
state variables s 1 , . . ., s 2n−1 , v s , v e , e 1 , . . ., e 2n−1 , as well as their domains and corresponding operators, are the same as before, except the predecessor of v e is now v 2 kn .The initial state on the new state variables is init(v .k] and j ∈ [1.
.n], and Figure 6 shows the corresponding DTGs.Table 6 also lists the new operators for variable v e , which have different pre-conditions now that the predecessor of v e is v 2 kn .

Intuition
The reduction for C 5 n is based on the following idea: instead of using an explicit value to remember that a clause has been satisfied, the goal is to remain in the initial value a x .This way we were able to reduce the size of the variable domains needed for the reduction.Somewhat surprisingly, the new reduction uses fewer total operators than that for C 11 n .
Our reduction for C 5 n also uses another new idea.In the reduction for C 11 n , information was propagated forward, i.e., variable v ij changed its value according to the value of its predecessor v i(j−1) .The reduction for C 5 n , however, is constructed such that some information is propagated forward (in particular, the bits of the message) but other information is propagated backwards (the index of the bit we are currently checking).The planning problem is arranged such that a variable v may have several applicable operators, but only one of them satisfies the pre-condition of an applicable action for its successor v ′ .The result is that the value of v at time t + 1 depends on the value of v ′ at time t.
We explain the planning problem P 5 (F ) in a bit more detail.Due to the backward propagation mechanism, the bits of the message are checked in reverse order.In other words, v in now checks the first bit, v i(n−1) checks the second bit, and v i1 checks the n-th bit.The purpose of v 2 ij is to check whether the (n − j + 1)-th bit satisfies the clause C i , whereas the purpose of v 1 ij is to inform v 2 i(j−1) that the (n − j + 2)-th bit has arrived.Implicitly, v 1 ij also keeps track of whether C i has been satisfied after the first (n − j + 1) bits.
Assume without loss of generality that the message is 0 in has to move to b 0 .This requires v 1 in = a 0 as a pre-condition, which in turn requires state variables v l ij , j ∈ [1..n − 1] and l ∈ {1, 2}, to be in a 0 .Next, v 2 in has to move back to a x , which requires the pre-condition v 1 in = b x .In turn, this requires state variables v l ij , j ∈ [1..n − 1] and l ∈ {1, 2}, to be in a x .When v 1 in moves again it is from b x to a 0 , requiring v 2 i(n−1) = b 0 as a pre-condition.We see that, as long as the clause remains unsatisfied, v 1 ij is in b x following the (n−j +1)th bit.In particular, this means v 1 i1 is in b x following the last bit.Assume now that the (n − j + 1)-th bit satisfies clause C i .When v 2 ij moves from b 0 to a x , this requires v 1 ij to move to a x instead of b x .From there, there is no way for v 1 i(j−1) to be in b x following the (n − j + 2)-th bit.In particular, v 1 i1 will be in a x following the last bit, satisfying the goal state.

Formal Proof
The proof for C 5 n is organized much in the same way as that for C 11 n .Note that variables s 1 , . . ., s 2n−1 , v s , v e , e 1 , . . ., e 2n−1 are the same as before, so Lemmas 4.2 and 4.6 still apply to P 5 (F ).It is easy to check that Lemmas 4.3, 4.5 and 4.8 also hold for P 5 (F ).However, Lemma 4.4 no longer holds, since several operators share the same preconditions, namely operators (2) and ( 3), ( 5) and ( 6), ( 8) and (10), and ( 11) and ( 13).In spite of this, the operators and sequences of values of an admissible plan Π are completely determined by its induced message m Π , just as for P 11 (F ) (as shown in Lemma 4.10): Lemma 5.1.Let Π be an admissible plan for P 5 (F ) and let m Π be its induced message.The operators in Π for changing the value of variable .n], and l ∈ {1, 2}, as well as the sequence of values that variable v l ij takes on during the execution of Π, are completely determined by m Π .
Proof.First consider variable v 1 11 , and assume without loss of generality that its value is a 0 .Given (v s = x), there are two applicable operators for v 1 11 , namely (2), changing its value to a x , and (3), changing its value to b x .At first sight, an admissible plan Π can choose either.However, for Π to be admissible, it has to change the value of v 2 11 in between each pair of value changes for v 1 11 .Note that when v 1 11 = a 0 , v 2 11 can have either of two values, namely a 0 or b 0 .If the value of v 2 11 is a 0 , the only admissible operator for v 2 11 is ( 12), which has pre-condition v 1 11 = a x .Thus, if Π changes the value of v 1 11 to b x it is no longer admissible, so it has to choose operator (2).If the value of v 2 11 is b 0 , the correct choice depends on the CNF formula F .If x n satisfies clause C 1 , the only admissible operator for v 2 11 is ( 16) with pre-condition v 1 11 = a x , so Π should choose operator (2).Otherwise, the only admissible operator for v 2 11 is (17) with pre-condition is v 1 11 = b x , so Π should choose operator (3).In either case, the operator choice for v 1 11 is forced given the value of v 2 11 .The same reasoning applies to variables .k] and j ∈ [1..n − 1], and the corresponding operators that share the same pre-conditions.The only degree of freedom of an admissible plan is selecting its induced message m Π by choosing the operators for v s accordingly.The remaining operator choices and, consequently, sequences of values are completely determined by the induced message m Π .
We now prove a lemma similar to Lemma 4.13, establishing the sequence of values taken on by state variables in P 5 (F ) during the execution of an admissible plan.
Definition 5.2.Let Π be an admissible plan for P 5 (F ).For each clause C i and each t ∈ [1..2n + 1], let the sequence of values Q t i (Π) be the vector of 2n elements representing, for each variable v l ij , j ∈ [1.
.n] and l ∈ {1, 2}, the t-th value taken on by variable v l ij during the execution of Π.Let us denote this value by Q t (Π)[v l ij ].We define the diagonal value q i j (Π), for i ∈ [1.
2) Claim.Let q i j be as described in Part 3) of this lemma.All admissible plans Π with σ Π = σ have the same diagonal values q i j (Π) = q i j for each i ∈ [1.
3) Diagonal values.The diagonal values q i j , for i ∈ [1.
a) If j < T i , then Proof.Note that, according to Lemma 5.1, not only the diagonal values q i j (Π), but also the full sequences of values Q t i (Π), are completely determined for an admissible plan Π.We have to prove, then, that admissible plans exist for any assignment σ, as claimed in Part 1, and that the diagonal values match the expression given in Part 3. We prove these two facts by doing a careful, general analysis of the planning problem P 5 (F ), and then explaining how this analysis implies the lemma.Incidentally, the sequences of values Q t i (Π) can also all be b x , according to Rule III.On the contrary, if we assume j ≥ T i as in Case (b), then it follows that q i p = b x for p < T i due to Rule III, that q i p = a x for p = T i due to Rule II, and that q i p = a x for j ≥ p > T i due to Rule I.
Theorem 5.4.There exists a valid plan for solving the planning problem P 5 (F ) if and only if there exists an assignment σ that satisfies the CNF formula F .
Proof.⇐: By Lemma 5.3, the existence of an assignment σ that satisfies F implies that all admissible plans Π with σ Π = σ satisfy q i j (Π) = q i j .Since T i ≤ n for all i ∈ [1.
.k], it follows that q i n = a x , as required by the goal state of P 5 (F ).The plan Π thus solves P 5 (F ).⇒: Let Π be a plan solving the planning problem P 5 (F ).Since Lemma 4.8 holds for P 5 (F ), the plan Π is admissible.We show by contradiction that σ = σ Π satisfies F .Assume not.Then there exists a clause C i not satisfied by σ.Thus, Lemma 5.3 implies that q i j (Π) = b x for all j ∈ [1.
.n].In particular, the value of v 1 i1 following the execution of Π is b x .This contradicts Π solving P 5 (F ), since b x is different from the goal state goal(v 1 i1 ) = a x .
Proposition 5.5.Plan existence for C 5 n is NP-hard.Proof.The largest variable domains of the planning problem P 5 (F ) are those of variables v 2 ij , i ∈ [1.
.k] and j ∈ [1..n − 1], which contain 5 values.The proof follows immediately from the NP-hardness of Cnf-Sat, Theorem 5.4, and the fact that we can produce the planning problem P 5 (F ) in polynomial time given the CNF formula F .

Discussion
In this paper, we have shown that the problem of determining whether a solution plan exists for planning problems in the class C k n is NP-hard whenever k ≥ 5.In contrast, Brafman and Domshlak (2003)  In what follows, we sketch some arguments for and against tractability of these cases.Although the discussion is mostly based on intuition gained from studying these classes, it might prove helpful for someone trying to determine their complexity.
On one hand, it seems likely to us that plan existence for C 4 n is also NP-hard.Our reduction for C 5 n only uses one type of state variable whose domain is larger than 4, namely v 2 ij .Finding a reduction for C 4 n seems possible, although it will likely be difficult since the available options become increasingly restricted as the state variable domains get smaller.In particular, we tried but failed to find a reduction for C 4 n .Domshlak and Dinitz (2001) showed that there exist planning problems in C 3 n with exponential length minimal solutions.Although this often indicates that a planning class is difficult, it does not imply that plan existence is intractable.This is exemplified by Jonsson and Bäckström (1998) who define a class of planning problems with exponential length minimal solutions but where plan existence could be checked in polynomial time.The present authors (Giménez & Jonsson, 2008a) showed that even plan generation for this particular class could be done in polynomial time, if the resulting plans are given in a compact format such as macros.
A second argument in favor of the hardness of C 3 n is that there may be multiple ways to transition between two values of a variable.For example, consider a planning problem such that there are two actions for changing the value of a variable v from 0 to 1, namely a = v ′ = 0, v = 0; v = 1 and a ′ = v ′ = 1, v = 0; v = 1 .Since variables can have 3 values, it is possible that neither v ′ = 0 nor v ′ = 1 hold in the current state.A planner would thus have to choose whether to satisfy v ′ = 0 or v ′ = 1.In contrast, for C 2 n the same two actions could be replaced by a single action v = 0; v = 1 since one of a and a ′ is always applicable.As a consequence, even if the minimal plan length is bounded for a planning problem in C 3 n , there may be exponentially many plans of that length (in fact, this is the main idea behind our reductions).
Another observation regards the number of possible domain transition graphs for each state variable.For each k ≥ 2, it is possible to show that a state variable in C k n may have 2 k 2 (k−1) distinct domain transition graphs.In other words, the number of graphs grows exponentially in k.In particular, while state variables in C 2 n can only have 2 4 = 16 distinct graphs, the same number for C 3 n is 2 18 .Although a large number of possibilities does not guarantee hardness, it is clear that the expressive power of C 3 n is much higher than that of C 2 n .The evidence provided above suggests that C 3 n is significantly harder than C 2 n .However, we are not sure that C 3 n is hard enough to be intractable.State variables with just three values do not lend themselves well to the type of reduction we have presented, since just propagating the message requires three values.If there is such a reduction for C 3 n , the idea underlying it may not be the message-passing mechanism we have exploited.On the other hand, maybe there is some way to determine plan existence of C 3 n in polynomial time.Such an algorithm would take into consideration the multiple (but finite) combinations of domain transition graphs of three values, as well as any inherent structure of the graphs.We know that the expressive power of domain transition graphs of 5 values is just too large to handle in polynomial time; maybe this is not the case when using just 3 values.

Variable
Ref.
2. Check whether the assignment to x j (the j-th bit of m) satisfies the clause C i .
3. Remember whether C i was satisfied by the assignment to some x l , l ≤ j.
4. If j < n and C i has been satisfied, propagate this fact.
5. If j < n, let v i(j+1) know when the (j + 1)-th bit of the message has arrived.
The first and fourth function is to propagate information and thus has to be performed by all state variables if information is not to be lost.However, the other functions can be performed by different state variables.The idea behind the reduction for C 7 n is to split v ij into three variables: v 1 ij , that performs the second function, v 2 ij , that performs the third, and v 3 ij , that performs the fifth.Just as before, the message m is propagated using the subscripts of values in the domains of state variables.When the j-th bit m j of the message arrives, state variable v 1 ij moves from a x to g x if the assignment σ(x j ) = m j satisfies C i , and to b m j otherwise.If v 1 ij moves to g x , it is forced to move to b m j next, forgetting that C i was satisfied.However, while the value of v 1 ij is g x , all subsequent state variables for C i can also move to g x , propagating the fact that C i has been satisfied.Consequently, state variable v 2 in is able to remember that C i has been satisfied by remaining within the subdomain {g 0 , g 1 , g x }.
If σ(x j ) = m j does not satisfy C i , v 1 ij moves to b m j , causing v 2 ij and v 3 ij to move to a m j .From there, v 1 ij , v 2 ij , and v 3 ij all move to b x .When the next bit arrives, v 1 ij moves to b 0 (b 1 ), causing v 2 ij to move to a 0 (a 1 ) and v 3 ij to b 0 (b 1 ).This indicates to v 1 i(j+1) that the (j + 1)-th bit has arrived, causing it to act accordingly.Just as before, the operators are defined such that v 1 i1 always reacts to the first bit for each clause C i .

A.2 Formal Proof
Since variables s 1 , . . ., s 2n−1 , v s , v e , e 1 , . . ., e 2n−1 are the same as before, Lemmas 4.2 and 4.6 both apply to P 7 (F ).However, Lemma 4.3 is violated since it is sometimes possible to change the value of a variable twice without changing the value of its predecessor (e.g. using operators (1) and ( 5)).Consequently, Lemma 4.8, which states that all plans that solve P 11 (F ) are admissible, no longer holds for P 7 (F ).
To prove equivalent lemmas for P 7 (F ), we redefine Π(v l ij ) for variables in the middle of the causal graph: Definition A.1.Given a partial plan Π and variable v l ij , i ∈ [1..k], j ∈ [1.
Proof.Follows immediately from inspection of the operators for v l ij .Each operator that changes the subscript of v l ij to z ∈ {0, 1, x} has a pre-condition on v ′ with subscript z (or value z in the case of v 1 11 and its predecessor v s ).There are operators for changing the value of v 1 ij to g x that have a pre-condition on v ′ with a subscript (or value) different from x, but these operators do not change the subscript of v 1 ij since their pre-condition on v 1 ij is a x .
Lemma A.3.For each partial plan Π for P 7 (F ), Π(v e ) ≤ Π(v 3 kn ).Proof.Note that Π(v e ) still denotes the number of value changes of v e , while Π(v 3 kn ) denotes the number of subscript changes of v 3 kn .Each time we change the value of v e we need to change the subscript of v 3 kn in between.In addition, the first value change of v e requires a subscript for v 3 kn different from that in the initial state.Thus, Π(v e ) ≤ Π(v 3 kn ).In other words, an admissible plan has to change the subscript of each v l ij exactly 2n times, although it can change the value of v l ij an extra time by moving through g x .However, even with the new definition of Π(v l ij ), we cannot prove an equivalent of Lemma 4.10 for P 7 (F ), since a variable v l ij , l ∈ {1, 2}, can choose not to follow its predecessor to g x without making the plan inadmissible.Consequently, the sequences of values Q t i (Π) of an admissible plan Π are no longer completely determined by the induced message m Π .Nevertheless, we can still prove a lemma similar to Lemma 4.13.Definition A.6.Let Π be an admissible plan.For each clause C i and each t ∈ [1..2n + 1], let the sequence of values Q t i (Π) be the vector of 3n elements representing, for each variable v l ij , j ∈ [1.
.n] and l ∈ {1, 2, 3}, the first value following the (t − 1)-th subscript change of v l ij during the execution of Π. Lemma A.7.Let σ be an assignment of variables x 1 , . . ., x n of formula F . 1) Existence.There exists an admissible plan Π of planning problem P 7 (F ) with induced assignment σ Π = σ.
2) Claim.Let Q t i be the sequences of values described in Part 3) of this lemma.If σ satisfies F , then there exists an admissible plan Π with σ Π = σ such that Q t i (Π) = Q

Figure 1 :
Figure 1: Example causal graph of a planning problem in the class C k 5 .

Figure 2 :
Figure 2: Causal graph of the planning problem P 11 (F ).

Figure 4 :
Figure 4: DTGs of (a) v 11 , (b) v i1 for i > 1, and (c) v ij for j > 1. Dashed edges are explained in the text.
t i , for all t ∈ [1..2n+1] and i ∈ [1..k].If σ does not satisfy clause C i , then all admissible plans Π with σ Π = σ have Q t i (Π) = Q t i , for all t ∈ [1..2k + 1]. 3) Sequence of values.The sequence of values Q t i , for i ∈ [1..k] and t ∈ [1..2n + 1], is as follows.a) If j < T i , then Q 2j−1 i = j−1 b x b x b x • • • b x b x b x a x a x a x n−j a x a x a x • • • a x a x a x Q 2j i = b m a m b m • • • b m a m b m b m a m a m a m a m a m • • • a m a m a m Q 2j+1 i = b x b x b x • • • b x b x b x b x b x b x a x a x a x • • • a x a x a x

Table 1 :
. The class C n contains planning problems with Overview of the complexity results for the class C k n .
• • • 0. Let us see what happens if the corresponding assignment does not satisfy the clause C i .Upon arrival of the first bit, state variable v 2 developed a polynomial-time algorithm for generating plans that solve planning problems in the class C 2 n .What can be said about the intermediate cases, namely C k n for k ∈ {3, 4}?