up_SMT_engine.helper_functions.FNODEHelperFunctions

Functions

convert_FNODE_to_Z3(FNODE, t[, r2exists_tuple])

Convert FNODE to z3 expression equivalent

convert_effect_to_Z3(effect, t[, r2exists_tuple])

Function used to convert an Effect object into Z3 equivalent expression for a given time t

createR2ExistsTuple(action_index, is_effect, ...)

Function for creating a relaxed relaxed ThereExists tuple, used to convey information required to handle chained variables

create_fluent_condition_tuple(effect)

Function used to extract and package useful effect information before passing to a Fluent class for generating frame axiom constraints

create_stated_action_instance(action, t)

Creates a Bool for the fluent or action at time 't', if a bool with that name exists then returns a reference to that bool

getR2ExistsTupleValue(info_tuple, val_name)

Tuple used to convey information needed for converting an FNODE to z3 for relaxed relaxed ThereExists encoding Extra information is needed due to chained variables

get_base_fluent_name(FNODE)

Function used to return a grounded fluent name, given it is the correct FNODE type

get_effected_fluent_name(fluent_name, args)

If a fluent has arguments then ground it by including arguments in name

get_fluent_name_at_state(fluent_name, t)

Generate the variable name for a Fluent, at timestep t

search_fluents_list(fluents_list, ...)

Return fluent object corresponding to basename, returns fluent if matched, None if no match

up_SMT_engine.helper_functions.FNODEHelperFunctions.get_fluent_name_at_state(fluent_name, t)[source]

Generate the variable name for a Fluent, at timestep t

Args:

fluent_name (String): The Fluent’s name t (int): timestep

Returns:

String: variable name for a Fluent, at timestep t

up_SMT_engine.helper_functions.FNODEHelperFunctions.create_stated_action_instance(action, t)[source]

Creates a Bool for the fluent or action at time ‘t’, if a bool with that name exists then returns a reference to that bool

Args:

action (String): Action name t (int): timestep

Returns:

z3.Bool: a Bool for the fluent or action at time ‘t’, if a bool with that name exists then returns a reference to that bool

up_SMT_engine.helper_functions.FNODEHelperFunctions.__convert_FNODE_args(args, t, r2exists_tuple=None)[source]

Handles recursively calling convert_FNODE_to_Z3 for each FNODE argument

Args:

args (FNODE.args): An FNODE’s arguments t (int): current timestep r2exists_tuple (Tuple, optional): Tuple of values required for handling chained variables for relaxed relaxed ThereExists parallelism. Defaults to None.

Returns:

Array: Array of z3 expressions

up_SMT_engine.helper_functions.FNODEHelperFunctions.get_effected_fluent_name(fluent_name, args)[source]

If a fluent has arguments then ground it by including arguments in name

Args:

fluent_name (String): Ungrounded fluent name args (FNODE.args): Parameter values for ungrounded fluent

Returns:

String: Grounded fluent name

up_SMT_engine.helper_functions.FNODEHelperFunctions.createR2ExistsTuple(action_index, is_effect, fluents_list, actions_list)[source]

Function for creating a relaxed relaxed ThereExists tuple, used to convey information required to handle chained variables

Args:

action_index (int): Index of current action in ordered action list. is_effect (bool): If True find chained variable corresponding to the current action fluents_list (List): List of fluents actions_list (List): Ordered list of Actions

Returns:

Tuple: Tuple used to convey information required to handle chained variables

up_SMT_engine.helper_functions.FNODEHelperFunctions.getR2ExistsTupleValue(info_tuple, val_name)[source]

Tuple used to convey information needed for converting an FNODE to z3 for relaxed relaxed ThereExists encoding Extra information is needed due to chained variables

Args:

info_tuple (Tuple): Tuple used to convey information needed for converting an FNODE to z3 for relaxed relaxed ThereExists encoding val_name (String): Information required from tuple

Returns:

int or Bool or List: action index, or is_effect, or fluents list, or actions list

up_SMT_engine.helper_functions.FNODEHelperFunctions.__create_stated_fluent_instance(fluent, args, t, r2exists_tuple=None)[source]

Creates a Bool, Real or Int for the fluent at time ‘t’, if a value with that name exists then returns a reference This effectively both grounds a fluent, and transforms it into a variable representing that fluent at time t.

Args:

fluent (FNODE.fluent): Fluent contained by FNODE args (FNODE.args): Fluent arguments t (int): current timestep r2exists_tuple (Tuple, optional): Tuple used to convey information needed for converting an FNODE to z3 for relaxed relaxed ThereExists encoding. Defaults to None.

Returns:

z3.Bool or z3.Real or z3.Int: Grounded variable corresponding to fluent at timestep t

up_SMT_engine.helper_functions.FNODEHelperFunctions.convert_FNODE_to_Z3(FNODE, t, r2exists_tuple=None)[source]

Convert FNODE to z3 expression equivalent

Args:

FNODE (FNODE): AIPLAN4EU API object used to express logical relations between fluents and other objects t (int): current timestep r2exists_tuple (Tuple, optional): Tuple used to convey information needed for converting an FNODE to z3 for relaxed relaxed ThereExists encoding. Defaults to None.

Raises:

Exception: Raise exception when FNODE does not match expected logical relation structure

Returns:

z3 expression: Equivalent expression expressued using z3

up_SMT_engine.helper_functions.FNODEHelperFunctions.convert_effect_to_Z3(effect, t, r2exists_tuple=None)[source]

Function used to convert an Effect object into Z3 equivalent expression for a given time t

Args:

effect (unified-planning.Model.effect): The effect to be converted t (int): current timestep r2exists_tuple (Tuple, optional): Tuple used to convey information needed for converting an FNODE to z3 for relaxed relaxed ThereExists encoding. Defaults to None.

Returns:

z3 expression: An action’s effect on a fluent expressed as a z3 expression at timestep t

up_SMT_engine.helper_functions.FNODEHelperFunctions.get_base_fluent_name(FNODE)[source]

Function used to return a grounded fluent name, given it is the correct FNODE type

Args:

FNODE (FNODE): unified-planning FNODE

Raises:

Exception: Raise an exception if FNODE is not a fluent

Returns:

String: Grounded fluent name

up_SMT_engine.helper_functions.FNODEHelperFunctions.create_fluent_condition_tuple(effect)[source]

Function used to extract and package useful effect information before passing to a Fluent class for generating frame axiom constraints

Args:

effect (unified-planning.Model.effect): Effect, changing a fluent value, with optional condition

Returns:

Tuple: (grounded fluent basename, effect condition as FNODE expression)

up_SMT_engine.helper_functions.FNODEHelperFunctions.search_fluents_list(fluents_list, fluent_basename)[source]

Return fluent object corresponding to basename, returns fluent if matched, None if no match

Args:

fluents_list (List(BaseFluent or BaseFluent subclass)): List of fluents fluent_basename (String): Name of fluent

Returns:

BaseFluent or BaseFluent subclass: Fluent corresponding to the fluent basename