Skip to content

Generalise numeric action application#3

Merged
morxa merged 3 commits intomainfrom
numeric_state_space
Mar 12, 2025
Merged

Generalise numeric action application#3
morxa merged 3 commits intomainfrom
numeric_state_space

Conversation

@DillonZChen
Copy link
Collaborator

Extend eval_function_term for conditions like

(<= (+ (truck_y) 1) (max_y))

and apply_effects_to_state for effects like

(assign (at_x ?p) (+ (max_x) 1))

@morxa
Copy link
Owner

morxa commented Mar 11, 2025

Can you rebase this onto main so the CI pipeline (new in main) is triggered?

@morxa morxa force-pushed the numeric_state_space branch from d2437ba to a234c0b Compare March 11, 2025 19:48
@morxa morxa requested review from Copilot and morxa March 12, 2025 14:58
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR aims to generalise the numeric action application in the state space generator by extending the evaluation functions for numeric expressions (e.g. the Plus operation) and updating how effects are applied to state representations.

  • Extended eval_function_term to support addition (Plus)
  • Modified state_to_string to build a comma-separated, sorted string of predicates
  • Improved handling of numeric effects in apply_effects_to_state by removing direct reliance on the NumericValue attribute
Comments suppressed due to low confidence (3)

genfond/state_space_generator.py:52

  • [nitpick] Sorting state string components may change the intended order of predicates. Verify if sorting is deliberate or if the original insertion order should be maintained.
return ",".join(sorted(state_str))

genfond/state_space_generator.py:137

  • Clarify the intent of the else branch in the BinaryFunction evaluation. Consider handling this case explicitly or documenting why it is expected to occur.
# DZC: What is this else case?

genfond/state_space_generator.py:141

  • Ensure that removing the assertion for NumericValue is safe by confirming that eval_function_term correctly computes a numeric value. Update tests to cover scenarios where numeric effects are processed without explicit NumericValue usage.
# DZC: remove this assert by evaluating change = eval_function_term(...)

@morxa morxa merged commit 42bd285 into main Mar 12, 2025
1 check passed
@morxa morxa deleted the numeric_state_space branch March 12, 2025 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants