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,
up_to_minus: 4,
max_arena_size: arena_size,
do_not_prune: true,
do_prune: false,
print: false,
children_eval_method: ChildrenEvalMethod::Max,
};

View File

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

View File

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

View File

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