From 73a3c3c7df2f54ca88cc89f24030ab7b40fd6ad6 Mon Sep 17 00:00:00 2001 From: Alessandro Valentini Date: Tue, 30 Jan 2024 14:16:31 +0100 Subject: [PATCH 1/2] Minor changes and fixes for the new release --- .github/workflows/test.yml | 14 +++++++------- README.md | 5 +++++ setup.py | 16 +++++++--------- unified_planning/engines/factory.py | 2 +- unified_planning/engines/sequential_simulator.py | 8 +++++++- .../test/test_disjunctive_conditions_remover.py | 2 +- unified_planning/test/test_grounder.py | 13 +++++++------ up_test_cases/builtin/multiagent/logistic.py | 3 --- 8 files changed, 35 insertions(+), 28 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f07140f14..0e5e13434 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,10 +8,10 @@ on: type: string env: - up_tamer_commit: "1b543623ad2ebd9795529abe812352db8f4ec014" - up_pyperplan_commit: "6cec570b88d62ca5c4b8029a60c704414fe7f6a9" + up_tamer_commit: "631dfd43a56e7c2dda44fe273ec6f5492e99cfe1" + up_pyperplan_commit: "a24854213caf5038e1540e31613d24b93825fbb3" up_fast_downward_commit: "c60b6ab82cb8c3046cfd4782afe4d4c6071c4109" - up_enhsp_commit: "1ec1086b7dbb67ce4a0bc03f5b71b551ee2168dc" + up_enhsp_commit: "78cc3331beb1fcc36380a8f698f49b4312dc411a" up_fmap_commit: "f29e66c8483abcb8f17ff1c46a0745ee9b1e95fa" jobs: @@ -140,7 +140,7 @@ jobs: - name: Download and install ENHSP run: | git clone https://gitlab.com/enricos83/ENHSP-Public.git - cd ENHSP-Public; git checkout enhsp20-0.13.0; ./compile; cd .. + cd ENHSP-Public; git checkout enhsp20-0.14.0; ./compile; cd .. mkdir .planners; mv ENHSP-Public/enhsp-dist .planners/enhsp-20; rm -rf ENHSP-Public - name: Run tests @@ -208,7 +208,7 @@ jobs: - name: Download and install ENHSP run: | git clone https://gitlab.com/enricos83/ENHSP-Public.git - cd ENHSP-Public; git checkout enhsp20-0.13.0; ./compile; cd .. + cd ENHSP-Public; git checkout enhsp20-0.14.0; ./compile; cd .. mkdir .planners; mv ENHSP-Public/enhsp-dist .planners/enhsp-20; rm -rf ENHSP-Public - name: Test code-snippets @@ -276,7 +276,7 @@ jobs: - name: Download and install ENHSP run: | git clone https://gitlab.com/enricos83/ENHSP-Public.git - cd ENHSP-Public; git checkout enhsp20-0.13.0; bash ./compile; cd .. + cd ENHSP-Public; git checkout enhsp20-0.14.0; bash ./compile; cd .. bash -c "mkdir .planners; mv ENHSP-Public/enhsp-dist .planners/enhsp-20; rm -rf ENHSP-Public" - name: Run tests @@ -337,7 +337,7 @@ jobs: - name: Download and install ENHSP run: | git clone https://gitlab.com/enricos83/ENHSP-Public.git - cd ENHSP-Public; git checkout enhsp20-0.13.0; bash ./compile; cd .. + cd ENHSP-Public; git checkout enhsp20-0.14.0; bash ./compile; cd .. bash -c "mkdir .planners; mv ENHSP-Public/enhsp-dist .planners/enhsp-20; rm -rf ENHSP-Public" - name: Run tests diff --git a/README.md b/README.md index 27edbc919..789e7a04d 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,11 @@ The documentation is available [here](https://unified-planning.readthedocs.io/en More complex examples are available as notebooks [here](https://unified-planning.readthedocs.io/en/latest/examples.html). +## Staying Updated + +To stay informed about project updates, announcements, and general discussions, we encourage you to join our public mailing list: (https://groups.google.com/g/unified-planning). + +You can subscribe to this list to receive notifications and engage in community discussions. ## Acknowledgments diff --git a/setup.py b/setup.py index 109651dda..4cf61cbd5 100644 --- a/setup.py +++ b/setup.py @@ -23,24 +23,22 @@ "dev": ["tarski[arithmetic]", "pytest", "pytest-cov", "mypy"], "grpc": ["grpcio", "grpcio-tools", "grpc-stubs"], "tarski": ["tarski[arithmetic]"], - "pyperplan": ["up-pyperplan==1.0.0.6.dev1"], - "tamer": ["up-tamer==1.0.0.8.dev1"], - "enhsp": ["up-enhsp==0.0.23"], + "pyperplan": ["up-pyperplan~=1.1.0"], + "tamer": ["up-tamer~=1.1.0"], + "enhsp": ["up-enhsp~=0.0.24"], "fast-downward": ["up-fast-downward==0.4.1"], "lpg": ["up-lpg==0.0.10"], "fmap": ["up-fmap==0.0.13"], "aries": ["up-aries>=0.3.3"], - "symk": ["up-symk>=1.0.1"], "engines": [ "tarski[arithmetic]", - "up-pyperplan==1.0.0.6.dev1", - "up-tamer==1.0.0.8.dev1", - "up-enhsp==0.0.23", + "up-pyperplan~=1.1.0", + "up-tamer~=1.1.0", + "up-enhsp~=0.0.24", "up-fast-downward==0.4.1", "up-lpg==0.0.10", "up-fmap==0.0.13", - "up-aries>=0.3.2", - "up-symk>=1.0.1", + "up-aries>=0.3.3", ], "plot": [ "plotly", diff --git a/unified_planning/engines/factory.py b/unified_planning/engines/factory.py index 9954583af..bbcd6391e 100644 --- a/unified_planning/engines/factory.py +++ b/unified_planning/engines/factory.py @@ -165,7 +165,7 @@ "aries-val", ] -DEFAULT_META_ENGINES_PREFERENCE_LIST = ["oversubscription"] +DEFAULT_META_ENGINES_PREFERENCE_LIST = ["oversubscription", "replanner"] def format_table(header: List[str], rows: List[List[str]]) -> str: diff --git a/unified_planning/engines/sequential_simulator.py b/unified_planning/engines/sequential_simulator.py index 667694042..d1657b2bb 100644 --- a/unified_planning/engines/sequential_simulator.py +++ b/unified_planning/engines/sequential_simulator.py @@ -34,6 +34,7 @@ UPProblemDefinitionError, ) from unified_planning.model import ( + Action, Fluent, FNode, ExpressionManager, @@ -108,6 +109,9 @@ def __init__( self._actions = set(self._problem.actions) self._se = StateEvaluator(self._problem) self._initial_state: Optional[UPState] = None + self._grounded_actions: Optional[ + List[Tuple[Action, Tuple[FNode, ...], Optional[Action]]] + ] = None # Add state invariants without quantifiers to get all the grounded # fluent instances that might modify the state invariants @@ -406,7 +410,9 @@ def _get_applicable_actions( :param state: the `state` where the formulas are evaluated. :return: an `Iterator` of applicable actions + parameters. """ - for original_action, params, _ in self._grounder.get_grounded_actions(): + if self._grounded_actions is None: + self._grounded_actions = list(self._grounder.get_grounded_actions()) + for original_action, params, _ in self._grounded_actions: if self._is_applicable(state, original_action, params): yield (original_action, params) diff --git a/unified_planning/test/test_disjunctive_conditions_remover.py b/unified_planning/test/test_disjunctive_conditions_remover.py index fdae86b3b..1c0638185 100644 --- a/unified_planning/test/test_disjunctive_conditions_remover.py +++ b/unified_planning/test/test_disjunctive_conditions_remover.py @@ -42,7 +42,7 @@ def setUp(self): self.problems = get_example_problems() @skipIfNoOneshotPlannerForProblemKind( - classical_kind.union(simple_numeric_kind).union(bounded_types_kind) + full_classical_kind.union(simple_numeric_kind).union(bounded_types_kind) ) @skipIfNoPlanValidatorForProblemKind( full_classical_kind.union(simple_numeric_kind).union(bounded_types_kind) diff --git a/unified_planning/test/test_grounder.py b/unified_planning/test/test_grounder.py index 9752d0831..73abbe1b7 100644 --- a/unified_planning/test/test_grounder.py +++ b/unified_planning/test/test_grounder.py @@ -18,6 +18,7 @@ from unified_planning.shortcuts import * from unified_planning.model.problem_kind import ( classical_kind, + full_classical_kind, simple_numeric_kind, general_numeric_kind, bounded_types_kind, @@ -83,10 +84,10 @@ def test_robot(self): self.assertTrue(pv.validate(problem, plan)) @skipIfNoOneshotPlannerForProblemKind( - classical_kind.union(simple_numeric_kind).union(bounded_types_kind) + full_classical_kind.union(simple_numeric_kind).union(bounded_types_kind) ) @skipIfNoPlanValidatorForProblemKind( - classical_kind.union(simple_numeric_kind).union(bounded_types_kind) + full_classical_kind.union(simple_numeric_kind).union(bounded_types_kind) ) def test_robot_locations_connected(self): problem = self.problems["robot_locations_connected"].problem @@ -110,10 +111,10 @@ def test_robot_locations_connected(self): self.assertTrue(pv.validate(problem, plan)) @skipIfNoOneshotPlannerForProblemKind( - classical_kind.union(simple_numeric_kind).union(bounded_types_kind) + full_classical_kind.union(simple_numeric_kind).union(bounded_types_kind) ) @skipIfNoPlanValidatorForProblemKind( - classical_kind.union(simple_numeric_kind).union(bounded_types_kind) + full_classical_kind.union(simple_numeric_kind).union(bounded_types_kind) ) def test_robot_locations_connected_from_factory(self): problem = self.problems["robot_locations_connected"].problem @@ -142,10 +143,10 @@ def test_robot_locations_connected_from_factory(self): self.assertTrue(pv.validate(problem, plan)) @skipIfNoOneshotPlannerForProblemKind( - classical_kind.union(simple_numeric_kind).union(bounded_types_kind) + full_classical_kind.union(simple_numeric_kind).union(bounded_types_kind) ) @skipIfNoPlanValidatorForProblemKind( - classical_kind.union(simple_numeric_kind).union(bounded_types_kind) + full_classical_kind.union(simple_numeric_kind).union(bounded_types_kind) ) def test_robot_locations_connected_from_factory_with_problem_kind(self): problem = self.problems["robot_locations_connected"].problem diff --git a/up_test_cases/builtin/multiagent/logistic.py b/up_test_cases/builtin/multiagent/logistic.py index db8a80fa8..21ed06034 100644 --- a/up_test_cases/builtin/multiagent/logistic.py +++ b/up_test_cases/builtin/multiagent/logistic.py @@ -13,14 +13,12 @@ def get_test_cases(): airplane = Agent("airplane", problem) object = UserType("object") location = UserType("location", object) - vehicle = UserType("vehicle", object) package = UserType("package", object) city = UserType("city", object) airport = UserType("airport", location) pos = Fluent("pos", location=location) at = Fluent("at", BoolType(), object=object, location=location) - In = Fluent("in", BoolType(), package=package, vehicle=vehicle) on = Fluent("on", BoolType(), object=object) in_city = Fluent("in_city", BoolType(), location=location, city=city) @@ -33,7 +31,6 @@ def get_test_cases(): airplane.add_public_fluent(pos, default_initial_value=False) airplane.add_public_fluent(on, default_initial_value=False) problem.ma_environment.add_fluent(at, default_initial_value=False) - problem.ma_environment.add_fluent(In, default_initial_value=False) load_truck = InstantaneousAction("load_truck", loc=location, obj=package) obj = load_truck.parameter("obj") From f18c7a765e8cc0f52b7ea1dbaff7410e04ce721a Mon Sep 17 00:00:00 2001 From: Alessandro Valentini Date: Thu, 1 Feb 2024 11:07:36 +0100 Subject: [PATCH 2/2] Updated symk version and fixed report.py --- setup.py | 2 ++ up_test_cases/report.py | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 4cf61cbd5..699f317ea 100644 --- a/setup.py +++ b/setup.py @@ -30,6 +30,7 @@ "lpg": ["up-lpg==0.0.10"], "fmap": ["up-fmap==0.0.13"], "aries": ["up-aries>=0.3.3"], + "symk": ["up-symk>=1.3.0"], "engines": [ "tarski[arithmetic]", "up-pyperplan~=1.1.0", @@ -39,6 +40,7 @@ "up-lpg==0.0.10", "up-fmap==0.0.13", "up-aries>=0.3.3", + "up-symk>=1.3.0", ], "plot": [ "plotly", diff --git a/up_test_cases/report.py b/up_test_cases/report.py index aea024e8c..afaf47660 100644 --- a/up_test_cases/report.py +++ b/up_test_cases/report.py @@ -157,7 +157,12 @@ def check_result( else: if planner.satisfies(OptimalityGuarantee.SOLVED_OPTIMALLY): output += verify( - result.status is PlanGenerationResultStatus.SOLVED_OPTIMALLY, + result.status + in ( + PlanGenerationResultStatus.SOLVED_OPTIMALLY, + PlanGenerationResultStatus.INTERMEDIATE, + PlanGenerationResultStatus.TIMEOUT, + ), f"Planner guarantees optimality but returned {result.status.name}", ) else: