concepts.dm.pdsketch.predicate.Predicate#
- class Predicate[source]#
Bases:
Function
A predicate is a special function that can part of the observation or state space. Predicate does not support overloaded function types. Currently, predicates are only used in planning domains.
Methods
from_function
(function[, implementation, sig])Create a function object from an actual Python function.
get_overridden_call
([ftype_index])Get the overridden call function.
get_sub_function
(ftype_index)mark_static
([flag])Mark a predicate as static (i.e., its grounded value will never change).
partial
(*args[, execute_fully_bound_functions])remap_arguments
(remapping)Generate a new Function object with a different argument order.
rename
(new_name)Rename the predicate.
set_function_body
(function_body)Set the function body.
set_function_name
(function_name)Set the function name.
Attributes
flag_value}.
Return True if the function is overloaded.
Whether the predicate is a static predicate.
Whether the predicate can be cached.
Whether the predicate is an observation variable.
Whether the predicate is a state variable.
Whether the predicate is a generator placeholder.
The names of the inplace defined generators associated with this predicate.
The evaluation mode of the predicate.
Whether the predicate is a state-goal-constraint function.
- __call__(*args, **kwargs)#
Call self as a function.
- __init__(name, ftype, derived_expression=None, overridden_call=None, observation=None, state=None, generator_placeholder=None, inplace_generators=None, simulation=False, execution=False, is_sgc_function=False)[source]#
Initialize a predicate.
- Parameters:
name (str) – the name of the predicate.
ftype (FunctionType) – the function type of the predicate.
derived_expression (str | None) – the derived expression of the predicate.
overridden_call (Callable | None) – the overridden call of the predicate.
observation (bool | None) – whether the predicate is an observation variable.
state (bool | None) – whether the predicate is a state variable.
generator_placeholder (bool | None) – whether the predicate is a generator placeholder.
inplace_generators (Sequence[str] | None) – the names of the inplace defined generators associated with this predicate. This value is stored for macro operator extension.
simulation (bool) – whether the predicate is a simulation-dependent function.
execution (bool) – whether the predicate is an execution-dependent function.
is_sgc_function (bool) – whether the predicate is a state-goal-constraint function.
- __new__(**kwargs)#
- classmethod from_function(function, implementation=True, sig=None)#
Create a function object from an actual Python function.
- get_overridden_call(ftype_index=None)#
Get the overridden call function.
- mark_static(flag=True)[source]#
Mark a predicate as static (i.e., its grounded value will never change).
- Parameters:
flag (bool) – Whether to mark the predicate as static.
- partial(*args, execute_fully_bound_functions=False, **kwargs)#
- Return type:
- remap_arguments(remapping)#
Generate a new Function object with a different argument order. Specifically, remapping is a permutation. The i-th argument to the new function will be the remapping[i]-th argument in the old function.
- property all_sub_functions#
- evaluation_mode: FunctionEvaluationDefinitionMode#
The evaluation mode of the predicate.
- property flags: Dict[str, bool]#
flag_value}.
- Type:
Return the flags of the predicate, which is a dictionary of {flag_name
- inplace_generators: Tuple[str, ...]#
The names of the inplace defined generators associated with this predicate.
- is_cacheable: bool#
Whether the predicate can be cached. Specifically, if it contains only “ObjectTypes” as arguments.
- is_static: bool#
Whether the predicate is a static predicate. I.e., the predicate will never be changed.
- property return_type: ObjectType | ValueType | FunctionType | SequenceType#