Skip to content

Commit d69f87a

Browse files
ImmanuelHaffnerNora Buschauer
authored andcommitted
[PE] Add searches with cost-based pruning to HSPE.
1 parent d58e1c9 commit d69f87a

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

include/mutable/util/HeuristicSearch.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ struct StateManager
104104
static constexpr bool has_beam_queue = HasBeamQueue;
105105

106106
static constexpr bool detect_duplicates = true;
107-
static constexpr bool enable_cost_based_pruning = true;
107+
static constexpr bool enable_cost_based_pruning = Config::PerformCostBasedPruning;
108108

109109
private:
110110
///> type for a pointer to an entry in the map of states

src/IR/HeuristicSearchPlanEnumerator.cpp

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2503,7 +2503,7 @@ struct Fibonacci_heap
25032503
using compare = boost::heap::compare<Cmp>;
25042504

25052505
template<typename T, typename... Options>
2506-
using heap_type = boost::heap::binomial_heap<T, Options...>;
2506+
using heap_type = boost::heap::fibonacci_heap<T, Options...>;
25072507

25082508
template<typename T>
25092509
using allocator_type = boost::container::node_allocator<T>;
@@ -2533,6 +2533,12 @@ struct monotone
25332533
static constexpr bool IsMonotone = B;
25342534
};
25352535

2536+
template<bool B>
2537+
struct cost_based_pruning
2538+
{
2539+
static constexpr bool PerformCostBasedPruning = B;
2540+
};
2541+
25362542
/** Combines multiple configuration parameters into a single configuration type. */
25372543
template<typename T, typename... Ts>
25382544
struct combine : T, combine<Ts...> { };
@@ -2549,10 +2555,12 @@ struct combine<T> : T { };
25492555
template<typename State, typename Expand, typename Heuristic, typename... Context> \
25502556
using NAME = ai::genericAStar<State, Expand, Heuristic, combine<__VA_ARGS__>, Context...>
25512557

2552-
DEFINE_SEARCH(AStar, monotone<true>, Fibonacci_heap, weight<1>, lazy<false>, beam<0>);
2553-
DEFINE_SEARCH(lazyAStar, monotone<true>, Fibonacci_heap, weight<1>, lazy<true>, beam<0>);
2554-
DEFINE_SEARCH(beam_search, monotone<true>, Fibonacci_heap, weight<1>, lazy<false>, beam<2>);
2555-
DEFINE_SEARCH(dynamic_beam_search, monotone<true>, Fibonacci_heap, weight<1>, lazy<false>, beam<1, 5>);
2558+
DEFINE_SEARCH(AStar, monotone<true>, Fibonacci_heap, weight<1>, lazy<false>, cost_based_pruning<false>, beam<0>);
2559+
DEFINE_SEARCH(lazyAStar, monotone<true>, Fibonacci_heap, weight<1>, lazy<true>, cost_based_pruning<false>, beam<0>);
2560+
DEFINE_SEARCH(beam_search, monotone<true>, Fibonacci_heap, weight<1>, lazy<false>, cost_based_pruning<false>, beam<2>);
2561+
DEFINE_SEARCH(dynamic_beam_search, monotone<true>, Fibonacci_heap, weight<1>, lazy<false>, cost_based_pruning<false>, beam<1, 5>);
2562+
DEFINE_SEARCH(AStar_with_cbp, monotone<true>, Fibonacci_heap, weight<1>, lazy<false>, cost_based_pruning<true>, beam<0>);
2563+
DEFINE_SEARCH(beam_search_with_cbp, monotone<true>, Fibonacci_heap, weight<1>, lazy<false>, cost_based_pruning<true>, beam<2>);
25562564

25572565
#undef DEFINE_SEARCH
25582566

@@ -2665,7 +2673,9 @@ struct HeuristicSearch final : PlanEnumeratorCRTP<HeuristicSearch>
26652673
// bottom-up
26662674
// zero
26672675
HEURISTIC_SEARCH( SubproblemsArray, BottomUpComplete, zero, AStar )
2676+
HEURISTIC_SEARCH( SubproblemsArray, BottomUpComplete, zero, AStar_with_cbp )
26682677
HEURISTIC_SEARCH( SubproblemsArray, BottomUpComplete, zero, beam_search )
2678+
HEURISTIC_SEARCH( SubproblemsArray, BottomUpComplete, zero, beam_search_with_cbp )
26692679
HEURISTIC_SEARCH( SubproblemsArray, BottomUpComplete, zero, dynamic_beam_search )
26702680

26712681
// sum
@@ -2697,12 +2707,14 @@ struct HeuristicSearch final : PlanEnumeratorCRTP<HeuristicSearch>
26972707
// top-down
26982708
// zero
26992709
HEURISTIC_SEARCH( SubproblemsArray, TopDownComplete, zero, AStar )
2710+
HEURISTIC_SEARCH( SubproblemsArray, TopDownComplete, zero, AStar_with_cbp )
27002711

27012712
// sqrt_sum
27022713
HEURISTIC_SEARCH( SubproblemsArray, TopDownComplete, sqrt_sum, AStar )
27032714

27042715
// sum
27052716
HEURISTIC_SEARCH( SubproblemsArray, TopDownComplete, sum, AStar )
2717+
HEURISTIC_SEARCH( SubproblemsArray, TopDownComplete, sum, AStar_with_cbp )
27062718

27072719
// GOO
27082720
HEURISTIC_SEARCH( SubproblemsArray, TopDownComplete, GOO, AStar )

0 commit comments

Comments
 (0)