rust_robotics_planning/experiments/moving_ai_runtime/
sampled_bucket.rs1use super::{RuntimeAggregationVariant, VariantDescriptor};
2
3#[derive(Debug, Clone)]
4pub struct SampledBucketRuntimeAggregation {
5 sample_slots: Vec<usize>,
6}
7
8impl SampledBucketRuntimeAggregation {
9 pub fn new(sample_slots: Vec<usize>) -> Self {
10 Self { sample_slots }
11 }
12}
13
14impl RuntimeAggregationVariant for SampledBucketRuntimeAggregation {
15 fn descriptor(&self) -> VariantDescriptor {
16 VariantDescriptor {
17 id: "sampled-bucket",
18 design_style: "configurable-pipeline",
19 source_path: concat!(
20 env!("CARGO_MANIFEST_DIR"),
21 "/src/experiments/moving_ai_runtime/sampled_bucket.rs"
22 ),
23 knob_count: 1,
24 reports_dispersion: true,
25 }
26 }
27
28 fn selected_slots(&self, total_scenarios: usize) -> Vec<usize> {
29 self.sample_slots
30 .iter()
31 .copied()
32 .filter(|slot| *slot < total_scenarios)
33 .collect()
34 }
35}