Unified Planning

raw JSON →
1.3.0 verified Sat May 09 auth: no python

Unified Planning is a Python framework for AI planning that provides a common API for modeling planning problems and using different planning engines. It supports PDDL, STRIPS, temporal and numeric planning, and integrates multiple solvers (e.g., Fast Downward, ENHSP). Current version is 1.3.0, with regular releases.

pip install unified-planning
error ModuleNotFoundError: No module named 'unified_planning'
cause Package not installed or installed under different name.
fix
Run 'pip install unified-planning' and ensure correct package name (with hyphen).
error AttributeError: module 'unified_planning' has no attribute 'shortcuts'
cause Incorrect import or old version without shortcuts.
fix
Upgrade to latest version: 'pip install --upgrade unified-planning'
error NameError: name 'Engine' is not defined
cause Using old import path for engine.
fix
Change to 'from unified_planning.engines import Engine'
breaking In v1.0, UPEngine was renamed to Engine. Code using UPEngine will break.
fix Replace 'from unified_planning.engines import UPEngine' with 'from unified_planning.engines import Engine'
gotcha The unified_planning.shortcuts module is designed for interactive use; for production, import specific classes.
fix Use 'from unified_planning.shortcuts import Problem, ...' or import from submodules directly.
gotcha Engine names are case-sensitive and depend on solver installation (e.g., 'fast_downward' vs 'pyperplan').
fix Check available planners with engine_selector().engines

Creates a simple planning problem with one action and solves it using a oneshot planner.

from unified_planning.shortcuts import *

problem = Problem('quickstart')
problem.add_fluent('x', IntType())

action = InstantaneousAction('a')
action.add_precondition(Equals(problem.fluent('x'), 0))
action.add_effect(problem.fluent('x'), Plus(problem.fluent('x'), 1))
problem.add_action(action)

problem.set_initial_value(problem.fluent('x'), 0)
problem.add_goal(Equals(problem.fluent('x'), 1))

with OneshotPlanner(problem_kind=problem.kind) as planner:
    plan = planner.solve(problem)
    if plan:
        print('%s plan found: %s' % (planner.name, plan))
    else:
        print('No plan found.')