Skip to content

Commit

Permalink
feat(up): Declare support of undefined initial values.
Browse files Browse the repository at this point in the history
  • Loading branch information
arbimo committed Jun 15, 2024
1 parent a12c60e commit 221c388
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
7 changes: 5 additions & 2 deletions planning/grpc/api/src/unified_planning.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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 ================
Expand Down
11 changes: 9 additions & 2 deletions planning/grpc/api/src/unified_planning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Expression>,
}
Expand Down Expand Up @@ -690,7 +689,8 @@ pub struct Problem {
/// features: ACTION_BASED
#[prost(message, repeated, tag = "6")]
pub actions: ::prost::alloc::vec::Vec<Action>,
/// 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<Assignment>,
/// Facts and effects that are expected to occur strictly later than the initial state.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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,
}
}
Expand Down
8 changes: 7 additions & 1 deletion planning/unified/plugin/up_aries/solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@
"TASK_ORDER_TOTAL",
"TASK_ORDER_PARTIAL",
# "TASK_ORDER_TEMPORAL",
# INITIAL_STATE
"UNDEFINED_INITIAL_NUMERIC",
"UNDEFINED_INITIAL_SYMBOLIC",
},
version=2
)
Expand Down Expand Up @@ -218,6 +221,9 @@
"TASK_ORDER_TOTAL",
"TASK_ORDER_PARTIAL",
"TASK_ORDER_TEMPORAL",
# INITIAL_STATE
"UNDEFINED_INITIAL_NUMERIC",
"UNDEFINED_INITIAL_SYMBOLIC",
},
version=2
)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 221c388

Please sign in to comment.