Skip to content

Commit

Permalink
Use soft nodes for data generation
Browse files Browse the repository at this point in the history
Bench: 1540328
  • Loading branch information
codedeliveryservice committed Apr 26, 2024
1 parent 7aa8fef commit 517f00f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/search/deepening.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ impl super::SearchThread<'_> {
self.time_manager.update(depth, result.best_move);

let effort = self.node_table.get(result.best_move) as f64 / self.nodes.local() as f64;
if self.time_manager.if_finished(depth, effort) {
if self.time_manager.if_finished(depth, self.nodes.local(), effort) {
break;
}
}
Expand Down
5 changes: 3 additions & 2 deletions src/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ impl TimeManager {
/// Checks if the search should be stopped due to reaching the maximum depth or time.
///
/// This method is used as a soft limit at the end of an iteration of iterative deepening.
pub fn if_finished(&self, depth: i32, effort: f64) -> bool {
if depth >= self.max_depth {
pub fn if_finished(&self, depth: i32, nodes: u64, effort: f64) -> bool {
if depth >= self.max_depth || nodes >= self.max_nodes {
return true;
}

Expand All @@ -101,6 +101,7 @@ impl TimeManager {

/// Checks if the maximum allocated time or nodes have been reached.
pub fn is_time_up(&self, nodes: u64) -> bool {
#[cfg(not(feature = "datagen"))]
if nodes >= self.max_nodes {
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion src/tools/datagen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const WRITE_MIN_PLY: usize = 16;
const WRITE_MAX_PLY: usize = 400;

const VALIDATION_LIMITS: Limits = Limits::FixedDepth(10);
const GENERATION_LIMITS: Limits = Limits::FixedNodes(7500);
const GENERATION_LIMITS: Limits = Limits::FixedNodes(5000);

static STOP_FLAG: AtomicBool = AtomicBool::new(false);
static COUNT: AtomicUsize = AtomicUsize::new(0);
Expand Down

0 comments on commit 517f00f

Please sign in to comment.