Bases: object
The FNode class represents an expression tree in the unified_planning library.
Since the FNode is immutable and the same expression can be used in more than one expression tree, it
is actually a DAG, but the single expression can be seen as a tree for simplicity.
All the expressions are managed by the ExpressionManager
in the Environment, so this class should never
be instantiated or modified by the user.
-
get_nary_expression_string(op: str, args: List[FNode]) → str[source]
-
property node_id: int
Returns the id of this expression.
-
property node_type: OperatorKind
Returns the OperatorKind that defines the semantic of this expression.
-
property environment: Environment
Returns the Environment in which this expression exists.
-
property args: List[FNode]
Returns the subexpressions of this expression.
-
property type: Type
Returns the Type of this expression.
-
get_contained_names() → Set[str][source]
Returns all the names contained in this expression.
-
arg(idx: int) → FNode[source]
Return the given subexpression at the given position.
- Parameters:
idx – The index of the wanted subexpression.
- Returns:
The expression at the position idx.
-
is_constant() → bool[source]
Returns True if the expression is a constant, False otherwise.
-
constant_value() → bool | int | Fraction[source]
Returns the constant value stored in this expression.
-
bool_constant_value() → bool[source]
Return constant boolean value stored in this expression.
-
int_constant_value() → int[source]
Return constant integer value stored in this expression.
-
real_constant_value() → Fraction[source]
Return constant real value stored in this expression.
-
fluent() → Fluent[source]
Return the Fluent stored in this expression.
-
parameter() → Parameter[source]
Return the Parameter stored in this expression.
-
variable() → Variable[source]
Return the variable of the VariableExp.
-
variables() → List[Variable][source]
Return the Variables of the Exists or Forall.
-
object() → Object[source]
Return the Object stored in this expression.
-
timing() → Timing[source]
Return the Timing stored in this expression.
-
agent() → str[source]
Return the name of the Agent stored in this expression.
-
simplify() → FNode[source]
Returns the simplified version of this expression.
The simplification is done just by constant propagation by the Simplifier
-
substitute(substitutions: Dict[unified_planning.model.expression.Expression, unified_planning.model.expression.Expression])[source]
Returns the version of this expression where every expression that is a key of the substitutions
map is substituted with it’s value in the map.
NOTE: check the Substituter
documentation for more details!
- Parameters:
substitutions – The mapping of expressions that must be substituted.
- Returns:
The expression where every instance of a key value in the substitutions map
is substituted with it’s value.
-
is_bool_constant() → bool[source]
Test whether the expression is a boolean constant.
-
is_int_constant() → bool[source]
Test whether the expression is an integer constant.
-
is_real_constant() → bool[source]
Test whether the expression is a real constant.
-
is_true() → bool[source]
Test whether the expression is the True Boolean constant.
-
is_false() → bool[source]
Test whether the expression is the False Boolean constant.
-
is_and() → bool[source]
Test whether the node is the And operator.
-
is_or() → bool[source]
Test whether the node is the Or operator.
-
is_not() → bool[source]
Test whether the node is the Not operator.
-
is_implies() → bool[source]
Test whether the node is the Implies operator.
-
is_iff() → bool[source]
Test whether the node is the Iff operator.
-
is_exists() → bool[source]
Test whether the node is the Exists operator.
-
is_always() → bool[source]
Test whether the node is the Always constraint.
-
is_sometime() → bool[source]
Test whether the node is the Sometime constraint.
-
is_at_most_once() → bool[source]
Test whether the node is the At-Most-Once constraint.
-
is_sometime_before() → bool[source]
Test whether the node is the Sometime-Before constraint.
-
is_sometime_after() → bool[source]
Test whether the node is the Sometime-After constraint.
-
is_forall() → bool[source]
Test whether the node is the Forall operator.
-
is_fluent_exp() → bool[source]
Test whether the node is a Fluent
Expression.
-
is_parameter_exp() → bool[source]
Test whether the node is an action parameter
.
-
is_variable_exp() → bool[source]
Test whether the node is a Variable
Expression.
-
is_object_exp() → bool[source]
Test whether the node is an Object
Expression.
-
is_timing_exp() → bool[source]
Test whether the node is a Timing
Expression.
-
is_plus() → bool[source]
Test whether the node is the Plus operator.
-
is_minus() → bool[source]
Test whether the node is the Minus operator.
-
is_times() → bool[source]
Test whether the node is the Times operator.
-
is_div() → bool[source]
Test whether the node is the Div operator.
-
is_equals() → bool[source]
Test whether the node is the Equals operator.
-
is_le() → bool[source]
Test whether the node is the LE operator.
-
is_lt() → bool[source]
Test whether the node is the LT operator.
-
is_dot() → bool[source]
Test whether the node is the DOT operator.
-
Equals(right)[source]
-
And(*other)[source]
-
Or(*other)[source]
-
Not()[source]
-
Xor(*other)[source]
-
Implies(right)[source]
-
Iff(right)[source]