STNPlan

class unified_planning.plans.STNPlan(constraints: List[Tuple[STNPlanNode, Real | None, Real | None, STNPlanNode]] | Dict[STNPlanNode, List[Tuple[Real | None, Real | None, STNPlanNode]]], environment: Environment | None = None, _stn: DeltaSimpleTemporalNetwork[Fraction] | None = None)[source]

Bases: Plan

Represents a STNPlan. A Simple Temporal Network plan is a generalization of a TimeTriggeredPlan, where the only constraints are among the start and the end of the different ActionInstances or among the start and the end of the plan.

An STNPlan is consistent if exists a time assignment for each STNPlanNode that does not violate any constraint; otherwise the STNPlan is inconsistent.

get_constraints() Dict[STNPlanNode, List[Tuple[Fraction | None, Fraction | None, STNPlanNode]]][source]

Returns all the constraints given by this STNPlan. Subsumed constraints are removed, this means that the constraints returned by this method are only the stricter.

The mapping returned is from the node A to the List of Tuple containing lower_bound L, upper_bound U and the node B. The semantic is L <= Time(A) - Time(B) <= U, where Time[STNPlanNode] is the time in which the STNPlanNode happen. L or U can be None, this means that the lower/upper bound is not set.

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

Returns a new STNPlan where every ActionInstance of the current plan is replaced using the given replace_function.

Parameters:

replace_function – The function that applied to an ActionInstance A returns the ActionInstance B; B replaces A in the resulting Plan.

Returns:

The STNPlan where every ActionInstance is replaced using 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.

is_consistent() bool[source]

Returns True if if exists a time assignment for each STNPlanNode that does not violate any constraint; False otherwise.

property environment: Environment

Return this plan’s Environment.

property kind: PlanKind

Returns the Plan kind