Improve type system with ResidentId and ToxicPair structs

This commit is contained in:
2026-01-14 23:37:58 +02:00
parent 70de9bcbf1
commit 7713318d01
7 changed files with 127 additions and 79 deletions

View File

@@ -1,5 +1,5 @@
use crate::{
bounds::WorkloadBounds, config::UserConfig, schedule::MonthlySchedule,
bounds::WorkloadBounds, config::UserConfig, resident::ResidentId, schedule::MonthlySchedule,
slot::Slot,
};
@@ -16,6 +16,7 @@ impl Scheduler {
}
pub fn run(&self, schedule: &mut MonthlySchedule) -> bool {
schedule.prefill(&self.config);
self.search(schedule, Slot::default())
}
@@ -66,7 +67,7 @@ impl Scheduler {
}
/// Return all valid residents for the current slot
pub fn valid_residents(&self, slot: Slot, schedule: &MonthlySchedule) -> Vec<String> {
pub fn valid_residents(&self, slot: Slot, schedule: &MonthlySchedule) -> Vec<ResidentId> {
let other_slot_resident_id = schedule.get_resident_id(&slot.other_position());
self.config
@@ -144,7 +145,4 @@ mod tests {
println!("{}", schedule.pretty_print(&scheduler.config));
}
#[rstest]
fn test_valid_residents(mut schedule: MonthlySchedule, scheduler: Scheduler) {}
}