use limbic_critic::{Environment, SimpleCritic, TDCritic};
struct GenericEnv {
objective: f32,
stress: f32,
volatility: f32,
}
impl Environment for GenericEnv {
fn objective(&self) -> f32 {
self.objective
}
fn volatility(&self) -> f32 {
self.volatility
}
fn stress(&self) -> f32 {
self.stress
}
}
fn main() {
let env = GenericEnv {
objective: 0.75,
stress: 0.1,
volatility: 0.2,
};
let mods = SimpleCritic::try_assess(&env).expect("finite observation");
println!(
"SimpleCritic: dopamine={:.3} serotonin={:.3} acetylcholine={:.3} norepinephrine={:.3}",
mods.dopamine, mods.serotonin, mods.acetylcholine, mods.norepinephrine
);
let mut td = TDCritic::new(0.2).expect("alpha in (0, 1]");
for &obj in &[0.0, 0.4, 0.3, 0.9] {
let e = GenericEnv {
objective: obj,
stress: 0.0,
volatility: 0.5,
};
let m = td.try_assess(&e).expect("finite observation");
println!("TD step obj={:.1} -> dopamine={:.3}", obj, m.dopamine);
}
}