Skip to content

Commit ca09acb

Browse files
authored
Merge pull request #98 from plaans/release01
Release 0.1
2 parents a4b633d + 5b2484c commit ca09acb

File tree

6 files changed

+161
-11
lines changed

6 files changed

+161
-11
lines changed

planning/grpc/api/src/unified_planning.proto

Lines changed: 62 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,9 @@ message EffectExpression {
165165
// If the effect is unconditional, the effect is set to the constant 'true' value.
166166
// features: CONDITIONAL_EFFECT
167167
Expression condition = 4;
168+
169+
// The variables that quantify this effect
170+
repeated Expression forall = 5;
168171
}
169172

170173
// Representation of an effect that allows qualifying the effect expression, e.g., to make it a conditional effect.
@@ -380,6 +383,50 @@ message Hierarchy {
380383
TaskNetwork initial_task_network = 3;
381384
}
382385

386+
// ============= Scheduling =======================
387+
388+
// Activity in a scheduling problem.
389+
message Activity {
390+
// Name of the activity that must uniquely identify it.
391+
string name = 1;
392+
393+
// Typed and named parameters of the activity.
394+
repeated Parameter parameters = 2;
395+
396+
// Duration of the activity
397+
Duration duration = 3;
398+
399+
// Conjunction of conditions that must hold if the activity is present.
400+
repeated Condition conditions = 4;
401+
402+
// Conjunction of effects that this activity produces.
403+
repeated Effect effects = 5;
404+
405+
// Conjunction of static constraints that must hold if the activity is present.
406+
repeated Expression constraints = 6;
407+
}
408+
409+
// Extension of `Problem` for scheduling
410+
message SchedulingExtension {
411+
// All potential activities of the scheduling problem.
412+
repeated Activity activities = 1;
413+
414+
// All variables in the base problem
415+
repeated Parameter variables = 2;
416+
417+
// All constraints in the base problem.
418+
repeated Expression constraints = 5;
419+
}
420+
421+
message Schedule {
422+
// Name of the activities that appear in the solution
423+
repeated string activities = 1;
424+
425+
// Assignment of all variables and activity parameters and timepoints
426+
// that appear in the solution.
427+
map<string, Atom> variable_assignments = 2;
428+
}
429+
383430

384431

385432
// ============== Problem =========================
@@ -481,7 +528,6 @@ message Metric {
481528
repeated TimedGoalWithWeight timed_goals = 6;
482529
}
483530

