Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/search/search_algorithm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ SearchAlgorithm::SearchAlgorithm(
bound(bound),
cost_type(cost_type),
is_unit_cost(task_properties::is_unit_cost(task_proxy)),
max_time(max_time) {
max_time(max_time),
bound_was_used(false) {
if (bound < 0) {
cerr << "error: negative cost bound " << bound << endl;
utils::exit_with(ExitCode::SEARCH_INPUT_ERROR);
Expand All @@ -70,13 +71,13 @@ SearchStatus SearchAlgorithm::get_status() const {
SearchStatus SearchAlgorithm::get_finished_search_status() const {
if (found_solution()) {
return SOLVED;
} else if (is_unbounded() && is_complete_within_bound()) {
log << "Search terminated -- no plan exists!" << endl;
return UNSOLVABLE;
} else if (is_complete_within_bound()) {
} else if (bound_was_used && is_complete_within_bound()) {
log << "Search terminated -- no plan with cost " << bound - 1
<< " or less exists!" << endl;
return UNSOLVABLE_WITHIN_BOUND;
} else if (is_complete_within_bound()) {
log << "Search terminated -- no plan exists!" << endl;
return UNSOLVABLE;
} else {
log << "Search terminated without finding a plan!" << endl;
return FAILED;
Expand Down
4 changes: 1 addition & 3 deletions src/search/search_algorithm.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class SearchAlgorithm : public components::TaskSpecificComponent {
OperatorCost cost_type;
bool is_unit_cost;
double max_time;
bool bound_was_used;
Comment thread
roeger marked this conversation as resolved.
Outdated

virtual void initialize() {
}
Expand Down Expand Up @@ -91,9 +92,6 @@ class SearchAlgorithm : public components::TaskSpecificComponent {
int get_bound() {
return bound;
}
bool is_unbounded() const {
return bound == std::numeric_limits<int>::max();
}
PlanManager &get_plan_manager() {
return plan_manager;
}
Expand Down
4 changes: 3 additions & 1 deletion src/search/search_algorithms/eager_search.cc
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,10 @@ void EagerSearch::generate_successors(const SearchNode &node) {

for (OperatorID op_id : applicable_operators) {
OperatorProxy op = task_proxy.get_operators()[op_id];
if ((node.get_real_g() + op.get_cost()) >= bound)
if ((node.get_real_g() + op.get_cost()) >= bound) {
bound_was_used = true;
continue;
}

State succ_state = state_registry.get_successor_state(state, op);
statistics.inc_generated();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,10 @@ SearchStatus EnforcedHillClimbingSearch::ehc() {
int d = parent_node.get_g() - current_phase_start_g +
get_adjusted_cost(last_op);

if (parent_node.get_real_g() + last_op.get_cost() >= bound)
if (parent_node.get_real_g() + last_op.get_cost() >= bound) {
bound_was_used = true;
continue;
}

State state = state_registry.get_successor_state(parent_state, last_op);
statistics.inc_generated();
Expand Down
12 changes: 7 additions & 5 deletions src/search/search_algorithms/lazy_search.cc
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,14 @@ void LazySearch::generate_successors() {
int new_g = current_g + get_adjusted_cost(op);
int new_real_g = current_real_g + op.get_cost();
bool is_preferred = preferred_operators.contains(op_id);
if (new_real_g < bound) {
EvaluationContext new_eval_context(
current_eval_context, new_g, is_preferred, nullptr);
open_list->insert(
new_eval_context, make_pair(current_state.get_id(), op_id));
if (new_real_g >= bound) {
bound_was_used = true;
continue;
}
EvaluationContext new_eval_context(
current_eval_context, new_g, is_preferred, nullptr);
open_list->insert(
new_eval_context, make_pair(current_state.get_id(), op_id));
}
}

Expand Down
Loading