Inferensys

Glossary

SHOP (Simple Hierarchical Ordered Planner)

SHOP is a seminal forward-chaining Hierarchical Task Network (HTN) planning algorithm that interleaves task decomposition with state progression to generate executable action sequences.
Close-up editorial shot of diverse hands gesturing over a glowing holographic AI roadmap display on a WeWork smart table, warm ambient lighting, lifestyle-focused composition.
HIERARCHICAL TASK NETWORKS

What is SHOP (Simple Hierarchical Ordered Planner)?

A seminal, forward-chaining planning algorithm for Hierarchical Task Networks (HTNs) that interleaves task decomposition with state progression.

SHOP (Simple Hierarchical Ordered Planner) is a forward-search, progression-based algorithm for Hierarchical Task Network (HTN) planning. It decomposes high-level compound tasks into primitive actions by recursively applying decomposition methods in the order tasks are encountered, simulating their effects on a current world state as it plans. This interleaving of planning and state progression makes it highly efficient, as it can prune irrelevant branches early by checking preconditions against the simulated state.

The algorithm operates in a depth-first manner, following the ordering constraints in the task network. Its simplicity and efficiency made it a foundational model for domain-specific planning and influenced later systems for agent-based reasoning and workflow automation. Unlike backward-chaining planners, SHOP's forward search from the initial state makes it particularly effective for problems where the current world state heavily constrains viable decompositions.

SHOP (SIMPLE HIERARCHICAL ORDERED PLANNER)

Core Algorithmic Characteristics

SHOP is a seminal, domain-independent HTN planning algorithm that performs forward-chaining task decomposition in a depth-first manner, interleaving planning with state progression to generate executable action sequences.

01

Forward-Chaining State Progression

SHOP is a progression planner. It starts from the initial world state and simulates the execution of actions forward in time. As it decomposes tasks, it immediately applies the effects of chosen primitive actions to a working copy of the state. This interleaving of planning and state simulation allows SHOP to:

  • Evaluate the preconditions of methods and operators in the current, simulated state.
  • Prune irrelevant decomposition paths early, as methods whose preconditions are not met in the current state are not considered.
  • Efficiently handle numeric preconditions and resource constraints by tracking state changes in real-time during the search.
02

Depth-First Task Decomposition

The algorithm decomposes tasks using a depth-first recursive search through the hierarchy of methods. When faced with a compound task, SHOP:

  1. Selects an applicable method from the domain description.
  2. Decomposes the compound task into the method's specified subtask network.
  3. Immediately recurses on the first subtask in that network. This creates a commitment strategy where the planner fully decomposes one branch of the task hierarchy to a sequence of primitive actions before backtracking to explore alternatives. This is efficient for domains where correct high-level method choices lead directly to valid primitive plans.
03

Ordered Task Network Processing

A defining feature is its requirement for totally ordered task networks. Subtasks within a method's decomposition are provided in a strict linear order. The planner processes them sequentially:

  • The first subtask in the network is fully decomposed (if compound) or added to the plan (if primitive).
  • Only after it is completely resolved does SHOP proceed to the next subtask in the order. This simplifies the planning process by eliminating the need for complex partial-order planning algorithms to manage temporal constraints during search, making the algorithm simpler and often faster for domains where natural sequential order exists.
04

Primitive Action as Planning Operators

At the leaves of the decomposition tree are primitive tasks, which correspond directly to planning operators with executable semantics. In SHOP:

  • A primitive task is an operator name with parameters.
  • When SHOP selects a primitive task during decomposition, it instantiates the corresponding operator.
  • It checks the operator's preconditions against the current simulated state.
  • If satisfied, it applies the operator's effects to update the simulated state and appends the operator instance to the growing plan sequence. This direct mapping ensures the final output is a concrete, executable sequence of grounded actions.
05

Method Precondition Evaluation

The choice of how to decompose a compound task is governed by method preconditions. Each method has logical preconditions that are evaluated in the current simulated state at the moment the compound task is encountered.

  • Selection Mechanism: SHOP non-deterministically chooses any method whose preconditions are true.
  • Backtracking Point: If a chosen method leads to a dead-end (e.g., a subsequent primitive task's preconditions fail), the planner backtracks to this choice point to try a different applicable method.
  • Expressive Power: Preconditions can test for the presence/absence of facts, numeric quantities, and can include complex logical expressions, allowing the domain expert to encode sophisticated knowledge about when a decomposition strategy is appropriate.
06

Soundness and Completeness

Under standard assumptions, SHOP is a sound and complete planner for HTN domains with totally ordered task networks.

  • Soundness: Any plan returned by SHOP is guaranteed to be executable from the initial state and will achieve the top-level task (i.e., it is a valid solution).
  • Completeness: If a valid plan exists for the given problem, SHOP's search algorithm will find it, provided the domain description and search control are correctly formulated and the search space is fully explored (e.g., via backtracking). These formal guarantees are critical for deploying SHOP-based planners in safety-critical or mission-critical applications where plan correctness is non-negotiable.
HIERARCHICAL TASK NETWORKS

How the SHOP Planning Algorithm Works

SHOP (Simple Hierarchical Ordered Planner) is a seminal, forward-chaining algorithm for Hierarchical Task Network (HTN) planning that interleaves task decomposition with state progression.

SHOP is a forward state-space planner that decomposes tasks in the order they will be executed. Starting from the initial state, it selects a task from the current task network, applies a relevant decomposition method if the task is compound, and progresses the simulated world state as primitive actions are added. This interleaving of planning and execution simulation allows SHOP to efficiently prune irrelevant decomposition paths by evaluating preconditions against the current, forward-propagated state.

The algorithm operates depth-first, recursively decomposing the first task in the network until it reaches a primitive action, which it then 'executes' in its internal state model. This creates a totally ordered plan by construction. Its simplicity and efficiency stem from this ordered, state-forward search, making it foundational for domains where actions have deterministic effects and task order is critical, such as in classical planning benchmarks and early agent systems.

SHOP (SIMPLE HIERARCHICAL ORDERED PLANNER)

Frequently Asked Questions

Essential questions and answers about the SHOP algorithm, a foundational forward-search planner for Hierarchical Task Networks (HTNs).

SHOP (Simple Hierarchical Ordered Planner) is a seminal Hierarchical Task Network (HTN) planning algorithm that performs task decomposition in a forward, depth-first manner, interleaving planning with state progression. Unlike planners that search backward from goals, SHOP starts from the initial state and the initial compound task. It selects a task from the current task network, and if it's a primitive task (an executable operator), it applies its effects to advance the simulated world state. If the task is a compound task, SHOP selects an applicable method to decompose it into subtasks, which are added to the network. This process repeats, with the planner always working on the first task in the current ordered list, until all tasks are decomposed into a sequence of primitive actions—the solution plan. Its key innovation is this progression search, which allows it to evaluate preconditions in the context of a simulated, evolving world state, making it highly efficient for many practical domains.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.