From 221c388cf1f722d5193d2911b9f3404bfc62eef7 Mon Sep 17 00:00:00 2001 From: Arthur Bit-Monnot Date: Sat, 15 Jun 2024 14:45:06 +0200 Subject: [PATCH] feat(up): Declare support of undefined initial values. --- planning/grpc/api/src/unified_planning.proto | 7 +++++-- planning/grpc/api/src/unified_planning.rs | 11 +++++++++-- planning/unified/plugin/up_aries/solver.py | 8 +++++++- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/planning/grpc/api/src/unified_planning.proto b/planning/grpc/api/src/unified_planning.proto index 99085ebb..53ba202a 100644 --- a/planning/grpc/api/src/unified_planning.proto +++ b/planning/grpc/api/src/unified_planning.proto @@ -116,7 +116,6 @@ message Fluent { // If non-empty, then any state variable using this fluent that is not explicitly given a value in the initial state // will be assumed to have this default value. // This allows mimicking the closed world assumption by setting a "false" default value to predicates. - // Note that in the initial state of the problem message, it is assumed that all default values are set. Expression default_value = 4; } @@ -539,7 +538,8 @@ message Problem { // features: ACTION_BASED repeated Action actions = 6; - // Initial state, including default values of state variables. + // Explicit assignments to state variables in the initial state. + // State variables not assigned there and will take the default value of their fluent, if any. repeated Assignment initial_state = 7; // Facts and effects that are expected to occur strictly later than the initial state. @@ -663,6 +663,9 @@ enum Feature { TASK_ORDER_TOTAL = 35; TASK_ORDER_PARTIAL = 36; TASK_ORDER_TEMPORAL = 37; + // INITIAL_STATE + UNDEFINED_INITIAL_NUMERIC = 68; + UNDEFINED_INITIAL_SYMBOLIC = 69; } // =================== Plan ================ diff --git a/planning/grpc/api/src/unified_planning.rs b/planning/grpc/api/src/unified_planning.rs index 59cf43ca..b6ebf024 100644 --- a/planning/grpc/api/src/unified_planning.rs +++ b/planning/grpc/api/src/unified_planning.rs @@ -90,7 +90,6 @@ pub struct Fluent { /// If non-empty, then any state variable using this fluent that is not explicitly given a value in the initial state /// will be assumed to have this default value. /// This allows mimicking the closed world assumption by setting a "false" default value to predicates. - /// Note that in the initial state of the problem message, it is assumed that all default values are set. #[prost(message, optional, tag = "4")] pub default_value: ::core::option::Option, } @@ -690,7 +689,8 @@ pub struct Problem { /// features: ACTION_BASED #[prost(message, repeated, tag = "6")] pub actions: ::prost::alloc::vec::Vec, - /// Initial state, including default values of state variables. + /// Explicit assignments to state variables in the initial state. + /// State variables not assigned there and will take the default value of their fluent, if any. #[prost(message, repeated, tag = "7")] pub initial_state: ::prost::alloc::vec::Vec, /// Facts and effects that are expected to occur strictly later than the initial state. @@ -1270,6 +1270,9 @@ pub enum Feature { TaskOrderTotal = 35, TaskOrderPartial = 36, TaskOrderTemporal = 37, + /// INITIAL_STATE + UndefinedInitialNumeric = 68, + UndefinedInitialSymbolic = 69, } impl Feature { /// String value of the enum field names used in the ProtoBuf definition. @@ -1354,6 +1357,8 @@ impl Feature { Feature::TaskOrderTotal => "TASK_ORDER_TOTAL", Feature::TaskOrderPartial => "TASK_ORDER_PARTIAL", Feature::TaskOrderTemporal => "TASK_ORDER_TEMPORAL", + Feature::UndefinedInitialNumeric => "UNDEFINED_INITIAL_NUMERIC", + Feature::UndefinedInitialSymbolic => "UNDEFINED_INITIAL_SYMBOLIC", } } /// Creates an enum from field names used in the ProtoBuf definition. @@ -1437,6 +1442,8 @@ impl Feature { "TASK_ORDER_TOTAL" => Some(Self::TaskOrderTotal), "TASK_ORDER_PARTIAL" => Some(Self::TaskOrderPartial), "TASK_ORDER_TEMPORAL" => Some(Self::TaskOrderTemporal), + "UNDEFINED_INITIAL_NUMERIC" => Some(Self::UndefinedInitialNumeric), + "UNDEFINED_INITIAL_SYMBOLIC" => Some(Self::UndefinedInitialSymbolic), _ => None, } } diff --git a/planning/unified/plugin/up_aries/solver.py b/planning/unified/plugin/up_aries/solver.py index 15d8783a..bdd1ccde 100644 --- a/planning/unified/plugin/up_aries/solver.py +++ b/planning/unified/plugin/up_aries/solver.py @@ -128,6 +128,9 @@ "TASK_ORDER_TOTAL", "TASK_ORDER_PARTIAL", # "TASK_ORDER_TEMPORAL", + # INITIAL_STATE + "UNDEFINED_INITIAL_NUMERIC", + "UNDEFINED_INITIAL_SYMBOLIC", }, version=2 ) @@ -218,6 +221,9 @@ "TASK_ORDER_TOTAL", "TASK_ORDER_PARTIAL", "TASK_ORDER_TEMPORAL", + # INITIAL_STATE + "UNDEFINED_INITIAL_NUMERIC", + "UNDEFINED_INITIAL_SYMBOLIC", }, version=2 ) @@ -424,7 +430,7 @@ def name(self) -> str: return "aries-val" def _validate( - self, problem: "up.model.AbstractProblem", plan: "up.plans.Plan" + self, problem: "up.model.AbstractProblem", plan: "up.plans.Plan" ) -> "up.engines.results.ValidationResult": # start a gRPC server in its own process # Note: when the `server` object is garbage collected, the process will be killed