multi_skill/systems/
mod.rs

1mod bar;
2mod codeforces_sys;
3mod elo_mmr;
4mod glicko;
5mod topcoder_sys;
6mod true_skill;
7mod util;
8
9pub use bar::BAR;
10pub use codeforces_sys::CodeforcesSys;
11pub use elo_mmr::{EloMMR, EloMMRVariant};
12pub use glicko::Glicko;
13pub use topcoder_sys::TopcoderSys;
14pub use true_skill::TrueSkillSPb;
15pub use util::{
16    get_participant_ratings, outcome_free, simulate_contest, Player, PlayerEvent, PlayersByName,
17    Rating, RatingSystem,
18};
19
20// TODO: add a version that can take parameters, like in experiment_config but polymorphic
21pub fn get_rating_system_by_name(
22    system_name: &str,
23) -> Result<Box<dyn RatingSystem + Send>, String> {
24    match system_name {
25        "bar" => Ok(Box::new(BAR::default())),
26        "glicko" => Ok(Box::new(Glicko::default())),
27        "cf" => Ok(Box::new(CodeforcesSys::default())),
28        "tc" => Ok(Box::new(TopcoderSys::default())),
29        "ts" => Ok(Box::new(TrueSkillSPb::default())),
30        "mmx" => Ok(Box::new(EloMMR::default_gaussian())),
31        "mmx-fast" => Ok(Box::new(EloMMR::default_gaussian_fast())),
32        "mmr" => Ok(Box::new(EloMMR::default())),
33        "mmr-fast" => Ok(Box::new(EloMMR::default_fast())),
34        name => Err(format!(
35            "{} is not a valid rating system. Must be one of: bar, glicko, cf, tc, ts, mmx, mmx-fast, mmr, mmr-fast",
36            name
37        )),
38    }
39}