elo: progress bar
This commit is contained in:
parent
ea7df6a739
commit
c0224f1a05
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -252,6 +252,7 @@ dependencies = [
|
|||||||
"console",
|
"console",
|
||||||
"number_prefix",
|
"number_prefix",
|
||||||
"portable-atomic",
|
"portable-atomic",
|
||||||
|
"rayon",
|
||||||
"unicode-width",
|
"unicode-width",
|
||||||
"web-time",
|
"web-time",
|
||||||
]
|
]
|
||||||
|
|||||||
@ -25,7 +25,7 @@ debug = true
|
|||||||
arrayvec = "0.7"
|
arrayvec = "0.7"
|
||||||
const_fn = "0.4"
|
const_fn = "0.4"
|
||||||
either = "1.13"
|
either = "1.13"
|
||||||
indicatif = "0.17"
|
indicatif = { version = "0.17", features = [ "rayon" ] }
|
||||||
nohash-hasher = "0.2"
|
nohash-hasher = "0.2"
|
||||||
num = "0.4"
|
num = "0.4"
|
||||||
rand = "0.9"
|
rand = "0.9"
|
||||||
|
|||||||
38
src/elo.rs
38
src/elo.rs
@ -5,6 +5,7 @@ use crate::{
|
|||||||
logic::{ChildrenEvalMethod, FutureMoveConfig},
|
logic::{ChildrenEvalMethod, FutureMoveConfig},
|
||||||
repr::{Board, Piece, Winner},
|
repr::{Board, Piece, Winner},
|
||||||
};
|
};
|
||||||
|
use indicatif::{ParallelProgressIterator, ProgressStyle};
|
||||||
use rayon::iter::{IntoParallelIterator, ParallelIterator};
|
use rayon::iter::{IntoParallelIterator, ParallelIterator};
|
||||||
use skillratings::{
|
use skillratings::{
|
||||||
elo::{elo, EloConfig, EloRating},
|
elo::{elo, EloConfig, EloRating},
|
||||||
@ -23,20 +24,24 @@ pub fn run() {
|
|||||||
children_eval_method: ChildrenEvalMethod::Average,
|
children_eval_method: ChildrenEvalMethod::Average,
|
||||||
};
|
};
|
||||||
|
|
||||||
let vec: Vec<(String, Box<dyn Fn(Piece) -> Box<dyn Agent>>)> = (3..=6)
|
let vec: Vec<(String, Box<dyn Fn(Piece) -> Box<dyn Agent>>)> = (5..=6)
|
||||||
.map(move |d| -> (String, Box<dyn Fn(Piece) -> Box<dyn Agent>>) {
|
.flat_map(move |d| {
|
||||||
(
|
// -> (String, Box<dyn Fn(Piece) -> Box<dyn Agent>>)
|
||||||
format!("ComplexAgentD{}", d),
|
[true, false].map(move |p| -> (String, Box<dyn Fn(Piece) -> Box<dyn Agent>>) {
|
||||||
Box::new(move |piece| {
|
(
|
||||||
Box::new(ComplexAgent::new(
|
format!("ComplexAgentD{}P{}", d, p),
|
||||||
piece,
|
Box::new(move |piece| {
|
||||||
FutureMoveConfig {
|
Box::new(ComplexAgent::new(
|
||||||
max_depth: d,
|
piece,
|
||||||
..FMV_BASE
|
FutureMoveConfig {
|
||||||
},
|
max_depth: d,
|
||||||
))
|
do_not_prune: p,
|
||||||
}),
|
..FMV_BASE
|
||||||
)
|
},
|
||||||
|
))
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
@ -93,6 +98,11 @@ impl PlayerArena {
|
|||||||
.collect::<Vec<_>>()
|
.collect::<Vec<_>>()
|
||||||
// after the agents are created, we can multithread the games being played
|
// after the agents are created, we can multithread the games being played
|
||||||
.into_par_iter()
|
.into_par_iter()
|
||||||
|
.progress_with_style(
|
||||||
|
ProgressStyle::with_template("[{elapsed_precise}] {pos:>7}/{len:7} ETA: {eta}")
|
||||||
|
.expect("invalid ProgressStyle")
|
||||||
|
.progress_chars("##-"),
|
||||||
|
)
|
||||||
.map(|((i, j), (p1, p2))| (i, j, Self::play_two_inner(p1, p2)))
|
.map(|((i, j), (p1, p2))| (i, j, Self::play_two_inner(p1, p2)))
|
||||||
.collect::<Vec<_>>()
|
.collect::<Vec<_>>()
|
||||||
// collect and process the outcomes of all the games
|
// collect and process the outcomes of all the games
|
||||||
|
|||||||
@ -12,8 +12,8 @@ pub mod repr;
|
|||||||
|
|
||||||
// TODO! make this agent configuration a config option via `clap-rs`
|
// TODO! make this agent configuration a config option via `clap-rs`
|
||||||
fn main() {
|
fn main() {
|
||||||
// elo::run();
|
elo::run();
|
||||||
// return;
|
return;
|
||||||
let player1 = complexagent::ComplexAgent::new(
|
let player1 = complexagent::ComplexAgent::new(
|
||||||
Piece::Black,
|
Piece::Black,
|
||||||
FutureMoveConfig {
|
FutureMoveConfig {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user