Added benchmark for Batch
This commit is contained in:
11
src/batch.rs
11
src/batch.rs
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user