entrenar/search/mcts/
config.rs1#[derive(Debug, Clone)]
7pub struct MctsConfig {
8 pub exploration_constant: f64,
10 pub max_iterations: usize,
12 pub max_simulation_depth: usize,
14 pub use_policy_priors: bool,
16 pub temperature: f64,
18 pub min_visits_for_expansion: usize,
20 pub reuse_tree: bool,
22 pub dirichlet_alpha: f64,
24 pub dirichlet_epsilon: f64,
26}
27
28impl Default for MctsConfig {
29 fn default() -> Self {
30 Self {
31 exploration_constant: std::f64::consts::SQRT_2,
32 max_iterations: 1000,
33 max_simulation_depth: 100,
34 use_policy_priors: true,
35 temperature: 1.0,
36 min_visits_for_expansion: 1,
37 reuse_tree: false,
38 dirichlet_alpha: 0.3,
39 dirichlet_epsilon: 0.25,
40 }
41 }
42}
43
44#[cfg(test)]
45mod tests {
46 use super::*;
47
48 #[test]
49 fn test_mcts_config_default() {
50 let config = MctsConfig::default();
51 assert_eq!(config.max_iterations, 1000);
52 assert!(config.exploration_constant > 0.0);
53 assert!(config.use_policy_priors);
54 }
55}