feat(factor): introduce Factor trait and BuiltinFactor enum
Adds the trait that all factors implement and the enum dispatcher used by the schedule to drive heterogeneous factors without dynamic dispatch in the hot loop. The three built-in factors (TeamSum, RankDiff, Trunc) are stubbed out; concrete implementations follow in tasks 4-6.
This commit is contained in:
16
src/factor/team_sum.rs
Normal file
16
src/factor/team_sum.rs
Normal file
@@ -0,0 +1,16 @@
|
||||
use crate::{
|
||||
factor::{Factor, VarId, VarStore},
|
||||
gaussian::Gaussian,
|
||||
};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct TeamSumFactor {
|
||||
pub(crate) inputs: Vec<(Gaussian, f64)>,
|
||||
pub(crate) out: VarId,
|
||||
}
|
||||
|
||||
impl Factor for TeamSumFactor {
|
||||
fn propagate(&mut self, _vars: &mut VarStore) -> (f64, f64) {
|
||||
unimplemented!("TeamSumFactor stub — implemented in Task 4")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user