Planning Fundamentals

Master how AI agents break down complex goals into executable steps

Handling Constraints & Goals

In the real world, plans must respect constraints: limited time, budget, resources. The planner must find solutions that satisfy all constraints while optimizing for goals.

Types of Constraints

Hard Constraints
Must be satisfied, no exceptions
• Flight must arrive before meeting
• Budget cannot exceed $10,000
• Task requires Python 3.8+
Soft Constraints
Preferences, can be violated if needed
• Prefer morning flights
• Try to stay under $5,000
• Use latest library version
Resource Constraints
Limited availability of resources
• Only 3 developers available
• 8GB RAM maximum
• 100 API calls per hour
Temporal Constraints
Time-based restrictions
• Must complete within 2 days
• Task B starts after Task A
• Service available 9am-5pm

Interactive: Constraint Solver

Adjust constraints with sliders to see which plans become feasible

Package Delivery

Optimize delivery route with time and cost constraints

Delivery Time2 hours
Fuel Cost50 $
Package Priority3 level
Available Plans:
Direct Route✗ Violates
Time:1.5h
Cost:$80
Quality:100%
Eco Route✗ Violates
Time:2.5h
Cost:$40
Quality:90%
Budget Route✗ Violates
Time:4h
Cost:$25
Quality:70%

Optimization Under Constraints

When multiple feasible plans exist, optimize for your primary goal:

Minimize Cost
Find cheapest plan that meets all constraints
argmin(cost) where all_constraints_satisfied
Minimize Time
Find fastest plan regardless of cost
argmin(time) where all_constraints_satisfied
Maximize Quality
Best outcome within constraints
argmax(quality) where time ≤ T and cost ≤ C
Multi-Objective
Balance multiple goals with weights
optimize(0.5*quality - 0.3*cost - 0.2*time)

CSP Techniques for Planning

🔍
Backtracking Search
Try assignments, backtrack when constraints violated
Constraint Propagation
Eliminate invalid options early to prune search space
🎯
Heuristic Ordering
Tackle most constrained variables first
🔄
Local Search
Iteratively improve solution, handle soft constraints