Skip to content

Commit

Permalink
Fix size of the queue in output in beam search
Browse files Browse the repository at this point in the history
  • Loading branch information
fontanf committed May 14, 2024
1 parent 85a4559 commit c7a9026
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions include/treesearchsolver/iterative_beam_search.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,11 +273,12 @@ inline const IterativeBeamSearchOutput<BranchingScheme> iterative_beam_search(
algorithm_formatter.print(ss);

// Increase the size of the queue.
output.maximum_size_of_the_queue = std::max(
NodeId maximum_size_of_the_queue_next = std::max(
output.maximum_size_of_the_queue + 1,
(NodeId)(output.maximum_size_of_the_queue * parameters.growth_factor));
if (output.maximum_size_of_the_queue > parameters.maximum_size_of_the_queue)
if (maximum_size_of_the_queue_next > parameters.maximum_size_of_the_queue)
break;
output.maximum_size_of_the_queue = maximum_size_of_the_queue_next;

// Stop if no nodes has been pruned.
if (stop)
Expand Down
5 changes: 3 additions & 2 deletions include/treesearchsolver/iterative_beam_search_2.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,11 +277,12 @@ inline const IterativeBeamSearch2Output<BranchingScheme> iterative_beam_search_2
algorithm_formatter.print(ss);

// Increase the size of the queue.
output.maximum_size_of_the_queue = std::max(
NodeId maximum_size_of_the_queue_next = std::max(
output.maximum_size_of_the_queue + 1,
(NodeId)(output.maximum_size_of_the_queue * parameters.growth_factor));
if (output.maximum_size_of_the_queue > parameters.maximum_size_of_the_queue)
if (maximum_size_of_the_queue_next > parameters.maximum_size_of_the_queue)
break;
output.maximum_size_of_the_queue = maximum_size_of_the_queue_next;

// Stop if no nodes has been pruned.
if (stop)
Expand Down

0 comments on commit c7a9026

Please sign in to comment.