Skip to content

Commit

Permalink
command line arguments for experiments to run
Browse files Browse the repository at this point in the history
  • Loading branch information
niklasf committed Nov 1, 2024
1 parent df65571 commit a11ba0c
Show file tree
Hide file tree
Showing 3 changed files with 153 additions and 8 deletions.
123 changes: 123 additions & 0 deletions research/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions research/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ edition = "2021"

[dependencies]
chrono = "0.4.38"
clap = { version = "4.5.20", features = ["derive"] }
compensated-summation = { git = "https://github.com/niklasf/compensated-summation", branch = "feat/default" }
csv = "1.3.0"
liglicko2 = { path = ".." }
Expand Down
37 changes: 29 additions & 8 deletions research/src/bin/replay_encounters.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use clap::Parser as _;
use std::{error::Error as StdError, fmt, fs::File, io, io::Write, str::FromStr};

use chrono::{DateTime, NaiveDateTime};
Expand Down Expand Up @@ -385,26 +386,46 @@ fn write_report<W: Write>(
Ok(())
}

#[derive(clap::Parser)]
struct Opt {
#[clap(long, value_delimiter = ',', num_args = 1.., default_value = "45")]
min_deviation: Vec<f64>,
#[clap(long, value_delimiter = ',', num_args = 1.., default_value = "500")]
max_deviation: Vec<f64>,
#[clap(long, value_delimiter = ',', num_args = 1.., default_value = "0.09")]
default_volatility: Vec<f64>,
#[clap(long, value_delimiter = ',', num_args = 1.., default_value = "0.75")]
tau: Vec<f64>,
#[clap(long, value_delimiter = ',', num_args = 1.., default_value = "0")]
first_advantage: Vec<f64>,
#[clap(long, value_delimiter = ',', num_args = 1.., default_value = "0,1")]
preview_opponent_deviation: Vec<u8>,
#[clap(long, value_delimiter = ',', num_args = 1.., default_value = "0.21436")]
rating_periods_per_day: Vec<f64>,
}

fn main() -> Result<(), Box<dyn StdError>> {
let opt = Opt::parse();

let process_uuid = Uuid::now_v7();

let mut experiments = Vec::new();

for min_deviation in [40.0, 45.0, 50.0] {
for max_deviation in [450.0, 500.0, 550.0] {
for default_volatility in [0.08, 0.09, 0.1] {
for tau in [0.6, 0.75, 0.9] {
for first_advantage in [0.0, 8.0, 11.0] {
for preview_opponent_deviation in [true, false] {
for rating_periods_per_day in [0.2, 0.21436, 0.23] {
for &min_deviation in &opt.min_deviation {
for &max_deviation in &opt.max_deviation {
for &default_volatility in &opt.default_volatility {
for &tau in &opt.tau {
for &first_advantage in &opt.first_advantage {
for &preview_opponent_deviation in &opt.preview_opponent_deviation {
for &rating_periods_per_day in &opt.rating_periods_per_day {
experiments.push(Experiment {
rating_system: RatingSystem::builder()
.min_deviation(RatingDifference(min_deviation))
.max_deviation(RatingDifference(max_deviation))
.default_volatility(Volatility(default_volatility))
.tau(tau)
.first_advantage(RatingDifference(first_advantage))
.preview_opponent_deviation(preview_opponent_deviation)
.preview_opponent_deviation(preview_opponent_deviation != 0)
.build(),
rating_periods_per_day,
..Default::default()
Expand Down

0 comments on commit a11ba0c

Please sign in to comment.