Skip to content

Commit

Permalink
Fixed a bug in the calculation of the lower bound in bidirectional se…
Browse files Browse the repository at this point in the history
…arch when the minimum action cost is greater than 2. Some minor printing improvements.
  • Loading branch information
speckdavid committed Sep 18, 2023
1 parent 4978191 commit c97ce83
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/search/sdac_parser/catamorph/printer.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class Printer {
if (auto *o = Factories::get_as_equals(e))
return Printer::print_op(*o, "==");
if (auto *o = Factories::get_as_and(e))
return Printer::print_op(*o, "^");
return Printer::print_op(*o, "&&");
if (auto *o = Factories::get_as_or(e))
return Printer::print_op(*o, "||");
if (auto *i = Factories::get_as_cst(e)) {
Expand Down
2 changes: 1 addition & 1 deletion src/search/symbolic/original_state_space.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ OriginalStateSpace::OriginalStateSpace(

init_mutex(task->get_mutex_groups());
shared_ptr<extra_tasks::SdacTask> sdac_task = dynamic_pointer_cast<extra_tasks::SdacTask>(task);
utils::g_log << "Creating transition relations..." << flush;
utils::g_log << "Creating " << task->get_num_operators() << " transition relations..." << flush;
if (sdac_task == nullptr) {
create_single_trs();
} else {
Expand Down
3 changes: 1 addition & 2 deletions src/search/symbolic/searches/bidirectional_search.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ class BidirectionalSearch : public SymSearch {

virtual int getF() const override {
return std::max<int>(std::max<int>(fw->getF(), bw->getF()),
fw->getG() + bw->getG() +
mgr->getAbsoluteMinTransitionCost());
fw->getG() + bw->getG() + std::min(1, mgr->getAbsoluteMinTransitionCost()));
}

bool isExpFor(BidirectionalSearch *bdExp) const;
Expand Down
11 changes: 11 additions & 0 deletions src/search/tasks/sdac_task.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#include "../symbolic/sym_function_creator.h"
#include "../symbolic/sym_variables.h"

#include "../utils/logging.h"

using namespace std;

namespace extra_tasks {
Expand All @@ -26,6 +28,15 @@ SdacTask::SdacTask(const shared_ptr<AbstractTask> &parent, symbolic::SymVariable

for (int op_id = 0; op_id < parent->get_num_operators(); ++op_id) {
ADD cost_function = creator.create_add(parent->get_operator_cost_function(op_id, false));

double min_value = Cudd_V(cost_function.FindMin().getNode());
if (min_value < 0) {
utils::g_log << "Negative actions costs are note supported!" << endl;
utils::g_log << "Minimum action costs of operator " << parent->get_operator_name(op_id, false) <<
" is " << min_value << "." << endl;
utils::exit_with(utils::ExitCode::SEARCH_UNSUPPORTED);
}

map<int, BDD> cost_cond;
create_bdds_from_add(sym_vars, cost_function, cost_cond);
for (auto pair : cost_cond) {
Expand Down

0 comments on commit c97ce83

Please sign in to comment.