use fabula::pattern::Pattern;
use std::collections::HashMap;
#[derive(Debug, Clone, Default)]
pub struct PatternScore {
pub scores: HashMap<String, f64>,
pub round: usize,
pub generator: String,
}
impl PatternScore {
pub fn composite(&self, weights: &HashMap<String, f64>) -> f64 {
self.scores
.iter()
.map(|(name, &value)| {
let w = weights.get(name).copied().unwrap_or(1.0);
w * value
})
.sum()
}
}
#[derive(Debug, Clone)]
pub struct ScoredPattern<L, V> {
pub pattern: Pattern<L, V>,
pub score: PatternScore,
}