Skip to content

Commit d58e1c9

Browse files
author
Nora Buschauer
committed
[PE] Use the initial GOO plan to keep beam search complete
1 parent 9805ffa commit d58e1c9

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

src/IR/HeuristicSearchPlanEnumerator.cpp

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2591,16 +2591,13 @@ bool heuristic_search_helper(const char *vertex_str, const char *expand_str, con
25912591
search_algorithm S(PT, G, M, CF, CE);
25922592

25932593
const double upper_bound = [&]() {
2594-
if constexpr (not search_algorithm::use_beam_search) {
2595-
/*----- Run GOO to compute upper bound of plan cost. -----*/
2596-
GOO Goo;
2597-
Goo(G, CF, PT);
2598-
return PT.get_final().cost;
2599-
} else {
2600-
/* Beam search becomes incomplete if an upper bound derived from an actual plan is provided. Beam
2601-
* search may never find that plan or any better plan, and hence return without finding a path. */
2602-
return std::numeric_limits<double>::quiet_NaN();
2603-
}
2594+
/*----- Run GOO to compute upper bound of plan cost. -----*/
2595+
/* Beam search becomes incomplete if an upper bound derived from an actual plan is provided. Beam search
2596+
* may never find that plan or any better plan, and hence return without finding a path. In this case, the
2597+
* initial plan found by GOO is used. */
2598+
GOO Goo;
2599+
Goo(G, CF, PT);
2600+
return PT.get_final().cost;
26042601
}();
26052602
if (Options::Get().statistics)
26062603
std::cout << "initial upper bound is " << upper_bound << std::endl;
@@ -2620,9 +2617,11 @@ bool heuristic_search_helper(const char *vertex_str, const char *expand_str, con
26202617
reconstruct_plan_bottom_up(goal, PT, G, CE, CF);
26212618
}
26222619
} catch (std::logic_error err) {
2623-
std::cout << "search " << search_str << '+' << vertex_str << '+' << expand_str << '+' << heuristic_str
2624-
<< " did not reach a goal state, fall back to DPccp" << std::endl;
2625-
DPccp{}(G, CF, PT);
2620+
if constexpr (not search_algorithm::use_beam_search) {
2621+
std::cout << "search " << search_str << '+' << vertex_str << '+' << expand_str << '+' << heuristic_str
2622+
<< " did not reach a goal state, fall back to DPccp" << std::endl;
2623+
DPccp{}(G, CF, PT);
2624+
}
26262625
}
26272626
#ifdef COUNTERS
26282627
if (Options::Get().statistics) {

0 commit comments

Comments
 (0)