484-
// features: ACTION_BASED
485531
message Problem {
486532
string domain_name = 1;
487533
string problem_name = 2;
@@ -490,6 +536,7 @@ message Problem {
490536
repeated ObjectDeclaration objects = 5;
491537

492538
// List of actions in the domain.
539+
// features: ACTION_BASED
493540
repeated Action actions = 6;
494541

495542
// Initial state, including default values of state variables.
@@ -508,11 +555,14 @@ message Problem {
508555
// The plan quality metrics
509556
repeated Metric metrics = 11;
510557

511-
512558
// If the problem is hierarchical, defines the tasks and methods as well as the initial task network.
513-
// features: hierarchical
559+
// features: HIERARCHICAL
514560
Hierarchy hierarchy = 12;
515561

562+
// Scheduling-specific extension of the problem.
563+
// features: SCHEDULING
564+
SchedulingExtension scheduling_extension = 17;
565+
516566
// Trajectory constraints of the planning problem.
517567
repeated Expression trajectory_constraints = 13;
518568

@@ -532,6 +582,7 @@ enum Feature {
532582
// PROBLEM_CLASS
533583
ACTION_BASED = 0;
534584
HIERARCHICAL = 26;
585+
SCHEDULING = 56;
535586
// PROBLEM_TYPE
536587
SIMPLE_NUMERIC_PLANNING = 30;
537588
GENERAL_NUMERIC_PLANNING = 31;
@@ -563,8 +614,11 @@ enum Feature {
563614
DECREASE_EFFECTS = 16;
564615
STATIC_FLUENTS_IN_BOOLEAN_ASSIGNMENTS = 41;
565616
STATIC_FLUENTS_IN_NUMERIC_ASSIGNMENTS = 42;
617+
STATIC_FLUENTS_IN_OBJECT_ASSIGNMENTS = 57;
566618
FLUENTS_IN_BOOLEAN_ASSIGNMENTS = 43;
567619
FLUENTS_IN_NUMERIC_ASSIGNMENTS = 44;
620+
FLUENTS_IN_OBJECT_ASSIGNMENTS = 58;
621+
FORALL_EFFECTS = 59;
568622
// TYPING
569623
FLAT_TYPING = 17;
570624
HIERARCHICAL_TYPING = 18;
@@ -622,7 +676,6 @@ message ActionInstance {
622676
// End time of the action. The default 0 value is OK in the case of non-temporal planning
623677
// feature: [DURATIVE_ACTIONS]
624678
Real end_time = 5;
625-
626679
}
627680

628681
message MethodInstance {
@@ -644,18 +697,22 @@ message PlanHierarchy {
644697

645698
// Instances of all methods used in the plan.
646699
repeated MethodInstance methods = 2;
647-
648700
}
649701

650702
message Plan {
651703
// An ordered sequence of actions that appear in the plan.
652704
// The order of the actions in the list must be compatible with the partial order of the start times.
653705
// In case of non-temporal planning, this allows having all start time at 0 and only rely on the order in this sequence.
706+
// features: ACTION_BASED
654707
repeated ActionInstance actions = 1;
655708

656709
// When the plan is hierarchical, this object provides the decomposition of hte root tasks into the actions of the plan
657710
// feature: HIERARCHY
658711
PlanHierarchy hierarchy = 2;
712+
713+
// Solution representation of a scheduling problem.
714+
// feature: SCHEDULING
715+
Schedule schedule = 3;
659716
}
660717

661718

planning/grpc/api/src/unified_planning.rs

Lines changed: 81 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@ pub struct EffectExpression {
124124
/// features: CONDITIONAL_EFFECT
125125
#[prost(message, optional, tag = "4")]
126126
pub condition: ::core::option::Option<Expression>,
127+
/// The variables that quantify this effect
128+
#[prost(message, repeated, tag = "5")]
129+
pub forall: ::prost::alloc::vec::Vec<Expression>,
127130
}
128131
/// Nested message and enum types in `EffectExpression`.
129132
pub mod effect_expression {
@@ -452,6 +455,57 @@ pub struct Hierarchy {
452455
#[prost(message, optional, tag = "3")]
453456
pub initial_task_network: ::core::option::Option<TaskNetwork>,
454457
}
458+
/// Activity in a scheduling problem.
459+
#[allow(clippy::derive_partial_eq_without_eq)]
460+
#[derive(Clone, PartialEq, ::prost::Message)]
461+
pub struct Activity {
462+
/// Name of the activity that must uniquely identify it.
463+
#[prost(string, tag = "1")]
464+
pub name: ::prost::alloc::string::String,
465+
/// Typed and named parameters of the activity.
466+
#[prost(message, repeated, tag = "2")]
467+
pub parameters: ::prost::alloc::vec::Vec<Parameter>,
468+
/// Duration of the activity
469+
#[prost(message, optional, tag = "3")]
470+
pub duration: ::core::option::Option<Duration>,
471+
/// Conjunction of conditions that must hold if the activity is present.
472+
#[prost(message, repeated, tag = "4")]
473+
pub conditions: ::prost::alloc::vec::Vec<Condition>,
474+
/// Conjunction of effects that this activity produces.
475+
#[prost(message, repeated, tag = "5")]
476+
pub effects: ::prost::alloc::vec::Vec<Effect>,
477+
/// Conjunction of static constraints that must hold if the activity is present.
478+
#[prost(message, repeated, tag = "6")]
479+
pub constraints: ::prost::alloc::vec::Vec<Expression>,
480+
}
481+
/// Extension of `Problem` for scheduling
482+
#[allow(clippy::derive_partial_eq_without_eq)]
483+
#[derive(Clone, PartialEq, ::prost::Message)]
484+
pub struct SchedulingExtension {
485+
/// All potential activities of the scheduling problem.
486+
#[prost(message, repeated, tag = "1")]
487+
pub activities: ::prost::alloc::vec::Vec<Activity>,
488+
/// All variables in the base problem
489+
#[prost(message, repeated, tag = "2")]
490+
pub variables: ::prost::alloc::vec::Vec<Parameter>,
491+
/// All constraints in the base problem.
492+
#[prost(message, repeated, tag = "5")]
493+
pub constraints: ::prost::alloc::vec::Vec<Expression>,
494+
}
495+
#[allow(clippy::derive_partial_eq_without_eq)]
496+
#[derive(Clone, PartialEq, ::prost::Message)]
497+
pub struct Schedule {
498+
/// Name of the activities that appear in the solution
499+
#[prost(string, repeated, tag = "1")]
500+
pub activities: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
501+
/// Assignment of all variables and activity parameters and timepoints
502+
/// that appear in the solution.
503+
#[prost(map = "string, message", tag = "2")]
504+
pub variable_assignments: ::std::collections::HashMap<
505+
::prost::alloc::string::String,
506+
Atom,
507+
>,
508+
}
455509
/// A Goal is currently an expression that must hold either:
456510
/// - in the final state,
457511
/// - over a specific temporal interval (under the `timed_goals` features)
@@ -619,7 +673,6 @@ pub mod metric {
619673
}
620674
}
621675
}
622-
/// features: ACTION_BASED
623676
#[allow(clippy::derive_partial_eq_without_eq)]
624677
#[derive(Clone, PartialEq, ::prost::Message)]
625678
pub struct Problem {
@@ -634,6 +687,7 @@ pub struct Problem {
634687
#[prost(message, repeated, tag = "5")]
635688
pub objects: ::prost::alloc::vec::Vec<ObjectDeclaration>,
636689
/// List of actions in the domain.
690+
/// features: ACTION_BASED
637691
#[prost(message, repeated, tag = "6")]
638692
pub actions: ::prost::alloc::vec::Vec<Action>,
639693
/// Initial state, including default values of state variables.
@@ -653,9 +707,13 @@ pub struct Problem {
653707
#[prost(message, repeated, tag = "11")]
654708
pub metrics: ::prost::alloc::vec::Vec<Metric>,
655709
/// If the problem is hierarchical, defines the tasks and methods as well as the initial task network.
656-
/// features: hierarchical
710+
/// features: HIERARCHICAL
657711
#[prost(message, optional, tag = "12")]
658712
pub hierarchy: ::core::option::Option<Hierarchy>,
713+
/// Scheduling-specific extension of the problem.
714+
/// features: SCHEDULING
715+
#[prost(message, optional, tag = "17")]
716+
pub scheduling_extension: ::core::option::Option<SchedulingExtension>,
659717
/// Trajectory constraints of the planning problem.
660718
#[prost(message, repeated, tag = "13")]
661719
pub trajectory_constraints: ::prost::alloc::vec::Vec<Expression>,
@@ -729,12 +787,17 @@ pub struct Plan {
729787
/// An ordered sequence of actions that appear in the plan.
730788
/// The order of the actions in the list must be compatible with the partial order of the start times.
731789
/// In case of non-temporal planning, this allows having all start time at 0 and only rely on the order in this sequence.
790+
/// features: ACTION_BASED
732791
#[prost(message, repeated, tag = "1")]
733792
pub actions: ::prost::alloc::vec::Vec<ActionInstance>,
734793
/// When the plan is hierarchical, this object provides the decomposition of hte root tasks into the actions of the plan
735794
/// feature: HIERARCHY
736795
#[prost(message, optional, tag = "2")]
737796
pub hierarchy: ::core::option::Option<PlanHierarchy>,
797+
/// Solution representation of a scheduling problem.
798+
/// feature: SCHEDULING
799+
#[prost(message, optional, tag = "3")]
800+
pub schedule: ::core::option::Option<Schedule>,
738801
}
739802
#[allow(clippy::derive_partial_eq_without_eq)]
740803
#[derive(Clone, PartialEq, ::prost::Message)]
@@ -1114,6 +1177,7 @@ pub enum Feature {
11141177
/// PROBLEM_CLASS
11151178
ActionBased = 0,
11161179
Hierarchical = 26,
1180+
Scheduling = 56,
11171181
/// PROBLEM_TYPE
11181182
SimpleNumericPlanning = 30,
11191183
GeneralNumericPlanning = 31,
@@ -1145,8 +1209,11 @@ pub enum Feature {
11451209
DecreaseEffects = 16,
11461210
StaticFluentsInBooleanAssignments = 41,
11471211
StaticFluentsInNumericAssignments = 42,
1212+
StaticFluentsInObjectAssignments = 57,
11481213
FluentsInBooleanAssignments = 43,
11491214
FluentsInNumericAssignments = 44,
1215+
FluentsInObjectAssignments = 58,
1216+
ForallEffects = 59,
11501217
/// TYPING
11511218
FlatTyping = 17,
11521219
HierarchicalTyping = 18,
@@ -1192,6 +1259,7 @@ impl Feature {
11921259
match self {
11931260
Feature::ActionBased => "ACTION_BASED",
11941261
Feature::Hierarchical => "HIERARCHICAL",
1262+
Feature::Scheduling => "SCHEDULING",
11951263
Feature::SimpleNumericPlanning => "SIMPLE_NUMERIC_PLANNING",
11961264
Feature::GeneralNumericPlanning => "GENERAL_NUMERIC_PLANNING",
11971265
Feature::ContinuousTime => "CONTINUOUS_TIME",
@@ -1223,8 +1291,13 @@ impl Feature {
12231291
Feature::StaticFluentsInNumericAssignments => {
12241292
"STATIC_FLUENTS_IN_NUMERIC_ASSIGNMENTS"
12251293
}
1294+
Feature::StaticFluentsInObjectAssignments => {
1295+
"STATIC_FLUENTS_IN_OBJECT_ASSIGNMENTS"
1296+
}
12261297
Feature::FluentsInBooleanAssignments => "FLUENTS_IN_BOOLEAN_ASSIGNMENTS",
12271298
Feature::FluentsInNumericAssignments => "FLUENTS_IN_NUMERIC_ASSIGNMENTS",
1299+
Feature::FluentsInObjectAssignments => "FLUENTS_IN_OBJECT_ASSIGNMENTS",
1300+
Feature::ForallEffects => "FORALL_EFFECTS",
12281301
Feature::FlatTyping => "FLAT_TYPING",
12291302
Feature::HierarchicalTyping => "HIERARCHICAL_TYPING",
12301303
Feature::NumericFluents => "NUMERIC_FLUENTS",
@@ -1259,6 +1332,7 @@ impl Feature {
12591332
match value {
12601333
"ACTION_BASED" => Some(Self::ActionBased),
12611334
"HIERARCHICAL" => Some(Self::Hierarchical),
1335+
"SCHEDULING" => Some(Self::Scheduling),
12621336
"SIMPLE_NUMERIC_PLANNING" => Some(Self::SimpleNumericPlanning),
12631337
"GENERAL_NUMERIC_PLANNING" => Some(Self::GeneralNumericPlanning),
12641338
"CONTINUOUS_TIME" => Some(Self::ContinuousTime),
@@ -1290,8 +1364,13 @@ impl Feature {
12901364
"STATIC_FLUENTS_IN_NUMERIC_ASSIGNMENTS" => {
12911365
Some(Self::StaticFluentsInNumericAssignments)
12921366
}
1367+
"STATIC_FLUENTS_IN_OBJECT_ASSIGNMENTS" => {
1368+
Some(Self::StaticFluentsInObjectAssignments)
1369+
}
12931370
"FLUENTS_IN_BOOLEAN_ASSIGNMENTS" => Some(Self::FluentsInBooleanAssignments),
12941371
"FLUENTS_IN_NUMERIC_ASSIGNMENTS" => Some(Self::FluentsInNumericAssignments),
1372+
"FLUENTS_IN_OBJECT_ASSIGNMENTS" => Some(Self::FluentsInObjectAssignments),
1373+
"FORALL_EFFECTS" => Some(Self::ForallEffects),
12951374
"FLAT_TYPING" => Some(Self::FlatTyping),
12961375
"HIERARCHICAL_TYPING" => Some(Self::HierarchicalTyping),
12971376
"NUMERIC_FLUENTS" => Some(Self::NumericFluents),

planning/grpc/server/src/serialize.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,11 @@ pub fn serialize_plan(
125125
} else {
126126
None
127127
};
128-
Ok(up::Plan { actions, hierarchy })
128+
Ok(up::Plan {
129+
actions,
130+
hierarchy,
131+
schedule: None,
132+
})
129133
}
130134

131135
fn rational_to_real(r: num_rational::Rational64) -> up::Real {
Submodule unified-planning updated 243 files

planning/unified/plugin/up_aries/solver.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,13 @@
7474
# "CONDITIONAL_EFFECTS",
7575
# "INCREASE_EFFECTS",
7676
# "DECREASE_EFFECTS",
77+
# "FORALL_EFFECTS",
7778
"STATIC_FLUENTS_IN_BOOLEAN_ASSIGNMENTS",
7879
"STATIC_FLUENTS_IN_NUMERIC_ASSIGNMENTS",
80+
"STATIC_FLUENTS_IN_OBJECT_ASSIGNMENTS",
7981
"FLUENTS_IN_BOOLEAN_ASSIGNMENTS",
8082
"FLUENTS_IN_NUMERIC_ASSIGNMENTS",
83+
"FLUENTS_IN_OBJECT_ASSIGNMENTS",
8184
# TYPING
8285
"FLAT_TYPING",
8386
"HIERARCHICAL_TYPING",
@@ -139,10 +142,13 @@
139142
"CONDITIONAL_EFFECTS",
140143
"INCREASE_EFFECTS",
141144
"DECREASE_EFFECTS",
145+
# "FORALL_EFFECTS",
142146
"STATIC_FLUENTS_IN_BOOLEAN_ASSIGNMENTS",
143147
"STATIC_FLUENTS_IN_NUMERIC_ASSIGNMENTS",
148+
"STATIC_FLUENTS_IN_OBJECT_ASSIGNMENTS",
144149
"FLUENTS_IN_BOOLEAN_ASSIGNMENTS",
145150
"FLUENTS_IN_NUMERIC_ASSIGNMENTS",
151+
"FLUENTS_IN_OBJECT_ASSIGNMENTS",
146152
# TYPING
147153
"FLAT_TYPING",
148154
"HIERARCHICAL_TYPING",
@@ -225,13 +231,12 @@ def _compile(self) -> str:
225231
aries_build_cmd = "cargo build --profile ci --bin up-server"
226232
print(f"Compiling Aries ({aries_path}) ...")
227233
with open(os.devnull, "w", encoding="utf-8") as stdout:
228-
build = subprocess.Popen(
234+
subprocess.run(
229235
aries_build_cmd,
230236
shell=True,
231237
cwd=aries_path,
232238
stdout=stdout,
233239
)
234-
build.wait()
235240
_ARIES_PREVIOUSLY_COMPILED = True
236241
return aries_exe.as_posix()
237242

0 commit comments

Comments
 (0)