symbolic.Pddl

class symbolic.Pddl

Bases: pybind11_object

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: symbolic.pysymbolic.Pddl, domain: str, problem: str, apply_axioms: bool = True) -> None

    Parse the pddl specification from the domain and problem files.

    Args:

    domain: Path to the domain pddl. problem: Path to the problem pddl. apply_axioms: Whether to apply axioms to the initial state.

    Example:
    >>> import symbolic
    >>> symbolic.Pddl("../resources/domain.pddl", "../resources/problem.pddl")
    symbolic.Pddl('../resources/domain.pddl', '../resources/problem.pddl')
    

    See also

    C++: symbolic::Pddl::Pddl().

  2. __init__(self: symbolic.pysymbolic.Pddl, domain: str) -> None

    Parse the pddl specification from the domain file without a problem.

    Args:

    domain: Path to the domain pddl.

    Example:
    >>> import symbolic
    >>> symbolic.Pddl("../resources/domain.pddl")
    symbolic.Pddl('../resources/domain.pddl', '')
    

    See also

    C++: symbolic::Pddl::Pddl().

Methods

__init__(*args, **kwargs)

Overloaded function.

add_object(self, name, type)

apply_actions(self, state, action)

Execute a sequence of actions from the given state

consistent_state(*args, **kwargs)

Overloaded function.

derived_state(self, state)

is_goal_satisfied(self, arg0)

is_valid(self[, verbose])

Evaluate whether the pddl specification is valid using VAL.

is_valid_action(self, state, action)

Evaluates whether the action's preconditions are satisfied.

is_valid_plan(self, arg0)

is_valid_state(*args, **kwargs)

Overloaded function.

is_valid_tuple(self, arg0, arg1, arg2)

list_valid_actions(self, arg0)

list_valid_arguments(self, arg0, arg1)

next_state(self, state, action)

Apply an action to the given state.

remove_object(self, name)

Attributes

actions

axioms

constants

derived_predicates

domain_pddl

goal

initial_state

Initial state for planning.

name

Pddl domain name.

object_map

objects

predicates

problem_pddl

state_index

add_object(self: symbolic.pysymbolic.Pddl, name: str, type: str) None
apply_actions(self: symbolic.pysymbolic.Pddl, state: Set[str], action: List[str]) Set[str]

Execute a sequence of actions from the given state

The action preconditions are not checked. The resulting state includes derived predicates.

Parameters:
  • state – Current state.

  • actions – Action calls in the form of "action(obj_a, obj_b)".

Returns:

Final state.

See also

C++: symbolic::Pddl::Execute.

consistent_state(*args, **kwargs)

Overloaded function.

  1. consistent_state(self: symbolic.pysymbolic.Pddl, state: Set[str]) -> Set[str]

    Applies the axioms to the given state.

    Args:

    state: Current state.

    Returns:

    Updated state.

  2. consistent_state(self: symbolic.pysymbolic.Pddl, state_pos: Set[str], state_neg: Set[str]) -> Tuple[Set[str], Set[str]]

    Applies the axioms to the given partial state.

    Args:

    state_pos: Positive propositions in partial state. state_pos: Negative propositions in negative state.

    Returns:

    Updated state.

derived_state(self: symbolic.pysymbolic.Pddl, state: Set[str]) Set[str]
property initial_state

Initial state for planning.

is_goal_satisfied(self: symbolic.pysymbolic.Pddl, arg0: Set[str]) bool
is_valid(self: symbolic.pysymbolic.Pddl, verbose: bool = False) bool

Evaluate whether the pddl specification is valid using VAL.

Parameters:

verbose – Print diagnostic information.

Returns:

Whether the pddl specification is valid.

Example

>>> import symbolic
>>> pddl = symbolic.Pddl("../resources/domain.pddl", "../resources/problem.pddl")
>>> pddl.is_valid()
True

See also

C++: symbolic::Pddl::IsValid().

is_valid_action(self: symbolic.pysymbolic.Pddl, state: Set[str], action: str) bool

Evaluates whether the action’s preconditions are satisfied.

Parameters:
  • state – Current state.

  • action – Action call in the form of "action(obj_a, obj_b)".

Returns:

Whether the action can be applied to the state.

Example

>>> import symbolic
>>> pddl = symbolic.Pddl("../resources/domain.pddl", "../resources/problem.pddl")
>>> pddl.is_valid_action(pddl.initial_state, "pick(hook)")
True
>>> pddl.is_valid_action(pddl.initial_state, "pick(box)")
False
is_valid_plan(self: symbolic.pysymbolic.Pddl, arg0: List[str]) bool
is_valid_state(*args, **kwargs)

Overloaded function.

  1. is_valid_state(self: symbolic.pysymbolic.Pddl, state: Set[str]) -> bool

    Evaluates whether the state satisfies the axioms.

    Args:

    state: Current state.

    Returns:

    Whether the state is valid.

  2. is_valid_state(self: symbolic.pysymbolic.Pddl, state_pos: Set[str], state_neg: Set[str]) -> bool

    Evaluate whether the partial state satisfies the axioms.

    Args:

    state_pos: Positive propositions in partial state. state_neg: Negative propositions in partial state.

    Returns:

    Whether the partial state is valid.

is_valid_tuple(self: symbolic.pysymbolic.Pddl, arg0: Set[str], arg1: str, arg2: Set[str]) bool
list_valid_actions(self: symbolic.pysymbolic.Pddl, arg0: Set[str]) List[str]
list_valid_arguments(self: symbolic.pysymbolic.Pddl, arg0: Set[str], arg1: str) List[List[str]]
property name

Pddl domain name.

Type:

str

next_state(self: symbolic.pysymbolic.Pddl, state: Set[str], action: str) Set[str]

Apply an action to the given state.

The action’s preconditions are not checked. The resulting state includes derived predicates.

Parameters:
  • state – Current state.

  • action – Action call in the form of "action(obj_a, obj_b)".

Returns:

Next state.

Example

>>> import symbolic
>>> pddl = symbolic.Pddl("../resources/domain.pddl", "../resources/problem.pddl")
>>> next_state = pddl.next_state(pddl.initial_state, "pick(hook)")
>>> sorted(next_state)
['inhand(hook)', 'inworkspace(hook)', 'inworkspace(shelf)', 'inworkspace(table)', 'on(box, table)']
remove_object(self: symbolic.pysymbolic.Pddl, name: str) None