From 41ebe8d2329cda18759b83169710d14c94853a82 Mon Sep 17 00:00:00 2001 From: Arthur Bit-Monnot Date: Mon, 3 Oct 2022 21:06:58 +0200 Subject: [PATCH] [grpc] Update protobuf definition --- grpc/api/src/unified_planning.proto | 22 ++++++++++++++++++++-- grpc/api/src/unified_planning.rs | 28 ++++++++++++++++++++++++++-- 2 files changed, 46 insertions(+), 4 deletions(-) diff --git a/grpc/api/src/unified_planning.proto b/grpc/api/src/unified_planning.proto index a0c122e4..e4a82543 100644 --- a/grpc/api/src/unified_planning.proto +++ b/grpc/api/src/unified_planning.proto @@ -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 { @@ -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; @@ -453,6 +463,10 @@ message Metric { // This is very awkward to do in this setting where the expression is detached from its scope. map 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 @@ -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; @@ -529,6 +546,7 @@ enum Feature { FINAL_VALUE = 22; MAKESPAN = 23; PLAN_LENGTH = 24; + OVERSUBSCRIPTION = 29; // SIMULATED_ENTITIES SIMULATED_EFFECTS = 25; } diff --git a/grpc/api/src/unified_planning.rs b/grpc/api/src/unified_planning.rs index da81a6fb..880eb2ff 100644 --- a/grpc/api/src/unified_planning.rs +++ b/grpc/api/src/unified_planning.rs @@ -455,6 +455,16 @@ pub struct Assignment { #[prost(message, optional, tag="2")] pub value: ::core::option::Option, } +/// 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, + /// The cost + #[prost(message, optional, tag="2")] + pub cost: ::core::option::Option, +} #[derive(Clone, PartialEq, ::prost::Message)] pub struct Metric { #[prost(enumeration="metric::MetricKind", tag="1")] @@ -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, + /// 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, } /// Nested message and enum types in `Metric`. pub mod metric { @@ -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. @@ -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", } } } @@ -843,6 +860,9 @@ pub enum Feature { /// PROBLEM_CLASS ActionBased = 0, Hierarchical = 26, + /// PROBLEM_TYPE + SimpleNumericPlanning = 30, + GeneralNumericPlanning = 31, /// TIME ContinuousTime = 1, DiscreteTime = 2, @@ -877,6 +897,7 @@ pub enum Feature { FinalValue = 22, Makespan = 23, PlanLength = 24, + Oversubscription = 29, /// SIMULATED_ENTITIES SimulatedEffects = 25, } @@ -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", @@ -915,6 +938,7 @@ impl Feature { Feature::FinalValue => "FINAL_VALUE", Feature::Makespan => "MAKESPAN", Feature::PlanLength => "PLAN_LENGTH", + Feature::Oversubscription => "OVERSUBSCRIPTION", Feature::SimulatedEffects => "SIMULATED_EFFECTS", } }