feat: added a Drift trait and a "default" ConstantDrift implementation

This commit is contained in:
2026-03-16 12:06:04 +01:00
parent 853f177fa8
commit a1f282a1c8
14 changed files with 423 additions and 127 deletions

View File

@@ -1,9 +1,9 @@
use std::collections::HashMap;
use criterion::{criterion_group, criterion_main, Criterion};
use criterion::{Criterion, criterion_group, criterion_main};
use trueskill_tt::{
agent::Agent, batch::Batch, gaussian::Gaussian, player::Player, IndexMap, BETA, GAMMA, MU,
P_DRAW, SIGMA,
BETA, GAMMA, IndexMap, MU, P_DRAW, SIGMA, agent::Agent, batch::Batch, drift::ConstantDrift,
gaussian::Gaussian, player::Player,
};
fn criterion_benchmark(criterion: &mut Criterion) {
@@ -19,21 +19,21 @@ fn criterion_benchmark(criterion: &mut Criterion) {
map.insert(
a,
Agent {
player: Player::new(Gaussian::from_ms(MU, SIGMA), BETA, GAMMA),
player: Player::new(Gaussian::from_ms(MU, SIGMA), BETA, ConstantDrift(GAMMA)),
..Default::default()
},
);
map.insert(
b,
Agent {
player: Player::new(Gaussian::from_ms(MU, SIGMA), BETA, GAMMA),
player: Player::new(Gaussian::from_ms(MU, SIGMA), BETA, ConstantDrift(GAMMA)),
..Default::default()
},
);
map.insert(
c,
Agent {
player: Player::new(Gaussian::from_ms(MU, SIGMA), BETA, GAMMA),
player: Player::new(Gaussian::from_ms(MU, SIGMA), BETA, ConstantDrift(GAMMA)),
..Default::default()
},
);