InstantaneousAction
- class unified_planning.model.InstantaneousAction(_name: str, _parameters: OrderedDict[str, Type] | None = None, _env: Environment | None = None, **kwargs: Type)[source]
Bases:
UntimedEffectMixin,Action,PreconditionMixinRepresents an instantaneous action.
- add_decrease_effect(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] = ())
Adds the given decrease effect to the action’s effects.
- Parameters:
fluent – The fluent which value is decreased.
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(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] = ())
Adds the given assignment to the action’s effects.
- Parameters:
fluent – The fluent of 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(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] = ())
Adds the given increase effect to the action’s effects.
- Parameters:
fluent – The fluent which value is increased.
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_precondition(precondition: FNode | Fluent | Parameter | bool)
Adds the given expression to action’s preconditions.
- Parameters:
precondition – The expression that must be added to the action’s preconditions.
- clear_effects()
Removes all the Action’s effects.
- clear_preconditions()
Removes all the Action preconditions
- property conditional_effects: List[Effect]
Returns the list of the action conditional effects.
IMPORTANT NOTE: this property does some computation, so it should be called as seldom as possible.
- property effects: List[Effect]
Returns the list of the Action effects.
- property environment: Environment
Returns this Transition Environment.
- is_conditional() bool
Returns True if the action has conditional effects, False otherwise.
- property name: str
Returns the Transition `name.
- parameter(name: str) Parameter
Returns the parameter of the Transition with the given name.
Example
>>> from unified_planning.shortcuts import * >>> location_type = UserType("Location") >>> move = InstantaneousAction("move", source=location_type, target=location_type) >>> move.parameter("source") # return the "source" parameter of the transition, with type "Location" Location source >>> move.parameter("target") Location target
If a parameter’s name (1) does not conflict with an existing attribute of Transition and (2) does not start with ‘_’ it can also be accessed as if it was an attribute of the transition. For instance:
>>> move.source Location source
- Parameters:
name – The name of the target parameter.
- Returns:
The parameter of the Transition with the given name.
- set_simulated_effect(simulated_effect: SimulatedEffect)
Sets the given simulated effect as the only action’s simulated effect.
- Parameters:
simulated_effect – The SimulatedEffect instance that must be set as this action’s only simulated effect.
- property simulated_effect: SimulatedEffect | None
Returns the action simulated effect.
- property unconditional_effects: List[Effect]
Returns the list of the action unconditional effects.
IMPORTANT NOTE: this property does some computation, so it should be called as seldom as possible.