MotionActivity
- class unified_planning.model.motion.MotionActivity(name: str, duration: int = 1, optional: bool = False, _env: Environment | None = None)[source]
Bases:
Activity,MotionConstraintsSetMixinThis class represents a motion activity.
- property motion_effects: Dict[FNode, FNode]
Returns the dict mapping each movable expression to its target configuration expression.
- add_motion_effect(movable: Timing | Timepoint | int | float | Fraction | FNode | Fluent | Parameter | Variable | Presence | bool | str | Object, config: Timing | Timepoint | int | float | Fraction | FNode | Fluent | Parameter | Variable | Presence | bool | str | Object)[source]
Adds a motion effect setting the given movable object to the given configuration.
- Parameters:
movable – The expression of movable type whose configuration is set.
config – The expression of configuration type assigned to the movable object.
- add_condition(interval: Timing | Timepoint | int | float | Fraction | TimeInterval, condition: FNode | Fluent | Parameter | bool)
Adds the given expression to the action’s conditions. For this action to be applicable the given expression must evaluate to True during the whole given interval.
- Parameters:
interval – The interval in which the given expression must evaluate to True for this action to be applicable.
condition – The expression that must be True in the given interval for this action to be applicable.
- add_constraint(constraint: FNode | Fluent | Parameter | bool)
Adds a constraint on the activity. If the activity is optional, the scope of the constraint will be the presence of the activity it self.
- add_deadline(date: int | float | Fraction | str | FNode)
Sets the latest date at which the activity might end.
- add_decrease_effect(timing: Timing | Timepoint | int | float | Fraction, fluent: FNode | Fluent, value: Timing | Timepoint | int | float | Fraction | FNode | Fluent | Parameter | Variable | Presence | bool | str | Object, condition: FNode | Fluent | Parameter | Variable | Presence | bool = True, forall: Iterable[Variable] = ())
At the given time, adds the given decrement to the action’s effects.
- Parameters:
timing – The exact time in which the decrement is applied.
fluent – The fluent which value is decremented by the added effect.
value – The given fluent is decremented by the given value.
condition – The condition in which this effect is applied; the default value is True.
forall – The ‘Variables’ that are universally quantified in this effect; the default value is empty.
- add_effect(timing: Timing | Timepoint | int | float | Fraction, fluent: FNode | Fluent, value: Timing | Timepoint | int | float | Fraction | FNode | Fluent | Parameter | Variable | Presence | bool | str | Object, condition: FNode | Fluent | Parameter | Variable | Presence | bool = True, forall: Iterable[Variable] = ())
At the given time, adds the given assignment to the action’s effects.
- Parameters:
timing – The exact time in which the assignment is applied.
fluent – The fluent which value is modified by the assignment.
value – The value to assign to the given fluent.
condition – The condition in which this effect is applied; the default value is True.
forall – The ‘Variables’ that are universally quantified in this effect; the default value is empty.
- add_increase_effect(timing: Timing | Timepoint | int | float | Fraction, fluent: FNode | Fluent, value: Timing | Timepoint | int | float | Fraction | FNode | Fluent | Parameter | Variable | Presence | bool | str | Object, condition: FNode | Fluent | Parameter | Variable | Presence | bool = True, forall: Iterable[Variable] = ())
At the given time, adds the given increment to the action’s effects.
- Parameters:
timing – The exact time in which the increment is applied.
fluent – The fluent which value is incremented by the added effect.
value – The given fluent is incremented by the given value.
condition – The condition in which this effect is applied; the default value is True.
forall – The ‘Variables’ that are universally quantified in this effect; the default value is empty.
- add_motion_constraint(motion_constraint: MotionConstraint)
Adds the given motion constraint.
- Parameters:
motion_constraint – The motion constraint to add.
- add_motion_constraints(motion_constraints: Iterable[MotionConstraint])
Adds the given motion constraints.
- Parameters:
motion_constraints – Iterable of motion constraints to add.
- add_parameter(name: str, tpe: Type) Parameter
Adds a new decision variable associated to this activity. The resulting parameter’s identifier will be prefixed with the activity’s name but may be used outside the activity itself. For instance, it could appear in global constraints or constraints involving more than one activity.
- add_release_date(date: int | float | Fraction | str | FNode)
Sets the earliest date at which the activity can be started.
- clear_conditions()
Removes all conditions.
- clear_effects()
Removes all effects from the Action.
- clear_motion_constraints()
Removes all motion constraints.
- property conditional_effects: Dict[Timing, List[Effect]]
Return the action conditional effects.
IMPORTANT NOTE: this property does some computation, so it should be called as seldom as possible.
- property conditions: Dict[TimeInterval, List[FNode]]
Returns the action conditions; a map from TimeInterval to a list of Expressions indicating that for this action to be applicable, during the whole TimeInterval set as key, all the expression in the mapped list must evaluate to True.
- property constraints: List[FNode]
Returns all non-scoped constraints defined. This is a convenience method for scheduling problems with no optional tasks, in which constraint typically would not have any scope.
Note: To get all constraints (with and without scope) consider the scoped_constraints property.
- property duration: DurationInterval
Returns the activity duration interval.
- property effects: Dict[Timing, List[Effect]]
Returns the all the action’s effects; a map from Timing to list of Effects indicating that, when the action is applied, all the Effects must be applied at the Timing set as key in the map.
- is_conditional() bool
Returns True if the action has conditional effects, False otherwise.
- property motion_constraints: List[MotionConstraint]
Returns the set of motion constraints.
- property name: str
Returns the Chronicle name.
- property optional: bool
Returns whether this activity is optional or not.
- property present: FNode
A boolean expression that is true iff the activity is present (i.e. appears in the solution).
- property scoped_constraints: List[Tuple[FNode, List[FNode]]]
Returns all constraints, with their associated scope.
- set_duration_bounds(lower: int | float | Fraction | str | FNode, upper: int | float | Fraction | str | FNode)
Sets the duration interval for this activity as the interval [lower, upper].
- Parameters:
lower – The value set as the lower edge of this action’s duration.
upper – The value set as the upper edge of this action’s duration.
- set_fixed_duration(value: int | float | Fraction | str | FNode)
Sets the duration interval for this activity as the interval [value, value].
- Parameters:
value – The value set as both edges of this action’s duration.
- set_simulated_effect(timing: Timing, simulated_effect: SimulatedEffect)
Sets the given simulated effect at the specified timing.
- Parameters:
timing – The time in which the simulated effect must be applied.
simulated_effect – The simulated effect that must be applied at the given timing.
- property unconditional_effects: Dict[Timing, List[Effect]]
Return the action unconditional effects.
IMPORTANT NOTE: this property does some computation, so it should be called as seldom as possible.
- uses(resource: Fluent | FNode, amount: int | float | Fraction | str | FNode = 1)
Asserts that the activity borrows a given amount (1 by default) of the resource. The borrowed resources will be reusable by another activity at the time epoch immediately succeeding the activity end.
- Parameters:
resource – Fluent expression that denotes the resource taht is used.
amount – Quantity of the resource that is borrowed over the course of the activity.