up_SMT_engine.helper_functions.SmtModelHelperFunctions¶
Functions
|
Function used to convert a list or list of sets to a corresponding unified-planning Plan object. |
|
Custom index finding function, for finding the action of an action_instance in an ordered list Uses the action's name to find the action |
|
Function used to find corresponding action to string action name in grounded_actions, if one exists |
|
Using the full z3 solution model compare each True boolean variable against the name of a grounded_action If the names match then the variable shows that action is executed at time x, given the variable name is 'action_@tx' Iterate over each variable in the model, setting the corresponding ground action to index x in the plan array Return the plan array 'solution' parameter should be a Solver.model() object |
|
Function used to get the string name of a variable in the Model result |
|
Splits action name from 'action_@tx' to ['action', 'x'], giving the action basename, and time of execution |
- up_SMT_engine.helper_functions.SmtModelHelperFunctions.get_z3_FuncDecl_name(obj)[source]¶
Function used to get the string name of a variable in the Model result
- Args:
obj: object to check
- Returns:
String: The object’s name
- up_SMT_engine.helper_functions.SmtModelHelperFunctions.split_stated_action_name(action_name)[source]¶
Splits action name from ‘action_@tx’ to [‘action’, ‘x’], giving the action basename, and time of execution
- Args:
action_name (String): An action basename with time of execution
- Returns:
String: The action basename
- up_SMT_engine.helper_functions.SmtModelHelperFunctions.get_action_by_name(name, grounded_actions)[source]¶
Function used to find corresponding action to string action name in grounded_actions, if one exists
- Args:
name (String): Action name grounded_actions (List of InstantaneousAction objects): List of grounded actions
- Returns:
InstantaneousAction: The grounded InstantaneousAction corresponding to the name
- up_SMT_engine.helper_functions.SmtModelHelperFunctions.get_goal_actions_list(solution, grounded_actions, plan_len, parallelism)[source]¶
Using the full z3 solution model compare each True boolean variable against the name of a grounded_action If the names match then the variable shows that action is executed at time x, given the variable name is ‘action_@tx’ Iterate over each variable in the model, setting the corresponding ground action to index x in the plan array Return the plan array ‘solution’ parameter should be a Solver.model() object
- Args:
solution (z3.Model): The model satisfying the problem as SMT grounded_actions (List of InstantaneousAction objects): List of grounded actions plan_len (int): Plan length parallelism (String): The type of parallelism chosen
- Returns:
List or List of sets: If sequential this returns a list of actions in the order the appear in the plan. Otherwise this returns a list of sets, each set corresponding to the parallel actions taken at that timestep
- up_SMT_engine.helper_functions.SmtModelHelperFunctions.find_action_in_ordered_list(action_instance, ordered_list)[source]¶
Custom index finding function, for finding the action of an action_instance in an ordered list Uses the action’s name to find the action
- Args:
action_instance (ActionInstance): a unified-planning Action instance ordered_list (List): ordered list of actions
- Returns:
int: action index
- up_SMT_engine.helper_functions.SmtModelHelperFunctions.convert_action_sequence_to_plan(actions, parallelism, ForAll_get_sets, ordered_list)[source]¶
Function used to convert a list or list of sets to a corresponding unified-planning Plan object.
- Args:
actions (list or list of sets): list or list of sets of InstantaneousActions parallelism (String): Choice of parallelism ForAll_get_sets (Boolean): True if the user wants to maintain the sets of parallel actions ordered_list (list): Ordered list of actions
- Returns:
PartialOrderPlan or SequentialPlan: If ForAll_get_sets is true we return a PartialOrderPlan. Otherwise we return a SequentialPlan