Back to Lecture 9

Backward Search Planning

Regression: Starting from the goal and working backward to the initial state

What is Backward Search?

Backward Search (Regression)

Backward search is a planning algorithm that starts from the goal and works backward toward the initial state.

Think of it like working backward from your destination: you know where you want to end up, and you figure out what steps could have gotten you there.

How It Works
  1. Start: Begin with goal state
  2. Find: Actions that achieve the goal
  3. Regress: Compute predecessor states
  4. Check: Can we reach initial state?
  5. Repeat: Continue from predecessors
Key Characteristics
  • Sound: Finds valid plans
  • Complete: Finds plan if it exists
  • ⚠️ Works with goals: Not ground states
  • 📊 Often more focused: Goal-directed
Backward Search Visual Overview
Goal
State
Find
Relevant Actions
Predecessor
States
Initial
State!

Simple Example: Backward Search with Robot Grasping

Let's walk through backward search step-by-step with the same robot grasping problem!

Problem Statement
Initial State:
At(Robot, RoomA) At(Box, RoomB) Empty(Robot)
Goal:
Holding(Robot, Box)

Available Actions: Move(from, to), Grasp(box)

Backward Search Step-by-Step
Step 0: Start with Goal
Current Goal Set:
Holding(Robot, Box)
Relevant Actions (achieve this goal):
Grasp(Box)
Effect: Adds Holding(Robot, Box) ✓
What must be true before Grasp(Box)? We need to find the preconditions!

Regress: Find preconditions of Grasp(Box)

Step 1: After Regressing Grasp(Box)
New Goal Set (Preconditions):
At(Robot, ?loc) At(Box, ?loc) Empty(Robot)
Robot and Box must be at same location!
Relevant Actions:
Move(RoomA, RoomB)
Effect: At(Robot, RoomB) ✓
Is this the initial state? Not yet - we need Robot at RoomB, but it starts at RoomA

Regress: Find preconditions of Move(RoomA, RoomB)

Step 2: After Regressing Move - INITIAL STATE REACHED!
Final Goal Set (Preconditions):
At(Robot, RoomA) At(Box, RoomB) Empty(Robot)
These match the initial state!
Initial State Reached!
Success! The current goal set is satisfied by the initial state
Solution Plan (Forward Direction)
Actions Sequence:
  1. Move(RoomA, RoomB)
  2. Grasp(Box)
Note: We worked backward, but execute forward!
Search Statistics:
  • Goal Sets Explored: 3
  • Regressions: 2
  • Plan Length: 2
  • Depth: 2
Key Insights
  • Backward search starts from goal
  • We find actions whose effects match the goal
  • We regress to find preconditions
  • We continue until we reach the initial state
  • The plan is executed in forward direction
Notice
  • We work with goal sets, not ground states
  • Actions are chosen by their effects, not preconditions
  • More focused than forward search
  • Same solution, different search direction!

The Regression Algorithm

The formal algorithm for backward state-space search:

function BACKWARD-SEARCH(problem) returns solution or failure
    // Initialize frontier with goal
    frontier ← {problem.GOAL}
    explored ← {}
    
    // NOTE: Similar to forward search but works backward!
    // We search from GOAL toward INITIAL state
    
    while frontier is not empty do
        // Choose a goal set from frontier
        g ← POP(frontier)
        
        // Check if initial state satisfies g
        if problem.INITIAL ⊇ g then
            return SOLUTION(g)
        
        // Mark goal set as explored
        explored ← explored ∪ {g}
        
        // Expand: find relevant actions
        for each action in RELEVANT-ACTIONS(g) do
            // Regress goal set through action
            predecessor ← REGRESS(g, action)
            
            // Add to frontier if not explored
            if predecessor ∉ explored and predecessor ∉ frontier then
                frontier ← frontier ∪ {predecessor}
    
    return failure
Key Data Structures
  • Frontier: Goal sets to explore
  • Explored: Already visited goal sets
  • Path: Sequence of actions (reversed)
Key Operations
  • RELEVANT-ACTIONS: Actions achieving goal
  • REGRESS: Compute predecessor goal
  • INITIAL ⊇ g: Check if initial satisfies g
Properties
  • Complete: Yes (if finite)
  • Optimal: Depends on strategy
  • Direction: Goal → Initial

Relevant Actions & Regression

Relevant Actions

An action is relevant to goal set g if:

  1. One of its effects is in g
  2. It doesn't delete any goal in g
Example

Goal: {At(Robot, RoomB)}

Move(RoomA, RoomB)
Effect: At(Robot, RoomB) ✓
Regression Function

Compute predecessor goal set:

REGRESS(g, a) = 
  (g - Add(a)) ∪ Precond(a)

Meaning: Remove what the action adds, and include what the action requires.

Example

g: {Holding(Robot, Box)}

Action: Grasp(Box)

Result:

g' = {At(Robot, ?loc), At(Box, ?loc), Empty(Robot)}
Regression Step-by-Step
Initial Goal
g = {On(B, C)}
Action: Stack(B, C)
  • Precond: {Holding(B), Clear(C)}
  • Add: {On(B, C), Clear(B), Empty}
  • Del: {Holding(B), Clear(C)}
Regressed Goal
g' = {Holding(B), Clear(C)}

Forward vs Backward Search

Forward Search VS Backward Search
Forward Search
Start: Initial State
Direction: Initial → Goal
States: Ground states (concrete)
Actions: Applicable (precond met)
Check: Is state = goal?
Successor: RESULT(s, a)
Best for: Many goals, few initial states
Backward Search
Start: Goal State
Direction: Goal → Initial
States: Goal sets (can have variables)
Actions: Relevant (effects match goal)
Check: Does initial satisfy goal?
Predecessor: REGRESS(g, a)
Best for: Few goals, many initial possibilities
When to Use Forward Search
  • Goal has many possible states
  • Initial state is well-defined
  • Want to find any valid goal
  • Example: Chess (many winning positions)
When to Use Backward Search
  • Goal is specific and well-defined
  • Initial state has many unknowns
  • Want to work goal-directed
  • Example: Assembly tasks (specific end configuration)

Key Takeaways

✅ Backward Search Strengths
  • Goal-directed (focused)
  • Works with goal sets (more general)
  • Can use variables
  • Often fewer branches
  • Good for specific goals
⚠️ Backward Search Challenges
  • More complex regression operation
  • Need to handle variables
  • Checking initial state satisfaction
  • Not always more efficient
  • Plan needs to be reversed
Summary
Start from Goal

Begin with what you want

Regress Through Actions

Find what's needed before

Reach Initial State

Check if achievable from start

The Big Picture: Forward and backward search are dual approaches to the same problem. Choose based on your domain characteristics! ← Back to Forward Search