-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ability to validate that the preconditions of future actions still hold for a given current state #607
Comments
Hi @scastro-bdai , check out the It should fit your use-case as long as you work with |
Thanks @Framba-Luca -- indeed that solves my use case! with SequentialSimulator(problem) as sim:
state = sim.get_initial_state()
print(f"Initial sim state: {state}")
act = result.plan.actions[0]
res = sim.is_applicable(state, act)
print(f"Is action {act} applicable? {res}")
state._values[robot_at(robby, kitchen)] = Bool(False)
res = sim.is_applicable(state, act)
print(f"Is action {act} applicable? {res}") yields
I can also do: sim.get_unsatisfied_conditions(state, act) to get
Maybe my one piece of feedback is to add a |
@scastro-bdai Actually the State should be immutable (eq and hash methods require immutability, otherwise bugs might arise; the internal implementations assumes immutability). So, instead of changing a value, we designed the I am copy-pasting here the method because the UPState is not in the api documentation. def make_child(
self,
updated_values: Dict["up.model.FNode", "up.model.FNode"],
) -> "UPState":
"""
Returns a different `UPState` in which every value in updated_values.keys() is evaluated as his mapping
in new the `updated_values` dict and every other value is evaluated as in `self`.
:param updated_values: The dictionary that contains the `values` that need to be updated in the new `UPState`.
:return: The new `UPState` created.
""" |
Worked perfectly. Thanks for all your help! |
User Story
As a user who wants to track the execution of plans to see if any preconditions have been violated, I want the ability to easily check the (grounded) preconditions and effects of my actual action instances.
Basically, the workflow would be to iteratively
Acceptance Criteria
Additional Material
I am not sure if I'm duplicating functionality because I can't read the code/documentation correctly, but this worked for me for the first criterion:
I was able to hack around this with the following code:
This code would yield something like this:
I guess there are "Grounders" available in this library that appear to do the above, but they seem very heavyweight for what I'm trying to achieve.
Then, you could start with a specific state and apply the effects by doing:
Finally, you could validate the preconditions by checking whether the new state includes them.
Am I on the right track? Would this be useful?
Attention Points
N/A
The text was updated successfully, but these errors were encountered: