do_not_prune -> do_prune

This commit is contained in:
Simon Gardling 2025-03-05 14:06:03 -05:00
parent f2fd89b50f
commit e60e546f2f
Signed by: titaniumtown
GPG Key ID: 9AB28AC10ECE533D
4 changed files with 14 additions and 17 deletions

View File

@ -11,7 +11,7 @@ fn extend_layers_no_pruning(depth: usize, arena_size: usize) -> usize {
top_k_children: 5, top_k_children: 5,
up_to_minus: 4, up_to_minus: 4,
max_arena_size: arena_size, max_arena_size: arena_size,
do_not_prune: true, do_prune: false,
print: false, print: false,
children_eval_method: ChildrenEvalMethod::Max, children_eval_method: ChildrenEvalMethod::Max,
}; };

View File

@ -20,7 +20,7 @@ pub fn run() {
top_k_children: 2, top_k_children: 2,
up_to_minus: 10, up_to_minus: 10,
max_arena_size: usize::MAX, max_arena_size: usize::MAX,
do_not_prune: true, do_prune: false,
print: false, print: false,
children_eval_method: ChildrenEvalMethod::Average, children_eval_method: ChildrenEvalMethod::Average,
}; };
@ -32,14 +32,11 @@ pub fn run() {
}) })
.flat_map(move |prev_c| { .flat_map(move |prev_c| {
// create children which enable, and disable pruning // create children which enable, and disable pruning
[true, false].map(move |do_not_prune| FutureMoveConfig { [true, false].map(move |do_prune| FutureMoveConfig { do_prune, ..prev_c })
do_not_prune,
..prev_c
})
}) })
.flat_map(move |prev_c| { .flat_map(move |prev_c| {
if prev_c.do_not_prune { if !prev_c.do_prune {
// do not bother making configs where do_not_prune is true // do not bother making configs when pruning is disabled
// as top_k_children does nothing when pruning is skipped // as top_k_children does nothing when pruning is skipped
return vec![prev_c]; return vec![prev_c];
} }
@ -53,8 +50,8 @@ pub fn run() {
.to_vec() .to_vec()
}) })
.flat_map(move |prev_c| { .flat_map(move |prev_c| {
if prev_c.do_not_prune { if !prev_c.do_prune {
// do not bother making configs where do_not_prune is true // do not bother making configs when pruning is disabled
// as top_k_children does nothing when pruning is skipped // as top_k_children does nothing when pruning is skipped
return vec![prev_c]; return vec![prev_c];
} }

View File

@ -40,7 +40,7 @@ pub struct FutureMoveConfig {
/// the arena is of that size or bigger /// the arena is of that size or bigger
pub max_arena_size: usize, pub max_arena_size: usize,
pub do_not_prune: bool, pub do_prune: bool,
pub print: bool, pub print: bool,
@ -50,7 +50,7 @@ pub struct FutureMoveConfig {
impl std::fmt::Display for FutureMoveConfig { impl std::fmt::Display for FutureMoveConfig {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "D{} ", self.max_depth)?; write!(f, "D{} ", self.max_depth)?;
if !self.do_not_prune { if self.do_prune {
write!(f, "MD{} ", self.min_arena_depth)?; write!(f, "MD{} ", self.min_arena_depth)?;
write!(f, "K{} ", self.top_k_children)?; write!(f, "K{} ", self.top_k_children)?;
write!(f, "UM{} ", self.up_to_minus)?; write!(f, "UM{} ", self.up_to_minus)?;
@ -65,7 +65,7 @@ impl std::fmt::Display for FutureMoveConfig {
write!(f, "S{} ", self.max_arena_size)?; write!(f, "S{} ", self.max_arena_size)?;
} }
write!(f, "P{} ", !self.do_not_prune)?; write!(f, "P{} ", self.do_prune)?;
write!(f, "C{:?}", self.children_eval_method)?; write!(f, "C{:?}", self.children_eval_method)?;
Ok(()) Ok(())
} }
@ -432,7 +432,7 @@ impl FutureMoves {
} }
fn prune_bad_children(&mut self) { fn prune_bad_children(&mut self) {
if self.current_depth < self.config.min_arena_depth || self.config.do_not_prune { if self.current_depth < self.config.min_arena_depth || !self.config.do_prune {
return; return;
} }
@ -543,7 +543,7 @@ mod tests {
top_k_children: 1, top_k_children: 1,
up_to_minus: 0, up_to_minus: 0,
max_arena_size: 100, max_arena_size: 100,
do_not_prune: true, do_prune: false,
print: false, print: false,
children_eval_method: ChildrenEvalMethod::Max, children_eval_method: ChildrenEvalMethod::Max,
}; };

View File

@ -22,7 +22,7 @@ fn main() {
top_k_children: 2, top_k_children: 2,
up_to_minus: 10, up_to_minus: 10,
max_arena_size: 100_000_000, max_arena_size: 100_000_000,
do_not_prune: false, do_prune: true,
print: true, print: true,
children_eval_method: ChildrenEvalMethod::Average, children_eval_method: ChildrenEvalMethod::Average,
}, },
@ -35,7 +35,7 @@ fn main() {
// top_k_children: 2, // top_k_children: 2,
// up_to_minus: 10, // up_to_minus: 10,
// max_arena_size: 50_000_000, // max_arena_size: 50_000_000,
// do_not_prune: false, // do_prune: true,
// }, // },
// ); // );