HierarchicalPlan

class unified_planning.plans.HierarchicalPlan(flat_plan: SequentialPlan | TimeTriggeredPlan, decomposition: Decomposition)[source]

Bases: Plan

A HierarchicalPlan represents a solution to a HierarchicalProblem. It provides the combination of a “flat plan” a set of action with ordering information, and for each task in the initial task network, its decomposition into methods and primitive actions.

property decomposition: Decomposition

The decomposition of the initial task network.

property action_plan: SequentialPlan | TimeTriggeredPlan

A flat plan that contains hierarchical information.

actions() List[Tuple[str, ActionInstance]][source]

Returns a list of all actions in the plan, together with a unique and stable identifier.

methods() List[Tuple[str, MethodInstance]][source]

Returns a list of all methods in the plan, together with a unique and stable identifier.

replace_action_instances(replace_function: Callable[[ActionInstance], ActionInstance | None]) Plan[source]

This function takes a function from ActionInstance to ActionInstance and returns a new Plan that have the ActionInstance modified by the replace_function function.

If the returned ActionInstance is None it means that the ActionInstance should not go in the resulting Plan.

Parameters:

replace_function – The function that must be used on the ActionInstances that must be replaced.

Returns:

The new Plan in which every ActionInstance of the original Plan is modified by the given replace_function.

convert_to(plan_kind: PlanKind, problem: AbstractProblem) Plan[source]

This function takes a PlanKind and returns the representation of self in the given plan_kind. If the conversion does not make sense, raises an exception.

Parameters:
  • plan_kind – The plan_kind of the returned plan.

  • problem – The Problem of which this plan is referring to.

Returns:

The plan equivalent to self but represented in the kind of plan_kind.

property environment: Environment

Return this plan’s Environment.

property kind: PlanKind

Returns the Plan kind