Skip to content

Commit

Permalink
[grpc] Update protobuf definition
Browse files Browse the repository at this point in the history
  • Loading branch information
arbimo committed Oct 3, 2022
1 parent 31f0bb1 commit 41ebe8d
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 4 deletions.
22 changes: 20 additions & 2 deletions grpc/api/src/unified_planning.proto
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,13 @@ message Assignment {
Expression value = 2;
}

// Represents a goal associated with a cost, used to define oversubscription planning.
message GoalWithCost {
// Goal expression
Expression goal = 1;
// The cost
Real cost = 2;
}

message Metric {
enum MetricKind {
Expand All @@ -432,11 +439,14 @@ message Metric {
// features: durative_actions
MINIMIZE_MAKESPAN = 2;

// Minimize the value of the expression defined in the `expression`` field
// Minimize the value of the expression defined in the `expression` field
MINIMIZE_EXPRESSION_ON_FINAL_STATE = 3;

// Maximize the value of the expression defined in the `expression`` field
// Maximize the value of the expression defined in the `expression` field
MAXIMIZE_EXPRESSION_ON_FINAL_STATE = 4;

// Maximize the number of goals reached, weighted by cost
OVERSUBSCRIPTION = 5;
}
MetricKind kind = 1;

Expand All @@ -453,6 +463,10 @@ message Metric {
// This is very awkward to do in this setting where the expression is detached from its scope.
map<string, Expression> action_costs = 3;
Expression default_action_cost = 4;

// List of goals used to define the oversubscription planning problem.
// Empty, if the `kind` is not OVERSUBSCRIPTION
repeated GoalWithCost goals = 5;
}

// features: ACTION_BASED
Expand Down Expand Up @@ -495,6 +509,9 @@ enum Feature {
// PROBLEM_CLASS
ACTION_BASED = 0;
HIERARCHICAL = 26;
// PROBLEM_TYPE
SIMPLE_NUMERIC_PLANNING = 30;
GENERAL_NUMERIC_PLANNING = 31;
// TIME
CONTINUOUS_TIME = 1;
DISCRETE_TIME = 2;
Expand Down Expand Up @@ -529,6 +546,7 @@ enum Feature {
FINAL_VALUE = 22;
MAKESPAN = 23;
PLAN_LENGTH = 24;
OVERSUBSCRIPTION = 29;
// SIMULATED_ENTITIES
SIMULATED_EFFECTS = 25;
}
Expand Down
28 changes: 26 additions & 2 deletions grpc/api/src/unified_planning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,16 @@ pub struct Assignment {
#[prost(message, optional, tag="2")]
pub value: ::core::option::Option<Expression>,
}
/// Represents a goal associated with a cost, used to define oversubscription planning.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GoalWithCost {
/// Goal expression
#[prost(message, optional, tag="1")]
pub goal: ::core::option::Option<Expression>,
/// The cost
#[prost(message, optional, tag="2")]
pub cost: ::core::option::Option<Real>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Metric {
#[prost(enumeration="metric::MetricKind", tag="1")]
Expand All @@ -473,6 +483,10 @@ pub struct Metric {
pub action_costs: ::std::collections::HashMap<::prost::alloc::string::String, Expression>,
#[prost(message, optional, tag="4")]
pub default_action_cost: ::core::option::Option<Expression>,
/// List of goals used to define the oversubscription planning problem.
/// Empty, if the `kind` is not OVERSUBSCRIPTION
#[prost(message, repeated, tag="5")]
pub goals: ::prost::alloc::vec::Vec<GoalWithCost>,
}
/// Nested message and enum types in `Metric`.
pub mod metric {
Expand All @@ -486,10 +500,12 @@ pub mod metric {
/// Minimize the makespan in case of temporal planning
/// features: durative_actions
MinimizeMakespan = 2,
/// Minimize the value of the expression defined in the `expression`` field
/// Minimize the value of the expression defined in the `expression` field
MinimizeExpressionOnFinalState = 3,
/// Maximize the value of the expression defined in the `expression`` field
/// Maximize the value of the expression defined in the `expression` field
MaximizeExpressionOnFinalState = 4,
/// Maximize the number of goals reached, weighted by cost
Oversubscription = 5,
}
impl MetricKind {
/// String value of the enum field names used in the ProtoBuf definition.
Expand All @@ -503,6 +519,7 @@ pub mod metric {
MetricKind::MinimizeMakespan => "MINIMIZE_MAKESPAN",
MetricKind::MinimizeExpressionOnFinalState => "MINIMIZE_EXPRESSION_ON_FINAL_STATE",
MetricKind::MaximizeExpressionOnFinalState => "MAXIMIZE_EXPRESSION_ON_FINAL_STATE",
MetricKind::Oversubscription => "OVERSUBSCRIPTION",
}
}
}
Expand Down Expand Up @@ -843,6 +860,9 @@ pub enum Feature {
/// PROBLEM_CLASS
ActionBased = 0,
Hierarchical = 26,
/// PROBLEM_TYPE
SimpleNumericPlanning = 30,
GeneralNumericPlanning = 31,
/// TIME
ContinuousTime = 1,
DiscreteTime = 2,
Expand Down Expand Up @@ -877,6 +897,7 @@ pub enum Feature {
FinalValue = 22,
Makespan = 23,
PlanLength = 24,
Oversubscription = 29,
/// SIMULATED_ENTITIES
SimulatedEffects = 25,
}
Expand All @@ -889,6 +910,8 @@ impl Feature {
match self {
Feature::ActionBased => "ACTION_BASED",
Feature::Hierarchical => "HIERARCHICAL",
Feature::SimpleNumericPlanning => "SIMPLE_NUMERIC_PLANNING",
Feature::GeneralNumericPlanning => "GENERAL_NUMERIC_PLANNING",
Feature::ContinuousTime => "CONTINUOUS_TIME",
Feature::DiscreteTime => "DISCRETE_TIME",
Feature::IntermediateConditionsAndEffects => "INTERMEDIATE_CONDITIONS_AND_EFFECTS",
Expand All @@ -915,6 +938,7 @@ impl Feature {
Feature::FinalValue => "FINAL_VALUE",
Feature::Makespan => "MAKESPAN",
Feature::PlanLength => "PLAN_LENGTH",
Feature::Oversubscription => "OVERSUBSCRIPTION",
Feature::SimulatedEffects => "SIMULATED_EFFECTS",
}
}
Expand Down

0 comments on commit 41ebe8d

Please sign in to comment.