Added benchmark for Batch

This commit is contained in:
2022-12-19 07:42:08 +01:00
parent 2bdd3d9b89
commit 2b83ee5ef9
8 changed files with 131 additions and 66 deletions

View File

@@ -109,7 +109,7 @@ pub struct Batch {
}
impl Batch {
pub(crate) fn new(
pub fn new(
composition: Vec<Vec<Vec<Index>>>,
results: Vec<Vec<f64>>,
weights: Vec<Vec<Vec<f64>>>,
@@ -269,13 +269,6 @@ impl Batch {
self.iteration(from, agents);
}
// TODO(anders): Use Item::posterior() instead.
pub fn posterior(&self, agent: Index) -> Gaussian {
let skill = &self.skills[&agent];
skill.likelihood * skill.backward * skill.forward
}
pub(crate) fn posteriors(&self) -> HashMap<Index, Gaussian> {
self.skills
.iter()
@@ -283,7 +276,7 @@ impl Batch {
.collect::<HashMap<_, _>>()
}
pub(crate) fn iteration(&mut self, from: usize, agents: &HashMap<Index, Agent>) {
pub fn iteration(&mut self, from: usize, agents: &HashMap<Index, Agent>) {
for event in self.events.iter_mut().skip(from) {
let teams = event.within_priors(false, false, &self.skills, agents);
let result = event.outputs();