Skip to content

Commit

Permalink
testing some functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuel Gobbi committed Dec 3, 2024
1 parent 5583f04 commit 162427f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
4 changes: 0 additions & 4 deletions unified_planning/model/problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -1030,10 +1030,6 @@ def update_problem_kind_action(
if len(action.simulated_effects) > 0:
self.kind.set_simulated_entities("SIMULATED_EFFECTS")
self.kind.set_time("CONTINUOUS_TIME")
elif isinstance(action, up.model.natural_transition.Process):
pass # TODO add Process kind
elif isinstance(action, up.model.natural_transition.Event):
pass # TODO add Event kind
else:
raise NotImplementedError

Expand Down
6 changes: 6 additions & 0 deletions unified_planning/test/examples/processes.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,16 @@ def get_example_problems():
evt.add_precondition(GE(d, 200))
evt.add_effect(on, False)

evt.clear_effects()
evt.add_effect(on, False)

b = Process("moving")
b.add_precondition(on)
b.add_derivative(d, 1)

b.clear_effects()
b.add_derivative(d, 1)

problem = Problem("1d_Movement")
problem.add_fluent(on)
problem.add_fluent(d)
Expand Down
13 changes: 13 additions & 0 deletions unified_planning/test/test_problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,19 @@ def test_undefined_initial_state(self):
pb_name,
)

def test_natural_transitions(self):
p = self.problems["1d_movement"].problem
print(p)
self.assertTrue(p.has_process("moving"))
self.assertTrue(p.has_event("turn_off_automatically"))
proc = p.process("moving")
evt = p.event("turn_off_automatically")
print(proc)
print(evt)
p.clear_events()
p.clear_processes()
self.assertEqual(len(p.natural_transitions), 0)


if __name__ == "__main__":
main()

0 comments on commit 162427f

Please sign in to comment.