Manuscript Offprint
arXiv:2609.03912Lose the Order, Keep the Hierarchy: Deordering HTN Plans
Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.
Abstract
Hierarchical Task Network (HTN) planning is a powerful planning formalism based on task decomposition. Although most of the literature studied plan generation, comparatively less attention has been paid to post-plan optimization. In particular, plan deordering has been extensively studied in classical planning but remains under-researched in the HTN setting. Plan deordering removes unnecessary ordering constraints between actions in a plan whilst keeping the plan valid. In this paper, we adapt two established plan deordering techniques from classical planning by extending the techniques to account for hierarchical decomposition constraints. We evaluate our proposed approaches on the IPC 2023 Partial-Order HTN benchmarks and we compare them against Optiplan, an HTN planner that generates partially ordered plans directly. Our results show a substantial reduction in number of ordering constraints in both our implementations. Although we also observe a reduction in critical path length, the improvements are less pronounced.
Introduction
Hierarchical Task Network (HTN) planning (Erol, Hendler, and Nau 1994b) is planning by task decomposition; that is, recursively refining complex tasks until they become executable tasks. Among other planning formalisms, HTN planning is generally more expressive than STRIPS-style planning (Erol, Hendler, and Nau 1994a; Georgievski and Aiello 2015).
The main objective of an HTN planner is to determine how to refine an initial abstract (compound) task into a sequence of executable tasks. In simple terms, a plan is a sequence of primitive actions whose execution accomplishes a given task network. Existing HTN planners differ in the way they address an HTN problem. Some encode the given HTN problem into propositional logic in order to exploit existing specialized solvers (Behnke, Höller, and Biundo 2019; Schreiber et al. 2019; Schreiber 2021; Quenard, Pellier, and Fiorino 2024, 2025). Alternatively, other planners make use of heuristic search (Höller et al. 2018, 2019, 2020), whereas others translate HTN problems to a classical planning problem in order to exploit classical planners (Alford et al. 2016; Behnke et al. 2022).
While most HTN planning research has extensively studied plan generation, fewer works have addressed plan optimization (Behnke, Höller, and Biundo 2019; Behnke and Speck 2021). In their recent survey, Bercher, Haslum, and Muise (2024) define plan optimization as the task of improving a plan that has already been generated, and they also highlight several optimization techniques.
In practice, one important aspect of plan quality is plan-order flexibility. In some real-world applications of HTN planning, a totally ordered plan imposes unnecessary ordering constraints at the expense of efficiency. For example, in a firefighting mission, a totally ordered plan could enforce that action dispatch-ground-crew be executed before dispatch-helicopter. However, these two actions do not interfere and thus removing the ordering constraint between these two actions results in a flexible partial-order plan. Executing actions in parallel might improve execution speed and flexibility. This approach of post-plan optimization by removing ordering constraints on a plan while keeping it a valid plan is known as deordering and has been extensively studied in the classical planning sense (Bäckström 1998; Kambhampati and Kedar 1994; Muise, McIlraith, and Beck 2012; Bercher and Olz 2020; Siddiqui and Haslum 2015; Muise, Beck, and McIlraith 2016). In particular, Muise, Beck, and McIlraith (2016) improved deordering methods by using partially weighted MaxSAT which computes the minimal deorderings. A minimum deordering is a deordered plan in which one cannot remove any additional ordering constraints without invalidating the plan.
To the best of our knowledge, no prior work has explicitly studied plan deordering under HTN decomposition constraints. Although there is not much done in terms of HTN plan deordering, a few planners try to pursue a similar goal of having a partially ordered plan. One such planner is OptiPlan by Firsov (2025), which produces a partially ordered plan directly. This motivates our interest in studying deordering in HTN planning. Our contributions in this paper are twofold. First, we adapt the PRF algorithm of Bäckström (1998) to the HTN setting, taking into account the hierarchical decomposition constraints. Second, we compute minimal deorderings using a MaxSAT approach of Muise, McIlraith, and Beck (2012), which we also adapt to the HTN setting.
We evaluate both implementations on the IPC 2023 Partial-Order HTN benchmarks. We apply the deordering techniques to plans generated by PANDA a partial-order planner (Höller 2023). As a baseline, we compare the performance of the post-plan optimization against Optiplan. The results show a significant decrease in both the number of ordering constraints and the critical-path length of the plans in the post-plan optimization.
The remainder of this paper is structured as follows: following this introduction, we introduce the formalisms used throughout the paper. Afterward, we present the two implemented algorithms followed by a discussion of the results. Finally, we provide directions for future work and conclude the paper.
STRIPS Planning Problem
For the purpose of this paper, whenever we mention propositional planning, we restrict it to the STRIPS formalism by Bylander (1996). In the STRIPS formalism, a planning task is defined as a tuple where refers to a set of propositional state variables, is a finite set of actions, is the initial state and is the goal condition. Each action is defined by a triple where is a set of preconditions, is a set of add effects, and is a set of delete effects. A state is the set of state variables that are true. Under the closed-world assumption, every variable in is considered false. An action is applicable in if and only if . The resulting successor state . A plan (solution) , is a sequence of actions which when successively applied from the initial state lead to a goal state. A partially ordered plan (PO plan) maintains a partial-order among actions (Bäckström 1998).
Hierarchical Task Network (HTN) Planning
In this section, we present the HTN planning formalism by Geier and Bercher (2011) that we are going to use for the rest of the paper. HTN planning is centered on task decomposition. A task consists of a task name and an associated list of parameters. In HTN, tasks are classified into two categories: abstract tasks and primitive tasks. A primitive task is analogous to an action in classical planning; that is, it can directly modify the state of the world. In contrast, abstract tasks cannot be executed directly and must be decomposed by applying decomposition methods.
A method m is defined as a tuple where c is an abstract task and tn a task network. We refer to c as the abstract task decomposed by method m, and to tn as the task network that replaces c when m is applied. The resulting task network consists of primitive and/or abstract tasks.
We now formally define a task network as follows:
Definition 1. (Task network). A task network over a set of task names is a tuple , where
• T is a finite set of tasks
- is a set of ordering constraints of the form where
• : assigns a task name to each task in the network.
denotes a set of all task networks over X. A task network comprising only primitive tasks is known as a primitive task network. In their paper, Geier and Bercher (2011) defined an executable task network as one that contains a linearization of its tasks that is executable.
Next, we define a HTN planning problem.
Definition 2. (Planning problem). A planning problem is a tuple , where
• L is a finite set of propositions
• C is a finite set of abstract tasks
• O is a finite set of primitive tasks (actions)
• a finite set of decomposition methods
• initial abstract task
• , the initial state
• g the goal condition (possibly empty).
We interpret each primitive task (action) as an action with preconditions and effects over , i.e., , , . This allows us to properly reason about adders and deleters. For proposition , let , and .
Definition 3. (Decomposition). A decomposition refines an abstract task of a given task network using a method with resulting in a new task network . The decomposition replaces with . We write for a single decomposition step and for an arbitrary number of decompositions.
We use a standard notion of decomposition trees of Geier and Bercher (2011), however, we adopt a simplified formulation that is sufficient for our purposes.
Definition 4. (Decomposition tree). Let be a decomposition tree that captures the refinement of an initial task network into a primitive task network. The root is the initial abstract task the primitive tasks are the leaves of the tree. The inner nodes represent the abstract tasks together with the methods. The tree induces a partial-order over its nodes.
Definition 5. (HTN solution). A task network is a solution to an HTN planning problem P if and only if:
-
is a primitive task network,
-
-
Any linearization of is executable in and satisfies g.
In this paper, we represent the HTN solution as where is a set of primitive tasks (actions); the ordering relations on these actions; represents the decomposition tree which captures the refinement of abstract tasks. Let, denote the mandatory ordering constraints that are induced by the decomposition methods. Since the constraints are part of they should be preserved.
HTN-PRF Algorithm
In this section, we extend the classical PRF algorithm of Bäckström (1998) by integrating the mandatory constraints induced by the decomposition hierarchy. The PRF algorithm
Algorithm 1: HTN-PRF algorithm
Input: Htn planning problem P, HTN solution , Output: A valid PO-HTN solution
1: for all such that do 2: if then 3: Order 4: else if then 5: Order 6: end if 7: end for 8: return
relies on simple concurrency to determine whether two distinct actions, and can execute in parallel. Their ordering can only be removed if they are not constrained by non-concurrency conditions.
Definition 6. (Simple concurrency). Let and be two distinct actions. Actions and are considered non-concurrent, denoted by if there exists an such that:
If any of the above conditions holds for any l, then we preserve the ordering constraint between and . In HTN planning, actions implicitly inherit the ordering constraints imposed by decomposition methods used during task refinement. These constraints should also therefore be conserved when deordering a plan.
Algorithm 1 iterates over all ordering constraints in the primitive HTN solution. For each pair of ordered primitive actions , the algorithm initially checks whether the ordering is induced by the decomposition tree. If so, the ordering is kept. Otherwise, the algorithm continues to perform the simple concurrency check. If the two actions are non-concurrent according to simple concurrency criterion, then we keep the ordering. Otherwise, the ordering between and is removed. The algorithm returns a partial-order HTN solution where is a set of actions, is a transitive closure of the ordering constraints and is the decomposition tree. Thus, the HTN-PRF algorithm only removes ordering constraints between and if the ordering is neither induced by the decomposition methods nor required by non-concurrency criteria.
Although the HTN-PRF deordering algorithm produces a partial-order plan, it does not guarantee an optimal deordering. To address this limitation, we propose an extension of the partial weighted MaxSAT algorithm of (Muise, McIlraith, and Beck 2012), which we refer to as HTN-MaxSAT deordering.
HTN-MaxSAT deordering
To generate optimal deorderings, we encode the deordering problem as a partial weighted MaxSAT problem. Given an HTN planning problem , let:
• be the primitive tasks (actions) of an HTN plan,
• be an initial dummy action,
• be a dummy goal action.
For every pair of actions , , we represent an ordering constraint between them using a variable . The encodings of Muise, McIlraith, and Beck (2012) used an action-membership variable to represent an action present in the partial-order plan. However, in our setting, this is not necessary as every action in must remain present in the final partial-order plan after deordering. Since all actions in are part of a valid HTN solution generated through the decomposition hierarchy, they must be preserved to maintain correctness.
Partial weighted MaxSAT allows us to differentiate between two types of clauses, namely, hard clauses and soft clauses. The objective of partially weighted MaxSAT is to satisfy all hard clauses and maximize the total weight associated with the soft clauses. We begin by presenting the hard clauses of our encoding.
Let be the set of mandatory ordering constraints induced by the decomposition methods. We must preserve all ordering constraints in :
Furthermore, we enforce additional structural properties of a valid partially ordered plan:
(2) forbids self loops; (3) ensures that each action is between and , we also assume ; (4) captures the transitive relations of the ordering constraints; the combination of (2) and (4) ensures our partial-order plan will be acyclic. For causal correctness, we define the following:
which forbids any action that deletes from occurring between and when produces for . Additionally, every precondition should be supported:
A combination of (5) and (6) enforces the condition that for each precondition of , there exists an action which adds and precedes , while forbidding any action that deletes from occurring between and .
To conclude the hard clauses, we ensure we only remove unnecessary ordering constraints without reversing the original ordering in our sequential plan. Assuming our sequential plan was originally ordered as then,:
For optimization, we add a soft unit clause for each ordering constraint that neither contains nor and is not induced by the hierarchy:
Evaluation
We conducted the experiments on a Linux laptop with an Intel(R) Core(TM) Ultra 9 185H processor and 32GB of RAM. Each problem instance was limited to a runtime of 30 minutes and 10GB of memory. We evaluate the effectiveness of our implementations using two metrics: (i) the number of ordering constraints, (ii) the length of the critical path. In this paper, we consider the critical path length as the longest chain of sequential actions. We compare our resulting partial-order plans to those produced by Optiplan (Firsov 2025). For our implementations , we also report the percentage improvements relative to the original plans denoted as %Diff in our tables.
We generate sequential plans using PANDA (Höller 2023) which are then used as input to our HTN-PRF and HTN-MaxSAT implementations. We conduct our experiments using the IPC 2023 Partial-Order HTN benchmarks. When we compare Optiplan to our implementations we only report domains and problem instances that are solved by all the approaches.
The values shown in the tables are the mean value for each of the domains. The percentage improvement (%Diff) for both the number of ordering constraints and critical path length are independently computed per domain relative to the original sequential plan. Given an init value (Init) and a deordered value (Final), we calculate (Init - Final)/Init × 100. The last row of the tables contain weighted values over all problem instances computed by weighing the mean by the number of instances.
To enhance readability we adopt a short-hand notation for our implementations, refers to HTN-PRF, whereas and OP refer to HTN-MaxSAT and Optiplan respectively.
| Domain | mean constraints | mean critical path | ||||
|---|---|---|---|---|---|---|
| OP | OP | |||||
| PCP (9) | 240.77 | 240.77 | 243.56 | 21.11 | 21.11 | 22.33 |
| Rover (4) | 32 | 28.50 | 522.75 | 7.00 | 6.70 | 25.75 |
| Satellite (25) | 46.12 | 46.12 | 30.32 | 8.72 | 8.72 | 6.60 |
| Transport (11) | 188.64 | 188.64 | 155.36 | 16.55 | 16.55 | 12.64 |
| Um-Translog (22) | 138.55 | 138.55 | 138.22 | 15.00 | 15.00 | 15.81 |
| ALL (71) | 120.72 | 120.52 | 137.90 | 13.35 | 13.34 | 13.46 |
Table 1: Mean ordering constraints and mean critical path of the partial-order plans. Numbers next to the domain names are the sum of problem instances evaluated for all methods
Table 1 reports the mean number of ordering constraints together with the mean critical path length of our two HTN approaches and Optiplan. In comparison, HTN-MaxSAT produces a plan with marginally lower mean number of ordering constraints to that of HTN-PRF. However, the difference is more pronounced when compared to Optiplan. This is despite the fact that Optiplan directly outputs a partial-order plan and the HTN approaches use a sequential plan generated by PANDA. The higher number of ordering constraints observed in Optiplan is due to Optiplan generating larger plans than those by PANDA. Across all approaches, the mean critical path length is comparable, with HTN-MaxSAT producing a partial-order plan with a slightly shorter mean critical path.
| Domain | ||||||
|---|---|---|---|---|---|---|
| Init | Final | %Diff | Init | Final | %Diff | |
| PCP (9) | 240.77 | 240.77 | 0 | 240.77 | 240.77 | 0 |
| Rover (4) | 39 | 32 | 17.95 | 39 | 28.50 | 26.92 |
| Satellite (25) | 63.76 | 46.12 | 27.67 | 63.76 | 46.12 | 27.67 |
| Transport (11) | 214.73 | 188.64 | 12.15 | 214.73 | 188.64 | 12.15 |
| Um-Translog (22) | 146.73 | 138.55 | 5.57 | 146.73 | 138.55 | 5.57 |
| ALL (71) | 133.90 | 120.72 | 9.84 | 133.90 | 120.52 | 9.99 |
Table 2: Ordering constraints percentage improvements
Table 2 shows that apart from the PCP domain, both HTN-PRF and HTN-MaxSAT achieve significant reductions in the number of ordering constraints in the partial-order plan. In particular, the largest improvement is observed in the Satellite domain using HTN-MaxSAT algorithm with a mean reduction of . HTN-MaxSAT performed at least as well as HTN-PRF in all domains and notably outperforms it in the Rover domain by close to . In domains such as Transport, we observe a correlation between number of trucks and number of ordering constraints removed. However, PANDA did not find solutions for most of the harder problems in Transport, which limits the observed improvements.
| Domain | ||||||
|---|---|---|---|---|---|---|
| Init | Final | %Diff | Init | Final | %Diff | |
| PCP (9) | 21.11 | 21.11 | 0 | 21.11 | 21.11 | 0 |
| Rover (4) | 9.25 | 7.00 | 24.32 | 9.25 | 6.70 | 27.57 |
| Satellite (25) | 10.96 | 8.72 | 20.44 | 10.96 | 8.72 | 20.44 |
| Transport (11) | 20 | 16.55 | 17.25 | 20 | 16.55 | 17.25 |
| Um-Translog (22) | 15.60 | 15.00 | 3.85 | 15.60 | 15.00 | 3.85 |
| ALL (71) | 14.99 | 13.35 | 10.91 | 14.99 | 13.34 | 11.03 |
Table 3: Critical path percentage improvements
The reduction in critical path length in Table 3 follow a similar pattern to the reductions in ordering constraints in Table 2. The largest percentage reduction is observed in the Rover domain. In contrast, the PCP domain remains totally ordered, with no reduction in both ordering constraints or critical path length.
Conclusion
In this paper, we proposed two approaches for HTN plan deordering. The first, HTN-PRF, preserves ordering constraints enforced by the hierarchy or required by simple concurrency and removes all others. The second, HTN-MaxSAT, encodes the problem as a partially weighted MaxSAT formulation and guarantees a minimal deordering for a given input plan.
Our results show that both approaches significantly reduce ordering constraints and the critical path length, resulting in more flexible partial-order plans. However, their effectiveness depends heavily on the quality of the input sequential plan. Although larger reductions were observed on harder instances, most harder instances were unsolved.
https://github.com/gaspard-quenard/sibylsat/tree/deordering
Acknowledgments
This work has been supported by the French National Research Agency (ANR) under the project ANR-24-CE10-0893 (Prod4Human).
References
Alford, R.; Behnke, G.; Höller, D.; Bercher, P.; Biundo, S.; and Aha, D. W. 2016. Bound to Plan: Exploiting Classical Heuristics via Automatic Translations of Tail-Recursive HTN Problems. In Proceedings of the Twenty-Sixth International Conference on Automated Planning and Scheduling, 20–28.
Bäckström, C. 1998. Computational Aspects of Reordering Plans. Journal of Artificial Intelligence Research, 9: 99–137.
Behnke, G.; Höller, D.; and Biundo, S. 2019. Bringing Order to Chaos - A Compact Representation of Partial Order in SAT-Based HTN Planning. In Proceedings of the Thirty-Third AAAI Conference on Artificial Intelligence, 7520–7529.
Behnke, G.; Höller, D.; and Biundo, S. 2019. Finding Optimal Solutions in HTN Planning - A SAT-based Approach. In Proceedings of the Twenty-Eighth International Joint Conference on Artificial Intelligence, 5500–5508.
Behnke, G.; Pollitt, F.; Höller, D.; Bercher, P.; and Alford, R. 2022. Making Translations to Classical Planning Competitive with Other HTN Planners. In Proceedings of the Thirty-Sixth AAAI Conference on Artificial Intelligence, 9687–9697.
Behnke, G.; and Speck, D. 2021. Symbolic Search for Optimal Total-Order HTN Planning. In Proceedings of the Thirty-Fifth AAAI Conference on Artificial Intelligence, 11744–11754.
Bercher, P.; Haslum, P.; and Muise, C. 2024. A Survey on Plan Optimization. In Proceedings of the Thirty-Third International Joint Conference on Artificial Intelligence, 7941–7950.
Bercher, P.; and Olz, C. 2020. POP ≡ POCL, right? Complexity Results for Partial Order (Causal Link) Makespan Minimization. In Proceedings of the Thirty-Fourth AAAI Conference on Artificial Intelligence, 9785–9793.
Bylander, T. 1996. A Probabilistic Analysis of Propositional STRIPS Planning. Journal of Artificial Intelligence, 81: 241–271.
Erol, K.; Hendler, J. A.; and Nau, D. S. 1994a. HTN Planning: Complexity and Expressivity. In Proceedings of the twelfth National Conference on Artificial Intelligence, 1123–1128.
Erol, K.; Hendler, J. A.; and Nau, D. S. 1994b. UMCP: A Sound and Complete Procedure for Hierarchical Task-network Planning. In Proceedings of the Second International Conference on Artificial Intelligence Planning Systems, 249–254.
Firsov, O. 2025. Automation of decision-making in Industry 4.0 with CSP-based temporal hierarchical planning. Ph.D. thesis, Université Grenoble Alpes, Grenoble, France.
Geier, T.; and Bercher, P. 2011. On the Decidability of HTN Planning with Task Insertion. In IJCAI 2011, Proceedings of the Twenty-second International Joint Conference on Artificial Intelligence, 1955–1961.
Georgievski, I.; and Aiello, M. 2015. HTN planning: Overview, comparison, and beyond. Artificial Intelligence, 222: 124–156.
Höller, D. 2023. The PANDA progression system for HTN planning in the 2023 IPC. In Proceedings of the Eleventh International Planning Competition: Planner Abstracts-HTN Planning Track.
Höller, D.; Bercher, P.; Behnke, G.; and Biundo, S. 2018. A Generic Method to Guide HTN Progression Search with Classical Heuristics. In Proceedings of the Twenty-Eighth International Conference on Automated Planning and Scheduling, 114–122.
Höller, D.; Bercher, P.; Behnke, G.; and Biundo, S. 2019. On Guiding Search in HTN Planning with Classical Planning Heuristics. In Proceedings of the Twenty-Eighth International Joint Conference on Artificial Intelligence, 6171–6175.
Höller, D.; Bercher, P.; Behnke, G.; and Biundo, S. 2020. HTN Planning as Heuristic Progression Search. Journal of Artificial Intelligence Research, 67: 835–880.
Kambhampati, S.; and Kedar, S. 1994. A Unified Framework for Explanation-Based Generalization of Partially Ordered and Partially Instantiated Plans. Journal of Artificial Intelligence, 29–70.
Muise, C. J.; Beck, J. C.; and McIlraith, S. A. 2016. Optimal Partial-Order Plan Relaxation via MaxSAT. Journal of Artificial Intelligence Research, 57: 113–149.
Muise, C. J.; McIlraith, S. A.; and Beck, J. C. 2012. Optimally Relaxing Partial-Order Plans with MaxSAT. In Proceedings of the Twenty-Second International Conference on Automated Planning and Scheduling, 358–362.
Quenard, G.; Pellier, D.; and Fiorino, H. 2024. SibylSat: Using SAT as an Oracle to Perform a Greedy Search on TO-HTN Planning. In Twenty-Seventh European Conference on Artificial Intelligence, 4157–4164.
Quenard, G.; Pellier, D.; and Fiorino, H. 2025. SibylSatOpt: a MaxSAT-based Greedy Optimal Search for TOHTN Planning. In Proceedings of the International Conference on Automated Planning and Scheduling, 236–244.
Schreiber, D. 2021. Lilotane: A Lifted SAT-Based Approach to Hierarchical Planning. Journal of Artificial Intelligence Research, 70: 1117–1181.
Schreiber, D.; Pellier, D.; Fiorino, H.; and Balyo, T. 2019. Tree-REX: SAT-Based Tree Exploration for Efficient and High-Quality HTN Planning. In Proceedings of the Twenty-Ninth International Conference on Automated Planning and Scheduling, 382–390.
Siddiqui, F. H.; and Haslum, P. 2015. Continuing Plan Quality Optimisation. Journal of Artificial Intelligence Research, 54: 369–435.