Skip to content

Commit eb3ca50

Browse files
committed
fix(up): If the problem is non-temporal, return a sequential plan.
1 parent 5b90af2 commit eb3ca50

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

planning/grpc/server/src/serialize.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,21 @@ pub fn serialize_plan(
2626
let action = serialize_action_instance(ch, problem, assignment)?;
2727
actions.push(action);
2828
}
29-
// sort actions by increasing start time
29+
// sort actions by increasing start time.
3030
actions.sort_by_key(|a| real_to_rational(a.start_time.as_ref().unwrap()));
31+
32+
fn is_temporal(feature: i32) -> bool {
33+
feature == (up::Feature::ContinuousTime as i32) || feature == (up::Feature::DiscreteTime as i32)
34+
}
35+
if !_problem_request.features.iter().any(|feature| is_temporal(*feature)) {
36+
// the problem is not temporal, remove time annotations
37+
// not that the sorting done earlier ensures the plan is a valid sequence
38+
for action in &mut actions {
39+
action.start_time = None;
40+
action.end_time = None;
41+
}
42+
}
43+
3144
Ok(up::Plan { actions })
3245
}
3346

0 commit comments

Comments
 (0)